Files
gl/gl-inet-op24.sh

184 lines
5.5 KiB
Bash
Raw Normal View History

2025-12-09 21:39:26 +08:00
#!/bin/sh
# GL-iNet MT-3000/MT-6000 OP24固件专用脚本
# by @wukongdaily
2025-12-09 21:50:44 +08:00
HTTP_HOST="https://cafe.cpolar.cn/wkdaily/gl/raw/branch/main"
LIB_COMMON="/tmp/lib-common.sh"
2025-12-09 21:39:26 +08:00
# 设置全局命令 g
cp -f "$0" /usr/bin/g
chmod +x /usr/bin/g
# 下载并加载公共库
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
. "$LIB_COMMON"
2025-12-09 21:39:26 +08:00
}
# MT系列专用架构配置
2025-12-17 14:05:36 +08:00
add_arch() {
if ! wget -O /etc/opkg/arch.conf $HTTP_HOST/mtarch/arch.conf; then
echo "下载 arch.conf 失败,脚本终止。"
exit 1
fi
}
2026-04-03 09:25:35 +08:00
# OP24专用切换到阿里云软件源
change_opkg_source() {
if [[ "$gl_name" == *3000* ]]; then
if ! wget -O /etc/opkg/distfeeds.conf $HTTP_HOST/mt-3000/distfeeds-24.conf; then
echo "换源失败,脚本终止。"
exit 1
fi
fi
2025-12-17 14:05:36 +08:00
}
# 安装应用商店和主题
2025-12-09 21:39:26 +08:00
install_istore_os_style() {
do_install_argon_skin
opkg install ttyd
do_install_filetransfer
is-opkg install app-meta-sftp
is-opkg install 'app-meta-ddnsto'
is-opkg install 'app-meta-diskman'
FILE_PATH="/etc/openwrt_release"
NEW_DESCRIPTION="Openwrt like iStoreOS Style by wukongdaily"
CONTENT=$(cat $FILE_PATH)
UPDATED_CONTENT=$(echo "$CONTENT" | sed "s/DISTRIB_DESCRIPTION='[^']*'/DISTRIB_DESCRIPTION='$NEW_DESCRIPTION'/")
echo "$UPDATED_CONTENT" >$FILE_PATH
}
# 设置风扇工作温度
2025-12-09 21:39:26 +08:00
setup_cpu_fans() {
uci set glfan.@globals[0].temperature=50
uci set glfan.@globals[0].warn_temperature=50
uci set glfan.@globals[0].integration=4
uci set glfan.@globals[0].differential=20
uci commit glfan
/etc/init.d/gl_fan restart
2025-12-09 21:39:26 +08:00
}
# 恢复原厂OPKG配置
2025-12-09 21:39:26 +08:00
recovery_opkg_settings() {
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
2025-12-09 21:39:26 +08:00
mt3000_opkg="$HTTP_HOST/mt-3000/distfeeds-24.conf"
wget -O /etc/opkg/distfeeds.conf ${mt3000_opkg}
2025-12-09 21:39:26 +08:00
}
# 更新首页风格
2025-12-09 21:39:26 +08:00
update_luci_app_quickstart() {
if [ -f "/bin/is-opkg" ]; then
is-opkg update
is-opkg install luci-i18n-quickstart-zh-cn --force-depends >/dev/null 2>&1
opkg install iptables-mod-tproxy
opkg install iptables-mod-socket
opkg install iptables-mod-iprange
do_install_new_quickstart
yellow "恭喜您!现在你的路由器已经变成iStoreOS风格啦!"
green "现在您可以访问8080端口 查看是否生效 http://192.168.8.1:8080"
green "更多up主项目和动态 请务必收藏我的导航站 https://tvhelper.cpolar.cn"
2025-12-09 21:39:26 +08:00
else
red "请先执行第一项 一键iStoreOS风格化"
2025-12-09 21:39:26 +08:00
fi
}
# 安装文件管理器
do_install_filemanager() {
echo "为避免bug,安装文件管理器之前,需要先iStore商店"
do_istore_generic
echo "接下来尝试安装文件管理器..."
is-opkg install 'app-meta-linkease'
echo "重新登录web页面,然后您可以访问: http://192.168.8.1/cgi-bin/luci/admin/services/linkease/file/?path=/root"
2025-12-09 21:39:26 +08:00
}
# ============================================================================
# 主程序
# ============================================================================
load_common_lib
2025-12-09 21:39:26 +08:00
while true; do
clear
gl_name=$(get_router_name)
result=$gl_name"一键iStoreOS风格化(新版)"
result=$(echo "$result" | sed 's/ like iStoreOS//')
echo "***********************************************************************"
echo "* 一键安装工具箱(for gl-inet Router)"
echo "* OP24固件专用 by @wukongdaily"
echo "**********************************************************************"
echo "* 当前的路由器型号: $gl_name" | sed 's/ like iStoreOS//'
echo
echo "********仅支持op24固件的机型*********************************************"
green "*******GL-iNet MT-3000 op24"
green "*******GL-iNet MT-6000 op24"
echo "******************下次调用 直接输入快捷键 g *****************************"
echo
light_magenta " 1. $result"
echo
echo " 2. 设置风扇开始工作的温度(仅限MT3000)"
echo " 3. 安装Argon紫色主题"
echo " 4. 安装文件管理器"
light_magenta " 5. 隐藏首页非必要UI元素"
light_magenta " 6. 安装个性化UI辅助插件(by VMatrices)"
light_magenta " 7. 安装高级卸载插件"
echo
echo " Q. 退出本程序"
echo
read -p "请选择一个选项: " choice
case $choice in
1)
add_arch
change_opkg_source
if [[ "$gl_name" == *3000* ]]; then
setup_cpu_fans
fi
do_istore_generic
install_istore_os_style
update_luci_app_quickstart
setup_base_init
advanced_uninstall
do_install_ui_helper
show_completion_message
;;
2)
case "$gl_name" in
*3000*)
set_glfan_temp
;;
*)
echo "当前的路由器型号: $gl_name" | sed 's/ like iStoreOS//'
echo "并非MT3000 它没有风扇 无需设置"
;;
esac
;;
3)
do_install_argon_skin
;;
4)
do_install_filemanager
;;
5)
hide_ui_elements
;;
6)
do_install_ui_helper
;;
7)
advanced_uninstall
;;
q | Q)
echo "退出"
exit 0
;;
*)
echo "无效选项,请重新选择。"
;;
esac
read -p "按 Enter 键继续..."
done