default-settings: fix override user settings

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
(cherry picked from commit c90db07cf9c325df5e1855681e9b7729e24ab090)
This commit is contained in:
Tianling Shen 2023-07-06 01:12:57 +08:00
parent 3267c28531
commit de6c207899
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
4 changed files with 55 additions and 37 deletions

View File

@ -1,28 +1,31 @@
#!/bin/sh
uci set luci.main.lang=auto
uci commit luci
uci -q get system.@imm_init[0] > "/dev/null" || uci -q add system imm_init > "/dev/null"
uci set fstab.@global[0].anon_mount=1
uci commit fstab
if ! uci -q get system.@imm_init[0].lang > "/dev/null"; then
uci -q set luci.main.lang="auto"
uci -q commit luci
rm -f /www/luci-static/resources/view/status/include/50_dsl.js
rm -f /www/luci-static/resources/view/status/include/70_ddns.js
rm -f /www/luci-static/resources/view/status/include/80_minidlna.js
rm -f /www/luci-static/resources/view/status/include/80_upnp.js
uci -q set system.@imm_init[0].lang="1"
uci -q commit system
fi
ln -sf /sbin/ip /usr/bin/ip
if ! uci -q get system.@imm_init[0].anon_mount > "/dev/null"; then
uci -q set fstab.@global[0].anon_mount="1"
uci -q commit fstab
[ -f '/bin/bash' ] && sed -i 's|root:x:0:0:root:/root:/bin/ash|root:x:0:0:root:/root:/bin/bash|g' /etc/passwd
uci -q set system.@imm_init[0].anon_mount="1"
uci -q commit system
fi
sed -i '/option disabled/d' /etc/config/wireless
sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
wifi up
ln -sf "/sbin/ip" "/usr/bin/ip"
sed -i '/log-facility/d' /etc/dnsmasq.conf
echo 'log-facility=/dev/null' >> /etc/dnsmasq.conf
[ ! -e "/bin/bash" ] || sed -i "s|root:x:0:0:root:/root:/bin/ash|root:x:0:0:root:/root:/bin/bash|g" "/etc/passwd"
rm -rf /tmp/luci-modulecache/
rm -f /tmp/luci-indexcache
sed -i "/log-facility/d" "/etc/dnsmasq.conf"
echo "log-facility=/dev/null" >> "/etc/dnsmasq.conf"
rm -rf "/tmp/luci-modulecache"
rm -f "/tmp/luci-indexcache"
exit 0

View File

@ -1,17 +1,23 @@
#!/bin/sh
uci -q batch <<-EOF
set system.@system[0].timezone='CST-8'
set system.@system[0].zonename='Asia/Shanghai'
uci -q get system.@imm_init[0] > "/dev/null" || uci -q add system imm_init > "/dev/null"
delete system.ntp.server
add_list system.ntp.server='ntp.tencent.com'
add_list system.ntp.server='ntp1.aliyun.com'
add_list system.ntp.server='ntp.ntsc.ac.cn'
add_list system.ntp.server='cn.ntp.org.cn'
EOF
uci commit system
if ! uci -q get system.@imm_init[0].system_chn > "/dev/null"; then
uci -q batch <<-EOF
set system.@system[0].timezone="CST-8"
set system.@system[0].zonename="Asia/Shanghai"
sed -i 's,downloads.immortalwrt.org,mirrors.vsean.net/openwrt,g' /etc/opkg/distfeeds.conf
delete system.ntp.server
add_list system.ntp.server="ntp.tencent.com"
add_list system.ntp.server="ntp1.aliyun.com"
add_list system.ntp.server="ntp.ntsc.ac.cn"
add_list system.ntp.server="cn.ntp.org.cn"
set system.@imm_init[0].system_chn="1"
commit system
EOF
fi
sed -i.bak "s,downloads.immortalwrt.org,mirrors.vsean.net/openwrt,g" "/etc/opkg/distfeeds.conf"
exit 0

View File

@ -1,12 +1,15 @@
#!/bin/sh
. /lib/functions.sh
if [ "$ACTION" != "ifup" ]; then
exit
fi
config_load network
config_get tunnelid $INTERFACE tunnelid
config_get username $INTERFACE username
config_get password $INTERFACE password
config_get tunnelid "$INTERFACE" tunnelid
config_get username "$INTERFACE" username
config_get password "$INTERFACE" password
if [ "$tunnelid" != "" ]; then
wget -O - https://$username:$password@ipv4.tunnelbroker.net/nic/update?hostname=$tunnelid --no-check-certificate
wget -O - "https://$username:$password@ipv4.tunnelbroker.net/nic/update?hostname=$tunnelid"
fi

View File

@ -1,9 +1,15 @@
#!/bin/sh
uci set dhcp.lan.ra='hybrid'
uci set dhcp.lan.ndp='hybrid'
uci set dhcp.lan.dhcpv6='hybrid'
uci set dhcp.lan.ra_management='1'
uci commit dhcp
uci -q get system.@imm_init[0] > "/dev/null" || uci -q add system imm_init > "/dev/null"
uci -q get system.@imm_init[0].ipv6 > "/dev/null" && exit 0
uci -q set dhcp.lan.ra="hybrid"
uci -q set dhcp.lan.ndp="hybrid"
uci -q set dhcp.lan.dhcpv6="hybrid"
uci -q set dhcp.lan.ra_management="1"
uci -q commit dhcp
uci -q set system.@imm_init[0].ipv6="1"
uci -q commit system
exit 0