summaryrefslogtreecommitdiff
path: root/net/https-dns-proxy/files/https-dns-proxy.init
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.net>2021-05-29 20:12:08 +0000
committerStan Grishin <stangri@melmac.net>2021-05-29 20:12:08 +0000
commitcf75ad2e6c5bde352dc57fd70f047e4bbe9fefe4 (patch)
tree5553d8cee1f493d6a837b1deb81f19a4f62148ba /net/https-dns-proxy/files/https-dns-proxy.init
parentf8843d2458e7ab9294af10b60468d0aad3c219cf (diff)
https-dns-proxy: update to 2021-05-14-1; bugfixes for dhcp server backup
Signed-off-by: Stan Grishin <stangri@melmac.net>
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
;;