#!/bin/bash
IPMI_IP=`ipmitool  lan print 1 | grep "IP Address  "| awk '{print $NF}'`
if [ "${IPMI_IP}" != "0.0.0.0" ]; then
        IPMI_pw=`curl -H "Content-Type:application/json" -X POST --data  "{\"data\":  [\"${IPMI_IP}\"],\"type\": \"IPMI\"}" http://udcm.ucloudadmin.com/api/ipmi/v1/getpwd/ | jq "." | grep 'IPMIPassword' | awk '{print $NF}' | sed  's/^"//g' | sed 's/",$//g' | sed 's/"$//g'`
fi
if [ "${IPMI_pw}" == "" ]; then
        IPMI_pw="ucloud.cn"
fi
   echo "$IPMI_IP"
   ./sum -i ${IPMI_IP} -u root -p ${IPMI_pw} -c updatebios --file EG_820_G10_BIOS_X10DRG8.608 
sleep 10

