Sfoglia il codice sorgente

Adds check to skip generate certs if they already exists on update.

j8
Damian Minkov 11 anni fa
parent
commit
cfa6ae33ee
1 ha cambiato i file con 27 aggiunte e 28 eliminazioni
  1. 27
    28
      debian/jitsi-meet.postinst

+ 27
- 28
debian/jitsi-meet.postinst Vedi File

@@ -34,35 +34,34 @@ case "$1" in
34 34
             sed -i "s/#\ server_names_hash_bucket_size\ 64/\ server_names_hash_bucket_size\ 64/" /etc/nginx/nginx.conf
35 35
         fi
36 36
 
37
-        # loading debconf
38
-        . /usr/share/debconf/confmodule
37
+        if [ ! -f /etc/ssl/$JVB_HOSTNAME.key] || [ ! -f /etc/ssl/$JVB_HOSTNAME.crt]; then
38
+            # loading debconf
39
+            . /usr/share/debconf/confmodule
39 40
 
40
-        # SSL for nginx
41
-        db_get jitsi-meet/cert-choice
42
-        CERT_CHOICE="$RET"
43
-        if [ "$CERT_CHOICE" = 'I want a generated self-signed certificate' ]; then
44
-            # self-signed certificate is already in place for prosody
45
-            :
46
-        elif [ "$CERT_CHOICE" = 'I have a certificate and will upload the files on the server' ]; then
47
-            db_set jitsi-meet/cert-path-key "/etc/ssl/$JVB_HOSTNAME.key"
48
-            db_input critical jitsi-meet/cert-path-key || true
49
-            db_go
50
-            db_get jitsi-meet/cert-path-key
51
-            CERT_KEY="$RET"
52
-            db_set jitsi-meet/cert-path-crt "/etc/ssl/$JVB_HOSTNAME.crt"
53
-            db_input critical jitsi-meet/cert-path-crt || true
54
-            db_go
55
-            db_get jitsi-meet/cert-path-crt
56
-            CERT_CRT="$RET"
57
-            # replace self-signed certificate paths with user provided ones
58
-            CERT_KEY_ESC=$(echo $CERT_KEY | sed 's/\./\\\./g')
59
-            CERT_KEY_ESC=$(echo $CERT_KEY_ESC | sed 's/\//\\\//g')
60
-            sed -i "s/ssl_certificate_key\ \/var\/lib\/prosody\/.*key/ssl_certificate_key\ $CERT_KEY_ESC/g" \
61
-                /etc/nginx/sites-available/$JVB_HOSTNAME.conf
62
-            CERT_CRT_ESC=$(echo $CERT_CRT | sed 's/\./\\\./g')
63
-            CERT_CRT_ESC=$(echo $CERT_CRT_ESC | sed 's/\//\\\//g')
64
-            sed -i "s/ssl_certificate\ \/var\/lib\/prosody\/.*crt/ssl_certificate\ $CERT_CRT_ESC/g" \
65
-                /etc/nginx/sites-available/$JVB_HOSTNAME.conf
41
+            # SSL for nginx
42
+            db_get jitsi-meet/cert-choice
43
+            CERT_CHOICE="$RET"
44
+            if [ "$CERT_CHOICE" = 'I have a certificate and will upload the files on the server' ]; then
45
+                db_set jitsi-meet/cert-path-key "/etc/ssl/$JVB_HOSTNAME.key"
46
+                db_input critical jitsi-meet/cert-path-key || true
47
+                db_go
48
+                db_get jitsi-meet/cert-path-key
49
+                CERT_KEY="$RET"
50
+                db_set jitsi-meet/cert-path-crt "/etc/ssl/$JVB_HOSTNAME.crt"
51
+                db_input critical jitsi-meet/cert-path-crt || true
52
+                db_go
53
+                db_get jitsi-meet/cert-path-crt
54
+                CERT_CRT="$RET"
55
+                # replace self-signed certificate paths with user provided ones
56
+                CERT_KEY_ESC=$(echo $CERT_KEY | sed 's/\./\\\./g')
57
+                CERT_KEY_ESC=$(echo $CERT_KEY_ESC | sed 's/\//\\\//g')
58
+                sed -i "s/ssl_certificate_key\ \/var\/lib\/prosody\/.*key/ssl_certificate_key\ $CERT_KEY_ESC/g" \
59
+                    /etc/nginx/sites-available/$JVB_HOSTNAME.conf
60
+                CERT_CRT_ESC=$(echo $CERT_CRT | sed 's/\./\\\./g')
61
+                CERT_CRT_ESC=$(echo $CERT_CRT_ESC | sed 's/\//\\\//g')
62
+                sed -i "s/ssl_certificate\ \/var\/lib\/prosody\/.*crt/ssl_certificate\ $CERT_CRT_ESC/g" \
63
+                    /etc/nginx/sites-available/$JVB_HOSTNAME.conf
64
+            fi
66 65
         fi
67 66
 
68 67
         # and we're done with debconf

Loading…
Annulla
Salva