]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/install+setup/install/probenic.sh
Replace kudzu at probenic.sh to detect virtio and ssb nics
[people/pmueller/ipfire-2.x.git] / src / install+setup / install / probenic.sh
CommitLineData
9607771a 1#!/bin/sh
70df8302
MT
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
9607771a 21
45625e98
AF
22if [ -e /var/ipfire/ethernet/scanned_nics ]; then
23 rm -f /var/ipfire/ethernet/scanned_nics
24fi
25touch /var/ipfire/ethernet/scanned_nics
26
27for card in `ls /sys/class/net`; do
28
29 #Check if this is an Ethernet device (type=1)
30 if [ `cat /sys/class/net/$card/type` == "1" ]; then
31 hwaddr=`cat /sys/class/net/$card/address`
32
33 #Check if mac is valid (not 00:00... or FF:FF...)
34 if [ ! "$hwaddr" == "00:00:00:00:00:00" ];then
35 if [ ! "$hwaddr" == "ff:ff:ff:ff:ff:ff" ];then
36
37 driver=`grep PHYSDEVDRIVER= /sys/class/net/$card/uevent | cut -d"=" -f2`
38 type=`grep PHYSDEVBUS= /sys/class/net/$card/uevent | cut -d"=" -f2`
39 description=`echo $type: $driver`
40
41 #Get more details for pci and usb devices
42 if [ "$type" == "pci" ]; then
43 slotname=`grep PCI_SLOT_NAME= /sys/class/net/$card/device/uevent | cut -d"=" -f2`
44 name=`lspci -s $slotname | cut -d':' -f3`
45 description=`echo $type:$name`
46 fi
47 if [ "$type" == "usb" ]; then
48 bus=`grep DEVICE= /sys/class/net/$card/device/uevent | cut -d"/" -f5`
49 dev=`grep DEVICE= /sys/class/net/$card/device/uevent | cut -d"/" -f6`
50 #work around the base8 convert
51 let bus=`echo 1$bus`-1000
52 let dev=`echo 1$dev`-1000
53 name=`lsusb -s $bus:$dev | cut -d':' -f3`
54 description=`echo $type: $name`
55 fi
56
57 echo desc: \"$description\" >>/var/ipfire/ethernet/scanned_nics
58 echo driver: $driver >>/var/ipfire/ethernet/scanned_nics
59 echo network.hwaddr: $hwaddr >>/var/ipfire/ethernet/scanned_nics
60 fi
61 fi
62 fi
63done
51f3b7f5 64
79ef49bd
AF
65# Revert Accesspoint marking at mac address
66sed -i 's|hwaddr: 06:|hwaddr: 00:|g' /var/ipfire/ethernet/scanned_nics
67
59de0b00 68exit 0