acme: adopt to new behavior of nginx
authorPeter Stadler <peter.stadler@student.uibk.ac.at>
Sun, 31 Jan 2021 17:43:12 +0000 (18:43 +0100)
committerToke Høiland-Jørgensen <toke@toke.dk>
Mon, 8 Feb 2021 22:51:55 +0000 (23:51 +0100)
Signed-off-by: Peter Stadler <peter.stadler@student.uibk.ac.at>
net/acme/Makefile
net/acme/files/run.sh

index 0ac93a96985bb43676df31b621ed913ff8b3a934..54ee236dbd7a507b7005109a9512326a0ee0d5bf 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=acme
 PKG_VERSION:=2.8.7
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/acmesh-official/acme.sh/tar.gz/$(PKG_VERSION)?
index 9cc8e35972dd8d58a585660e62526cfc22f307a0..87863b58d42840ce58c20328795231893105b1d5 100644 (file)
@@ -335,7 +335,18 @@ issue_cert()
                # commit and reload is in post_checks
        fi
 
-       if [ -e /etc/init.d/nginx ] && [ "$update_nginx" -eq "1" ]; then
+       local nginx_updated
+       nginx_updated=0
+       if command -v nginx-util 2>/dev/null && [ "$update_nginx" -eq "1" ]; then
+               nginx_updated=1
+               for domain in $domains; do
+                       nginx-util add_ssl "${domain}" acme "${domain_dir}/fullchain.cer" \
+                               "${domain_dir}/${main_domain}.key" || nginx_updated=0
+               done
+               # reload is in post_checks
+       fi
+
+       if [ "$nginx_updated" -eq "0" ] && [ -w /etc/nginx/nginx.conf ] && [ "$update_nginx" -eq "1" ]; then
                sed -i "s#ssl_certificate\ .*#ssl_certificate ${domain_dir}/fullchain.cer;#g" /etc/nginx/nginx.conf
                sed -i "s#ssl_certificate_key\ .*#ssl_certificate_key ${domain_dir}/${main_domain}.key;#g" /etc/nginx/nginx.conf
                # commit and reload is in post_checks