#!/bin/bash

# Script to collect hardware information

# Copyright (C) 2003-2006 IBM
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

echo "Hardware Information for `hostname` at `date`."
if [ "$UID" -ne 0 ]; then
	echo "You are not running as root.  Hardware data may be restricted."
fi
echo
echo "dmesg output:"
echo "============="
dmesg
echo
echo "/proc/cmdline:"
echo "=============="
cat /proc/cmdline
echo
echo "CPU Information:"
echo "================"
cat /proc/cpuinfo
echo
echo "DMI Table Dump:"
echo "==============="
dmidecode
echo
echo "Registered Devices:"
echo "==================="
cat /proc/devices
echo
echo "Registered DMA Channels:"
echo "========================"
cat /proc/dma
echo
echo "Registered Interrupts:"
echo "======================"
cat /proc/interrupts
echo
echo "IO Memory:"
echo "=========="
cat /proc/iomem
echo
echo "IO Ports:"
echo "========="
cat /proc/ioports
echo
echo "PCI Device Tree via lspci:"
echo "=========================="
lspci -v
echo
echo "IDE Device/Driver Info:"
echo "======================="
find /proc/ide -type f | while read f; do echo $f; cat $f; done;
echo
echo "SCSI Device/Driver Info:"
echo "========================"
find /proc/scsi -type f | while read f; do echo $f; cat $f; done;
echo
echo "Network Devices:"
echo "================"
ifconfig -a
echo
echo "Partition Layout:"
echo "================="
fdisk -l /dev/sd[a-z] /dev/hd[a-z]
echo
echo "sysfs Device Info:"
echo "=================="
find /sys -mount -type f | while read f; do echo $f: `cat $f`; done

exit 0