[arch-releng] Basic Hardware detect for Profiles

Jud jud at judfilm.net
Thu Apr 2 21:25:45 EDT 2009

# Proof of Concept
# Relate hardware to vendors specs aka as people know it
# Try to use minimal dependencies

# MAC address' - can return multiples
mac=$(ifconfig -a | awk '/^eth/ {print $NF}')
mac2=$(ifconfig -a | awk '/^wlan/ {print $NF}')
echo $mac $mac2

# System Architecture
uname -m

# CPU Brand, Number of Processors, Flags
#cat /proc/cpuinfo
cpu=$(cat /proc/cpuinfo | awk '/^vendor_id/ {print $3}')
cpu2=$(cat /proc/cpuinfo | awk '/^processor/ {print $3+1}')
# todo:sockets physical on board ie 2 for dual socket even if only 1
cpu populated
cpu3=$(cat /proc/cpuinfo | grep flags | awk ' { for (i=3;
i<=NF; i++) printf("%s ", $i) }')
cpu4=$(cat /proc/cpuinfo | grep MHz |
awk '/^cpu/ {printf ("%5.2f",$NF/1000)}') # todo: stepping, family
echo $cpu $cpu2 $cpu3 $cpu4

# Mainboard Model Number - need a much better way
#lshw dmidecode
mb=$(dmesg | grep RSDT | awk '/^ACPI/ {print $6, $7}')
#mb2=$(dmesg | grep RSDT)
echo $mb

# Total RAM
mem=$(cat /proc/meminfo | awk '/^MemTotal/ {printf
echo $mem

# Hard Disk Capacity - Only as root , any ideas for a user?
hdd=$(fdisk -l | grep /dev/sda | awk '/^Disk/ {print $3}')
echo $hdd

# Video Card Vendor/Type
#vga=$(lspci | awk '/^VGA/ {print $1:$NF}')
vga=$(lspci | grep VGA)
echo $vga

# VirtualMachines - how do I know if running?


# End of File

More information about the arch-releng mailing list