add an example script for ifup/ifdown
authorFelix Fietkau <nbd@openwrt.org>
Sun, 27 Mar 2011 16:33:04 +0000 (18:33 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 27 Mar 2011 16:33:04 +0000 (18:33 +0200)
scripts/ifdown [new symlink]
scripts/ifup [new file with mode: 0755]

diff --git a/scripts/ifdown b/scripts/ifdown
new file mode 120000 (symlink)
index 0000000..a0e5c17
--- /dev/null
@@ -0,0 +1 @@
+ifup
\ No newline at end of file
diff --git a/scripts/ifup b/scripts/ifup
new file mode 100755 (executable)
index 0000000..b62054c
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+case "$0" in
+       *ifdown) mode=down;;
+       *ifup) mode=up;;
+       *) echo "Invalid command: $0";;
+esac
+
+[[ "$1" == "-a" ]] && {
+       for interface in `ubus -S list 'network.interface.*'`; do
+               ubus call $interface $mode
+       done
+       exit
+}
+
+ubus -S list "network.interface.$1" > /dev/null || {
+       echo "Interface $1 not found"
+       exit
+}
+ubus call "network.interface.$1" "$mode"