2014-08-10 19:29:48 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# postinst script for jitsi-meet
|
|
|
|
#
|
|
|
|
# see: dh_installdeb(1)
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# summary of how this script can be called:
|
|
|
|
# * <postinst> `configure' <most-recently-configured-version>
|
|
|
|
# * <old-postinst> `abort-upgrade' <new version>
|
|
|
|
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
|
|
|
# <new-version>
|
|
|
|
# * <postinst> `abort-remove'
|
|
|
|
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
|
|
|
# <failed-install-package> <version> `removing'
|
|
|
|
# <conflicting-package> <version>
|
|
|
|
# for details, see http://www.debian.org/doc/debian-policy/ or
|
|
|
|
# the debian-policy package
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
configure)
|
|
|
|
|
|
|
|
# nginx conf
|
|
|
|
. /etc/default/jitsi-videobridge
|
2014-08-28 07:29:07 +00:00
|
|
|
if [ ! -f /etc/nginx/sites-available/$JVB_HOSTNAME.conf ]; then
|
|
|
|
cp /usr/share/doc/jitsi-meet/jitsi-meet.example /etc/nginx/sites-available/$JVB_HOSTNAME.conf
|
|
|
|
if [ ! -f /etc/nginx/sites-enabled/$JVB_HOSTNAME.conf ]; then
|
|
|
|
ln -s /etc/nginx/sites-available/$JVB_HOSTNAME.conf /etc/nginx/sites-enabled/$JVB_HOSTNAME.conf
|
|
|
|
fi
|
|
|
|
sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" /etc/nginx/sites-available/$JVB_HOSTNAME.conf
|
2014-08-10 19:29:48 +00:00
|
|
|
fi
|
2014-08-28 07:29:07 +00:00
|
|
|
|
2014-08-10 19:29:48 +00:00
|
|
|
if grep "# server_names_hash_bucket_size 64" /etc/nginx/nginx.conf > /dev/null; then
|
|
|
|
sed -i "s/#\ server_names_hash_bucket_size\ 64/\ server_names_hash_bucket_size\ 64/" /etc/nginx/nginx.conf
|
|
|
|
fi
|
|
|
|
|
2014-08-29 12:28:51 +00:00
|
|
|
# loading debconf
|
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
|
|
|
|
# SSL for nginx
|
|
|
|
db_get jitsi-meet/cert-choice
|
|
|
|
CERT_CHOICE="$RET"
|
2014-08-29 17:20:13 +00:00
|
|
|
if [ "$CERT_CHOICE" = 'I want a generated self-signed certificate' ]; then
|
2014-08-29 12:28:51 +00:00
|
|
|
# self-signed certificate is already in place for prosody
|
2014-08-29 15:18:28 +00:00
|
|
|
:
|
2014-08-29 17:20:13 +00:00
|
|
|
elif [ "$CERT_CHOICE" = 'I have a certificate and will upload the files on the server' ]; then
|
2014-08-29 21:17:18 +00:00
|
|
|
db_set jitsi-meet/cert-path-key "/etc/ssl/$JVB_HOSTNAME.key"
|
2014-08-29 20:14:15 +00:00
|
|
|
db_input critical jitsi-meet/cert-path-key || true
|
|
|
|
db_go
|
2014-08-29 12:28:51 +00:00
|
|
|
db_get jitsi-meet/cert-path-key
|
|
|
|
CERT_KEY="$RET"
|
2014-08-29 21:17:18 +00:00
|
|
|
db_set jitsi-meet/cert-path-crt "/etc/ssl/$JVB_HOSTNAME.crt"
|
2014-08-29 20:14:15 +00:00
|
|
|
db_input critical jitsi-meet/cert-path-crt || true
|
|
|
|
db_go
|
2014-08-29 12:28:51 +00:00
|
|
|
db_get jitsi-meet/cert-path-crt
|
|
|
|
CERT_CRT="$RET"
|
|
|
|
# replace self-signed certificate paths with user provided ones
|
2014-08-29 21:17:18 +00:00
|
|
|
CERT_KEY_ESC=$(echo $CERT_KEY | sed 's/\./\\\./g')
|
|
|
|
CERT_KEY_ESC=$(echo $CERT_KEY_ESC | sed 's/\//\\\//g')
|
|
|
|
sed -i "s/ssl_certificate_key\ \/var\/lib\/prosody\/.*key/ssl_certificate_key\ $CERT_KEY_ESC/g" \
|
2014-08-29 12:28:51 +00:00
|
|
|
/etc/nginx/sites-available/$JVB_HOSTNAME.conf
|
2014-08-29 21:17:18 +00:00
|
|
|
CERT_CRT_ESC=$(echo $CERT_CRT | sed 's/\./\\\./g')
|
|
|
|
CERT_CRT_ESC=$(echo $CERT_CRT_ESC | sed 's/\//\\\//g')
|
|
|
|
sed -i "s/ssl_certificate\ \/var\/lib\/prosody\/.*crt/ssl_certificate\ $CERT_CRT_ESC/g" \
|
2014-08-29 12:28:51 +00:00
|
|
|
/etc/nginx/sites-available/$JVB_HOSTNAME.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
# and we're done with debconf
|
|
|
|
db_stop
|
|
|
|
|
2014-08-10 19:29:48 +00:00
|
|
|
# jitsi meet
|
|
|
|
chown -R www-data:www-data /usr/share/jitsi-meet/
|
|
|
|
sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" /usr/share/jitsi-meet/config.js
|
|
|
|
# enable turn
|
2014-08-29 09:53:24 +00:00
|
|
|
#if grep "// useStunTurn: true," /usr/share/jitsi-meet/config.js > /dev/null; then
|
|
|
|
# sed -i "s/\/\/\ \ useStunTurn:\ true,/\ \ \ \ useStunTurn:\ true,/" /usr/share/jitsi-meet/config.js
|
|
|
|
#fi
|
2014-08-10 19:29:48 +00:00
|
|
|
invoke-rc.d nginx restart
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# dh_installdeb will replace this with shell code automatically
|
|
|
|
# generated by other debhelper scripts.
|
|
|
|
|
|
|
|
#DEBHELPER#
|
|
|
|
|
|
|
|
exit 0
|