瀏覽代碼

misc: replace certbot-auto with certbot

master
Elliot Cooper 4 年之前
父節點
當前提交
b814827df1
No account linked to committer's email address
共有 1 個文件被更改,包括 30 次插入9 次删除
  1. 30
    9
      resources/install-letsencrypt-cert.sh

+ 30
- 9
resources/install-letsencrypt-cert.sh 查看文件

@@ -23,11 +23,32 @@ 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
-cd /usr/local/sbin
27
-
28
-if [ ! -f certbot-auto ] ; then
29
-  wget https://dl.eff.org/certbot-auto
30
-  chmod a+x ./certbot-auto
26
+if [ ! -x "$(command -v certbot)" ] ; then
27
+    DISTRO=$(lsb_release -is)
28
+    DISTRO_VERSION=$(lsb_release -rs)
29
+    if [ "$DISTRO" = "Debian" ]; then
30
+        apt-get update
31
+        apt-get -y install certbot
32
+    elif [ "$DISTRO" = "Ubuntu" ]; then
33
+        if [ "$DISTRO_VERSION" = "20.04" ] || [ "$DISTRO_VERSION" = "19.10" ]; then
34
+                apt-get update
35
+                apt-get -y install software-properties-common
36
+                add-apt-repository -y universe
37
+                apt-get update
38
+                apt-get -y install certbot
39
+        elif [ "$DISTRO_VERSION" = "18.04" ]; then
40
+                apt-get update
41
+                apt-get -y install software-properties-common
42
+                add-apt-repository -y universe
43
+                add-apt-repository -y ppa:certbot/certbot
44
+                apt-get update
45
+                apt-get -y install certbot
46
+        fi
47
+    else
48
+        echo "$DISTRO $DISTRO_VERSION is not supported"
49
+        echo "Only Debian 9,10 and Ubuntu 18.04,19.10,20.04 are supported"
50
+        exit 1
51
+    fi
31 52
 fi
32 53
 
33 54
 CRON_FILE="/etc/cron.weekly/letsencrypt-renew"
@@ -35,7 +56,7 @@ if [ ! -d "/etc/cron.weekly" ] ; then
35 56
     mkdir "/etc/cron.weekly"
36 57
 fi
37 58
 echo "#!/bin/bash" > $CRON_FILE
38
-echo "/usr/local/sbin/certbot-auto renew >> /var/log/le-renew.log" >> $CRON_FILE
59
+echo "/usr/bin/certbot renew >> /var/log/le-renew.log" >> $CRON_FILE
39 60
 
40 61
 CERT_KEY="/etc/letsencrypt/live/$DOMAIN/privkey.pem"
41 62
 CERT_CRT="/etc/letsencrypt/live/$DOMAIN/fullchain.pem"
@@ -51,13 +72,13 @@ if [ -f /etc/nginx/sites-enabled/$DOMAIN.conf ] ; then
51 72
         chmod u+x $TURN_HOOK
52 73
         sed -i "s/jitsi-meet.example.com/$DOMAIN/g" $TURN_HOOK
53 74
 
54
-        ./certbot-auto certonly --noninteractive \
75
+        /usr/bin/certbot certonly --noninteractive \
55 76
         --webroot --webroot-path /usr/share/jitsi-meet \
56 77
         -d $DOMAIN \
57 78
         --agree-tos --email $EMAIL \
58 79
         --deploy-hook $TURN_HOOK
59 80
     else
60
-        ./certbot-auto certonly --noninteractive \
81
+        /usr/bin/certbot certonly --noninteractive \
61 82
         --webroot --webroot-path /usr/share/jitsi-meet \
62 83
         -d $DOMAIN \
63 84
         --agree-tos --email $EMAIL
@@ -79,7 +100,7 @@ if [ -f /etc/nginx/sites-enabled/$DOMAIN.conf ] ; then
79 100
     service nginx reload
80 101
 elif [ -f /etc/apache2/sites-enabled/$DOMAIN.conf ] ; then
81 102
 
82
-    ./certbot-auto certonly --noninteractive \
103
+    /usr/bin/certbot certonly --noninteractive \
83 104
     --webroot --webroot-path /usr/share/jitsi-meet \
84 105
     -d $DOMAIN \
85 106
     --agree-tos --email $EMAIL

Loading…
取消
儲存