https-dns-proxy: shellcheck & beautify 11209/head
authorStan Grishin <stangri@melmac.net>
Fri, 13 Mar 2020 02:36:58 +0000 (02:36 +0000)
committerGerard Ryan <G.M0N3Y.2503@gmail.com>
Fri, 13 Mar 2020 11:31:02 +0000 (21:31 +1000)
Signed-off-by: Stan Grishin <stangri@melmac.net>
net/https-dns-proxy/files/README.md
net/https-dns-proxy/files/https-dns-proxy.init

index 437cd8688d60b6f34308f502d1c8e5fe207e3077..87e548462688eb1c0a9fa72b8a15c746134e5fa9 100644 (file)
@@ -88,7 +88,7 @@ The https-dns-proxy instance settings are:
 |group|String|nogroup|Local group to run instance under.|
 |use_http1|Boolean|0|If set to 1, use HTTP/1 on installations with broken/outdated ```curl``` package. Included for posterity reasons, you will most likely not ever need it on OpenWrt.|
 |verbosity|Integer|0|logging verbosity level. fatal = 0, error = 1, warning = 2, info = 3, debug = 4|
-|ipv6_resolvers_only|Boolean|0|If set to 1, Forces IPv6 DNS resolvers instead of IPv4|
+|use_ipv6_resolvers_only|Boolean|0|If set to 1, Forces IPv6 DNS resolvers instead of IPv4|
 
 ## Thanks
 
index 8dd509edb1b271dfeecd924bae76bee4f2e00091..0267235d422ff3cfdc12ef2f5a3a8fd20ace3b4e 100755 (executable)
@@ -48,12 +48,14 @@ start_instance() {
        append_bool "$cfg" 'use_http1' '-x'
 
        config_get verbosity "$cfg" 'verbosity' "0"
+# shellcheck disable=SC2086,SC2154
        for i in $(seq 1 $verbosity); do
                xappend "-v"
        done
 
-       config_get_bool ipv6_resolvers_only "$cfg" 'ipv6_resolvers_only' '0'
-       if [ "$ipv6_resolvers_only" == 0 ]; then
+       config_get_bool ipv6_resolvers_only "$cfg" 'use_ipv6_resolvers_only' '0'
+# shellcheck disable=SC2154
+       if [ "$ipv6_resolvers_only" = 0 ]; then
                xappend "-4"
        fi
 
@@ -123,8 +125,8 @@ dnsmasq_add_doh_server() {
                        ;;
        esac
 
-       uci -q del_list dhcp."$cfg".server="$address#$port"
-       uci -q add_list dhcp."$cfg".server="$address#$port"
+       uci -q del_list "dhcp.$cfg.server=${address}#${port}"
+       uci -q add_list "dhcp.$cfg.server=${address}#${port}"
 }
 
 dnsmasq_create_server_backup() {
@@ -134,7 +136,7 @@ dnsmasq_create_server_backup() {
        for i in $(uci -q get "dhcp.$cfg.server"); do
                uci -q add_list dhcp."$cfg".doh_backup_server="$i"
                if [ "$i" = "${i//127.0.0.1}" ] && [ "$i" = "$(echo "$i" | tr -d /)" ]; then
-                       uci -q del_list dhcp."$cfg".server="$i"
+                       uci -q del_list "dhcp.$cfg.server=$i"
                fi
        done
 }
@@ -145,7 +147,7 @@ dnsmasq_restore_server_backup() {
        if uci -q get "dhcp.$cfg.doh_backup_server" >/dev/null; then
                uci -q del "dhcp.$cfg.server"
                for i in $(uci -q get "dhcp.$cfg.doh_backup_server"); do
-                       uci -q add_list dhcp."$cfg".server="$i"
+                       uci -q add_list "dhcp.$cfg.server=$i"
                done
        uci -q del "dhcp.$cfg.doh_backup_server"
        fi