From 45625e98e3ed22ea99b59e5456972999d78ed31c Mon Sep 17 00:00:00 2001 From: Arne Fitzenreiter Date: Wed, 30 Sep 2009 18:47:34 +0200 Subject: [PATCH] Replace kudzu at probenic.sh to detect virtio and ssb nics --- config/rootfiles/core/32/filelists/files | 1 + src/install+setup/install/probenic.sh | 43 +++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/config/rootfiles/core/32/filelists/files b/config/rootfiles/core/32/filelists/files index a0aa907319..371330e696 100644 --- a/config/rootfiles/core/32/filelists/files +++ b/config/rootfiles/core/32/filelists/files @@ -1,4 +1,5 @@ etc/system-release +bin/probenic.sh etc/rc.d/init.d/networking/red opt/pakfire/lib/functions.pl srv/web/ipfire/cgi-bin/ids.cgi diff --git a/src/install+setup/install/probenic.sh b/src/install+setup/install/probenic.sh index 296eb7c6a3..fcec6bd23b 100644 --- a/src/install+setup/install/probenic.sh +++ b/src/install+setup/install/probenic.sh @@ -19,7 +19,48 @@ # # ############################################################################### -kudzu -qps -c NETWORK | egrep "desc|network.hwaddr|driver" > /var/ipfire/ethernet/scanned_nics 2>/dev/null +if [ -e /var/ipfire/ethernet/scanned_nics ]; then + rm -f /var/ipfire/ethernet/scanned_nics +fi +touch /var/ipfire/ethernet/scanned_nics + +for card in `ls /sys/class/net`; do + + #Check if this is an Ethernet device (type=1) + if [ `cat /sys/class/net/$card/type` == "1" ]; then + hwaddr=`cat /sys/class/net/$card/address` + + #Check if mac is valid (not 00:00... or FF:FF...) + if [ ! "$hwaddr" == "00:00:00:00:00:00" ];then + if [ ! "$hwaddr" == "ff:ff:ff:ff:ff:ff" ];then + + driver=`grep PHYSDEVDRIVER= /sys/class/net/$card/uevent | cut -d"=" -f2` + type=`grep PHYSDEVBUS= /sys/class/net/$card/uevent | cut -d"=" -f2` + description=`echo $type: $driver` + + #Get more details for pci and usb devices + if [ "$type" == "pci" ]; then + slotname=`grep PCI_SLOT_NAME= /sys/class/net/$card/device/uevent | cut -d"=" -f2` + name=`lspci -s $slotname | cut -d':' -f3` + description=`echo $type:$name` + fi + if [ "$type" == "usb" ]; then + bus=`grep DEVICE= /sys/class/net/$card/device/uevent | cut -d"/" -f5` + dev=`grep DEVICE= /sys/class/net/$card/device/uevent | cut -d"/" -f6` + #work around the base8 convert + let bus=`echo 1$bus`-1000 + let dev=`echo 1$dev`-1000 + name=`lsusb -s $bus:$dev | cut -d':' -f3` + description=`echo $type: $name` + fi + + echo desc: \"$description\" >>/var/ipfire/ethernet/scanned_nics + echo driver: $driver >>/var/ipfire/ethernet/scanned_nics + echo network.hwaddr: $hwaddr >>/var/ipfire/ethernet/scanned_nics + fi + fi + fi +done # Revert Accesspoint marking at mac address sed -i 's|hwaddr: 06:|hwaddr: 00:|g' /var/ipfire/ethernet/scanned_nics -- 2.39.2