add an initial (experimental) version of netifd, disabled by default
[openwrt.git] / package / netifd / files / sbin / ifup
1 #!/bin/sh
2
3 case "$0" in
4         *ifdown) modes=down;;
5         *ifup) modes="down up";;
6         *) echo "Invalid command: $0";;
7 esac
8
9 if_call() {
10         local interface="$1"
11         for mode in $modes; do
12                 ubus call $interface $mode
13         done
14 }
15
16 [[ "$1" == "-a" ]] && {
17         for interface in `ubus -S list 'network.interface.*'`; do
18                 if_call "$interface"
19         done
20         exit
21 }
22
23 ubus -S list "network.interface.$1" > /dev/null || {
24         echo "Interface $1 not found"
25         exit
26 }
27 if_call "network.interface.$1"