Răsfoiți Sursa

fix dns port problem

rufengsuixing 5 ani în urmă
părinte
comite
9f47a91d6a
2 a modificat fișierele cu 5 adăugiri și 6 ștergeri
  1. 1 1
      Makefile
  2. 4 5
      root/etc/init.d/AdGuardHome

+ 1 - 1
Makefile

@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luci-app-adguardhome
 PKG_VERSION:=1.7
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
 

+ 4 - 5
root/etc/init.d/AdGuardHome

@@ -7,13 +7,9 @@ STOP=01
 
 CONFIGURATION=AdGuardHome
 config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
-AdGuardHome_PORT=$(awk '/  port:/{printf($2)}' $configpath)
 config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome/AdGuardHome"
 mkdir -p ${binpath%/*}
 
-if [ -z "$AdGuardHome_PORT" ]; then
-	AdGuardHome_PORT="0"
-fi
 set_forward_dnsmasq()
 {
 	local PORT="$1"
@@ -152,7 +148,10 @@ do_redirect()
 	ipv6_server=0
 	tcp_server=0
 	enabled=$1
-
+	AdGuardHome_PORT=$(awk '/  port:/{printf($2)}' $configpath)
+	if [ -z "$AdGuardHome_PORT" ]; then
+		AdGuardHome_PORT="0"
+	fi
 	config_get "redirect" "$section" "redirect" "none"
 	config_get "old_redirect" "$section" "old_redirect" "none"
 	config_get "old_port" "$section" "old_port" "0"