From 1be5684ae33166cf33a5a588628b5597242a0ec1 Mon Sep 17 00:00:00 2001 From: "Lukas f. Paluch" Date: Fri, 23 Feb 2024 15:03:52 +0100 Subject: [PATCH 1/2] enable rootless start fixes bbernhard/signal-cli-rest-api#490 --- entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 6e18e074..3d8e35bd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,6 +5,10 @@ set -e [ -z "${SIGNAL_CLI_CONFIG_DIR}" ] && echo "SIGNAL_CLI_CONFIG_DIR environmental variable needs to be set! Aborting!" && exit 1; +["${UID}" = "${SIGNAL_CLI_UID}" && "${GID}" = "${SIGNAL_CLI_GID}"] &&\ + echo "UID and GID are already correct. Trying to start Signal Api" &&\ + signal-cli-rest-api -signal-cli-config=${SIGNAL_CLI_CONFIG_DIR}; + usermod -u ${SIGNAL_CLI_UID} signal-api groupmod -g ${SIGNAL_CLI_GID} signal-api From f27a3c5206fead40d77aebac4424397b58be7f94 Mon Sep 17 00:00:00 2001 From: Lukas Paluch Date: Tue, 27 Feb 2024 08:54:33 +0100 Subject: [PATCH 2/2] fix rootless entrypoint - clarify and append jsonrpc - rework statemant to be more clear - append check of json-rpc mode to rootless part --- entrypoint.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3d8e35bd..7fcd701c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,11 +3,26 @@ set -x set -e +[ -d /etc/docker ] && echo "$FILE is a directory." + [ -z "${SIGNAL_CLI_CONFIG_DIR}" ] && echo "SIGNAL_CLI_CONFIG_DIR environmental variable needs to be set! Aborting!" && exit 1; -["${UID}" = "${SIGNAL_CLI_UID}" && "${GID}" = "${SIGNAL_CLI_GID}"] &&\ - echo "UID and GID are already correct. Trying to start Signal Api" &&\ +if [ "$(id -u)" -eq "${SIGNAL_CLI_UID}" ] && [ "$(id -g)" -eq "${SIGNAL_CLI_GID}" ]] +then + echo "UID and GID are already correct. Trying to start Signal Api" + + # TODO: check mode + if [ "$MODE" = "json-rpc" ] + then + /usr/bin/jsonrpc2-helper + if [ -n "$JAVA_OPTS" ] ; then + echo "export JAVA_OPTS='$JAVA_OPTS'" >> /etc/default/supervisor + fi + service supervisor start + supervisorctl start all + fi signal-cli-rest-api -signal-cli-config=${SIGNAL_CLI_CONFIG_DIR}; +fi usermod -u ${SIGNAL_CLI_UID} signal-api groupmod -g ${SIGNAL_CLI_GID} signal-api