@@ -10,83 +10,62 @@ function error() {
1010 [ " $language " = " en" ] && abort " $1 " || abort " $2 "
1111}
1212
13- info " - Installing AdGuardHome for $ARCH " " - 开始安装 AdGuardHome for $ARCH "
13+ info " - 🚀 Installing AdGuardHome for $ARCH " " - 🚀 开始安装 AdGuardHome for $ARCH "
1414
1515AGH_DIR=" /data/adb/agh"
1616BIN_DIR=" $AGH_DIR /bin"
1717SCRIPT_DIR=" $AGH_DIR /scripts"
18- BACKUP_DIR=" $AGH_DIR /backup"
1918PID_FILE=" $AGH_DIR /bin/agh.pid"
2019
21- info " - Extracting module basic files..." " - 解压模块基本文件..."
22- unzip -o " $ZIPFILE " " action.sh" -d $MODPATH > /dev/null 2>&1
23- unzip -o " $ZIPFILE " " module.prop" -d $MODPATH > /dev/null 2>&1
24- unzip -o " $ZIPFILE " " service.sh" -d $MODPATH > /dev/null 2>&1
25- unzip -o " $ZIPFILE " " uninstall.sh" -d $MODPATH > /dev/null 2>&1
20+ info " - 📦 Extracting module basic files..." " - 📦 解压模块基本文件..."
21+ unzip -o " $ZIPFILE " " action.sh" -d " $MODPATH " > /dev/null 2>&1
22+ unzip -o " $ZIPFILE " " module.prop" -d " $MODPATH " > /dev/null 2>&1
23+ unzip -o " $ZIPFILE " " service.sh" -d " $MODPATH " > /dev/null 2>&1
24+ unzip -o " $ZIPFILE " " uninstall.sh" -d " $MODPATH " > /dev/null 2>&1
2625
2726extract_keep_config () {
28- info " - Keeping old configuration files" " - 保留原来的配置文件"
29- unzip -o " $ZIPFILE " " scripts/*" -d $AGH_DIR > /dev/null 2>&1 || {
30- error " - Failed to extract scripts" " - 解压脚本文件失败"
31- }
32- unzip -o " $ZIPFILE " " bin/*" -x " bin/AdGuardHome.yaml" -d $AGH_DIR > /dev/null 2>&1 || {
33- error " - Failed to extract binary files" " - 解压二进制文件失败"
34- }
35- unzip -o " $ZIPFILE " " settings.conf" -d $AGH_DIR > /dev/null 2>&1 || {
36- error " - Failed to extract configuration files" " - 解压配置文件失败"
37- }
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" " - 解压配置文件失败"
3832}
3933
4034extract_no_config () {
41- [ -d " $BACKUP_DIR " ] && rm -r " $BACKUP_DIR "
42- mkdir -p " $BACKUP_DIR "
43- info " - Backing up old configuration files..." " - 正在备份旧配置文件..."
44- mv " $AGH_DIR /settings.conf" " $BACKUP_DIR "
45- mv " $AGH_DIR /bin/AdGuardHome.yaml" " $BACKUP_DIR "
46- info " - Extracting script files..." " - 正在解压脚本文件..."
47- unzip -o " $ZIPFILE " " scripts/*" -d $AGH_DIR > /dev/null 2>&1 || {
48- error " - Failed to extract scripts" " - 解压脚本文件失败"
49- }
50- info " - Extracting binary files..." " - 正在解压二进制文件..."
51- unzip -o " $ZIPFILE " " bin/*" -d $AGH_DIR > /dev/null 2>&1 || {
52- error " - Failed to extract binary files" " - 解压二进制文件失败"
53- }
54- info " - Extracting configuration files..." " - 正在解压配置文件..."
55- unzip -o " $ZIPFILE " " settings.conf" -d $AGH_DIR > /dev/null 2>&1 || {
56- error " - Failed to extract configuration files" " - 解压配置文件失败"
57- }
35+ info " - 💾 Backing up old configuration files with .bak extension..." " - 💾 使用 .bak 扩展名备份旧配置文件..."
36+ [ -f " $AGH_DIR /settings.conf" ] && mv " $AGH_DIR /settings.conf" " $AGH_DIR /settings.conf.bak"
37+ [ -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" " - 解压配置文件失败"
5844}
5945
6046first_install_extract () {
61- info " - First time installation, extracting files..." " - 第一次安装,正在解压文件..."
47+ info " - 📦 First time installation, extracting files..." " - 📦 第一次安装,正在解压文件..."
6248 mkdir -p " $AGH_DIR " " $BIN_DIR " " $SCRIPT_DIR "
63- info " - Extracting script files..." " - 正在解压脚本文件..."
64- unzip -o " $ZIPFILE " " scripts/*" -d $AGH_DIR > /dev/null 2>&1 || {
65- error " - Failed to extract scripts" " - 解压脚本文件失败"
66- }
67- info " - Extracting binary files..." " - 正在解压二进制文件..."
68- unzip -o " $ZIPFILE " " bin/*" -d $AGH_DIR > /dev/null 2>&1 || {
69- error " - Failed to extract binary files" " - 解压二进制文件失败"
70- }
71- info " - Extracting configuration files..." " - 正在解压配置文件..."
72- unzip -o " $ZIPFILE " " settings.conf" -d $AGH_DIR > /dev/null 2>&1 || {
73- error " - Failed to extract configuration files" " - 解压配置文件失败"
74- }
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" " - 解压配置文件失败"
7555}
7656
7757if [ -d " $AGH_DIR " ]; then
78- # Kill all processes named AdGuardHome
79- info " - Stopping all AdGuardHome processes..." " - 正在停止所有 AdGuardHome 进程..."
58+ info " - ⏹️ Stopping all AdGuardHome processes..." " - ⏹️ 正在停止所有 AdGuardHome 进程..."
8059 pkill -f " AdGuardHome" || pkill -9 -f " AdGuardHome"
8160 sleep 1
82- info " - Found old version, do you want to keep the old configuration? (If not, it will be automatically backed up)" " - 发现旧版模块,是否保留原来的配置文件?(若不保留则自动备份)"
83- info " - (Volume Up = Yes, Volume Down = No, 10s no input = No)" " - (音量上键 = 是, 音量下键 = 否,10秒无操作 = 否)"
61+ info " - 🔄 Found old version, do you want to keep the old configuration? (If not, it will be automatically backed up)" " - 🔄 发现旧版模块,是否保留原来的配置文件?(若不保留则自动备份)"
62+ info " - 🔊 (Volume Up = Yes, Volume Down = No, 10s no input = No)" " - 🔊 (音量上键 = 是, 音量下键 = 否,10秒无操作 = 否)"
8463 START_TIME=$( date +%s)
8564 while true ; do
8665 NOW_TIME=$( date +%s)
8766 timeout 1 getevent -lc 1 2>&1 | grep KEY_VOLUME > " $TMPDIR /events"
8867 if [ $(( NOW_TIME - START_TIME )) -gt 9 ]; then
89- info " - No input detected after 10 seconds, defaulting to not keep old configuration." " - 10秒无输入,默认不保留原配置。"
68+ info " - ⏰ No input detected after 10 seconds, defaulting to not keep old configuration." " - ⏰ 10秒无输入,默认不保留原配置。"
9069 extract_no_config
9170 break
9271 elif $( cat $TMPDIR /events | grep -q KEY_VOLUMEUP) ; then
@@ -101,16 +80,11 @@ else
10180 first_install_extract
10281fi
10382
104- info " - Setting permissions..." " - 设置权限..."
83+ info " - 🔐 Setting permissions..." " - 🔐 设置权限..."
84+
10585chmod +x " $BIN_DIR /AdGuardHome"
10686chown root:net_raw " $BIN_DIR /AdGuardHome"
10787
108- chmod +x " $SCRIPT_DIR /inotify.sh"
109- chmod +x " $SCRIPT_DIR /iptables.sh"
110- chmod +x " $SCRIPT_DIR /tool.sh"
111-
112- chmod +x " $MODPATH /action.sh"
113- chmod +x " $MODPATH /service.sh"
114- chmod +x " $MODPATH /uninstall.sh"
88+ chmod +x " $SCRIPT_DIR " /* .sh " $MODPATH " /* .sh
11589
116- info " - Installation completed, please reboot." " - 安装完成,请重启设备。"
90+ info " - ✅ Installation completed, please reboot." " - ✅ 安装完成,请重启设备。"
0 commit comments