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/<release-id> 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/<release-id> if they have been prestaged

PASS: Verify that packages are downloaded from systemcontroller
      for installation if packages are not prestaged in
      /opt/platform-backup/<release-id>

Closes-Bug: 1963709
Change-Id: Ibd2fe8d555c47da16e181b03703374bfd73731e3
Signed-off-by: Shrikumar Sharma <shrikumar.sharma@windriver.com>
This commit is contained in:
Shrikumar Sharma 2022-03-04 12:32:49 -05:00
parent 5635352596
commit 710452d2e5

View File

@ -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