acme: run through shellcheck
authorRosen Penev <redacted>
Sat, 26 Jun 2021 05:06:20 +0000 (22:06 -0700)
committerRosen Penev <redacted>
Sat, 26 Jun 2021 05:09:19 +0000 (22:09 -0700)
Signed-off-by: Rosen Penev <redacted>
net/acme/files/run.sh

index 744e133384b66e9c8d841113fbd9cdc44ebb1f88..a42339daad80b901bd21964a096319048f091894 100644 (file)
@@ -44,7 +44,7 @@ debug() {
 
 get_listeners() {
        local proto rq sq listen remote state program
-       netstat -nptl 2> /dev/null | while read proto rq sq listen remote state program; do
+       netstat -nptl 2> /dev/null | while read -r proto rq sq listen remote state program; do
                case "$proto#$listen#$program" in
                        tcp#*:80#[0-9]*/*) echo -n "${program%% *} " ;;
                esac
@@ -52,7 +52,7 @@ get_listeners() {
 }
 
 run_acme() {
-       debug "Running acme.sh as '$ACME $@'"
+       debug "Running acme.sh as '$ACME $*'"
        $ACME "$@"
 }
 
@@ -139,7 +139,7 @@ post_checks() {
        iptables -D input_rule -p tcp --dport 80 -j ACCEPT -m comment --comment "ACME" 2> /dev/null
        ip6tables -D input_rule -p tcp --dport 80 -j ACCEPT -m comment --comment "ACME" 2> /dev/null
 
-       if [ -e /etc/init.d/uhttpd ] && ([ -n "$UHTTPD_LISTEN_HTTP" ] || [ "$UPDATE_UHTTPD" -eq 1 ]); then
+       if [ -e /etc/init.d/uhttpd ] && { [ -n "$UHTTPD_LISTEN_HTTP" ] || [ "$UPDATE_UHTTPD" -eq 1 ]; }; then
                if [ -n "$UHTTPD_LISTEN_HTTP" ]; then
                        uci set uhttpd.main.listen_http="$UHTTPD_LISTEN_HTTP"
                        UHTTPD_LISTEN_HTTP=
@@ -148,7 +148,7 @@ post_checks() {
                /etc/init.d/uhttpd reload
        fi
 
-       if [ -e /etc/init.d/nginx ] && ([ "$NGINX_WEBSERVER" -eq 1 ] || [ "$UPDATE_NGINX" -eq 1 ]); then
+       if [ -e /etc/init.d/nginx ] && { [ "$NGINX_WEBSERVER" -eq 1 ] || [ "$UPDATE_NGINX" -eq 1 ]; }; then
                NGINX_WEBSERVER=0
                /etc/init.d/nginx restart
        fi
@@ -235,7 +235,7 @@ issue_cert() {
                [ -n "$webroot" ] || [ -n "$dns" ] || pre_checks "$main_domain" || return 1
        fi
 
-       if echo $keylength | grep -q "^ec-"; then
+       if echo "$keylength" | grep -q "^ec-"; then
                domain_dir="$STATE_DIR/${main_domain}_ecc"
                keylength_ecc=1
        else
git clone https://git.99rst.org/PROJECT