organzing for portfolio
This commit is contained in:
@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
#Standalone iLO updater script - Jason Mak 6/25/2018
|
||||
#Defines the latest version of iLO
|
||||
ilo2latest="2.33"
|
||||
ilo4latest="2.61"
|
||||
#Checks server type, only proceeds on HP servers
|
||||
function server-check()
|
||||
{
|
||||
ISHP=$(dmidecode -t System | grep Manufacturer | grep HP -c)
|
||||
ISDELL=$(dmidecode -t System | grep Manufacturer | grep Dell -c)
|
||||
if [ $ISDELL -eq 1 ]; then
|
||||
echo "Server is a Dell, exiting"
|
||||
server-cleanup
|
||||
exit
|
||||
fi
|
||||
if [ $ISHP -eq 1 ]; then
|
||||
echo "Server is an HP, proceeding"
|
||||
ilogeneration=$(hponcfg | grep -i "ilo" | awk -F= '{print $3}' | awk '{print $2}')
|
||||
iloversionraw=$(hponcfg | grep -i "ilo" | awk -F= '{print $2}' | awk '{print $1}')
|
||||
iloversion=${iloversionraw//.}
|
||||
ilo-versioncheck
|
||||
fi
|
||||
}
|
||||
|
||||
#Checks iLO generation and version, updates as necessary
|
||||
function ilo-versioncheck()
|
||||
{
|
||||
if [ $ilogeneration -eq "2" ]; then
|
||||
if [ $(echo $iloversion -lt ${ilo2latest//.}) ]; then
|
||||
echo "iLO2 firmware:" $iloversionraw "latest version is:" $ilo2latest "updating..."
|
||||
wget http://172.16.99.121/iLO/ilo2_${ilo2latest//.}.bin -O /tmp/iloFW.bin
|
||||
update-ilo
|
||||
server-cleanup
|
||||
else
|
||||
echo "iLO 2 is up to date, exiting"
|
||||
server-cleanup
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $ilogeneration -eq "4" ]; then
|
||||
if [ $(echo $iloversion -lt ${ilo4latest//.}) ]; then
|
||||
echo "iLO4 firmware:" $iloversionraw "latest version is:" $ilo4latest "updating..."
|
||||
wget http://172.16.99.121/iLO/ilo4_${ilo4latest//.}.bin -O /tmp/iloFW.bin
|
||||
update-ilo
|
||||
server-cleanup
|
||||
else
|
||||
echo "iLO 4 is up to date, exiting"
|
||||
server-cleanup
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#xml file that performs the update
|
||||
function update-ilo()
|
||||
{
|
||||
cat > /tmp/ilo_update.xml << EOF
|
||||
<RIBCL VERSION="2.0">
|
||||
<LOGIN USER_LOGIN="adminname" PASSWORD="password">
|
||||
<RIB_INFO MODE="write">
|
||||
<!-- Firmware support information for next tag: -->
|
||||
<!-- iLO 2 - 1.70 and later. For servers with TPM enabled. -->
|
||||
<!-- iLO - None -->
|
||||
<!-- Riloe II - None -->
|
||||
<TPM_ENABLED VALUE="Yes"/>
|
||||
<UPDATE_RIB_FIRMWARE IMAGE_LOCATION="/tmp/iloFW.bin"/>
|
||||
</RIB_INFO>
|
||||
</LOGIN>
|
||||
</RIBCL>
|
||||
EOF
|
||||
|
||||
hponcfg -f /tmp/ilo_update.xml
|
||||
}
|
||||
|
||||
#Clean-up
|
||||
function server-cleanup()
|
||||
{
|
||||
rm -vf /tmp/iloFW.bin
|
||||
rm -vf /tmp/ilo_update.xml
|
||||
rm -vf /tmp/iloUpdater.sh
|
||||
}
|
||||
|
||||
#Control logic
|
||||
main ()
|
||||
{
|
||||
server-check
|
||||
}
|
||||
|
||||
main
|
Reference in New Issue
Block a user