diff --git a/debian/postinst b/debian/postinst index 12b363d85b..91c4801985 100644 --- a/debian/postinst +++ b/debian/postinst @@ -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 diff --git a/resources/jicofo.sh b/resources/jicofo.sh index fbc45358a5..09fa1542ae 100755 --- a/resources/jicofo.sh +++ b/resources/jicofo.sh @@ -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" diff --git a/resources/mvn-exec.sh b/resources/mvn-exec.sh index f31da7d66c..340bf7dd86 100755 --- a/resources/mvn-exec.sh +++ b/resources/mvn-exec.sh @@ -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