ncurses: Fix path in ncursesw.pc
[librecmc/librecmc.git] / package / network / config / netifd / files / sbin / ifup
1 #!/bin/sh
2
3 ifup_all=
4
5 if_call() {
6         local interface="$1"
7         for mode in $modes; do
8                 ubus call network.interface $mode "{ \"interface\" : \"$interface\" }"
9         done
10 }
11
12 case "$0" in
13         *ifdown) modes=down;;
14         *ifup)
15                 modes="down up"
16         ;;
17         *) echo "Invalid command: $0";;
18 esac
19
20 while :; do
21         case "$1" in
22                 -a)
23                         ifup_all=1
24                         shift
25                 ;;
26                 *)
27                         break
28                 ;;
29         esac
30 done
31
32 [ "$modes" = "down up" ] && ubus call network reload
33 if [ -n "$ifup_all" ]; then
34         for interface in $(ubus -S list 'network.interface.*'); do
35                 if_call "${interface##network.interface.}"
36         done
37         exit
38 else
39         ubus -S list "network.interface.$1" > /dev/null || {
40                 echo "Interface $1 not found"
41                 exit
42         }
43         if_call "$1"
44 fi