From b0fa682dc14eb8062275c804329f28fceadf4c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=B5=E4=BA=8C?= <66155308+miaoermua@users.noreply.github.com> Date: Sun, 9 Jun 2024 22:06:57 +0800 Subject: [PATCH] Update setip --- init.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/init.sh b/init.sh index ce89dc1..379d878 100644 --- a/init.sh +++ b/init.sh @@ -26,14 +26,28 @@ show_menu() { echo "-------------------------" echo " CatTools " echo "-------------------------" - echo "1. Debug" - echo "2. catwrt_update" - echo "3. use_repo" + echo "1. SetIP" + echo "2. Debug" + echo "3. catwrt_update" + echo "4. use_repo" echo "0. Exit" echo "-------------------------" echo -n "Please enter your choice: " } +setip(){ + read -p "请输入 IP(默认为 $DEFAULT_IP): " input_ip + if [ -z $input_ip ]; then + input_ip=$DEFAULT_IP + fi + + uci set network.lan.ipaddr=$input_ip + uci commit network + /etc/init.d/network restart + + echo "默认 IP 已设置为 $input_ip" +} + # Debug debug() { if [ -f /www/logs.txt ]; then @@ -227,12 +241,15 @@ while true; do read choice case $choice in 1) - debug + setip ;; 2) - catwrt_update + debug ;; 3) + catwrt_update + ;; + 4) use_repo ;; 0)