diff options
author | Manuel Munz <munz@comuno.net> | 2016-01-04 22:34:55 +0100 |
---|---|---|
committer | Manuel Munz <munz@comuno.net> | 2016-01-04 22:34:55 +0100 |
commit | 71dc54af6affa1a0f9b26f5fbe2fe874f2791630 (patch) | |
tree | 5d763987e3c3c23922d89831f83dd1e3d6027d63 /contrib | |
parent | ed7e17438a4919efd4f73b09dc76c9143a8ab2ed (diff) |
a cleaner solution for disabling dyngw and dyngw_plain in freifunk-policyrouting init
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting b/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting index 05a75407d..4c9172427 100755 --- a/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting +++ b/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting @@ -51,22 +51,33 @@ rt_tables() { } -disable_dyngw() { - for cfg in $cfgs; do - local dyngwlib=`uci show $cfg |grep dyn_gw.so |awk {' FS="."; print $1"."$2 '}` - if [ -n "$dyngwlib" ]; then - uci set $dyngwlib.ignore=1 - uci commit $cfg - fi - - dyngwplainlib=`uci show $cfg |grep dyn_gw_plain |awk {' FS="."; print $1"."$2 '}` - if [ -n "$dyngwplainlib" ]; then - rttable="$(uci -q get $dyngwplainlib.RtTable)" - if [ -z "$rttable" ] || [ "$rttable" = "254" ]; then - uci set $dyngwplainlib.ignore=1 - uci commit $cfg +handle_disable_dyngw() { + local cfg="$1" + local olsrd_cfg="$2" + config_get library "$cfg" library + case "$library" in + olsrd_dyn_gw_plain*) + config_get RtTable "$cfg" RtTable + if [ -z "$RtTable" ] || [ "$RtTable" = "254" ]; then + config_set "$cfg" ignore '1' + uci set $olsrd_cfg.$cfg.ignore="1" + uci commit $olsrd_cfg + logger -s -t policyrouting -p info "dyngw_plain plugin disabled." fi - fi + ;; + olsrd_dyn_gw.so*) + logger -s -t policyrouting -p info "$cfg" + uci set $olsrd_cfg.$cfg.ignore="1" + uci commit $olsrd_cfg + logger -s -t policyrouting -p info "dyngw plugin disabled." + ;; + esac +} + +disable_dyngw() { + for olsrd_cfg in $cfgs; do + config_load $olsrd_cfg + config_foreach handle_disable_dyngw LoadPlugin $olsrd_cfg done } |