|
@@ -7,7 +7,10 @@ STOP=01
|
|
|
|
|
|
CONFIGURATION=AdGuardHome
|
|
|
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
|
|
|
-
|
|
|
+AdGuardHome_PORT=$(awk '/ port:/{printf($2)}' $configpath)
|
|
|
+if [ -z "$AdGuardHome_PORT" ]; then
|
|
|
+ AdGuardHome_PORT="0"
|
|
|
+fi
|
|
|
set_forward_dnsmasq()
|
|
|
{
|
|
|
local PORT="$1"
|
|
@@ -147,10 +150,7 @@ do_redirect()
|
|
|
tcp_server=0
|
|
|
enabled=$1
|
|
|
|
|
|
- AdGuardHome_PORT=$(awk '/ port:/{printf($2)}' $configpath)
|
|
|
- if [ -z "$AdGuardHome_PORT" ]; then
|
|
|
- return 1
|
|
|
- fi
|
|
|
+
|
|
|
config_get "redirect" "$section" "redirect" "none"
|
|
|
config_get "old_redirect" "$section" "old_redirect" "none"
|
|
|
config_get "old_port" "$section" "old_port" "0"
|
|
@@ -176,14 +176,15 @@ do_redirect()
|
|
|
uci commit AdGuardHome
|
|
|
|
|
|
[ "$enabled" -gt 0 ] || return 1
|
|
|
-
|
|
|
+ if [ "$AdGuardHome_PORT" == "0" ]; then
|
|
|
+ return 1
|
|
|
+ fi
|
|
|
if [ "$redirect" = "redirect" ]; then
|
|
|
set_iptable $ipv6_server $tcp_server
|
|
|
elif [ "$redirect" = "dnsmasq-upstream" ]; then
|
|
|
set_forward_dnsmasq "$AdGuardHome_PORT"
|
|
|
fi
|
|
|
|
|
|
-
|
|
|
#procd_open_instance "AdGuardHome"
|
|
|
|
|
|
#get_tz
|
|
@@ -244,6 +245,7 @@ start_service() {
|
|
|
do_redirect 0
|
|
|
sh /usr/share/AdGuardHome/update_core.sh
|
|
|
fi
|
|
|
+
|
|
|
config_get_bool verbose $CONFIGURATION verbose 0
|
|
|
if [ "$verbose" -eq 1 ]; then
|
|
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -v"
|
|
@@ -265,13 +267,13 @@ start_service() {
|
|
|
ln -s /tmp/sessions.db $workdir/data/sessions.db
|
|
|
fi
|
|
|
fi
|
|
|
-
|
|
|
procd_open_instance
|
|
|
procd_set_param respawn
|
|
|
# pass config to script on start
|
|
|
procd_set_param command $binpath $ADDITIONAL_ARGS
|
|
|
procd_close_instance
|
|
|
- do_redirect 1
|
|
|
+ do_redirect 1
|
|
|
+
|
|
|
echo "AdGuardHome turn on"
|
|
|
echo "enabled="$enabled""
|
|
|
}
|