Install from prestaged ostree_repo if exists in

/opt/platform-backup

To make installation more efficient, we need to prestage the
ostree_repo in /opt/platform-backup.

When we add a subcloud, the ostree_repo will not be fetched from
the System Controller, but from the prestaged ostree_repo, if it
exists.

Test Plan:
PASS: Verify that the ostree_repo is not pulled from the system
      controller but from /opt/platform-backup for installation.

Story: 2010120
Task: 46691
Change-Id: I6a00b28abe96f5d254a77331fc231cd9edac7bea
Signed-off-by: Shrikumar Sharma <shrikumar.sharma@windriver.com>
This commit is contained in:
Shrikumar Sharma 2022-10-31 17:12:25 +00:00
parent 6c85ea114b
commit 5ee4654b4d

View File

@ -1920,6 +1920,23 @@ else
repo="${PHYS_SYSROOT}/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/ostree_repo"
mkdir -p "${repo}"
# If we have already prestaged ostree_repo in /opt/platform-backup,
# then we should use that repo instead of downloading off of the system controller.
backup_device=/dev/disk/by-partlabel/platform_backup
backup_mount=/tmp/platform-backup
ilog "Temporary backup mount is ${backup_mount}"
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.
if [ -e ${backup_mount}/ostree_repo ]; then
insturl="file:///${backup_mount}/ostree_repo"
ilog "Setting insturl to ${insturl} to use prestaged ostree_repo"
fi
# Tell LAT to install from this local stage
# i.e. override where LAT installs from.
export instl=${repo}
@ -1947,6 +1964,8 @@ else
if [ $rc -ne 0 ]; then
report_failure_with_msg "ostree pull failed, rc=$rc"
fi
umount ${backup_mount}
umount ${PHYS_SYSROOT}
fi