Files
gl/gl-inet-op25.sh
wukongdaily e72dce9dc6 refactor(gl-inet-op25): extract dependency installation to separate function
extract installing luci-i18n-ttyd-zh-cn and app-meta-sftp into do_install_needs function, call it after istore installation
2026-07-11 18:19:13 +08:00

156 lines
4.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# GL-iNet MT-3000/MT-6000 OP25固件专用脚本
# by @wukongdaily
HTTP_HOST="https://cafe.cpolar.cn/wkdaily/gl/raw/branch/main"
LIB_COMMON="/tmp/lib-common.sh"
# 设置全局命令 g
cp -f "$0" /usr/bin/g
chmod +x /usr/bin/g
# 下载并加载公共库
load_common_lib() {
rm -f "$LIB_COMMON"
wget -O "$LIB_COMMON" "$HTTP_HOST/lib/lib-common.sh" 2>/dev/null || {
echo "下载公共库失败"
exit 1
}
. "$LIB_COMMON"
}
# 安装argon紫色主题
do_install_argon_apk() {
echo "正在安装argon紫色主题"
wget -O /tmp/argon.run "$HTTP_HOST/theme/apk/argon/25-argon.run"
sh /tmp/argon.run --target /tmp/abc --noexec
apk add --allow-untrusted /tmp/abc/*.apk
echo "argon紫色主题安装完成"
}
# 安装iStore商店
do_install_istore() {
echo "正在安装iStore商店"
wget -O /tmp/istore.run "$HTTP_HOST/theme/25-luci-app-store.run"
sh /tmp/istore.run
echo "iStore商店安装完成"
do_install_needs
}
# 安装首页和网络向导
do_install_quickstart() {
echo "正在安装首页和网络向导"
is-opkg install luci-i18n-quickstart-zh-cn
# 去除磁盘显示和网口IP信息
wget -O /etc/config/quickstart "$HTTP_HOST/config/quickstart"
echo "首页和网络向导安装完成"
}
# 设置默认风扇开始工作的温度
do_setup_default_temp() {
echo "正在设置默认风扇开始工作的温度"
temp=50
uci set glfan.@globals[0].temperature="$temp"
uci set glfan.@globals[0].warn_temperature="$temp"
uci set glfan.@globals[0].integration=4
uci set glfan.@globals[0].differential=20
uci commit glfan
/etc/init.d/gl_fan restart
}
# 安装个性化辅助UI
do_install_ui_helper_apk() {
echo "正在安装UI助手APK"
wget -O /tmp/uihelper.apk "$HTTP_HOST/theme/apk/uihelper/uihelper.apk"
apk add --allow-untrusted /tmp/uihelper.apk
echo "UI助手APK安装完成"
}
do_install_needs() {
is-opkg install luci-i18n-ttyd-zh-cn
is-opkg install app-meta-sftp
}
# ============================================================================
# 一键执行函数
# ============================================================================
run_quick_install() {
green "正在安装 LuCI 管理界面..."
sh /usr/bin/init_luci.sh web > /dev/null 2>&1
green "LuCI 安装完成"
if ! command -v tty > /dev/null 2>&1; then
cat > /usr/bin/tty << 'EOF'
#!/bin/sh
echo "/dev/pts/0"
EOF
chmod +x /usr/bin/tty
fi
do_setup_default_temp
do_install_argon_apk
do_install_istore
do_install_quickstart
add_author_info
echo "安装完毕请使用8080端口访问luci界面http://192.168.8.1:8080"
}
# ============================================================================
# 主程序
# ============================================================================
load_common_lib
# 检查是否传入 --quick 参数
if [ "$1" = "--quick" ] || [ "$1" = "-q" ]; then
run_quick_install
exit 0
fi
while true; do
clear
gl_name=$(get_router_name)
echo "***********************************************************************"
echo "* 一键安装工具箱(for gl-inet Router)"
echo "* OP25固件专用 by @wukongdaily"
echo "**********************************************************************"
echo "* 当前的路由器型号: $gl_name"
echo
green "*******GL-iNet MT-3000 op25"
green "*******GL-iNet MT-6000 op25"
echo
light_magenta " 1. 一键安装风格化"
echo
echo " 2. 安装Argon紫色主题"
echo " 3. 安装iStore商店"
echo " 4. 安装首页和网络向导"
echo " 5. 安装个性化辅助UI"
echo
echo " Q. 退出本程序"
echo
read -p "请选择一个选项: " choice
case $choice in
1)
run_quick_install
;;
2)
do_install_argon_apk
;;
3)
do_install_istore
;;
4)
do_install_quickstart
;;
5)
do_install_ui_helper_apk
;;
q | Q)
echo "退出"
exit 0
;;
*)
echo "无效选项,请重新选择。"
;;
esac
read -p "按 Enter 键继续..."
done