refactor: 统一替换多脚本公共库加载逻辑

移除公共库文件存在检查,直接删除旧文件后重新下载,确保始终使用最新版本公共库
同时修复mt3600.sh中的多余空行和缩进格式问题
This commit is contained in:
2026-07-09 08:53:16 +08:00
parent 4f24f9d5fe
commit 8ff396cf64
8 changed files with 67 additions and 75 deletions

View File

@@ -7,12 +7,11 @@ LIB_COMMON="/tmp/lib-common.sh"
# 下载并加载公共库
load_common_lib() {
if [ ! -f "$LIB_COMMON" ]; then
wget -O "$LIB_COMMON" "$HTTP_HOST/lib/lib-common.sh" 2>/dev/null || {
echo "下载公共库失败"
exit 1
}
fi
rm -f "$LIB_COMMON"
wget -O "$LIB_COMMON" "$HTTP_HOST/lib/lib-common.sh" 2>/dev/null || {
echo "下载公共库失败"
exit 1
}
. "$LIB_COMMON"
}
@@ -50,16 +49,16 @@ do_quickstart() {
do_install_ui_helper_silent() {
local ipk_file="/tmp/glinjector_3.0.5-6_all.ipk"
local sha_file="${ipk_file}.sha256"
wget -O "$sha_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk.sha256" || return 1
wget --user-agent="Mozilla/5.0" -O "$ipk_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk" || return 1
cd "$(dirname "$ipk_file")"
sha256sum -c "$sha_file" || {
rm -f "$ipk_file"
return 1
}
opkg update
opkg install "$ipk_file"
}
@@ -97,7 +96,7 @@ while true; do
echo "*******支持的机型列表***************************************************"
green "*******GL-iNet MT3600BE********"
echo
light_magenta " 1. $result"
echo
light_magenta " 2. 安装argon紫色主题"
@@ -117,40 +116,40 @@ while true; do
echo " Q. 退出本程序"
echo
read -p "请选择一个选项: " choice
case $choice in
1)
run_quick_install
1)
run_quick_install
;;
2)
do_install_argon_skin
2)
do_install_argon_skin
;;
3)
do_istore
3)
do_istore
;;
4)
hide_ui_elements
4)
hide_ui_elements
;;
5)
set_glfan_temp
5)
set_glfan_temp
;;
6)
do_install_ui_helper
6)
do_install_ui_helper
;;
7)
advanced_uninstall
7)
advanced_uninstall
;;
8)
recovery
8)
recovery
;;
q | Q)
echo "退出"
exit 0
q | Q)
echo "退出"
exit 0
;;
*)
echo "无效选项,请重新选择。"
*)
echo "无效选项,请重新选择。"
;;
esac
read -p "按 Enter 键继续..."
done