swconfig: support providing the switch device name in an option instead of the sectio...
[openwrt-10.03/.git] / package / swconfig / files / switch.sh
index 7078b2e823e3bf2e575b0ca85b7974a593606a31..18d5fbd2c3d58f356e6f9ceec86ebc2caf38b757 100644 (file)
@@ -2,8 +2,10 @@
 # Copyright (C) 2009 OpenWrt.org
 
 setup_switch_dev() {
-       ifconfig "$1" 0.0.0.0
-       swconfig dev "$1" load network
+       config_get name "$1" name
+       name="${name:-$1}"
+       [ -d "/sys/class/net/$name" ] && ifconfig "$name" up
+       swconfig dev "$name" load network
 }
 
 setup_switch() {