Skip to content

Commit

Permalink
feat: Update jicofo start script to check for config. (#1176)
Browse files Browse the repository at this point in the history
* feat: Update jicofo start script to check for config.

* squash: Adds a default value.

* squash: Drops not needed postinst logic.
  • Loading branch information
damencho authored Oct 15, 2024
1 parent eb53e19 commit a2b1f83
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
6 changes: 0 additions & 6 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ case "$1" in
OLD_JITSI_CONFIG="/etc/jitsi/jicofo/sip-communicator.properties"
HOCON_CONFIG="/etc/jitsi/jicofo/jicofo.conf"

# Updates config so new and old installs will start using the new config file
if ! grep -q "\-Dconfig.file" "$CONFIG"; then
echo "Updating $CONFIG to use jicofo.conf"
sed -i 's|JAVA_SYS_PROPS="|JAVA_SYS_PROPS="-Dconfig.file='"$HOCON_CONFIG"' |g' $CONFIG
fi

if [ ! -f $HOCON_CONFIG ]; then
echo "Generating an empty jicofo.conf file"
echo "# Jicofo HOCON configuration. See reference.conf in /usr/share/jicofo/jicofo.jar for
Expand Down
14 changes: 13 additions & 1 deletion resources/jicofo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@
if [[ "$1" == "--help" ]]; then
echo -e "Usage: $0"
echo
echo -e "Supported environment variables: JICOFO_AUTH_PASSWORD, JICOFO_MAX_MEMORY, JAVA_SYS_PROPS."
echo -e "Supported environment variables: JICOFO_MAX_MEMORY, JAVA_SYS_PROPS."
echo
exit 1
fi

if [[ ! "$JAVA_SYS_PROPS" == *"-Dconfig.file="* ]]; then
if [[ -f /etc/jitsi/jicofo/jicofo.conf ]]; then
JAVA_SYS_PROPS="$JAVA_SYS_PROPS -Dconfig.file=/etc/jitsi/jicofo/jicofo.conf"
else
echo
echo "To run jicofo you need a configuration file. Use environment variable JAVA_SYS_PROPS."
echo "e.g. export JAVA_SYS_PROPS=\"-Dconfig.file=/etc/jitsi/jicofo/jicofo.conf\""
echo
exit 2
fi
fi

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

mainClass="org.jitsi.jicofo.Main"
Expand Down
20 changes: 9 additions & 11 deletions resources/mvn-exec.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#!/bin/sh -e

readonly CONFIG=$1
if [ -z ${CONFIG+x} -o ! -f $1 ]; then
echo 'Config file missing.'
exit 1
#!/bin/bash -e

if [[ ! "$JAVA_SYS_PROPS" == *"-Dconfig.file="* ]]; then
echo
echo "To run jicofo you need a configuration file. Use environment variable JAVA_SYS_PROPS."
echo "e.g. export JAVA_SYS_PROPS=\"-Dconfig.file=/etc/jitsi/jicofo/jicofo.conf\""
echo
exit 2
fi

. $CONFIG

export JICOFO_AUTH_PASSWORD

exec mvn compile exec:exec -Dexec.executable=java -Dexec.args="-cp %classpath ${JAVA_SYS_PROPS} org.jitsi.jicofo.Main --domain=\"${JICOFO_HOSTNAME}\" --host=\"${JICOFO_HOST}\" --user_domain=\"${JICOFO_AUTH_DOMAIN}\" --user_name=\"${JICOFO_AUTH_USER}\""
exec mvn ${JAVA_SYS_PROPS} compile exec:java -pl jicofo -Dexec.mainClass=org.jitsi.jicofo.Main

0 comments on commit a2b1f83

Please sign in to comment.