diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-20 15:01:06 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-20 15:01:06 +0000 |
commit | c2b5767572c7cece21f7739e416d59458278b7d8 (patch) | |
tree | bbb6d468090141c8fe0367f573272ec8289fa755 /package/base-files-network/files/sbin/ifup | |
parent | fce837994043793008be610cb24154d649c7b190 (diff) | |
download | upstream-c2b5767572c7cece21f7739e416d59458278b7d8.tar.gz upstream-c2b5767572c7cece21f7739e416d59458278b7d8.tar.bz2 upstream-c2b5767572c7cece21f7739e416d59458278b7d8.zip |
base-files: move network related scripts to a separate package to make the transition to netifd easier
SVN-Revision: 28495
Diffstat (limited to 'package/base-files-network/files/sbin/ifup')
-rwxr-xr-x | package/base-files-network/files/sbin/ifup | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/package/base-files-network/files/sbin/ifup b/package/base-files-network/files/sbin/ifup new file mode 100755 index 0000000000..5f8d80dc2d --- /dev/null +++ b/package/base-files-network/files/sbin/ifup @@ -0,0 +1,51 @@ +#!/bin/sh +# Copyright (C) 2006-2011 OpenWrt.org + +/sbin/ifdown "$@" + +. /etc/functions.sh +[ $# = 0 ] && { echo " $0 <group>"; exit; } + +setup_wifi=1 + +case "$1" in + "-a") + [ -e "/tmp/resolv.conf.auto" ] && rm /tmp/resolv.conf.auto + config_cb() { + [ interface != "$1" -o -z "$2" ] || eval "$0 -w $2" + } + config_load network + exit 0 + ;; + "-w") setup_wifi=0; shift ;; +esac + +if [ $setup_wifi -gt 0 ] && grep -q config /etc/config/wireless; then + find_related_radios() { + local wdev wnet + config_get wdev "$1" device + config_get wnet "$1" network + + if [ -n "$wdev" ] && [ "$wnet" = "$network" ]; then + append radio_devs "$wdev" "$N" + fi + } + + local radio_devs + local network="$1" + config_load wireless + config_foreach find_related_radios wifi-iface + + local dev + for dev in $(echo "$radio_devs" | sort -u); do + /sbin/wifi up "$dev" + done +fi + +include /lib/network +scan_interfaces + +config_get ifname "$1" device +for dev in ${ifname:-$1}; do + setup_interface "$dev" "$1" +done |