summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2013-06-19 10:07:55 -0500
committerWilliam Hubbs <williamh@gentoo.org>2013-06-19 10:17:38 -0500
commit104e9c65b1e1aadcb375debaa259589702fc08f3 (patch)
tree1b02e67acfeda5fc4806341f6ee7699464343c51
parentlivecd-functions.sh: do not hard code the paths to lspci or iwconfig (diff)
downloadlivecd-tools-104e9c65b1e1aadcb375debaa259589702fc08f3.tar.gz
livecd-tools-104e9c65b1e1aadcb375debaa259589702fc08f3.tar.bz2
livecd-tools-104e9c65b1e1aadcb375debaa259589702fc08f3.zip
autoconfig: update network device name recognission
The previous code assumed the old style network names such as eth* were the names of interfaces. With the new udev, this is not always the case, so this updates autoconfig to ignore lo and sit0 and assume that the rest are valid network interfaces. Also we now use /sys/class/net/* to detect interfaces instead of /proc/dev/net. Reported-by: alexeyk13@yandex.ru X-Gentoo-Bug: 471054 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=471054
-rwxr-xr-xinit.d/autoconfig13
1 files changed, 12 insertions, 1 deletions
diff --git a/init.d/autoconfig b/init.d/autoconfig
index 8f5c5db..10a60b7 100755
--- a/init.d/autoconfig
+++ b/init.d/autoconfig
@@ -375,6 +375,17 @@ detect_sparc() {
PC="Detected ${numcpu} active ${cpuinfo} CPU(s) of ${numprobed} total"
}
+detect_netdevices() {
+ for dev in /sys/class/net/*; do
+ n="$(basename $dev)"
+ case "$n" in
+ lo|sit0) continue ;;
+ *) echo $n
+ esac
+ done
+ return 0
+}
+
start() {
ebegin "Starting autoconfig"
echo "0" > /proc/sys/kernel/printk
@@ -501,7 +512,7 @@ start() {
if yesno "${DETECT}"
then
- NETDEVICES="$(awk -F: '/eth.:|tr.:|ath.:|wlan.:/{print $1}' /proc/net/dev 2>/dev/null)"
+ NETDEVICES="$(detect_netdevices)"
else
DHCP="no"
fi