debian: Skip turnserver config if it is already configured.

This commit is contained in:
damencho 2020-04-01 09:16:55 -05:00 committed by Дамян Минков
parent 5bb23b2d17
commit 990c77bd3d
1 changed files with 44 additions and 35 deletions

View File

@ -40,8 +40,10 @@ case "$1" in
db_get jitsi-meet-turnserver/jvb-hostname
JVB_HOSTNAME_OLD=$RET
if [ -n "$RET" ] && [ ! "$JVB_HOSTNAME_OLD" = "$JVB_HOSTNAME" ] ; then
if [[ -f $TURN_CONFIG ]] && grep -q "jitsi-meet coturn config" "$TURN_CONFIG" ; then
rm -f $TURN_CONFIG
fi
fi
# this detect only old installations with no nginx
db_get jitsi-meet/jvb-serve || true
@ -54,6 +56,14 @@ case "$1" in
exit 0
fi
if [[ -f $TURN_CONFIG ]] ; then
echo ""
echo "turnserver is already configured on this machine, skipping."
echo ""
db_stop
exit 0
fi
# stores the hostname so we will reuse it later, like in purge
db_set jitsi-meet-turnserver/jvb-hostname "$JVB_HOSTNAME"
@ -65,7 +75,7 @@ case "$1" in
fi
TURN_SECRET="$RET"
if [[ -f $TURN_CONFIG ]] && ! grep -q "jitsi-meet coturn config" "$TURN_CONFIG" ; then
# no turn config exists, lt's copy template and fill it in
PUBLIC_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
cp /usr/share/jitsi-meet-turnserver/turnserver.conf $TURN_CONFIG
sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" $TURN_CONFIG
@ -105,7 +115,6 @@ case "$1" in
if [ -f $JITSI_MEET_CONFIG ] ; then
sed -i "s/\/\/ useStunTurn: true/useStunTurn: true/g" $JITSI_MEET_CONFIG
fi
fi
# and we're done with debconf
db_stop