1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update openmptcprouter script and config to use device setting instead of ifname

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-06-25 19:48:43 +02:00
parent c5945ec683
commit ea3a4840c4
7 changed files with 33 additions and 31 deletions

View file

@ -1,24 +1,24 @@
#!/bin/sh
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
wanintf="$(uci -q get network.wan1.ifname)"
wanintf="$(uci -q get network.wan1.device)"
if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep $wanintf)" = "" ]; then
uci -q batch <<-EOF >/dev/null
delete vnstat.@vnstat[-1]
add vnstat vnstat
set vnstat.@vnstat[-1].interface=$wanintf
EOF
wanintf="$(uci -q get network.wan2.ifname)"
wanintf="$(uci -q get network.wan2.device)"
uci -q batch <<-EOF >/dev/null
add_list vnstat.@vnstat[-1].interface=$wanintf
EOF
if [ "$(uci -q get network.wan3)" != "" ]; then
wanintf="$(uci -q get network.wan3.ifname)"
wanintf="$(uci -q get network.wan3.device)"
uci -q batch <<-EOF >/dev/null
add_list vnstat.@vnstat[-1].interface=$wanintf
EOF
fi
if [ "$(uci -q get network.wan4)" != "" ]; then
wanintf="$(uci -q get network.wan4.ifname)"
wanintf="$(uci -q get network.wan4.device)"
uci -q batch <<-EOF >/dev/null
add_list vnstat.@vnstat[-1].interface=$wanintf
EOF