Skip to content

Commit bb317ed

Browse files
committed
fix: discard setting,conf when install
1 parent e5b062c commit bb317ed

File tree

8 files changed

+55
-50
lines changed

8 files changed

+55
-50
lines changed

changelog.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Changelog
22

3-
- 添加了全模块中英双语支持
4-
- 尝试解决部分设备无法启动的问题
5-
- 添加了 debug.sh 作为排错工具
6-
- 移除了无效的黑白名单
7-
- 配置文件改名 setting.conf
8-
- 其它文本提示类的改进
3+
- 修复安装模块时 `settings.conf` 无法保留的问题
4+
- 优化了安装模块语序与emoji
5+
- 更新了密码加密串(原文未变)

src/bin/AdGuardHome.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ http:
66
session_ttl: 720h
77
users:
88
- name: root
9-
password: $2a$10$zHcQbG4nXIzPB/Cj5M9lQ.qbQH/EZAT2wakz/sK1.b/d4ey2oqUd2
9+
password: $2b$12$D3zeMIBFfzcQTqGqB.k7GOkMvqx1jgsrdiRCn2kwOHl.kNmmPfMom
1010
auth_attempts: 5
1111
block_auth_min: 15
1212
http_proxy: ""
@@ -77,7 +77,7 @@ tls:
7777
force_https: false
7878
port_https: 443
7979
port_dns_over_tls: 853
80-
port_dns_over_quic: 784
80+
port_dns_over_quic: 853
8181
port_dnscrypt: 0
8282
dnscrypt_config_file: ""
8383
allow_unencrypted_doh: false
@@ -127,7 +127,7 @@ filtering:
127127
blocking_ipv6: ""
128128
blocked_services:
129129
schedule:
130-
time_zone: UTC
130+
time_zone: Asia/Shanghai
131131
ids: []
132132
protection_disabled_until: null
133133
safe_search:
@@ -148,7 +148,7 @@ filtering:
148148
safesearch_cache_size: 1048576
149149
parental_cache_size: 1048576
150150
cache_time: 30
151-
filters_update_interval: 72
151+
filters_update_interval: 24
152152
blocked_response_ttl: 10
153153
filtering_enabled: true
154154
parental_enabled: false
@@ -158,7 +158,7 @@ clients:
158158
runtime_sources:
159159
whois: true
160160
arp: true
161-
rdns: false
161+
rdns: true
162162
dhcp: true
163163
hosts: true
164164
persistent: []
@@ -169,7 +169,7 @@ log:
169169
max_size: 100
170170
max_age: 3
171171
compress: false
172-
local_time: true
172+
local_time: false
173173
verbose: false
174174
os:
175175
group: ""

src/bin/data/filters/1732747955.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@
5454
||ads-api-o.api.leiniao.com^
5555
||ads-api.tiktok.com^
5656
||ads-api.twitter.com^
57+
||ads-img-al.xhscdn.com^
5758
||ads-img-qc.xhscdn.com^
5859
||ads-marketing-vivofs.vivo.com.cn^
5960
||ads-sdk-api.ranfenghd.com^
6061
||ads-sg.tiktok.com^
6162
||ads-video-al.xhscdn.com^
6263
||ads-video-qc.xhscdn.com^
6364
||ads.95516.com^
64-
||ads.flurry.com^
6565
||ads.google.cn^
6666
||ads.huan.tv^
6767
||ads.huantest.com^
@@ -71,6 +71,7 @@
7171
||ads.music.126.net^
7272
||ads.pinterest.com^
7373
||ads.pubmatic.com^
74+
||ads.raidrive.com^
7475
||ads.servebom.com^
7576
||ads.service.kugou.com^
7677
||ads.tiktok.com^
@@ -536,6 +537,7 @@
536537
||p6-be-pack-sign.pglstatp-toutiao.com^
537538
||pagead2.googleadservices.com^
538539
||pagead2.googlesyndication.com^
540+
||pay.sboot.cn^
539541
||pcdn.xmcdn.com^
540542
||pcm-img.zhls.qq.com^
541543
||pgdt.gtimg.cn^
@@ -747,6 +749,7 @@
747749
||widgets.pinterest.com^
748750
||wildcard.moatads.com.edgekey.net^
749751
||win.gdt.qq.com^
752+
||wn.x.jd.com^
750753
||ws-keyboard.shouji.sogou.com^
751754
||ws.sj.qq.com^
752755
||wv.inner-active.mobi^

src/customize.sh

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,50 @@ unzip -o "$ZIPFILE" "service.sh" -d "$MODPATH" >/dev/null 2>&1
2424
unzip -o "$ZIPFILE" "uninstall.sh" -d "$MODPATH" >/dev/null 2>&1
2525

2626
extract_keep_config() {
27-
info "- 📁 Keeping old configuration files" "- 📁 保留原来的配置文件"
28-
unzip -o "$ZIPFILE" "scripts/*" -d $AGH_DIR >/dev/null 2>&1 || error "- Failed to extract scripts" "- 解压脚本文件失败"
29-
unzip -o "$ZIPFILE" "bin/*" -x "bin/AdGuardHome.yaml" -d $AGH_DIR >/dev/null 2>&1 || error "- Failed to extract binary files" "- 解压二进制文件失败"
30-
info "- 📦 Extracting configuration files..." "- 📦 正在解压配置文件..."
31-
unzip -o "$ZIPFILE" "settings.conf" -d $AGH_DIR >/dev/null 2>&1 || error "- Failed to extract configuration files" "- 解压配置文件失败"
27+
info "- 🌈 Keeping old configuration files..." "- 🌈 保留原来的配置文件..."
28+
info "- 📜 Extracting script files..." "- 📜 正在解压脚本文件..."
29+
unzip -o "$ZIPFILE" "scripts/*" -d $AGH_DIR >/dev/null 2>&1 || {
30+
error "- ❌ Failed to extract scripts!" "- ❌ 解压脚本文件失败!"
31+
}
32+
info "- 🛠️ Extracting binary files except configuration..." "- 🛠️ 正在解压二进制文件(不包括配置文件)..."
33+
unzip -o "$ZIPFILE" "bin/*" -x "bin/AdGuardHome.yaml" -d $AGH_DIR >/dev/null 2>&1 || {
34+
error "- ❌ Failed to extract binary files!" "- ❌ 解压二进制文件失败!"
35+
}
36+
info "- 🚫 Skipping configuration file extraction..." "- 🚫 跳过解压配置文件..."
3237
}
3338

3439
extract_no_config() {
3540
info "- 💾 Backing up old configuration files with .bak extension..." "- 💾 使用 .bak 扩展名备份旧配置文件..."
3641
[ -f "$AGH_DIR/settings.conf" ] && mv "$AGH_DIR/settings.conf" "$AGH_DIR/settings.conf.bak"
3742
[ -f "$AGH_DIR/bin/AdGuardHome.yaml" ] && mv "$AGH_DIR/bin/AdGuardHome.yaml" "$AGH_DIR/bin/AdGuardHome.yaml.bak"
38-
info "- 📦 Extracting script files..." "- 📦 正在解压脚本文件..."
39-
unzip -o "$ZIPFILE" "scripts/*" -d $AGH_DIR >/dev/null 2>&1 || error "- Failed to extract scripts" "- 解压脚本文件失败"
40-
info "- 📦 Extracting binary files..." "- 📦 正在解压二进制文件..."
41-
unzip -o "$ZIPFILE" "bin/*" -d $AGH_DIR >/dev/null 2>&1 || error "- Failed to extract binary files" "- 解压二进制文件失败"
42-
info "- 📦 Extracting configuration files..." "- 📦 正在解压配置文件..."
43-
unzip -o "$ZIPFILE" "settings.conf" -d $AGH_DIR >/dev/null 2>&1 || error "- Failed to extract configuration files" "- 解压配置文件失败"
43+
extract_all
4444
}
4545

46-
first_install_extract() {
47-
info "- 📦 First time installation, extracting files..." "- 📦 第一次安装,正在解压文件..."
48-
mkdir -p "$AGH_DIR" "$BIN_DIR" "$SCRIPT_DIR"
49-
info "- 📦 Extracting script files..." "- 📦 正在解压脚本文件..."
50-
unzip -o "$ZIPFILE" "scripts/*" -d $AGH_DIR >/dev/null 2>&1 || error "- Failed to extract scripts" "- 解压脚本文件失败"
51-
info "- 📦 Extracting binary files..." "- 📦 正在解压二进制文件..."
52-
unzip -o "$ZIPFILE" "bin/*" -d $AGH_DIR >/dev/null 2>&1 || error "- Failed to extract binary files" "- 解压二进制文件失败"
53-
info "- 📦 Extracting configuration files..." "- 📦 正在解压配置文件..."
54-
unzip -o "$ZIPFILE" "settings.conf" -d $AGH_DIR >/dev/null 2>&1 || error "- Failed to extract configuration files" "- 解压配置文件失败"
46+
extract_all() {
47+
info "- 🌟 Extracting script files..." "- 🌟 正在解压脚本文件..."
48+
unzip -o "$ZIPFILE" "scripts/*" -d $AGH_DIR >/dev/null 2>&1 || {
49+
error "- ❌ Failed to extract scripts" "- ❌ 解压脚本文件失败"
50+
}
51+
info "- 🛠️ Extracting binary files..." "- 🛠️ 正在解压二进制文件..."
52+
unzip -o "$ZIPFILE" "bin/*" -d $AGH_DIR >/dev/null 2>&1 || {
53+
error "- ❌ Failed to extract binary files" "- ❌ 解压二进制文件失败"
54+
}
55+
info "- 📜 Extracting configuration files..." "- 📜 正在解压配置文件..."
56+
unzip -o "$ZIPFILE" "settings.conf" -d $AGH_DIR >/dev/null 2>&1 || {
57+
error "- ❌ Failed to extract configuration files" "- ❌ 解压配置文件失败"
58+
}
5559
}
5660

5761
if [ -d "$AGH_DIR" ]; then
58-
info "- ⏹️ Stopping all AdGuardHome processes..." "- ⏹️ 正在停止所有 AdGuardHome 进程..."
59-
pkill -f "AdGuardHome" || pkill -9 -f "AdGuardHome"
60-
sleep 1
61-
info "- 🔄 Found old version, do you want to keep the old configuration? (If not, it will be automatically backed up)" "- 🔄 发现旧版模块,是否保留原来的配置文件?(若不保留则自动备份)"
62+
info "- ⏹️ Found old version, stopping all AdGuardHome processes..." "- ⏹️ 发现旧版模块,正在停止所有 AdGuardHome 进程..."
63+
pkill -f "AdGuardHome" || pkill -9 -f "AdGuardHome"
64+
info "- 🔄 Do you want to keep the old configuration? (If not, it will be automatically backed up)" "- 🔄 是否保留原来的配置文件?(若不保留则自动备份)"
6265
info "- 🔊 (Volume Up = Yes, Volume Down = No, 10s no input = No)" "- 🔊 (音量上键 = 是, 音量下键 = 否,10秒无操作 = 否)"
6366
START_TIME=$(date +%s)
64-
while true ; do
67+
while true; do
6568
NOW_TIME=$(date +%s)
66-
timeout 1 getevent -lc 1 2>&1 | grep KEY_VOLUME > "$TMPDIR/events"
67-
if [ $(( NOW_TIME - START_TIME )) -gt 9 ]; then
69+
timeout 1 getevent -lc 1 2>&1 | grep KEY_VOLUME >"$TMPDIR/events"
70+
if [ $((NOW_TIME - START_TIME)) -gt 9 ]; then
6871
info "- ⏰ No input detected after 10 seconds, defaulting to not keep old configuration." "- ⏰ 10秒无输入,默认不保留原配置。"
6972
extract_no_config
7073
break
@@ -77,7 +80,9 @@ if [ -d "$AGH_DIR" ]; then
7780
fi
7881
done
7982
else
80-
first_install_extract
83+
info "- 📦 First time installation, extracting files..." "- 📦 第一次安装,正在解压文件..."
84+
mkdir -p "$AGH_DIR" "$BIN_DIR" "$SCRIPT_DIR"
85+
extract_all
8186
fi
8287

8388
info "- 🔐 Setting permissions..." "- 🔐 设置权限..."

src/module.prop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id=AdGuardHome
22
name=AdGuardHome for Root
3-
version=20250511
4-
versionCode=36
3+
version=20250514
4+
versionCode=37
55
author=twoone3
66
description=none
77
updateJson=https://raw.githubusercontent.com/twoone-3/AdGuardHomeForRoot/main/version.json

src/scripts/tool.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ start_adguardhome() {
99

1010
# to fix https://github.com/AdguardTeam/AdGuardHome/issues/7002
1111
export SSL_CERT_DIR="/system/etc/security/cacerts/"
12+
# set timezone to Shanghai
13+
export TZ="Asia/Shanghai"
14+
# run binary
1215
busybox setuidgid "$adg_user:$adg_group" "$BIN_DIR/AdGuardHome" >>"$AGH_DIR/bin.log" 2>&1 &
1316
adg_pid=$!
1417

@@ -23,10 +26,7 @@ start_adguardhome() {
2326
else
2427
log "😭 Error occurred, check logs for details" "😭 出现错误,请检查日志以获取详细信息"
2528
update_description "😭 Error occurred, check logs for details" "😭 出现错误,请检查日志以获取详细信息"
26-
log "==== Last 20 lines of bin.log ====" "==== bin.log 的最后 20 行 ===="
27-
tail -n 20 "$AGH_DIR/bin.log" | while read -r line; do
28-
log "$line" "$line"
29-
done
29+
$SCRIPT_DIR/debug.sh
3030
exit 1
3131
fi
3232
}

src/service.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
until [ $(getprop init.svc.bootanim) = "stopped" ]; do
2-
sleep 5
2+
sleep 12
33
done
44

55
/data/adb/agh/scripts/tool.sh start

version.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"versionCode": 36,
3-
"version": "20250511",
2+
"versionCode": 37,
3+
"version": "20250514",
44
"zipUrl": "https://github.com/twoone-3/AdGuardHomeForRoot/releases/latest/download/AdGuardHomeForRoot_arm64.zip",
55
"changelog": "https://raw.githubusercontent.com/twoone-3/AdGuardHomeForRoot/main/changelog.md"
66
}

0 commit comments

Comments
 (0)