🐶 Sync 2025-11-02 14:26:26

This commit is contained in:
actions-user
2025-11-02 14:26:26 +08:00
parent 64bcc56c2a
commit ac011db799
1557 changed files with 746465 additions and 0 deletions

View File

@@ -0,0 +1,140 @@
#模板用户名为 admin 密码为 admin
#The username is admin and the password is admin.
#提交就可以直接用的配置模板文件
#a template config can be use with a apply
bind_host: 0.0.0.0
bind_port: 3000
beta_bind_port: 0
users:
- name: admin
password: $2y$10$vHRcARdPCieYG3RXWomV5evDYN.Nj/edtwEkQgQJZcK6z7qTLaIc6
auth_attempts: 5
block_auth_min: 15
http_proxy: ""
language: zh-cn
theme: auto
debug_pprof: false
dns:
bind_hosts:
- 0.0.0.0
port: 5333
anonymize_client_ip: false
protection_enabled: true
blocking_mode: default
blocking_ipv4: ""
blocking_ipv6: ""
blocked_response_ttl: 10
protection_disabled_until: null
parental_block_host: family-block.dns.adguard.com
safebrowsing_block_host: standard-block.dns.adguard.com
ratelimit: 0
ratelimit_whitelist: []
refuse_any: false
upstream_dns:
- 223.5.5.5
upstream_dns_file: ""
bootstrap_dns:
- 119.29.29.29
- 223.5.5.5
all_servers: false
fastest_addr: false
fastest_timeout: 1s
allowed_clients: []
disallowed_clients: []
blocked_hosts:
- version.bind
- id.server
- hostname.bind
trusted_proxies:
- 127.0.0.0/8
- ::1/128
cache_size: 4194304
cache_ttl_min: 0
cache_ttl_max: 0
cache_optimistic: true
bogus_nxdomain: []
aaaa_disabled: false
enable_dnssec: false
edns_client_subnet: false
max_goroutines: 300
ipset: []
filtering_enabled: true
filters_update_interval: 24
parental_enabled: false
safesearch_enabled: false
safebrowsing_enabled: false
safebrowsing_cache_size: 1048576
safesearch_cache_size: 1048576
parental_cache_size: 1048576
cache_time: 30
rewrites: []
blocked_services: []
upstream_timeout: 10s
private_networks: []
use_private_ptr_resolvers: true
local_ptr_upstreams: []
tls:
enabled: false
server_name: ""
force_https: false
port_https: 443
port_dns_over_tls: 853
port_dns_over_quic: 784
port_dnscrypt: 0
dnscrypt_config_file: ""
allow_unencrypted_doh: false
certificate_chain: ""
private_key: ""
certificate_path: ""
private_key_path: ""
filters:
- enabled: true
url: https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
name: AdGuard DNS filter
id: 1128750870
- enabled: true
url: https://anti-ad.net/easylist.txt
name: 'CHN: anti-AD'
id: 1128750871
- enabled: true
url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt
name: AdGuard DNS filter
id: 1128751871
- enabled: false
url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt
name: AdAway Default Blocklist
id: 1128752871
whitelist_filters: []
user_rules:
- '@@||taobao.com^$important'
- '@@||jd.com^important'
- '@@||flyme.cn^$important'
- '@@||meizu.com^$important'
- '@@||wl.jd.com^$important'
- '@@||flydigi.com^'
- '@@||pv.sohu.com^$important'
dhcp:
enabled: false
interface_name: ""
dhcpv4:
gateway_ip: ""
subnet_mask: ""
range_start: ""
range_end: ""
lease_duration: 86400
icmp_timeout_msec: 1000
options: []
dhcpv6:
range_start: ""
lease_duration: 86400
ra_slaac_only: false
ra_allow_slaac: false
clients: []
log_compress: false
log_localtime: false
log_max_backups: 0
log_max_size: 100
log_max_age: 3
log_file: ""
verbose: false
schema_version: 10

View File

@@ -0,0 +1,35 @@
#!/bin/sh
checkmd5(){
local nowmd5=$(md5sum /etc/hosts)
nowmd5=${nowmd5%% *}
local lastmd5=$(uci get AdGuardHome.AdGuardHome.hostsmd5 2>/dev/null)
if [ "$nowmd5" != "$lastmd5" ]; then
uci set AdGuardHome.AdGuardHome.hostsmd5="$nowmd5"
uci commit AdGuardHome
[ "$1" == "noreload" ] || /etc/init.d/AdGuardHome reload
fi
}
[ "$1" == "del" ] && sed -i '/programaddstart/,/programaddend/d' /etc/hosts && checkmd5 "$2" && exit 0
/usr/bin/awk 'BEGIN{
while ((getline < "/tmp/dhcp.leases") > 0)
{
a[$2]=$4;
}
while (("ip -6 neighbor show | grep -v fe80" | getline) > 0)
{
if (a[$5]) {print $1" "a[$5] >"/tmp/tmphost"; }
}
print "#programaddend" >"/tmp/tmphost";
}'
grep programaddstart /etc/hosts >/dev/null 2>&1
if [ "$?" == "0" ]; then
sed -i '/programaddstart/,/programaddend/c\#programaddstart' /etc/hosts
sed -i '/programaddstart/'r/tmp/tmphost /etc/hosts
else
echo "#programaddstart" >>/etc/hosts
cat /tmp/tmphost >> /etc/hosts
fi
rm /tmp/tmphost
checkmd5 "$2"

View File

@@ -0,0 +1,10 @@
table inet adguardhome {
chain prerouting {
type nat hook prerouting priority dstnat; policy accept;
iifname { "eth0" } return
fib daddr type local udp dport 53 redirect to :__AGH_PORT__
fib daddr type local tcp dport 53 redirect to :__AGH_PORT__
}
}

View File

@@ -0,0 +1,8 @@
#!/bin/sh
AdGuardHome_enable=$(uci get AdGuardHome.AdGuardHome.enabled)
redirect=$(uci get AdGuardHome.AdGuardHome.redirect)
if [ $AdGuardHome_enable -eq 1 -a "$redirect" == "redirect" ]; then
/etc/init.d/AdGuardHome do_redirect 1
fi

View File

@@ -0,0 +1,20 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
logread -e AdGuardHome > /tmp/AdGuardHometmp.log
logread -e AdGuardHome -f >> /tmp/AdGuardHometmp.log &
pid=$!
echo "1">/var/run/AdGuardHomesyslog
while true
do
sleep 12
watchdog=$(cat /var/run/AdGuardHomesyslog)
if [ "$watchdog"x == "0"x ]; then
kill $pid
rm /tmp/AdGuardHometmp.log
rm /var/run/AdGuardHomesyslog
exit 0
else
echo "0">/var/run/AdGuardHomesyslog
fi
done

View File

@@ -0,0 +1,89 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
checkmd5(){
local nowmd5=$(md5sum /tmp/adguard.list 2>/dev/null)
nowmd5=${nowmd5%% *}
local lastmd5=$(uci get AdGuardHome.AdGuardHome.gfwlistmd5 2>/dev/null)
if [ "$nowmd5" != "$lastmd5" ]; then
uci set AdGuardHome.AdGuardHome.gfwlistmd5="$nowmd5"
uci commit AdGuardHome
[ "$1" == "noreload" ] || /etc/init.d/AdGuardHome reload
fi
}
configpath=$(uci get AdGuardHome.AdGuardHome.configpath 2>/dev/null)
[ "$1" == "del" ] && sed -i '/programaddstart/,/programaddend/d' $configpath && checkmd5 "$2" && exit 0
gfwupstream=$(uci get AdGuardHome.AdGuardHome.gfwupstream 2>/dev/null)
if [ -z $gfwupstream ]; then
gfwupstream="tcp://208.67.220.220:5353"
fi
if [ ! -f "$configpath" ]; then
echo "please make a config first"
exit 1
fi
wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O- | base64 -d > /tmp/gfwlist.txt
cat /tmp/gfwlist.txt | awk -v upst="$gfwupstream" 'BEGIN{getline;}{
s1=substr($0,1,1);
if (s1=="!")
{next;}
if (s1=="@"){
$0=substr($0,3);
s1=substr($0,1,1);
white=1;}
else{
white=0;
}
if (s1=="|")
{s2=substr($0,2,1);
if (s2=="|")
{
$0=substr($0,3);
split($0,d,"/");
$0=d[1];
}else{
split($0,d,"/");
$0=d[3];
}}
else{
split($0,d,"/");
$0=d[1];
}
star=index($0,"*");
if (star!=0)
{
$0=substr($0,star+1);
dot=index($0,".");
if (dot!=0)
$0=substr($0,dot+1);
else
next;
s1=substr($0,1,1);
}
if (s1==".")
{fin=substr($0,2);}
else{fin=$0;}
if (index(fin,".")==0) next;
if (index(fin,"%")!=0) next;
if (index(fin,":")!=0) next;
match(fin,"^[0-9\.]+")
if (RSTART==1 && RLENGTH==length(fin)) {print "ipset add gfwlist "fin>"/tmp/doipset.sh";next;}
if (fin=="" || finl==fin) next;
finl=fin;
if (white==0)
{print(" - '\''[/"fin"/]"upst"'\''");}
else{
print(" - '\''[/"fin"/]#'\''");}
}END{print(" - '\''[/programaddend/]#'\''")}' > /tmp/adguard.list
grep programaddstart $configpath
if [ "$?" == "0" ]; then
sed -i '/programaddstart/,/programaddend/c\ - '\''\[\/programaddstart\/\]#'\''' $configpath
sed -i '/programaddstart/'r/tmp/adguard.list $configpath
else
sed -i '1i\ - '\''[/programaddstart/]#'\''' /tmp/adguard.list
sed -i '/upstream_dns:/'r/tmp/adguard.list $configpath
fi
checkmd5 "$2"
rm -f /tmp/gfwlist.txt /tmp/adguard.list

View File

@@ -0,0 +1,93 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
mkdir -p "/etc/AdGuardHome"
checkmd5(){
local nowmd5=$(md5sum /tmp/adguard.list 2>/dev/null)
nowmd5=${nowmd5%% *}
local lastmd5=$(uci get AdGuardHome.AdGuardHome.ipsetlistmd5 2>/dev/null)
if [ "$nowmd5" != "$lastmd5" ]; then
uci set AdGuardHome.AdGuardHome.ipsetlistmd5="$nowmd5"
uci commit AdGuardHome
[ "$1" == "noreload" ] || /etc/init.d/AdGuardHome reload
fi
}
ipstok=1
configpath=$(uci get AdGuardHome.AdGuardHome.configpath 2>/dev/null)
if [ "$1" == "del" ]; then
#sed -i -r 's/upstream_dns_file:\s*['\"]?.*['\"]?/upstream_dns_file: ""/' $configpath
sed -i -r 's/ipset_file:\s*['\"]?.*['\"]?/ipset_file: ""/' $configpath
checkmd5 "$2"
exit 0
fi
gfwupstream=$(uci get AdGuardHome.AdGuardHome.gfwupstream 2>/dev/null)
if [ -z $gfwupstream ]; then
gfwupstream="tcp://208.67.220.220:5353"
fi
if [ ! -f "$configpath" ]; then
echo "please make a config first"
exit 1
fi
wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O- | base64 -d > /tmp/gfwlist.txt
cat /tmp/gfwlist.txt | awk -v upst="$gfwupstream" 'BEGIN{getline;}{
s1=substr($0,1,1);
if (s1=="!")
{next;}
if (s1=="@"){
$0=substr($0,3);
s1=substr($0,1,1);
white=1;}
else{
white=0;
}
if (s1=="|")
{s2=substr($0,2,1);
if (s2=="|")
{
$0=substr($0,3);
split($0,d,"/");
$0=d[1];
}else{
split($0,d,"/");
$0=d[3];
}}
else{
split($0,d,"/");
$0=d[1];
}
star=index($0,"*");
if (star!=0)
{
$0=substr($0,star+1);
dot=index($0,".");
if (dot!=0)
$0=substr($0,dot+1);
else
next;
s1=substr($0,1,1);
}
if (s1==".")
{fin=substr($0,2);}
else{fin=$0;}
if (index(fin,".")==0) next;
if (index(fin,"%")!=0) next;
if (index(fin,":")!=0) next;
match(fin,"^[0-9\.]+")
if (RSTART==1 && RLENGTH==length(fin)) {print "ipset add gfwlist "fin>"/tmp/doipset.sh";next;}
if (fin=="" || finl==fin) next;
finl=fin;
if (white==0)
{print(" - '\''[/"fin"/]"upst"'\''");}
else{
print(" - '\''[/"fin"/]#'\''");}
}END{print(" - '\''[/programaddend/]#'\''")}' > /tmp/adguard.list
cat /tmp/adguard.list 2>/dev/null |sed -r -e "s/\s+\-\s+'//" -e "s/'//" -e "/programaddend/d" > /etc/AdGuardHome/gfw.txt
cat /etc/AdGuardHome/gfw.txt 2>/dev/null |sed -e 's:\[\/::' -e 's:\/\].*:\/gfwlist:' -e "/#/d" |sort -u > /etc/AdGuardHome/ipset.txt
#sed -i -r 's/upstream_dns_file:\s*['\"].*['\"]/upstream_dns_file: \/etc\/AdGuardHome\/gfw.txt/' $configpath
which ipset >/dev/null || ipstok=0
if [ -s /etc/AdGuardHome/ipset.txt -a $ipstok -eq 1 ];then
ipset list gfwlist >/dev/null 2>&1 || ipset create gfwlist hash:ip 2>/dev/null
sed -i -r 's/ipset_file:\s*['\"].*['\"]/ipset_file: \/etc\/AdGuardHome\/ipset.txt/' $configpath
fi
checkmd5 "$2"
rm -f /tmp/gfwlist.txt /tmp/adguard.list

View File

@@ -0,0 +1,3 @@
https://github.com/AdguardTeam/AdGuardHome/releases/download/${latest_ver}/AdGuardHome_linux_${Arch}.tar.gz
https://static.adguard.com/adguardhome/release/AdGuardHome_linux_${Arch}.tar.gz
https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_${Arch}.tar.gz

View File

@@ -0,0 +1,5 @@
#!/bin/sh
tail -n $1 "$2" > /var/run/tailtmp
cat /var/run/tailtmp > "$2"
rm /var/run/tailtmp

View File

@@ -0,0 +1,223 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
update_mode=$1
binpath=$(uci get AdGuardHome.AdGuardHome.binpath)
if [ -z "$binpath" ]; then
uci set AdGuardHome.AdGuardHome.binpath="/tmp/AdGuardHome/AdGuardHome"
binpath="/tmp/AdGuardHome/AdGuardHome"
fi
[[ ! -d ${binpath%/*} ]] && mkdir -p ${binpath%/*}
upxflag=$(uci get AdGuardHome.AdGuardHome.upxflag 2>/dev/null)
[[ -z ${upxflag} ]] && upxflag=off
enabled=$(uci get AdGuardHome.AdGuardHome.enabled 2>/dev/null)
core_version=$(uci get AdGuardHome.AdGuardHome.core_version 2>/dev/null)
case "${core_version}" in
beta)
core_api_url=https://api.github.com/repos/AdguardTeam/AdGuardHome/releases
;;
*)
core_api_url=https://api.github.com/repos/AdguardTeam/AdGuardHome/releases/latest
;;
esac
Check_Task(){
running_tasks="$(ps -efww | grep -v grep | grep "AdGuardHome" | grep "update_core" | awk '{print $1}' | wc -l)"
case $1 in
force)
echo -e "执行: 强制更新核心"
echo -e "清除 ${running_tasks} 个进程 ..."
ps -efww | grep -v grep | grep -v $$ | grep "AdGuardHome" | grep "update_core" | awk '{print $1}' | xargs kill -9 2> /dev/null
;;
*)
[[ ${running_tasks} -gt 2 ]] && echo -e "已经有 ${running_tasks} 个任务正在运行, 请等待其执行结束或将其强行停止!" && EXIT 2
;;
esac
}
Check_Downloader(){
which curl > /dev/null 2>&1 && PKG="curl" && return
echo -e "\n未安装 curl"
which wget-ssl > /dev/null 2>&1 && PKG="wget-ssl" && return
echo "未安装 curl 和 wget, 无法检测更新!" && EXIT 1
}
Check_Updates(){
Check_Downloader
case "${PKG}" in
curl)
Downloader="curl -L -k -o"
_Downloader="curl -s"
;;
wget-ssl)
Downloader="wget-ssl --no-check-certificate -T 5 -O"
_Downloader="wget-ssl -q -O -"
;;
esac
echo "[${PKG}] 开始检查更新, 请耐心等待 ..."
Cloud_Version="$(${_Downloader} ${core_api_url} 2>/dev/null | grep 'tag_name' | grep -Eo "v[0-9].+[0-9.]" | awk 'NR==1')"
[[ -z ${Cloud_Version} ]] && echo -e "\n检查更新失败, 请检查网络或稍后重试!" && EXIT 1
if [[ -f ${binpath} ]]; then
Current_Version="$(${binpath} --version 2>/dev/null | grep -Eo "v[0-9].+[0-9]" | sed -r 's/(.*), c(.*)/\1/')"
else
Current_Version="未知"
fi
[[ -z ${Current_Version} ]] && Current_Version="未知"
echo -e "\n执行文件: ${binpath}\n正在检查更新, 请耐心等待 ..."
echo -e "\n当前 AdGuardHome 版本: ${Current_Version}\n云端 AdGuardHome 版本: ${Cloud_Version}"
if [[ ! "${Cloud_Version}" == "${Current_Version}" || "$1" == force ]]; then
Update_Core
else
echo -e "\n已是最新版本, 无需更新!"
EXIT 0
fi
EXIT 0
}
UPX_Compress(){
Arch_upx=$(GET_Arch )
# https://github.com/upx/upx/releases/download/v5.0.0/upx-5.0.0-amd64_linux.tar.xz
upx_latest_ver="$(${_Downloader} https://api.github.com/repos/upx/upx/releases/latest 2>/dev/null | grep -E 'tag_name' | grep -E '[0-9.]+' -o 2>/dev/null)"
upx_name="upx-${upx_latest_ver}-${Arch_upx}_linux.tar.xz"
echo -e "开始下载 ${upx_name} ...\n"
$Downloader /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux.tar.xz "https://github.com/upx/upx/releases/download/v${upx_latest_ver}/${upx_name}"
if [[ ! -e /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux.tar.xz ]]; then
echo -e "\n${upx_name} 下载失败!\n"
EXIT 1
else
echo -e "\n${upx_name} 下载成功!\n"
fi
which xz > /dev/null 2>&1 || (opkg list | grep ^xz || opkg update > /dev/null 2>&1 && opkg install xz --force-depends) || (echo "软件包 xz 安装失败!" && EXIT 1)
mkdir -p /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux
echo -e "正在解压 ${upx_name} ...\n"
xz -d -c /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux.tar.xz | tar -x -C "/tmp"
[[ ! -f /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux/upx ]] && echo -e "\n${upx_name} 解压失败!" && EXIT 1
}
Update_Core(){
rm -r /tmp/AdGuardHome_Update > /dev/null 2>&1
mkdir -p "/tmp/AdGuardHome_Update"
Arch=$(GET_Arch )
eval link=$(uci get AdGuardHome.AdGuardHome.update_url 2>/dev/null)
echo -e "下载链接:${link}"
echo -e "文件名称:${link##*/}"
echo -e "\n开始下载 AdGuardHome 核心文件 ...\n"
$Downloader /tmp/AdGuardHome_Update/${link##*/} ${link}
if [[ $? != 0 ]];then
echo -e "\nAdGuardHome 核心下载失败 ..."
rm -r /tmp/AdGuardHome_Update
EXIT 1
fi
if [[ ${link##*.} == gz ]]; then
echo -e "\n正在解压 AdGuardHome ..."
tar -zxf "/tmp/AdGuardHome_Update/${link##*/}" -C "/tmp/AdGuardHome_Update/"
if [[ ! -e /tmp/AdGuardHome_Update/AdGuardHome ]]
then
echo "AdGuardHome 核心解压失败!"
rm -rf "/tmp/AdGuardHome_Update" > /dev/null 2>&1
EXIT 1
fi
downloadbin="/tmp/AdGuardHome_Update/AdGuardHome/AdGuardHome"
else
downloadbin="/tmp/AdGuardHome_Update/${link##*/}"
fi
chmod +x ${downloadbin}
echo -e "\nAdGuardHome 核心体积: $(awk 'BEGIN{printf "%.2fMB\n",'$((`ls -l $downloadbin | awk '{print $5}'`))'/1000000}')"
if [[ ${upxflag} != off ]]; then
UPX_Compress
echo -e "使用 UPX 压缩可能会花很长时间, 期间请耐心等待!\n正在压缩 $downloadbin ..."
/tmp/upx-${upx_latest_ver}-${Arch_upx}_linux/upx $upxflag $downloadbin > /dev/null 2>&1
echo -e "\n压缩后的核心体积: $(awk 'BEGIN{printf "%.2fMB\n",'$((`ls -l $downloadbin | awk '{print $5}'`))'/1000000}')"
else
echo "未启用 UPX 压缩, 跳过操作..."
fi
/etc/init.d/AdGuardHome stop > /dev/null 2>&1
echo -e "\n移动 AdGuardHome 核心文件到 ${binpath%/*} ..."
rm -rf ${binpath}
mv -f ${downloadbin} ${binpath} > /dev/null 2>&1
if [[ ! -s ${binpath} && $? != 0 ]]; then
echo -e "AdGuardHome 核心移动失败!\n可能是设备空间不足导致, 请尝试开启 UPX 压缩, 或更改 [执行文件路径] 为 /tmp/AdGuardHome"
EXIT 1
fi
rm -f /tmp/upx*.tar.xz
rm -rf /tmp/upx*
rm -rf /tmp/AdGuardHome_Update
chmod +x ${binpath}
if [[ ${enabled} == 1 ]]; then
echo -e "\n正在重启 AdGuardHome 服务..."
/etc/init.d/AdGuardHome restart
fi
echo -e "\nAdGuardHome 核心更新成功!"
}
GET_Arch() {
Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')"
case "${Archt}" in
"i386")
Arch="386"
;;
"i686")
Arch="386"
;;
"x86")
Arch="amd64"
;;
"mipsel")
Arch="mipsle"
;;
"mips64el")
Arch="mips64le"
Arch="mipsle"
echo -e "mips64el use $Arch may have bug"
;;
"mips")
Arch="mips"
;;
"mips64")
Arch="mips64"
Arch="mips"
echo -e "mips64 use $Arch may have bug"
;;
"arm")
Arch="arm"
;;
"aarch64")
Arch="arm64"
;;
"powerpc")
Arch="ppc"
echo -e "error not support $Archt"
EXIT 1
;;
"powerpc64")
Arch="ppc64"
echo -e "error not support $Archt"
EXIT 1
;;
*)
echo -e "error not support $Archt if you can use offical release please issue a bug"
EXIT 1
;;
esac
echo "$Arch"
}
EXIT(){
rm -rf /var/run/update_core $LOCKU 2>/dev/null
[[ $1 != 0 ]] && touch /var/run/update_core_error
exit $1
}
main(){
Check_Task ${update_mode}
Check_Updates ${update_mode}
}
trap "EXIT 1" SIGTERM SIGINT
touch /var/run/update_core
rm - rf /var/run/update_core_error 2>/dev/null
main

View File

@@ -0,0 +1,35 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
count=0
while :
do
ping -c 1 -W 1 -q www.baidu.com 1>/dev/null 2>&1
if [ "$?" == "0" ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
ping -c 1 -W 1 -q 202.108.22.5 1>/dev/null 2>&1
if [ "$?" == "0" ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
sleep 5
ping -c 1 -W 1 -q www.google.com 1>/dev/null 2>&1
if [ "$?" == "0" ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
ping -c 1 -W 1 -q 8.8.8.8 1>/dev/null 2>&1
if [ "$?" == "0" ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
sleep 5
count=$((count+1))
if [ $count -gt 18 ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
done
return 0

View File

@@ -0,0 +1,13 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
configpath=$(uci get AdGuardHome.AdGuardHome.configpath)
while :
do
sleep 10
if [ -f "$configpath" ]; then
/etc/init.d/AdGuardHome do_redirect 1
break
fi
done
return 0

View File

@@ -0,0 +1,24 @@
{
"luci-app-adguardhome": {
"description": "Grant UCI access for luci-app-adguardhome",
"read": {
"file": {
"/usr/share/AdGuardHome/addhost.sh": [ "exec" ],
"/usr/share/AdGuardHome/AdGuardHome_template.yaml": [ "read" ],
"/usr/share/AdGuardHome/getsyslog.sh": [ "exec" ],
"/usr/share/AdGuardHome/gfw2adg.sh": [ "exec" ],
"/usr/share/AdGuardHome/gfwipset2adg.sh": [ "exec" ],
"/usr/share/AdGuardHome/update_core.sh": [ "exec" ],
"/usr/share/AdGuardHome/waitnet.sh": [ "exec" ],
"/usr/share/AdGuardHome/watchconfig.sh": [ "exec" ],
"/etc/init.d/AdGuardHome": [ "exec" ],
"/etc/init.d/dnsmasq": [ "exec" ],
"/usr/bin/AdGuardHome/AdGuardHome": [ "exec" ]
},
"uci": [ "AdGuardHome" ]
},
"write": {
"uci": [ "AdGuardHome" ]
}
}
}