Root/package/netifd/files/sbin/ifup

1#!/bin/sh
2
3case "$0" in
4    *ifdown) modes=down;;
5    *ifup) modes="down up";;
6    *) echo "Invalid command: $0";;
7esac
8
9if_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
24ubus -S list "network.interface.$1" > /dev/null || {
25    echo "Interface $1 not found"
26    exit
27}
28if_call "network.interface.$1"
29

Archive Download this file



interactive