netifd: always issue a reload on ifup, not just for -a
[openwrt/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 [ "$modes" = "down up" ] && ubus call network reload
17 [[ "$1" == "-a" ]] && {
18 for interface in `ubus -S list 'network.interface.*'`; do
19 if_call "$interface"
20 done
21 exit
22 }
23
24 ubus -S list "network.interface.$1" > /dev/null || {
25 echo "Interface $1 not found"
26 exit
27 }
28 if_call "network.interface.$1"