tunneldigger-broker: update lib functions
authorPerry Melange <isprotejesvalkata@gmail.com>
Sat, 29 Jul 2023 19:35:46 +0000 (21:35 +0200)
committerNick Hainke <vincent@systemli.org>
Sun, 20 Aug 2023 00:25:27 +0000 (02:25 +0200)
Use config_foreach instead of config_cb

Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
net/tunneldigger-broker/files/tunneldigger.sh

index 68b323f3143d16fa4555481dba574ff388c16bbc..3c7b8fff84f5e2ab0ec907fa83b1eac9fc1fc295 100644 (file)
@@ -11,12 +11,8 @@ tunneldigger_get_bridge() {
        # Discover the configured bridge.
        unset _td_bridge
        _td_bridge=""
-       config_cb() {
-               local cfg="$CONFIG_SECTION"
-               config_get configname "$cfg" TYPE
-               if [ "$configname" != "bridge" ]; then
-                       return
-               fi
+       handle_bridge() {
+               local cfg="$1"
 
                config_get cfg_mtu "$cfg" mtu
                config_get interface "$cfg" interface
@@ -29,11 +25,12 @@ tunneldigger_get_bridge() {
        }
 
        config_load tunneldigger-broker
-       reset_cb
+       config_foreach handle_bridge bridge $mtu
        if [ -z "$_td_bridge" ]; then
                return
        fi
 
-       eval $variable=$_td_bridge
-       # network_get_device $variable $_td_bridge
+       variable="$_td_bridge"
+       export ${NO_EXPORT:+-n} "$1=$variable"
 }
+