#!/bin/sh -e
#
# Report the detected HW

LSPCI=/sbin/lspci
if [ -x /usr/bin/lspci ] ; then
    LSPCI=/usr/bin/lspci # This is the location in Sarge [2005-01-30]
fi

if [ -x $LSPCI ] ; then
	(
		$LSPCI -v -t || true
		$LSPCI -n || true
		$LSPCI -v || true
		echo "For use with 'lspci -F':"
		$LSPCI -x || true
	)| sed "s%^%info: $0: lspci: %"
else
	echo "error: $0: Unable to find $LSPCI"
fi

if [ -x /sbin/lsmod ] ; then
	/sbin/lsmod | sed "s%^%info: $0: lsmod: %"
else
	echo "error: $0: Unable to find /sbin/lsmod"
fi

for file in cpuinfo ioports iomem interrupts meminfo ; do
	if [ -e /proc/$file ] ; then
		cat /proc/$file | sed "s%^%info: $0: $file: %"
	else
		echo "error: $0: Unable to find /proc/$file"
	fi
done

disks=`cat /proc/partitions|egrep 'ide|scsi'|awk '{print $4}'|grep '/disc'|sed 's%^%/dev/%'`
for disk in $disks ; do
	/sbin/hdparm -i $disk 2>&1 |  sed "s%^%info: $0: hdparm: %"
done

if [ -x /usr/sbin/dmidecode ] ; then
    /usr/sbin/dmidecode | sed "s%^%info: $0: dmidecode: %"
else
    echo "error: $0: Unable to find /usr/sbin/dmidecode"
fi

if [ -x /usr/sbin/ddcprobe ] ; then
    ddcprobe | sed "s%^%info: $0: ddcprobe: %"
elif [ -x /usr/bin/ddccontrol ] ; then
    ddccontrol -c -p | sed "s%^%info: $0: ddccontrol: %"
else
    echo "error: $0: Unable to find /usr/sbin/ddcprobe and /usr/bin/ddccontrol"
fi

isenkram-lookup | sed "s%^%info: $0: isenkram-lookup: %"
isenkram-autoinstall-firmware -l | sed "s%^%info: $0: isenkram-autoinstall-firmware: %"
