diff --git a/bsp-files/kickstarts/post_miniboot_controller.cfg b/bsp-files/kickstarts/post_miniboot_controller.cfg index 6cf689f2..b7cb51fc 100644 --- a/bsp-files/kickstarts/post_miniboot_controller.cfg +++ b/bsp-files/kickstarts/post_miniboot_controller.cfg @@ -58,8 +58,8 @@ SW_VERSION=xxxPLATFORM_RELEASExxx STAGING_DIR="platform-backup" -BACKUP_PART_LABEL=Platform\\x20Backup -BACKUP_DEVICE=/dev/disk/by-partlabel/${BACKUP_PART_LABEL} +BACKUP_DEVICE= +BACKUP_PART_GUID="BA5EBA11-0000-1111-2222-000000000002" BACKUP_MOUNT=/mnt/${STAGING_DIR} BOOTIMAGE_ISO="" @@ -76,8 +76,17 @@ iso_check=false iso_mount=false prestaging_files=false +# Search for a backup partition, using GUID (which appears lower case in the blkid output): +while read -r device_path; do + if [ "$(blkid -p "${device_path}" | grep -c -i "${BACKUP_PART_GUID}")" -gt 0 ]; then + BACKUP_DEVICE=${device_path} + wlog "Found backup device: ${BACKUP_DEVICE}" + break + fi +done <<<"$(lsblk --noheadings --list --path --output NAME)" + # Look for and validate the local iso image -if [ -e ${BACKUP_DEVICE} ]; then +if [ -n "${BACKUP_DEVICE}" ] && [ -e "${BACKUP_DEVICE}" ]; then mkdir -p ${BACKUP_MOUNT} mount ${BACKUP_DEVICE} ${BACKUP_MOUNT} 2>/dev/null rc=$? @@ -183,6 +192,7 @@ fi # Make sure the prestage directory exists, as well as the required subdirectories. exists_prestage=false +ilog "${KS} Checking prestaged content PRESTAGE_DIR: ${PRESTAGE_DIR}" if [ ! -e ${PRESTAGE_DIR} ] || [ ! -e ${PRESTAGE_DIR}/Packages ] || [ ! -e ${PRESTAGE_DIR}/repodata ]; then exists_prestage=false wlog "${KS} Prestaged content not present" diff --git a/kickstart/files/miniboot.cfg b/kickstart/files/miniboot.cfg index 70721b8c..3428610d 100644 --- a/kickstart/files/miniboot.cfg +++ b/kickstart/files/miniboot.cfg @@ -1582,13 +1582,10 @@ else fi ilog "ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev}" ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev} - # TODO(kmacleod) change to wait_for_interface 60: - sleep 15 + wait_for_interface ${mgmt_dev} 60 ilog "ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_iface}" ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_iface} - # TODO(kmacleod) change to wait_for_interface 60: - ilog "Wait 10s to settle interface..." - sleep 10 + wait_for_interface ${mgmt_iface} 60 if [ -z "${BOOTPARAM_GW}" ]; then # No gateway @@ -2049,28 +2046,29 @@ else backup_device=/dev/disk/by-partlabel/platform_backup backup_mount=/tmp/platform-backup + backup_mount_release="${backup_mount}"/xxxPLATFORM_RELEASExxx - ilog "Temporary backup mount is ${backup_mount}" + ilog "Temporary backup mount: ${backup_mount}, release: ${backup_mount_release}" mkdir -p "${backup_mount}" mount "${backup_device}" "${backup_mount}" 2>/dev/null # If ostree_repo is found at the mounted backup directory, # then set the ostree url to its location. remote_insturl= - if [ -e ${backup_mount}/ostree_repo ]; then + if [ -e ${backup_mount_release}/ostree_repo ]; then local_repo_check_fail= # Calculate local checksum and compare - checksum_file=${backup_mount}/.ostree_repo_checksum + checksum_file=${backup_mount_release}/.ostree_repo_checksum if [ -f "${checksum_file}" ]; then checksum_from_file=$(cat "${checksum_file}") - ilog "Verifying checksum for prestaged ${backup_mount}/ostree_repo" - pushd ${backup_mount} > /dev/null + ilog "Verifying checksum for prestaged ${backup_mount_release}/ostree_repo" + pushd ${backup_mount_release} > /dev/null checksum=$(find ostree_repo -type f -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1; }') popd > /dev/null if [ "${checksum}" = "${checksum_from_file}" ]; then ilog "Verified ostree checksum: ${checksum}" else - elog "ostree checksum failed on ${backup_mount}/ostree_repo" + elog "ostree checksum failed on ${backup_mount_release}/ostree_repo" elog "Calulated checksum: ${checksum}" elog "File checksum: ${checksum_from_file}" local_repo_check_fail=true @@ -2079,8 +2077,8 @@ else # No prestage checksum file is available. Use ostree fsck instead. # The only problem with this is the length of time required for fsck to complete. wlog "No ostree checksum file at ${checksum_file}. Performing ostree fsck instead." - if ! ostree --repo="${backup_mount}/ostree_repo" fsck; then - elog "ostree fsck failed on prestaged ${backup_mount}/ostree_repo: reverting to remote pull" + if ! ostree --repo="${backup_mount_release}/ostree_repo" fsck; then + elog "ostree fsck failed on prestaged ${backup_mount_release}/ostree_repo: reverting to remote pull" local_repo_check_fail=true fi fi @@ -2088,13 +2086,13 @@ else # Preserve remote_insturl for use in 2nd ostree pull below remote_insturl=${insturl} - insturl="file:///${backup_mount}/ostree_repo" + insturl="file:///${backup_mount_release}/ostree_repo" ilog "Setting insturl to ${insturl} to use prestaged ostree_repo" else # Remove the corrupted ostree_repo. # Avoid setting insturl which will revert to using a remote pull - elog "ostree integrity check failed: removing prestaged ${backup_mount}/ostree_repo" - rm -rf "${backup_mount}/ostree_repo" + elog "ostree integrity check failed: removing prestaged ${backup_mount_release}/ostree_repo" + rm -rf "${backup_mount_release}/ostree_repo" elog "ostree integrity check failed: reverting to remote pull" fi fi