blob: fefd704ec76ac848de55ae073bdeba081ebe4442 [file] [log] [blame]
Nico Hubera1a296f2023-06-25 10:07:07 +00001#!/bin/sh
2
3set -e
4
Nico Huber177e6102023-07-25 13:39:16 +00005secret() {
6 seed=$(cat /run/secrets/seed)
7 printf "%s:%40s" "${seed}" "$*" | sha256sum | sed 's/[[:space:]].*//'
8}
9
10export GERRIT_MAIL_PASSWORD=$(secret mail:gerrit)
Nico Huber7f8dc5b2023-07-25 16:48:01 +000011export GERRIT_KC_PASSWORD=$(secret kc:gerrit)
Nico Huber177e6102023-07-25 13:39:16 +000012
Nico Hubera1a296f2023-06-25 10:07:07 +000013# Allows us to bind mount arbitrary owned files
Nico Huber177e6102023-07-25 13:39:16 +000014chown -R gerrit:gerrit /var/gerrit/{logs,etc,db,git,index,cache}/
Nico Hubera1a296f2023-06-25 10:07:07 +000015
16# Drop privileges as we set `USER root` only to change file permissions
17exec setpriv --reuid=gerrit --regid=gerrit --init-groups --inh-caps=-all /unprivileged.sh "$@"