lifecycle: fix check_if_root not working without docker
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
01c5235e82
commit
4ee2f951da
|
@ -9,16 +9,18 @@ function check_if_root {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
SOCKET="/var/run/docker.sock"
|
SOCKET="/var/run/docker.sock"
|
||||||
|
GROUP="authentik"
|
||||||
if [[ -e "$SOCKET" ]]; then
|
if [[ -e "$SOCKET" ]]; then
|
||||||
# Get group ID of the docker socket, so we can create a matching group and
|
# Get group ID of the docker socket, so we can create a matching group and
|
||||||
# add ourselves to it
|
# add ourselves to it
|
||||||
DOCKER_GID=$(stat -c '%g' $SOCKET)
|
DOCKER_GID=$(stat -c '%g' $SOCKET)
|
||||||
getent group $DOCKER_GID || groupadd -f -g $DOCKER_GID docker
|
getent group $DOCKER_GID || groupadd -f -g $DOCKER_GID docker
|
||||||
usermod -a -G $DOCKER_GID authentik
|
usermod -a -G $DOCKER_GID authentik
|
||||||
|
GROUP="authentik:docker"
|
||||||
fi
|
fi
|
||||||
# Fix permissions of backups and media
|
# Fix permissions of backups and media
|
||||||
chown -R authentik:authentik /media /backups
|
chown -R authentik:authentik /media /backups
|
||||||
chpst -u authentik:authentik:docker env HOME=/authentik $1
|
chpst -u authentik:$GROUP env HOME=/authentik $1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$1" == "server" ]]; then
|
if [[ "$1" == "server" ]]; then
|
||||||
|
|
Reference in New Issue