mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-09 23:34:51 +01:00
netmode: fallback to checking usr_data if /opconf/opconf.json is not available
This commit is contained in:
parent
59e7ece054
commit
a0c1801511
1 changed files with 5 additions and 2 deletions
|
|
@ -5,15 +5,18 @@ if [ "$enabled" != "1" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
opconf_file="/opconf/opconf.json"
|
||||
[ -f $opconf_file ] || opconf_file="/usr_data/opconf/opconf.json"
|
||||
|
||||
# Check if netmode getting provisioned from opconf, in case of opconf
|
||||
# provisioning, mode setting not required
|
||||
mode="$(jsonfilter -i /opconf/opconf.json -e @.netmode.mode 2>/dev/null)"
|
||||
mode="$(jsonfilter -i $opconf_file -e @.netmode.mode 2>/dev/null)"
|
||||
if [ -n "${mode}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if opconf has wan provisioning enabled, if yes, get the proto/mode from opconf
|
||||
proto="$(jsonfilter -i /usr_data/opconf/opconf.json -e '@.network.wan[@.name="wan"].proto' 2>/dev/null)"
|
||||
proto="$(jsonfilter -i $opconf_file -e '@.network.wan[@.name="wan"].proto' 2>/dev/null)"
|
||||
if [ -n "${proto}" ]; then
|
||||
mode="routed-${proto}"
|
||||
uci -q set netmode.global.mode="${mode}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue