feat: 增加第一启动脚本, 用于修改默认ip地址.

This commit is contained in:
Olia Lisa
2026-07-13 13:41:28 +08:00
parent 788cf4433a
commit 69f9855b95
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
# 仅在首次启动时执行(/etc/uci-defaults机制)
# 修改 LAN 口 IP 地址
update_lan_ip(){
local NEW_LAN_IP="$1"
# 检查 network 配置是否存在
if [ -f /etc/config/network ]; then
# 检查 lan 接口是否存在
if uci get network.lan >/dev/null 2>&1; then
# 修改 LAN IP
uci set network.lan.ipaddr="${NEW_LAN_IP}/24"
# 保存配置
uci commit network
fi
fi
# 重启网络服务
if [ -x /etc/init.d/network ]; then
/etc/init.d/network restart
fi
}
# 启用 LAN IP 修改
# update_lan_ip "192.168.50.100"
exit 0