blob: 7079792d0b0cd7ef179c00edcb1323600ea3a6ea [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)
11
Nico Hubera1a296f2023-06-25 10:07:07 +000012# Allows us to bind mount arbitrary owned files
Nico Huber177e6102023-07-25 13:39:16 +000013chown -R gerrit:gerrit /var/gerrit/{logs,etc,db,git,index,cache}/
Nico Hubera1a296f2023-06-25 10:07:07 +000014
15# Drop privileges as we set `USER root` only to change file permissions
16exec setpriv --reuid=gerrit --regid=gerrit --init-groups --inh-caps=-all /unprivileged.sh "$@"