加入ipv6开关选项
Signed-off-by: zhao <zhao@noreply.localhost>
This commit is contained in:
parent
0c15c272c4
commit
3816c19f77
@ -46,11 +46,12 @@ show_menu() {
|
|||||||
color_output "\e[36m┃\e[0m 4. 恢复出厂设置 \e[36m┃\e[0m"
|
color_output "\e[36m┃\e[0m 4. 恢复出厂设置 \e[36m┃\e[0m"
|
||||||
color_output "\e[36m┃\e[0m 5. 一键换源 \e[36m┃\e[0m"
|
color_output "\e[36m┃\e[0m 5. 一键换源 \e[36m┃\e[0m"
|
||||||
color_output "\e[36m┃\e[0m 6. 一键部署 \e[36m┃\e[0m"
|
color_output "\e[36m┃\e[0m 6. 一键部署 \e[36m┃\e[0m"
|
||||||
color_output "\e[36m┃\e[0m 7. 检测更新 \e[36m┃\e[0m"
|
color_output "\e[36m┃\e[0m 7. IPv6 开关 \e[36m┃\e[0m"
|
||||||
|
color_output "\e[36m┃\e[0m 8. 检测更新 \e[36m┃\e[0m"
|
||||||
color_output "\e[36m┃\e[0m 0. 退出 \e[36m┃\e[0m"
|
color_output "\e[36m┃\e[0m 0. 退出 \e[36m┃\e[0m"
|
||||||
color_output "\e[36m┃ ┃\e[0m"
|
color_output "\e[36m┃ ┃\e[0m"
|
||||||
color_output "\e[36m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\e[0m"
|
color_output "\e[36m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\e[0m"
|
||||||
read -p "$(color_output "\e[33m请输入您的选择 [0-7]: \e[0m")" choice
|
read -p "$(color_output "\e[33m请输入您的选择 [0-0]: \e[0m")" choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
1) change_ip ;;
|
1) change_ip ;;
|
||||||
2) change_password ;;
|
2) change_password ;;
|
||||||
@ -58,6 +59,7 @@ show_menu() {
|
|||||||
4) reset_config ;;
|
4) reset_config ;;
|
||||||
5) change_source ;;
|
5) change_source ;;
|
||||||
6) install_apps ;;
|
6) install_apps ;;
|
||||||
|
7) toggle_ipv6
|
||||||
7) check_update ;;
|
7) check_update ;;
|
||||||
0) exit 0 ;;
|
0) exit 0 ;;
|
||||||
*) echo "无效选项,请重新输入"; show_menu ;;
|
*) echo "无效选项,请重新输入"; show_menu ;;
|
||||||
@ -320,7 +322,67 @@ install_apps() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# 7. 检测更新
|
# 7. Ipv6 开关
|
||||||
|
toggle_ipv6() {
|
||||||
|
color_output "\e[34m[IPv6 开关]\e[0m"
|
||||||
|
|
||||||
|
# 检查当前 IPv6 状态
|
||||||
|
local current_status=$(uci -q get network.lan.ipv6)
|
||||||
|
if [ "$current_status" = "0" ]; then
|
||||||
|
status_text="已禁用"
|
||||||
|
else
|
||||||
|
status_text="已启用"
|
||||||
|
fi
|
||||||
|
|
||||||
|
color_output "\e[36m当前 IPv6 状态: $status_text\e[0m"
|
||||||
|
color_output "\e[36m请选择操作:\e[0m"
|
||||||
|
color_output "1. 启用 IPv6"
|
||||||
|
color_output "2. 禁用 IPv6"
|
||||||
|
color_output "0. 返回主菜单"
|
||||||
|
|
||||||
|
read -p "请输入选择 [0-2]: " ipv6_choice
|
||||||
|
|
||||||
|
case "$ipv6_choice" in
|
||||||
|
1)
|
||||||
|
# 启用 IPv6
|
||||||
|
uci set network.lan.ipv6='1'
|
||||||
|
uci set network.wan.ipv6='1'
|
||||||
|
uci set dhcp.lan.ra='server'
|
||||||
|
uci set dhcp.lan.dhcpv6='server'
|
||||||
|
uci set dhcp.lan.ra_management='1'
|
||||||
|
uci set dhcp.lan.ra_default='1'
|
||||||
|
uci commit network
|
||||||
|
uci commit dhcp
|
||||||
|
/etc/init.d/network restart
|
||||||
|
/etc/init.d/odhcpd restart
|
||||||
|
color_output "\e[32mIPv6 已启用,网络正在重启...\e[0m"
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
# 禁用 IPv6
|
||||||
|
uci set network.lan.ipv6='0'
|
||||||
|
uci set network.wan.ipv6='0'
|
||||||
|
uci set dhcp.lan.ra='disabled'
|
||||||
|
uci set dhcp.lan.dhcpv6='disabled'
|
||||||
|
uci commit network
|
||||||
|
uci commit dhcp
|
||||||
|
/etc/init.d/network restart
|
||||||
|
/etc/init.d/odhcpd restart
|
||||||
|
color_output "\e[32mIPv6 已禁用,网络正在重启...\e[0m"
|
||||||
|
;;
|
||||||
|
0)
|
||||||
|
show_menu
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
color_output "\e[31m无效选择\e[0m"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
read -p "按 Enter 键返回菜单..."
|
||||||
|
show_menu
|
||||||
|
}
|
||||||
|
# 8. 检测更新
|
||||||
check_update() {
|
check_update() {
|
||||||
color_output "\e[34m[检测更新]\e[0m"
|
color_output "\e[34m[检测更新]\e[0m"
|
||||||
color_output "正在检查更新..."
|
color_output "正在检查更新..."
|
||||||
|
Loading…
Reference in New Issue
Block a user