summaryrefslogtreecommitdiff
path: root/net/https-dns-proxy/files/https-dns-proxy.init
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2021-05-29 14:59:59 -0700
committerGitHub <noreply@github.com>2021-05-29 14:59:59 -0700
commitd4f697db7b808aae68e25f3adfc3d23ca432da2e (patch)
tree945990b7744cd68ffa0da29dda7f3b2f86346bc6 /net/https-dns-proxy/files/https-dns-proxy.init
parent9755e05e4e1b722bac4c625b3f7836ce5c2c63b2 (diff)
parentcf75ad2e6c5bde352dc57fd70f047e4bbe9fefe4 (diff)
Merge pull request #15715 from stangri/master-https-dns-proxy
https-dns-proxy: update to 2021-05-14-1; bugfixes for dhcp server backup
Diffstat (limited to 'net/https-dns-proxy/files/https-dns-proxy.init')
-rwxr-xr-xnet/https-dns-proxy/files/https-dns-proxy.init13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/https-dns-proxy/files/https-dns-proxy.init b/net/https-dns-proxy/files/https-dns-proxy.init
index e83fafb49..8b8680763 100755
--- a/net/https-dns-proxy/files/https-dns-proxy.init
+++ b/net/https-dns-proxy/files/https-dns-proxy.init
@@ -1,6 +1,6 @@
#!/bin/sh /etc/rc.common
# Copyright 2019-2020 Stan Grishin (stangri@melmac.net)
-# shellcheck disable=SC2039
+# shellcheck disable=SC2039,SC3043,SC3060
PKG_VERSION='dev-test'
# shellcheck disable=SC2034
@@ -171,7 +171,7 @@ dnsmasq_add_doh_server() {
dnsmasq_create_server_backup() {
local cfg="$1"
local i
- uci -q get "dhcp.${cfg}" >/dev/null || return 0
+ uci -q get "dhcp.${cfg}" >/dev/null || return 1
if ! uci -q get "dhcp.${cfg}.doh_backup_noresolv" >/dev/null; then
if [ -z "$(uci -q get "dhcp.${cfg}.noresolv")" ]; then
uci -q set "dhcp.${cfg}.noresolv=1"
@@ -182,13 +182,17 @@ dnsmasq_create_server_backup() {
fi
fi
if ! uci -q get "dhcp.${cfg}.doh_backup_server" >/dev/null; then
+ if [ -z "$(uci -q get "dhcp.${cfg}.server")" ]; then
+ uci -q add_list "dhcp.${cfg}.doh_backup_server="
+ fi
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
+ if [ "$i" = "$(echo "$i" | tr -d /\#)" ]; then
uci -q del_list "dhcp.${cfg}.server=$i"
fi
done
fi
+ return 0
}
dnsmasq_restore_server_backup() {
@@ -221,7 +225,8 @@ dhcp_backup() {
config_foreach dnsmasq_create_server_backup 'dnsmasq'
elif [ -n "$dnsmasqConfig" ]; then
for i in $dnsmasqConfig; do
- dnsmasq_create_server_backup "@dnsmasq[${i}]"
+ dnsmasq_create_server_backup "@dnsmasq[${i}]" || \
+ dnsmasq_create_server_backup "$i"
done
fi
;;