Просмотр исходного кода

misc: replace certbot-auto with certbot

master
Elliot Cooper 5 лет назад
Родитель
Сommit
b814827df1
Аккаунт пользователя с таким Email не найден
1 измененных файлов: 30 добавлений и 9 удалений
  1. 30
    9
      resources/install-letsencrypt-cert.sh

+ 30
- 9
resources/install-letsencrypt-cert.sh Просмотреть файл

23
 echo -n "Enter your email and press [ENTER]: "
23
 echo -n "Enter your email and press [ENTER]: "
24
 read EMAIL
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
 fi
52
 fi
32
 
53
 
33
 CRON_FILE="/etc/cron.weekly/letsencrypt-renew"
54
 CRON_FILE="/etc/cron.weekly/letsencrypt-renew"
35
     mkdir "/etc/cron.weekly"
56
     mkdir "/etc/cron.weekly"
36
 fi
57
 fi
37
 echo "#!/bin/bash" > $CRON_FILE
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
 CERT_KEY="/etc/letsencrypt/live/$DOMAIN/privkey.pem"
61
 CERT_KEY="/etc/letsencrypt/live/$DOMAIN/privkey.pem"
41
 CERT_CRT="/etc/letsencrypt/live/$DOMAIN/fullchain.pem"
62
 CERT_CRT="/etc/letsencrypt/live/$DOMAIN/fullchain.pem"
51
         chmod u+x $TURN_HOOK
72
         chmod u+x $TURN_HOOK
52
         sed -i "s/jitsi-meet.example.com/$DOMAIN/g" $TURN_HOOK
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
         --webroot --webroot-path /usr/share/jitsi-meet \
76
         --webroot --webroot-path /usr/share/jitsi-meet \
56
         -d $DOMAIN \
77
         -d $DOMAIN \
57
         --agree-tos --email $EMAIL \
78
         --agree-tos --email $EMAIL \
58
         --deploy-hook $TURN_HOOK
79
         --deploy-hook $TURN_HOOK
59
     else
80
     else
60
-        ./certbot-auto certonly --noninteractive \
81
+        /usr/bin/certbot certonly --noninteractive \
61
         --webroot --webroot-path /usr/share/jitsi-meet \
82
         --webroot --webroot-path /usr/share/jitsi-meet \
62
         -d $DOMAIN \
83
         -d $DOMAIN \
63
         --agree-tos --email $EMAIL
84
         --agree-tos --email $EMAIL
79
     service nginx reload
100
     service nginx reload
80
 elif [ -f /etc/apache2/sites-enabled/$DOMAIN.conf ] ; then
101
 elif [ -f /etc/apache2/sites-enabled/$DOMAIN.conf ] ; then
81
 
102
 
82
-    ./certbot-auto certonly --noninteractive \
103
+    /usr/bin/certbot certonly --noninteractive \
83
     --webroot --webroot-path /usr/share/jitsi-meet \
104
     --webroot --webroot-path /usr/share/jitsi-meet \
84
     -d $DOMAIN \
105
     -d $DOMAIN \
85
     --agree-tos --email $EMAIL
106
     --agree-tos --email $EMAIL

Загрузка…
Отмена
Сохранить