#!/bin/sh # +-----------------------------------------------------+ # | HP Insight Manager Agents unattend install Script | # | | # | Version : 3.0 | # | Author : Arnim van Lieshout | # +-----------------------------------------------------+ # version 3.0 # ========== # This script only supports HP management agents 8.3.1 for VMware ESX4.0 and ESX4.0U1 # +-----------------------------------------------------+ # | Setting some variables | # +-----------------------------------------------------+ HPPACKAGE=hpmgmt-8.3.1-vmware4x.tgz HBAPACKAGE=qlapi_vmw-v4.00build26.tgz HPVERSION=831 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 mkdir /opt/hp mkdir /opt/hp/hp-agents-config cp /tmp/$HPSMHCONFIG /opt/hp/hp-agents-config/smhpd.xml # +-----------------------------------------------------+ # | Uninstall old packages | # +-----------------------------------------------------+ cd /tmp/hpmgmt/$HPVERSION echo -e 'y\ny' | ./install${HPVERSION}vibs.sh --uninstall cd /tmp/hbaapi ./Remove.sh # +-----------------------------------------------------+ # | Install new packages | # +-----------------------------------------------------+ cd /tmp/hbaapi ./Install.sh cd /tmp/hpmgmt/$HPVERSION ./install${HPVERSION}vibs.sh --silent --inputfile /tmp/$HPCONFIG # +-----------------------------------------------------+ # | Reboot host as requested by the HP agents installer | # +-----------------------------------------------------+ shutdown -r now "System shutdown to complete HP agents installation"