1
0
Fork 0
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:
Ycarus 2019-01-27 07:57:24 +01:00
parent 5df9ee2856
commit f895376029
6 changed files with 199 additions and 192 deletions

View file

@ -1,7 +1,8 @@
#!/bin/sh
NBCPU=$(grep -c '^processor' /proc/cpuinfo | tr -d "\n")
if [ "$NBCPU" -gt 2 ]; then
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
NBCPU=$(grep -c '^processor' /proc/cpuinfo | tr -d "\n")
if [ "$NBCPU" -gt 2 ]; then
if [ "$(uci -q get shadowsocks-libev.hi3)" = "" ]; then
for c in $(seq 3 $NBCPU); do
uci -q batch <<-EOF >/dev/null
@ -21,9 +22,9 @@ if [ "$NBCPU" -gt 2 ]; then
EOF
done
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
set shadowsocks-libev.hi.timeout=600
commit shadowsocks-libev
@ -34,14 +35,14 @@ if [ "$(uci -q get shadowsocks-libev.hi.timeout)" != "600" ]; then
commit shadowsocks-libev
EOF
done
fi
if [ "$(uci -q get shadowsocks-libev.sss0.method)" != "chacha20" ]; then
fi
if [ "$(uci -q get shadowsocks-libev.sss0.method)" != "chacha20" ]; then
uci -q batch <<-EOF > /dev/null
set shadowsocks-libev.sss0.method=chacha20
commit shadowsocks-libev
EOF
fi
if [ "$(uci -q get shadowsocks-libev.hi.mode)" != "tcp" ]; then
fi
if [ "$(uci -q get shadowsocks-libev.hi.mode)" != "tcp" ]; then
uci -q batch <<-EOF > /dev/null
set shadowsocks-libev.hi.mode=tcp_and_udp
commit shadowsocks-libev
@ -52,7 +53,7 @@ if [ "$(uci -q get shadowsocks-libev.hi.mode)" != "tcp" ]; then
commit shadowsocks-libev
EOF
done
fi
fi
rm -f /tmp/luci-indexcache
exit 0

View file

@ -1,6 +1,6 @@
#!/bin/sh
if [ "$(uci -q get unbound.@unbound[0].listen_port | grep 5353)" = "" ]; then
if [ "$(uci -q openmptcprouter.latest_versions)" = "" ]; then
if [ "$(uci -q get unbound.@unbound[0].listen_port | grep 5353)" = "" ]; then
uci -q batch <<-EOF >/dev/null
set unbound.@unbound[-1].listen_port=5353
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"
commit unbound
EOF
fi
if [ "$(uci -q show dhcp | grep 127.0.0.1#5353)" = "" ]; then
fi
if [ "$(uci -q show dhcp | grep 127.0.0.1#5353)" = "" ]; then
uci -q batch <<-EOF >/dev/null
add_list dhcp.@dnsmasq[-1].server="127.0.0.1#5353"
commit dhcp
EOF
fi
fi
uci -q batch <<-EOF >/dev/null
set dhcp.@dnsmasq[-1].noresolv=1

View file

@ -1,6 +1,6 @@
#!/bin/sh
if [ "$(uci -q get qos.wan1)" = "" ]; then
if [ "$(uci -q openmptcprouter.latest_versions)" ]; then
if [ "$(uci -q get qos.wan1)" = "" ]; then
uci -q batch <<-EOF >/dev/null
delete qos.wan
set qos.wan1=interface
@ -45,6 +45,7 @@ if [ "$(uci -q get qos.wan1)" = "" ]; then
commit qos
EOF
fi
fi
fi
rm -f /tmp/luci-indexcache

View file

@ -1,7 +1,7 @@
#!/bin/sh
wanintf="$(uci -q get network.wan1.ifname)"
if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep $wanintf)" = "" ]; then
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
wanintf="$(uci -q get network.wan1.ifname)"
if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep $wanintf)" = "" ]; then
uci -q batch <<-EOF >/dev/null
delete vnstat.@vnstat[-1]
add vnstat vnstat
@ -26,6 +26,7 @@ if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep $wanintf)" = "" ]; then
uci -q batch <<-EOF >/dev/null
commit vnstat
EOF
fi
fi
rm -f /tmp/luci-indexcache
echo '0 */2 * * * /etc/init.d/vnstat_backup backup' > /etc/crontabs/root

View file

@ -1,10 +1,12 @@
#!/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
delete wireless.default_radio0
commit wireless
EOF
}
}
fi
exit 0

View file

@ -1,6 +1,6 @@
#!/bin/sh
if [ "$(uci -q get sqm.wan1)" = "" ]; then
if [ "$(uci -q openmptcprouter.latest_versions)" = "" ]; then
if [ "$(uci -q get sqm.wan1)" = "" ]; then
wan1="$(uci -q get network.wan1.ifname)"
wan2="$(uci -q get network.wan2.ifname)"
uci -q batch <<-EOF >/dev/null
@ -63,6 +63,7 @@ if [ "$(uci -q get sqm.wan1)" = "" ]; then
commit sqm
EOF
fi
fi
fi
rm -f /tmp/luci-indexcache