From: Peter Stadler Date: Sun, 31 Jan 2021 17:43:12 +0000 (+0100) Subject: acme: adopt to new behavior of nginx X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=e553f0cf7020a807c800bb478d8b866b98ac5220;p=feed%2Fpackages.git acme: adopt to new behavior of nginx Signed-off-by: Peter Stadler --- diff --git a/net/acme/Makefile b/net/acme/Makefile index 0ac93a9698..54ee236dbd 100644 --- a/net/acme/Makefile +++ b/net/acme/Makefile @@ -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)? diff --git a/net/acme/files/run.sh b/net/acme/files/run.sh index 9cc8e35972..87863b58d4 100644 --- a/net/acme/files/run.sh +++ b/net/acme/files/run.sh @@ -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