Article
6040
ENVIRONMENT: ZEN 7 Boot Environment
Ever wish you could add more Addon Image files based on the configuration of the PC? Here's how you do it. Using HWINFO and DMIDECODE you can determine hardware configuration using a scripted image.
(Note: dmidecode is available in my cool tool:
http://www.novell.com/coolsolutions/tools/17306.html
and referenced in my other Cool Solutions article. )
To determine if a CD-RW is present at imaging time, add the following lines in your imaging script:
CDRCOUNT=`hwinfo --cdrom | grep -i 'Features' | grep -ic 'CD-RW'`
if [ $CDRCOUNT -gt 0 ]; then
echo CD-RW software would be installed
fiTo determine if a DVD is present at imaging time, add the following lines in your imaging script:
DVDCOUNT=`hwinfo --cdrom | grep -i 'Features' | grep -ic 'DVD'`
if [ $DVDCOUNT -gt 0 ]; then
echo DVD player software would be installed
fiTo determine if the PC is a desktop or a laptop at imaging time, add the following lines to your script:
CLASS=`dmidecode -t chassis|grep -i -m1 'type:'|awk 'BEGIN {FS = ": "} {print $2}'`
case "$CLASS" in
"Other" )
CLASS="Other"
;;
"Unknown" )
CLASS="Unknown"
;;
"Desktop" )
CLASS="Desktop"
;;
"Low Profile Desktop" )
CLASS="Desktop"
;;
"Pizza Box" )
CLASS="Desktop"
;;
"Mini Tower" )
CLASS="Desktop"
;;
"Tower" )
CLASS="Desktop"
;;
"Portable" )
CLASS="Laptop"
;;
"Laptop" )
CLASS="Laptop"
;;
"Notebook" )
CLASS="Laptop"
;;
"Handheld" )
CLASS="Handheld"
;;
"Docking Station" )
CLASS="Laptop"
;;
"Sub-Notebook" )
CLASS="Laptop"
;;
"Space Saving" )
CLASS="Desktop"
;;
"Lunch Box" )
CLASS="Desktop"
;;
"Main System Chassis" )
CLASS="Desktop"
;;
"Expansion Chassis" )
CLASS="Desktop"
;;
"Sub-Chassis" )
CLASS="Desktop"
;;
"Bus Expansion Chassis" )
CLASS="Desktop"
;;
"Peripheral Chassis" )
CLASS="Desktop"
;;
"Storage Chassis" )
CLASS="Desktop"
;;
"Rack Mount Chassis" )
CLASS="Desktop"
;;
"Sealed-Case PC" )
CLASS="Desktop"
;;
* )
CLASS="Unknown"
;;
esacTo determine the PC Model at Imaging time, add the following line to your scripted image:
SYSTEMNAME=`dmidecode -s system-product-name|awk 'BEGIN {FS = " "} {print $1}'`





0