source: trunk/package/base-files-network/files/sbin/ifup @ 28495

Last change on this file since 28495 was 28495, checked in by nbd, 5 years ago

base-files: move network related scripts to a separate package to make the transition to netifd easier

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 978 bytes
Line 
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
9setup_wifi=1
10
11case "$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 ;;
21esac
22
23if [ $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
43fi
44
45include /lib/network
46scan_interfaces
47
48config_get ifname "$1" device
49for dev in ${ifname:-$1}; do
50        setup_interface "$dev" "$1"
51done
Note: See TracBrowser for help on using the repository browser.