The sample install_rhel4.sh script performs many hardware configuration tasks, including:
The scripting for these steps must be adapted to your server deployment process. In particular, be sure to change the IP address and path of the NFS server to match your environment. You might also need to make other modifications, such as adding extra configuration steps (for instance, running HPONCFG to configure iLO) or additional servers.
The sample install_rhel4.sh script is similar to the following:
#!/bin/bash
## this script's methods work for RHEL 5
## SAMPLE. Change the NFS mount points to match your environment
export NFS_TOOLKIT_DIR=10.0.0.1:/TOOLKIT
## Internal Variables, do not modify
export TOOLKIT=/TOOLKIT
export NFS_MAIN=/mnt/nfs
export HPDISCOVERY_FILE=/TOOLKIT/hpdiscovery.xml
export SERVERNAME=
export BOOTDEVNODE=
clear
echo "*** Performing RHEL4 installation ***"
echo "Mounting NFS share"
mkdir ${NFS_MAIN}
mount -t nfs ${NFS_TOOLKIT_DIR} ${NFS_MAIN} -o ro,nolock
if [ $? != 0 ]; then
echo "Unable to mount NFS share, make sure you updated the $0 script with the location of your NFS server."
exec /bin/bash
fi
echo "Copying over toolkit scripts and utilities from NFS share"
cd ${TOOLKIT}
cp -a ${NFS_MAIN}/scripts/* ${TOOLKIT}
cp -a ${NFS_MAIN}/utilities/* ${TOOLKIT}
cp -a ${NFS_MAIN}/data_files ${TOOLKIT}
echo ""
echo "Loading storage drivers for hardware"
./load_modules.sh
echo ""
echo "Pausing to allow drivers to finish loading"
sleep 15
echo ""
echo "Configure server"
## run hardware discovery
./hpdiscovery -f ${HPDISCOVERY_FILE}
## use hwquery to fetch the SystemName from hardware discovery file. ( extra " " are required )
export "`./hwquery ${HPDISCOVERY_FILE} allboards.xml SERVERNAME=SystemName`";
echo "Server Type: ${SERVERNAME}"
case "${SERVERNAME}" in
"ProLiant DL380 G4" )
# Apply System Configuration
./conrep -l -fdata_files/dl380g4_conrep.dat
# Apply Array Configuration for Smart Array 6i Controller if present
./ifhw ${HPDISCOVERY_FILE} allboards.xml "PCI:Smart Array 6i Controller" 2> /dev/null
if [ $? = 0 ] ; then
cd ${TOOLKIT}/hpacuscripting
./hpacuscripting -i ../data_files/dl380g4_sa6i_hpacuscripting.dat
fi
# Apply Array Configuration for Smart Array P600 Controller if present
./ifhw ${HPDISCOVERY_FILE} allboards.xml "PCI:Smart Array P600 Controller" 2> /dev/null
if [ $? = 0 ] ; then
cd ${TOOLKIT}/hpacuscripting
./hpacuscripting -i ../data_files/dl380g4_p600_hpacuscripting.dat
fi
## ADD EXTRA DL380 G4 Configuration Steps HERE
;;
"ProLiant BL45p G1" )
./conrep -l -fdata_files/bl45pg1_conrep.dat
# Apply Array Configuration for Smart Array 6i Controller if present
./ifhw ${HPDISCOVERY_FILE} allboards.xml "PCI:Smart Array 6i Controller" 2> /dev/null
if [ $? = 0 ] ; then
cd ${TOOLKIT}/hpacuscripting
./hpacuscripting -i ../data_files/bl45pg1_sa6i_hpacuscripting.dat
fi
## ADD EXTRA BL45p G1 Configuration Steps HERE
;;
"ProLiant ML310 G2" )
./conrep -l -fdata_files/ml310g2_conrep.dat
./ifhw ${HPDISCOVERY_FILE} allboards.xml "PCI:Intel(R) 6300ESB Ultra ATA Storage/SATA Controller"
if [ $? = 0 ] ; then
echo "Plain SATA found"
# Plain SATA, set BOOTDEVNODE manually since hardware discovery won't find IDE devices
export BOOTDEVNODE=/dev/hda
fi
## ADD EXTRA ProLiant ML310 G2 Configuration Steps HERE
;;
## ADD MORE SERVERS HERE
ProLiant* )
echo "No configuration process defined for this ProLiant server"
echo "Update $0 with steps for this ProLiant server"
exec /bin/bash
;;
* )
echo "Unrecognized Server"
exec /bin/bash
;;
esac
## CONTINUE COMMON INSTALL PROCESS
cd ${TOOLKIT}
echo "Pausing to allow drivers to catch up"
sleep 5
echo ""
echo "Rerun hardware discovery to find boot device"
./hpdiscovery -f ${HPDISCOVERY_FILE}
## use hwquery to fetch the boot dev node from hardware discovery file.
if [ -z ${BOOTDEVNODE} ]; then
export `./hwquery ${HPDISCOVERY_FILE} allboards.xml BOOTDEVNODE=DevNode`
fi
echo "Boot Device=${BOOTDEVNODE}"
if [ -z ${BOOTDEVNODE} ]; then
echo "MISSING boot device dev node. Check that the drivers are loaded."
exec /bin/bash
fi
ls -al ${BOOTDEVNODE}*
ln -s ${BOOTDEVNODE} /dev/sssd
echo "### Linux Unattended Install using Kickstart ###"
echo "clearing mbr and a few more sectors"
dd if=/dev/zero of=/dev/sssd bs=512 count=32
echo "forcing kernel to re-read partition table"
sfdisk --re-read /dev/sssd
sleep 5
echo "landing mbr"
dd if=${NFS_MAIN}/linux_unattend/generic.mbr of=/dev/sssd bs=512 count=1
echo "create new 256M FAT16 partition using sfdisk"
echo "0,256,6,*" | sfdisk -uM -D /dev/sssd
echo "forcing kernel to re-read partition table"
sfdisk --re-read /dev/sssd
sleep 5
## make symlink for first partition, usually sda1 or c0d0p1
if test -e ${BOOTDEVNODE}1 ; then
ln -s ${BOOTDEVNODE}1 /dev/sssd1
elif test -e ${BOOTDEVNODE}p1 ; then
ln -s ${BOOTDEVNODE}p1 /dev/sssd1
else
echo "Partition 1 missing, check that partition creation succeeded"
exec /bin/bash
fi
ls -al /dev/sssd1
cd ${NFS_MAIN}/linux_unattend/rhel4/
echo "landing diskboot.img from RHEL4-disc1/images/"
dd if=diskboot.img of=/dev/sssd1
## mount disk
echo "mounting to /mnt/dos"
mount -t vfat /dev/sssd1 /mnt/dos
##### MAKE SURE YOU MODIFY syslinux-rh.cfg FOR YOUR ENVIRONMENT #######
cp -a syslinux-rh.cfg /mnt/dos/syslinux.cfg
cd ${TOOLKIT}
## unmount disk
umount /mnt/dos
umount ${NFS_MAIN}
## unmount everything else
#umount -a
#echo "Rebooting"
#sleep 5
#/bin/reboot c: