#!/bin/sh ###################################################### # V.1.75 Dino Amato dino@brownnut.com # hardware inventory and detect script # # added the lspci command to the script for better # card reporting and added fall-back to proc if old # # feel free to use, any changes please send to me # to include in another version # GNU GENERAL PUBLIC LICENSE # tested on RedHat, SuSE and Debian so far. ####################################################### verbose= # show usage usage() { echo "usage: `basename $0` [-h]" echo " `basename $0` [-c|--clear][-v|--verbose][-h|--help]" echo " -c | clear's screen before displaying" echo " -v | verbose output" exit 0 } # parse options while [ $# -gt 0 ] ; do { [ ${1} = "-v" ] || [ ${1} = "--verbose" ] && { verbose=y; shift; continue } [ ${1} = "-c" ] || [ ${1} = "--clear" ] && { clear; shift; continue } usage } done [ $# -gt 0 ] && usage ################### # CPU Section ################### case `uname -m` in alpha) proc=`grep "^cpus" /proc/cpuinfo | cut -d: -f2` proc=`expr $proc + 1` echo "Total Processors: $proc" egrep -i "cpu (model|revision)|cycle" /proc/cpuinfo ;; *) count=`egrep -c ^processor /proc/cpuinfo` type=`egrep "model name" /proc/cpuinfo | cut -d: -f2 | uniq` speed=`egrep "cpu MHz" /proc/cpuinfo | cut -d: -f2 | cut -d. -f1 | uniq` cach=`egrep "cache size" /proc/cpuinfo | cut -d: -f2 | uniq` # echo "Total CPU's: $count" echo "$type $speed MHZ " | awk '{print""$0;}' echo "Cache Size: $cach" | awk '{print" "$0;}' # echo "Total CPU's: $count" # echo "$type $speed " # echo "Cache Size: $cach" ;; esac ################### # Mem Section ################### mem=`ls -l /proc/kcore | awk '{print int($5 / 1024 / 1024)}'` echo "Main Memory Size: $mem MB" echo ################## # IDE HD Section ################## do_hdr=y for host in 0 1 ; do { for chan in a b c d ; do { [ -r /proc/ide/ide${host}/hd${chan}/model ] && { [ ${do_hdr} ] && { echo; do_hdr= } echo "Host: ide${host} Channel: hd${chan}" read vendor model