From 4301673bed7cecd0b1dfda142d2b4a707509f826 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 15 Nov 2022 14:27:48 +0200 Subject: [PATCH] Add option to bypass startup script --- docker-run.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docker-run.sh b/docker-run.sh index 313c6e67..36874564 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -1,4 +1,18 @@ #!/bin/sh +if [ ! -z "$MAUTRIX_DIRECT_STARTUP" ]; then + if [ $(id -u) == 0 ]; then + echo "|------------------------------------------|" + echo "| Warning: running bridge unsafely as root |" + echo "|------------------------------------------|" + fi + exec python3 -m mautrix_facebook -c /data/config.yaml +elif [ $(id -u) != 0 ]; then + echo "The startup script must run as root. It will use su-exec to drop permissions before running the bridge." + echo "To bypass the startup script, either set the `MAUTRIX_DIRECT_STARTUP` environment variable," + echo "or just use `python3 -m mautrix_facebook -c /data/config.yaml` as the run command." + echo "Note that the config and registration will not be auto-generated when bypassing the startup script." + exit 1 +fi # Define functions. function fixperms {