From 710452d2e5c79a2f5a0d61eab19ec68324044057 Mon Sep 17 00:00:00 2001 From: Shrikumar Sharma Date: Fri, 4 Mar 2022 12:32:49 -0500 Subject: [PATCH] Install packages from platform backup if prestage iso is absent When the %pre code in post_miniboot_controller.cfg kickstart is run, it checks if a prestage iso is present; if one is not, then it attempts to download from the systemcontroller. The solution is to add /opt/platform-backup/ as a repo of higher priority than download, but lesser than prestage-iso, in the %pre section in post_miniboot_controller.cfg. Test Plan PASS: Verify that packages are retrieved from /opt/platform-backup/ if they have been prestaged PASS: Verify that packages are downloaded from systemcontroller for installation if packages are not prestaged in /opt/platform-backup/ Closes-Bug: 1963709 Change-Id: Ibd2fe8d555c47da16e181b03703374bfd73731e3 Signed-off-by: Shrikumar Sharma --- .../kickstarts/post_miniboot_controller.cfg | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/bsp-files/kickstarts/post_miniboot_controller.cfg b/bsp-files/kickstarts/post_miniboot_controller.cfg index fc2604da..fd94069d 100644 --- a/bsp-files/kickstarts/post_miniboot_controller.cfg +++ b/bsp-files/kickstarts/post_miniboot_controller.cfg @@ -10,6 +10,7 @@ BACKUP_DEVICE=/dev/disk/by-partlabel/${BACKUP_PART_LABEL} BACKUP_MOUNT=/mnt/${STAGING_DIR} BOOTIMAGE_ISO="" BOOTIMAGE_MOUNT=/mnt/bootimage +PRESTAGE_DIR=${BACKUP_MOUNT}/${SW_VERSION} KS="Miniboot pre:" wlog "${KS} local install check" @@ -125,20 +126,42 @@ if [ "${iso_mount}" = false ] ; then wlog "${KS} Prestage ISO is not available" fi +# Make sure the prestage directory exists, as well as the required subdirectories. +exists_prestage=false +if [ ! -e ${PRESTAGE_DIR} ] || [ ! -e ${PRESTAGE_DIR}/Packages ] || [ ! -e ${PRESTAGE_DIR}/repodata ]; then + exists_prestage=false +else + exists_prestage=true +fi + # # This controls where the packages come from. # Lower cost has higher priority ; making local install preferred. # # If ${BOOTIMAGE_MOUNT} exists then install from local iso - Local Install -# Otherwise, they are fetched from platform backup. +# Otherwise, they are fetched from platform backup if the Packages have been +# prestaged. # If this fails, they are fetched from the System Controller - Remote Install # -cat << EOF > /tmp/repo-include -repo --name=local-base --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/ -repo --name=local-updates --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/patches/ -repo --name=remote-base --cost=200 --baseurl=xxxHTTP_URLxxx/ -repo --name=remote-updates --cost=200 --baseurl=xxxHTTP_URLxxx/patches/ +if [ "${exists_prestage}" = true ]; then + wlog "${KS} Prestage directory found: ${PRESTAGE_DIR}" + cat << EOF > /tmp/repo-include + repo --name=local-base --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/ + repo --name=local-updates --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/patches/ + repo --name=local-base --cost=200 --baseurl=file://${PRESTAGE_DIR}/ + repo --name=local-updates --cost=200 --baseurl=file://${PRESTAGE_DIR}/patches/ + repo --name=remote-base --cost=300 --baseurl=xxxHTTP_URLxxx/ + repo --name=remote-updates --cost=300 --baseurl=xxxHTTP_URLxxx/patches/ EOF +else + wlog "${KS} Packages will either be retrieved from prestage iso or downloaded" + cat << EOF > /tmp/repo-include + repo --name=local-base --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/ + repo --name=local-updates --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/patches/ + repo --name=remote-base --cost=200 --baseurl=xxxHTTP_URLxxx/ + repo --name=remote-updates --cost=200 --baseurl=xxxHTTP_URLxxx/patches/ +EOF +fi %end # Repository arguments from %pre