@@ -24,47 +24,50 @@ unzip -o "$ZIPFILE" "service.sh" -d "$MODPATH" >/dev/null 2>&1
2424unzip -o " $ZIPFILE " " uninstall.sh" -d " $MODPATH " > /dev/null 2>&1
2525
2626extract_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
3439extract_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
5761if [ -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
7982else
80- first_install_extract
83+ info " - 📦 First time installation, extracting files..." " - 📦 第一次安装,正在解压文件..."
84+ mkdir -p " $AGH_DIR " " $BIN_DIR " " $SCRIPT_DIR "
85+ extract_all
8186fi
8287
8388info " - 🔐 Setting permissions..." " - 🔐 设置权限..."
0 commit comments