mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Apply config again only for very old config or needed settings
This commit is contained in:
parent
5df9ee2856
commit
f895376029
6 changed files with 199 additions and 192 deletions
|
@ -1,7 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
NBCPU=$(grep -c '^processor' /proc/cpuinfo | tr -d "\n")
|
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
|
||||||
if [ "$NBCPU" -gt 2 ]; then
|
NBCPU=$(grep -c '^processor' /proc/cpuinfo | tr -d "\n")
|
||||||
|
if [ "$NBCPU" -gt 2 ]; then
|
||||||
if [ "$(uci -q get shadowsocks-libev.hi3)" = "" ]; then
|
if [ "$(uci -q get shadowsocks-libev.hi3)" = "" ]; then
|
||||||
for c in $(seq 3 $NBCPU); do
|
for c in $(seq 3 $NBCPU); do
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
@ -21,9 +22,9 @@ if [ "$NBCPU" -gt 2 ]; then
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(uci -q get shadowsocks-libev.hi.timeout)" != "600" ]; then
|
if [ "$(uci -q get shadowsocks-libev.hi.timeout)" != "600" ]; then
|
||||||
uci -q batch <<-EOF > /dev/null
|
uci -q batch <<-EOF > /dev/null
|
||||||
set shadowsocks-libev.hi.timeout=600
|
set shadowsocks-libev.hi.timeout=600
|
||||||
commit shadowsocks-libev
|
commit shadowsocks-libev
|
||||||
|
@ -34,14 +35,14 @@ if [ "$(uci -q get shadowsocks-libev.hi.timeout)" != "600" ]; then
|
||||||
commit shadowsocks-libev
|
commit shadowsocks-libev
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get shadowsocks-libev.sss0.method)" != "chacha20" ]; then
|
if [ "$(uci -q get shadowsocks-libev.sss0.method)" != "chacha20" ]; then
|
||||||
uci -q batch <<-EOF > /dev/null
|
uci -q batch <<-EOF > /dev/null
|
||||||
set shadowsocks-libev.sss0.method=chacha20
|
set shadowsocks-libev.sss0.method=chacha20
|
||||||
commit shadowsocks-libev
|
commit shadowsocks-libev
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get shadowsocks-libev.hi.mode)" != "tcp" ]; then
|
if [ "$(uci -q get shadowsocks-libev.hi.mode)" != "tcp" ]; then
|
||||||
uci -q batch <<-EOF > /dev/null
|
uci -q batch <<-EOF > /dev/null
|
||||||
set shadowsocks-libev.hi.mode=tcp_and_udp
|
set shadowsocks-libev.hi.mode=tcp_and_udp
|
||||||
commit shadowsocks-libev
|
commit shadowsocks-libev
|
||||||
|
@ -52,7 +53,7 @@ if [ "$(uci -q get shadowsocks-libev.hi.mode)" != "tcp" ]; then
|
||||||
commit shadowsocks-libev
|
commit shadowsocks-libev
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f /tmp/luci-indexcache
|
rm -f /tmp/luci-indexcache
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
if [ "$(uci -q openmptcprouter.latest_versions)" = "" ]; then
|
||||||
if [ "$(uci -q get unbound.@unbound[0].listen_port | grep 5353)" = "" ]; then
|
if [ "$(uci -q get unbound.@unbound[0].listen_port | grep 5353)" = "" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set unbound.@unbound[-1].listen_port=5353
|
set unbound.@unbound[-1].listen_port=5353
|
||||||
set unbound.@unbound[-1].protocol="ip4_only"
|
set unbound.@unbound[-1].protocol="ip4_only"
|
||||||
|
@ -8,12 +8,13 @@ if [ "$(uci -q get unbound.@unbound[0].listen_port | grep 5353)" = "" ]; then
|
||||||
set unbound.@unbound[-1].recursion="aggressive"
|
set unbound.@unbound[-1].recursion="aggressive"
|
||||||
commit unbound
|
commit unbound
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q show dhcp | grep 127.0.0.1#5353)" = "" ]; then
|
if [ "$(uci -q show dhcp | grep 127.0.0.1#5353)" = "" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
add_list dhcp.@dnsmasq[-1].server="127.0.0.1#5353"
|
add_list dhcp.@dnsmasq[-1].server="127.0.0.1#5353"
|
||||||
commit dhcp
|
commit dhcp
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set dhcp.@dnsmasq[-1].noresolv=1
|
set dhcp.@dnsmasq[-1].noresolv=1
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
if [ "$(uci -q openmptcprouter.latest_versions)" ]; then
|
||||||
if [ "$(uci -q get qos.wan1)" = "" ]; then
|
if [ "$(uci -q get qos.wan1)" = "" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
delete qos.wan
|
delete qos.wan
|
||||||
set qos.wan1=interface
|
set qos.wan1=interface
|
||||||
|
@ -45,6 +45,7 @@ if [ "$(uci -q get qos.wan1)" = "" ]; then
|
||||||
commit qos
|
commit qos
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f /tmp/luci-indexcache
|
rm -f /tmp/luci-indexcache
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
|
||||||
wanintf="$(uci -q get network.wan1.ifname)"
|
wanintf="$(uci -q get network.wan1.ifname)"
|
||||||
if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep $wanintf)" = "" ]; then
|
if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep $wanintf)" = "" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
delete vnstat.@vnstat[-1]
|
delete vnstat.@vnstat[-1]
|
||||||
add vnstat vnstat
|
add vnstat vnstat
|
||||||
|
@ -26,6 +26,7 @@ if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep $wanintf)" = "" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
commit vnstat
|
commit vnstat
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f /tmp/luci-indexcache
|
rm -f /tmp/luci-indexcache
|
||||||
echo '0 */2 * * * /etc/init.d/vnstat_backup backup' > /etc/crontabs/root
|
echo '0 */2 * * * /etc/init.d/vnstat_backup backup' > /etc/crontabs/root
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
uci -q show wireless.default_radio0 && {
|
if [ "$(uci -q openmptcprouter.latest_versions)" = "" ]; then
|
||||||
|
uci -q show wireless.default_radio0 && {
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
delete wireless.default_radio0
|
delete wireless.default_radio0
|
||||||
commit wireless
|
commit wireless
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
if [ "$(uci -q openmptcprouter.latest_versions)" = "" ]; then
|
||||||
if [ "$(uci -q get sqm.wan1)" = "" ]; then
|
if [ "$(uci -q get sqm.wan1)" = "" ]; then
|
||||||
wan1="$(uci -q get network.wan1.ifname)"
|
wan1="$(uci -q get network.wan1.ifname)"
|
||||||
wan2="$(uci -q get network.wan2.ifname)"
|
wan2="$(uci -q get network.wan2.ifname)"
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
@ -63,6 +63,7 @@ if [ "$(uci -q get sqm.wan1)" = "" ]; then
|
||||||
commit sqm
|
commit sqm
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f /tmp/luci-indexcache
|
rm -f /tmp/luci-indexcache
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue