#!/bin/csh

### figure out what dir this program was found/run in (but if there
### was no path mentioned, don't just assume "./")
if ( "X$0" !~ */* ) then
    set rundir = "";
else
    set rundir = "`dirname $0`/"
endif

# log the fact this script ran, in case it faults the controller as in
# bug 74005.
logger "$0 extracting SAS2008 BIOS and firmware"

echo "Extracting BIOS..."
${rundir}isi_mpsutil -ub /tmp/mpsimg | sed -e "s~^~    ~"
echo "BIOS versions:"
strings /tmp/mpsimg | sed -ne "s~^@(#)~    ~p"

echo ""
echo "Extracting Firmware..."
${rundir}isi_mpsutil -uf /tmp/mpsimg | sed -e "s~^~    ~"
echo "Firmware versions:"
strings /tmp/mpsimg | sed -ne "s~^\(.*\)@(#)~    ~p"
echo ""

echo "Booted as:"
sysctl dev.mps.0.firmware_version | sed -ne "s~^~    ~p"
