#! /bin/bash

# display some information about the system and save it to the logserver


echo The defined classes are:
echo $classes
echo The classes are also saved in $LOGDIR/FAI_CLASSES

# now show hardware info

[ -x "$(which dmidecode)" ] && dmidecode
[ -x "$(which lshw)" ] && lshw -short

[ -x "$(which discover)" ] && {
    discover
    discover-modprobe -v
    discover --data-path=xfree86/server/device/driver display
    discover --data-path=linux/module/name network
}

[ -x "$(which hwinfo)" ] && hwinfo --short

lspci
lsdev
lsusb
echo "Ethernet cards found: $netdevices_all"
echo "Ethernet cards running: $netdevices_up"
ip addr show up

[ -x "$(which sfdisk)" ] && sfdisk -d

# show ide disk geometry
grep . /proc/ide/ide?/hd?/geometry /dev/null | sed -e 's#/proc/ide/ide./##' 2>/dev/null

[ -f /proc/scsi/scsi ] && cat /proc/scsi/scsi
cat /proc/partitions

[ -x "$(which blkid)" ] && blkid

for disk in $disklist; do
    smartctl -i /dev/$disk 
    hdparm -iv /dev/$disk
    fdisk -lu /dev/$disk
    parted -s /dev/$disk print
    LC_ALL=C file -s /dev/$disk?* | grep -v ": empty"
done

fdisk -lu
fai-mount-disk -f
lsmod
# - - - - - - - - - - -
save_dmesg
fai-savelog -r
