diff --git a/bsp-files/kickstarts/post_miniboot_controller.cfg b/bsp-files/kickstarts/post_miniboot_controller.cfg index df8ebfd2..2983acda 100644 --- a/bsp-files/kickstarts/post_miniboot_controller.cfg +++ b/bsp-files/kickstarts/post_miniboot_controller.cfg @@ -14,8 +14,10 @@ KS="Miniboot pre:" wlog "${KS} local install check" -image=false -check=true +iso_check=false +iso_mount=false +prestaging_files=false + # Look for and validate the local iso image if [ -e ${BACKUP_DEVICE} ]; then mkdir -p ${BACKUP_MOUNT} @@ -32,46 +34,82 @@ if [ -e ${BACKUP_DEVICE} ]; then # change to prestaging dir and load the file names cd ${BACKUP_MOUNT}/${SW_VERSION} - # loop over the files if there are any + # Local Install Bundle Validation: + # + # ISO Image: There must be an iso image whose base + # filename matches an md5 check file and + # that check must pass. + # + # Container Images: Missing container image check file(s) or + # container image validation check failure + # does not reject a Local Install. + # + # Find the iso image first. + # - there should be only one so use the first one found + # just in case there are others there. + + # Loop over the files if there are any looking for the iso + iso_filename="" for file in $(ls -A .) ; do + prestaging_files=true filename="${file%.*}" extension="${file##*.}" - wlog "${KS} prestaged file : ${file}" - if [ "${extension}" = "md5" ] ; then - md5sum -c "${file}" - if [ $? -eq 0 ] ; then - wlog "${KS} ${filename} check passed" - else - wlog "${KS} ${filename} check failed" - check=false + if [ "${extension}" = "iso" ] ; then + iso_filename="${filename}" - fi - elif [ "${extension}" = "iso" ] ; then - # found the iso name for the mount operation below + # Found the iso name for the mount operation below BOOTIMAGE_ISO=${BACKUP_MOUNT}/${SW_VERSION}/${file} wlog "${KS} found prestaged iso image ${BOOTIMAGE_ISO}" - image=true + if [ -f ${filename}.md5 ] ; then + md5sum -c "${filename}.md5" + if [ $? -eq 0 ] ; then + wlog "${KS} ${file} iso check passed" + iso_check=true + mkdir -p ${BOOTIMAGE_MOUNT} + mount -o loop ${BOOTIMAGE_ISO} ${BOOTIMAGE_MOUNT} + if [ $? -eq 0 ] ; then + iso_mount=true + wlog "${KS} local iso mounted ${BOOTIMAGE_MOUNT}" + else + wlog "${KS} local iso mount failed" + fi + else + wlog "${KS} ${file} iso check failed" + fi + else + wlog "${KS} no iso image check file found ${filename}.md5" + fi + break fi done - else + + # Loop over the files again this time to run checks + # on md5 files that are not the iso. + # Such files are expected to be checks for container image sets. + # Failure of container image sets check will not reject + # the local install. + for file in $(ls -A .) ; do + prestaging_files=true + filename="${file%.*}" + extension="${file##*.}" + if [ "${extension}" = "md5" -a "${filename}" != "${iso_filename}" ] ; then + wlog "${KS} prestaged file : ${file}" + md5sum -c "${file}" + if [ $? -eq 0 ] ; then + wlog "${KS} ${file} check passed" + else + wlog "${KS} ${file} check failed" + fi + fi + done + fi + + if [ "${prestaging_files}" = false ] ; then wlog "${KS} no prestaged files" fi else wlog "${KS} Error: ${BACKUP_MOUNT} not mounted" fi - - if [ "${check}" = true ] ; then - if [ "${image}" = true -a "${BOOTIMAGE_ISO}" != "" ]; then - wlog "${KS} local iso found : ${BOOTIMAGE_ISO}" - mkdir -p ${BOOTIMAGE_MOUNT} - mount -o loop ${BOOTIMAGE_ISO} ${BOOTIMAGE_MOUNT} - wlog "${KS} local iso mounted for local install" - else - wlog "${KS} local iso file not found" - fi - else - wlog "${KS} local install rejected due to validity check error" - fi else wlog "${KS} mount of ${BACKUP_DEVICE} to ${BACKUP_MOUNT} failed rc:$rc" fi @@ -79,6 +117,10 @@ else wlog "${KS} backup device ${BACKUP_DEVICE} does not exist" fi +if [ "${iso_check}" = true -a "${iso_mount}" = true ] ; then + wlog "${KS} Local Install ready" +fi + # # This controls where the packages come from. # Lower cost has higher priority ; making local install preferred.