#!/bin/sh # +-----------------------------------------------------+ # | HP Insight Manager Agents unattend install Script | # | | # | Version : 2.0 | # | Author : Arnim van Lieshout | # +-----------------------------------------------------+ # version 2.0 # ========== # This script only supports HP management agents 8.3.0 for VMware ESX3.5U4 and ESX3.5U5 # +-----------------------------------------------------+ # | Setting some variables | # +-----------------------------------------------------+ HPPACKAGE=hpmgmt-8.3.0-vmware3x.tgz HBAPACKAGE=qlapi_vmw-v4.00build23.tgz HPVERSION=830 HPCONFIG=hpmgmt${HPVERSION}.conf HPSMHCONFIG=smhpd${HPVERSION}.xml # +-----------------------------------------------------+ # | Warn about the reboot | # +-----------------------------------------------------+ SETCOLOR_YELLOW="echo -en \\033[1;33m" SETCOLOR_RED="echo -en \\033[0;31m" SETCOLOR_WHITE="echo -en \\033[0;39m" $SETCOLOR_YELLOW echo "This update requires a reboot! " echo -n "Do you wish to continue (y/n) " read answer if [ "$answer" != "y" ]; then echo "Action cancelled by user" $SETCOLOR_WHITE exit fi $SETCOLOR_WHITE # +-----------------------------------------------------+ # | Check if host is in Maintenance mode | # +-----------------------------------------------------+ if [ `vimsh -n -e hostsvc/runtimeinfo | grep -i "inMaintenanceMode = false" | wc -l` == 1 ]; then $SETCOLOR_RED echo -e "\nHost must be in Maintenance Mode, exiting...\n\n" $SETCOLOR_WHITE exit fi # +-----------------------------------------------------+ # | Download files | # +-----------------------------------------------------+ /usr/sbin/esxcfg-firewall --allowOutgoing lwp-download http://repository.mydomain.com/hpagents/$HPPACKAGE /tmp/$HPPACKAGE lwp-download http://repository.mydomain.com/hpagents/$HBAPACKAGE /tmp/$HBAPACKAGE lwp-download http://repository.mydomain.com/hpagents/$HPCONFIG /tmp/$HPCONFIG lwp-download http://repository.mydomain.com/hpagents/$HPSMHCONFIG /tmp/$HPSMHCONFIG /usr/sbin/esxcfg-firewall --blockOutgoing # +-----------------------------------------------------+ # | Unpack archives | # +-----------------------------------------------------+ cd /tmp tar -zxvf $HPPACKAGE mkdir /tmp/hbaapi tar -C /tmp/hbaapi -zxvf $HBAPACKAGE cp /tmp/$HPSMHCONFIG /tmp/hpmgmt/$HPVERSION/smhpd.xml # +-----------------------------------------------------+ # | Uninstall old packages | # +-----------------------------------------------------+ cd /tmp/hpmgmt/$HPVERSION echo -e 'y\ny' | ./installvm${HPVERSION}.sh --uninstall cd /tmp/hbaapi ./Remove.sh # +-----------------------------------------------------+ # | Modify rc.local to start installxxx.sh script | # +-----------------------------------------------------+ # Backup original rc.local file cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak # Modify rc.local to start hpagent setup after the reboot cat >> /etc/rc.d/rc.local < /root/hpmgmt-install.log 2>&1 # Restore original rc.local file mv -f /etc/rc.d/rc.local.bak /etc/rc.d/rc.local EOF # +-----------------------------------------------------+ # | Install HBAAPI libraries and start PreInstall script| | # +-----------------------------------------------------+ cd /tmp/hbaapi ./Install.sh cd /tmp/hpmgmt/$HPVERSION echo -e 'y' | ./PreInstall_Setup.sh #Force reboot if PreInstall script detects no IPMI device on this system shutdown -r now "System shutdown as preinstall operation for agents installation"