Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash -x
- URL=$1
- USER=$2
- PASSWORD=$3
- LATEST_FIRMWARE="0.00"
- # ILO3 firmware: http://h20564.www2.hpe.com/hpsc/swd/public/detail?swItemId=MTX_ef5d840040af4d189c4b4991a7#tab-history
- # ILO4 firmware: http://h20566.www2.hpe.com/hpsc/swd/public/detail?swItemId=MTX_a6d201edd56c4ff4b7d0488d01#tab-history
- # chmod +x CP*.scexe; ./CP026424.scexe --unpack=.
- TYPE=`curl -k https://$URL/xmldata?item=All | grep "<PN>" | sed -e 's,.*<PN>\([^<]*\)</PN>.*,\1,g'`
- if [ "$TYPE" == "Integrated Lights-Out 3 (iLO 3)" ];
- then
- LATEST_FIRMWARE="1.85"
- fi
- if [ "$TYPE" == "Integrated Lights-Out 4 (iLO 4)" ];
- then
- LATEST_FIRMWARE="2.54"
- fi
- if [ "$LATEST_FIRMWARE" == "0.00" ];
- then
- # Somethings wrong
- exit 1
- fi
- FIRMWARE=`curl -k https://$URL/xmldata?item=All | grep "<FWRI>" | sed -e 's,.*<FWRI>\([^<]*\)</FWRI>.*,\1,g'`
- if [ "$LATEST_FIRMWARE" == "$FIRMWARE" ];
- then
- exit 0;
- else
- echo "logging in"
- SESSION_KEY=`curl -k -X POST https://$URL/json/login_session -d "{\"method\":\"login\",\"user_login\":\"$USER\",\"password\":\"$PASSWORD\"}" | python -c 'import json,sys;obj=json.load(sys.stdin);p$
- echo "starting upload to $URL"
- if [ "$TYPE" == "Integrated Lights-Out 3 (iLO 3)" ];
- then
- curl -v -k --cookie "sessionUrl=https%253A%2F%2F$URL%2F; sessionLang=en; sessionKey=$SESSION_KEY" -F sessionKey=$SESSION_KEY -F file=@ilo3_185.bin https://$URL/cgi-bin/uploadFile
- fi
- if [ "$TYPE" == "Integrated Lights-Out 4 (iLO 4)" ];
- then
- curl -v -k --cookie "sessionUrl=https%253A%2F%2F$URL%2F; sessionLang=en; sessionKey=$SESSION_KEY" -F sessionKey=$SESSION_KEY -F file=@ilo4_254.bin https://$URL/cgi-bin/uploadFile
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement