acme-common: no exporting webroot
authorGlen Huang <redacted>
Wed, 17 May 2023 09:27:38 +0000 (17:27 +0800)
committerGlen Huang <redacted>
Wed, 17 May 2023 09:27:38 +0000 (17:27 +0800)
ACME clients shouldn't deal with deprecated values. They should be
processed by acme-common.

Reformatting is done by shfmt.

Signed-off-by: Glen Huang <redacted>
net/acme-acmesh/Makefile
net/acme-acmesh/files/hook.sh
net/acme-common/Makefile
net/acme-common/files/acme.init

index a5ffe76a5576aea2fe6041fb3468bb600ad2ef71..553d8ddf501cccfd0415708c6084236a6ef3a380 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=acme-acmesh
 PKG_VERSION:=3.0.1
-PKG_RELEASE:=10
+PKG_RELEASE:=11
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/acmesh-official/acme.sh/tar.gz/$(PKG_VERSION)?
index 03343dacbffbc956c7342471b6247c0aeffb81e8..1e784edc383b9142075bfad40f2c02c851736e98 100644 (file)
@@ -2,8 +2,6 @@
 set -u
 ACME=/usr/lib/acme/client/acme.sh
 LOG_TAG=acme-acmesh
-# webroot option deprecated, use the exported value directly in the next major version
-WEBROOT=${webroot:-$CHALLENGE_DIR}
 NOTIFY=/usr/lib/acme/notify
 
 # shellcheck source=net/acme/files/functions.sh
@@ -13,30 +11,32 @@ NOTIFY=/usr/lib/acme/notify
 export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
 export NO_TIMESTAMP=1
 
-link_certs()
-{
-    local main_domain
-    local domain_dir
-    domain_dir="$1"
-    main_domain="$2"
+link_certs() {
+       local main_domain
+       local domain_dir
+       domain_dir="$1"
+       main_domain="$2"
 
-    (umask 077; cat "$domain_dir/fullchain.cer" "$domain_dir/$main_domain.key" > "$domain_dir/combined.cer")
+       (
+               umask 077
+               cat "$domain_dir/fullchain.cer" "$domain_dir/$main_domain.key" >"$domain_dir/combined.cer"
+       )
 
-    if [ ! -e "$CERT_DIR/$main_domain.crt" ]; then
+       if [ ! -e "$CERT_DIR/$main_domain.crt" ]; then
                ln -s "$domain_dir/$main_domain.cer" "$CERT_DIR/$main_domain.crt"
-    fi
-    if [ ! -e "$CERT_DIR/$main_domain.key" ]; then
+       fi
+       if [ ! -e "$CERT_DIR/$main_domain.key" ]; then
                ln -s "$domain_dir/$main_domain.key" "$CERT_DIR/$main_domain.key"
-    fi
-    if [ ! -e "$CERT_DIR/$main_domain.fullchain.crt" ]; then
+       fi
+       if [ ! -e "$CERT_DIR/$main_domain.fullchain.crt" ]; then
                ln -s "$domain_dir/fullchain.cer" "$CERT_DIR/$main_domain.fullchain.crt"
-    fi
-    if [ ! -e "$CERT_DIR/$main_domain.combined.crt" ]; then
+       fi
+       if [ ! -e "$CERT_DIR/$main_domain.combined.crt" ]; then
                ln -s "$domain_dir/combined.cer" "$CERT_DIR/$main_domain.combined.crt"
-    fi
-    if [ ! -e "$CERT_DIR/$main_domain.chain.crt" ]; then
+       fi
+       if [ ! -e "$CERT_DIR/$main_domain.chain.crt" ]; then
                ln -s "$domain_dir/ca.cer" "$CERT_DIR/$main_domain.chain.crt"
-    fi
+       fi
 }
 
 case $1 in
@@ -71,7 +71,7 @@ get)
 
                        case $status in
                        0)
-                                link_certs "$domain_dir" "$main_domain"
+                               link_certs "$domain_dir" "$main_domain"
                                $NOTIFY renewed
                                exit
                                ;;
@@ -121,8 +121,8 @@ get)
        elif [ "$standalone" = 1 ]; then
                set -- "$@" --standalone --listen-v6
        else
-               mkdir -p "$WEBROOT"
-               set -- "$@" --webroot "$WEBROOT"
+               mkdir -p "$CHALLENGE_DIR"
+               set -- "$@" --webroot "$CHALLENGE_DIR"
        fi
 
        set -- "$@" --issue --home "$state_dir"
@@ -137,7 +137,7 @@ get)
 
        case $status in
        0)
-                link_certs "$domain_dir" "$main_domain"
+               link_certs "$domain_dir" "$main_domain"
                $NOTIFY issued
                ;;
        *)
index ac92fc5642f61b9d03d7d0b241be488d7ecb5ae3..324b742b6099b63f5f938ba3507f9092e554b5c3 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=acme-common
-PKG_VERSION:=1.0.3
+PKG_VERSION:=1.0.4
 
 PKG_MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
 PKG_LICENSE:=GPL-3.0-only
index a97856496ececfe2bcbacfc9507f4bde4961cbe9..a365ecd3e69b74d4c082fb644cc029bd4474d728 100644 (file)
@@ -53,9 +53,9 @@ load_options() {
        export dns_wait
 
        config_get webroot "$section" webroot
-       export webroot
        if [ "$webroot" ]; then
                log warn "Option \"webroot\" is deprecated, please remove it and change your web server's config so it serves ACME challenge requests from $CHALLENGE_DIR."
+               CHALLENGE_DIR=$webroot
        fi
 }
 
git clone https://git.99rst.org/PROJECT