Adds certificate choices to debconf.

This commit is contained in:
turint 2014-08-29 15:28:51 +03:00 committed by Damian Minkov
parent c5adfac561
commit d0b58b6d53
1 changed files with 25 additions and 1 deletions

View File

@ -17,7 +17,6 @@ set -e
# for details, see http://www.debian.org/doc/debian-policy/ or # for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package # the debian-policy package
case "$1" in case "$1" in
configure) configure)
@ -35,6 +34,31 @@ case "$1" in
sed -i "s/#\ server_names_hash_bucket_size\ 64/\ server_names_hash_bucket_size\ 64/" /etc/nginx/nginx.conf sed -i "s/#\ server_names_hash_bucket_size\ 64/\ server_names_hash_bucket_size\ 64/" /etc/nginx/nginx.conf
fi fi
# loading debconf
. /usr/share/debconf/confmodule
# SSL for nginx
db_get jitsi-meet/cert-choice
CERT_CHOICE="$RET"
if [ "$CERT_CHOICE" == 'I want a generated self-signed certificate' ]; then
# self-signed certificate is already in place for prosody
elif [ "$CERT_CHOICE" == 'I have a certificate and will upload the files on the server' ]; then
db_fset jitsi-meet/default-key "/etc/ssl/$JVB_HOSTNAME.key"
db_get jitsi-meet/cert-path-key
CERT_KEY="$RET"
db_fset jitsi-meet/default-crt "/etc/ssl/$JVB_HOSTNAME.crt"
db_get jitsi-meet/cert-path-crt
CERT_CRT="$RET"
# replace self-signed certificate paths with user provided ones
sed -i "s/ssl_certificate_key\ /var/lib/prosody/(.*)key;/ssl_certificate_key\ $CERT_KEY;/g" \
/etc/nginx/sites-available/$JVB_HOSTNAME.conf
sed -i "s/ssl_certificate\ /var/lib/prosody/(.*)crt;/ssl_certificate\ $CERT_CRT;/g" \
/etc/nginx/sites-available/$JVB_HOSTNAME.conf
fi
# and we're done with debconf
db_stop
# jitsi meet # jitsi meet
chown -R www-data:www-data /usr/share/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 sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" /usr/share/jitsi-meet/config.js