# Do all provisioning for S3000 and S5000
#
# See prepareResources for unpacking the correct firmware/BIOS images.
#

# platform=`dmidecode -s bios-version   |cut -f1 -d'.'`
platform=`queryProperty IntelBIOSID BoardFamilyID -`
if [ "$platform" = "S3000" ]
then
    chassis=SR1530AH
else
    # chassis=`ipmiutil fru  |grep "Chassis OEM" |cut -f2 -d':'`
    chassis=`queryProperty FRU "Chassis OEM Field" -`
fi

echo "prepareResources $chassis"
./prepareResources.sh $chassis

if [ "$platform" = "S3000" ]
then 
  echo "flashamt"
  flashamt/flashamt-s3.sh

  echo "flashbios"
  ofu/flashbios-s3.sh

  # first edit here for the correct IP address, name, gwy, dns
  echo "cfgamt"
  amtcfg/cfgamt.sh 10.243.42.139 aspenhill9  10.243.42.251  10.127.1.11

  echo "cfgbios"
  syscfg/cfgbios.sh

  echo "cfgdisk"
  hdparm/cfgdisk-ata.sh
else
  echo "flash:  THIS WILL TAKE 10 MINUTES. "
  ofu/flash-s5.sh 

  # first edit here for the correct IP address, username, password
  # it should find the gateway if eth0 is up
  echo "cfgbmc"
  ipmiutil/cfgbmc.sh 10.243.42.139 usr2 psw2
 
  echo "cfgbios"
  syscfg/cfgbios.sh
 
  echo "cfgdisk"
  scsirastools/cfgdisk-scsi.sh
fi

echo "cfgnic.sh"
cfgnic/cfgnic.sh

echo "erase"
# erase -v sda -s

echo "ready to reboot"
sleep 10
#reboot/reboot.sh

