Merge "Add support for flashing ILO BMC's from ramdisks"

This commit is contained in:
Jenkins 2014-09-04 20:00:18 +00:00 committed by Gerrit Code Review
commit 2399a51133
4 changed files with 72 additions and 0 deletions

15
elements/ilo/README.md Normal file
View File

@ -0,0 +1,15 @@
Ramdisk support for applying HP iLO firmware.
The firmware files are copied in via an extra-data hook: the variable
DIB\_ILO\_FIRMWARE\_PATH specifies a directory, and every file in that directory
will be unpacked into a same-named directory in the ramdisk (using
--unpack=...). If the path is not specified, a diagnostic is output but no
error is triggered.
During ramdisk init every found firmware installer will be executed using
--silent --log=log The log is displayed after the firmware has executed.
If the firmware exits with status 0 (ok), status 2 (same or older version) or 4
(ilo not detected) a diagnostic message is logged and init proceeds.
Any other status code is treated as an error.

View File

@ -0,0 +1,25 @@
#!/bin/bash
set -eu
set -o pipefail
if [ -z "${DIB_ILO_FIRMWARE_PATH:-}" ]; then
echo "DIB_ILO_FIRMWARE_PATH not set in ilo element" >&2
exit 0
fi
if [ ! -d "${DIB_ILO_FIRMWARE_PATH}" ]; then
echo "Firmware path not found: ${DIB_ILO_FIRMWARE_PATH}"
exit 1
fi
# We copy to /tmp because its temporary - we do a mv later into the initramfs
# image.
mkdir -p "$TMP_MOUNT_PATH/tmp/ilo/"
find "${DIB_ILO_FIRMWARE_PATH}" -type f \( -name '*.scexe' -o -name '*.exe' \) | while read FWNAME
do
TARGET="$TMP_MOUNT_PATH/tmp/ilo/$(basename "$FWNAME")"
echo Unpacking $FWNAME to $TARGET
bash "$FWNAME" "--unpack=$TARGET"
echo Done
done

View File

@ -0,0 +1,22 @@
if [ -d /ilo ]; then
find /ilo -type f \( -name flash_ilo3 -o -name flash_ilo4 \) | while read FWNAME
do
cd "$(dirname "$FWNAME")"
logname="$(basename "$(dirname "$FWNAME")").log"
echo Running $FWNAME
"$FWNAME" --silent --log "$logname"
result=$?
echo Finished $FWNAME with result $?
cat "$logname"
#avoid leaking space during large runs
rm "$logname"
if [ $result -eq 2 ]; then
echo "Firmware already up to date"
elif [ $result -eq 4 ]; then
echo "Firmware not applicable to machine"
elif [ $result -ne 0 ]; then
echo "Error applying firmware"
troubleshoot
fi
done
fi

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -eu
set -o pipefail
if [ ! -d /tmp/ilo ]; then
exit 0
fi
mv /tmp/ilo "$TMP_MOUNT_PATH"