Browse Source

fix(letsencrypt) avoid using hardcoded path

This introduces a variable which holds the path to the detected `certbot`
binary and reuses that to fix the inconsistency which arose from looking for
`certbot` but then later using the hardcoded path `/usr/bin/certbot` in
invocations. This broke snap installations of certbot.

Fixes: https://github.com/jitsi/jitsi-meet/issues/11072

Co-authored-by: Oliver Schneider <oliver@assarbad.net>
master
Oliver Schneider 3 years ago
parent
commit
ec96acac71
No account linked to committer's email address
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      resources/install-letsencrypt-cert.sh

+ 6
- 5
resources/install-letsencrypt-cert.sh View File

@@ -23,7 +23,8 @@ echo "by providing an email address for important account notifications"
23 23
 echo -n "Enter your email and press [ENTER]: "
24 24
 read EMAIL
25 25
 
26
-if [ ! -x "$(command -v certbot)" ] ; then
26
+CERTBOT="$(command -v certbot)"
27
+if [ ! -x "$CERTBOT" ] ; then
27 28
     DISTRO=$(lsb_release -is)
28 29
     DISTRO_VERSION=$(lsb_release -rs)
29 30
     if [ "$DISTRO" = "Debian" ]; then
@@ -56,7 +57,7 @@ if [ ! -d "/etc/cron.weekly" ] ; then
56 57
     mkdir "/etc/cron.weekly"
57 58
 fi
58 59
 echo "#!/bin/bash" > $CRON_FILE
59
-echo "/usr/bin/certbot renew >> /var/log/le-renew.log" >> $CRON_FILE
60
+echo "$CERTBOT renew >> /var/log/le-renew.log" >> $CRON_FILE
60 61
 
61 62
 CERT_KEY="/etc/letsencrypt/live/$DOMAIN/privkey.pem"
62 63
 CERT_CRT="/etc/letsencrypt/live/$DOMAIN/fullchain.pem"
@@ -72,13 +73,13 @@ if [ -f /etc/nginx/sites-enabled/$DOMAIN.conf ] ; then
72 73
         chmod u+x $TURN_HOOK
73 74
         sed -i "s/jitsi-meet.example.com/$DOMAIN/g" $TURN_HOOK
74 75
 
75
-        /usr/bin/certbot certonly --noninteractive \
76
+        $CERTBOT certonly --noninteractive \
76 77
         --webroot --webroot-path /usr/share/jitsi-meet \
77 78
         -d $DOMAIN \
78 79
         --agree-tos --email $EMAIL \
79 80
         --deploy-hook $TURN_HOOK
80 81
     else
81
-        /usr/bin/certbot certonly --noninteractive \
82
+        $CERTBOT certonly --noninteractive \
82 83
         --webroot --webroot-path /usr/share/jitsi-meet \
83 84
         -d $DOMAIN \
84 85
         --agree-tos --email $EMAIL
@@ -107,7 +108,7 @@ if [ -f /etc/nginx/sites-enabled/$DOMAIN.conf ] ; then
107 108
     
108 109
 elif [ -f /etc/apache2/sites-enabled/$DOMAIN.conf ] ; then
109 110
 
110
-    /usr/bin/certbot certonly --noninteractive \
111
+    $CERTBOT certonly --noninteractive \
111 112
     --webroot --webroot-path /usr/share/jitsi-meet \
112 113
     -d $DOMAIN \
113 114
     --agree-tos --email $EMAIL

Loading…
Cancel
Save