#!/bin/sh
if [ "$(whoami)" = "root" ]; then
    echo "This command will run under the signal-cli user (@SCUSER@)."
    su -l @SCUSER@ -c "$0 $*"
    exit $?
elif [ "$(whoami)" != "@SCUSER@" -a "${SIGNAL_USER_OVERRIDE}" != "1" ]; then
    echo "This command must be run under the signal-cli user (@SCUSER@)."
    exit 1
fi
export JAVA_HOME=/etc/alternatives/jre_@JAVAMAJOR@
@BINDIR@/signal-cli "$@"
