net/mwan3: pass environment variables to mwan3-user
authorFlorian Eckert <redacted>
Tue, 21 Mar 2017 07:31:03 +0000 (08:31 +0100)
committerFlorian Eckert <redacted>
Tue, 21 Mar 2017 07:31:06 +0000 (08:31 +0100)
User scripts conversion from luci-app-wan3 will be simplified if the variables
are passed by env instead of arguments.

Signed-off-by: Florian Eckert <redacted>
net/mwan3/files/etc/hotplug.d/iface/16-mwan3-user
net/mwan3/files/etc/mwan3.user

index d472087917bb4b0c66946e1216b996221e3559e0..485f8de4e96f67aeefea72378912584848a22e69 100644 (file)
@@ -4,9 +4,10 @@
        . /lib/functions.sh
 
        config_load mwan3
-       config_get enabled $INTERFACE enabled 0
+       config_get enabled "$INTERFACE" enabled 0
        [ "${enabled}" = "1" ] || exit 0
-       /bin/sh /etc/mwan3.user $ACTION $INTERFACE $DEVICE
+       env -i ACTION="$ACTION" INTERFACE="$INTERFACE" DEVICE="$DEVICE" \
+               /bin/sh /etc/mwan3.user
 }
 
 exit 0
index d1c5349c9c2bd494ff86d2074a4267781e395a1e..3c1f9fb7a871f406d40a30048e3447cccb436449 100644 (file)
@@ -5,7 +5,8 @@
 # be executed with each netifd hotplug interface event
 # on interfaces for which mwan3 is enabled.
 #
-# Parameter values from hotplug.d
-# $1 = ACTION (ifup/ifdown)
-# $2 = INTERFACE (wan/lan/...)
-# $3 = DEVICE (eth0/wwan0/...)
+# There are three main environment variables that are passed to this script.
+#
+# $ACTION      Either "ifup" or "ifdown"
+# $INTERFACE   Name of the interface which went up or down (e.g. "wan" or "wwan")
+# $DEVICE      Physical device name which interface went up or down (e.g. "eth0" or "wwan0")
git clone https://git.99rst.org/PROJECT