38 lines
661 B
Bash
Executable File
38 lines
661 B
Bash
Executable File
#!/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
|