Update setup

This commit is contained in:
喵二
2024-07-01 19:40:10 +08:00
committed by GitHub
parent 7f87834df6
commit c689c08d00

View File

@@ -92,11 +92,20 @@ fi
# Setup # Setup
setip(){ setip(){
read -p "请输入 IP (默认为 $DEFAULT_IP): " input_ip DEFAULT_IP="192.168.1.4"
if [ -z $input_ip ]; then while true; do
read -p "Please enter the IP Addr and press Enter /// 请输入 IP (默认为 $DEFAULT_IP): " input_ip
if [ -z "$input_ip" ]; then
input_ip=$DEFAULT_IP input_ip=$DEFAULT_IP
fi fi
if echo "$input_ip" | grep -Eo '^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$' > /dev/null; then
break
else
echo "Invalid IP address format /// 非法的 IP 地址格式,请重新输入"
fi
done
uci set network.lan.ipaddr=$input_ip uci set network.lan.ipaddr=$input_ip
uci commit network uci commit network
/etc/init.d/network restart /etc/init.d/network restart