base-files: move network related scripts to a separate package to make the transition...
[openwrt.git] / package / base-files-network / files / sbin / ifup
1 #!/bin/sh
2 # Copyright (C) 2006-2011 OpenWrt.org
3
4 /sbin/ifdown "$@"
5
6 . /etc/functions.sh
7 [ $# = 0 ] && { echo " $0 <group>"; exit; }
8
9 setup_wifi=1
10
11 case "$1" in
12 "-a")
13 [ -e "/tmp/resolv.conf.auto" ] && rm /tmp/resolv.conf.auto
14 config_cb() {
15 [ interface != "$1" -o -z "$2" ] || eval "$0 -w $2"
16 }
17 config_load network
18 exit 0
19 ;;
20 "-w") setup_wifi=0; shift ;;
21 esac
22
23 if [ $setup_wifi -gt 0 ] && grep -q config /etc/config/wireless; then
24 find_related_radios() {
25 local wdev wnet
26 config_get wdev "$1" device
27 config_get wnet "$1" network
28
29 if [ -n "$wdev" ] && [ "$wnet" = "$network" ]; then
30 append radio_devs "$wdev" "$N"
31 fi
32 }
33
34 local radio_devs
35 local network="$1"
36 config_load wireless
37 config_foreach find_related_radios wifi-iface
38
39 local dev
40 for dev in $(echo "$radio_devs" | sort -u); do
41 /sbin/wifi up "$dev"
42 done
43 fi
44
45 include /lib/network
46 scan_interfaces
47
48 config_get ifname "$1" device
49 for dev in ${ifname:-$1}; do
50 setup_interface "$dev" "$1"
51 done
This page took 0.04556 seconds and 5 git commands to generate.