Article

coolguys's picture

Adding more Addon Image files based on PC Configuration

Author Info

25 May 2006 - 11:00pm
Submitted by: coolguys

article
Reads:

6040

Score:
0
0
 
Comments:

0

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
     fi

To 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
     fi

To 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"
        ;;
     
     esac

To 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}'` 

Author Info

25 May 2006 - 11:00pm
Submitted by: coolguys




User Comments

© 2009 Novell, Inc. All Rights Reserved.