HP Insight Control server provisioning Capturing and Installing Linux System Images

9
sed -i -e '/^HWADDR/d' -e '/^UUID/d'
/mnt/target/etc/sysconfig/network-scripts/ifcfg-eth0
rm -f /mnt/target/etc/udev/rules.d/70-persistent-net.rules
#
# Hostname
exit 0
3. Click OK to save the script.
Re-Install HP SA Agent Script
Create a new script that sets up the target server to re-install the HP SA Agent after the server has rebooted for the first
time into production. It is a fairly complicated script and requires that it be passed the IP address of the appliance. The
script runs once on the server during the image deployment and then again when the server reboots.
To create a new script that re-installs the HP SA Agent after deployment:
1. On the IC server provisioning appliance, create a new script of Unix type and name it for the appropriate
function.
2. Create the script content or copy and paste the script content from an external application. For example, the
script would contain:
#!/bin/bash
icspip="@@REPLACE_ME@@"
if [ "$icspip" == "@@REPLACE_ME@@" ]; then
# script is running on server as part of deployment
# need to set it up so that it runs after rebooting
# deployed server.
if [ -f "$0" ]; then
sed -i -e "s/=\"@@REPLACE_ME@@/=\"$1/" $0
# copy server into /rc{3,5}.d to run on startup.
cp $0 /mnt/target/etc/rc3.d/S40hpsa_agent_installer
cp $0 /mnt/target/etc/rc5.d/S40hpsa_agent_installer
rm -rf /mnt/target/etc/opt/opsware/agent/mid
rm -rf /mnt/target/var/opt/opsware/crypto/agent
cp -R /var/opt/opsware/crypto/agent \
/mnt/target/var/opt/opsware/crypto
cp /etc/opt/opsware/agent/mid \
/mnt/target/etc/opt/opsware/agent/mid
else
echo "Could not find script $0"
exit 1
fi
rm -rf /mnt/target/etc/rc*.d/*opsware*
echo "Done creating installation script for post reboot agent
installation.."
exit 0
else
cp /etc/rc3.d/S40hpsa_agent_installer /tmp
rm -rf /etc/rc?.d/S40hpsa_agent_installer
fi
logfile=/tmp/Migrate.log
cd /tmp
filename=""
echo "**************************************************" >> $logfile
echo "*********** Start ****************************" >> $logfile
echo "**************************************************" >> $logfile
echo `date` >> $logfile