
This commit introduces support for installing CentOS-based previous release (21.12) in Debian. There are two main components in this commit: 1. Handle the label change for the backup partition: Platform Backup in 21.12 vs 'platform_backup' in Debian This is accomplished by ignoring the label/partlabel entirely when searching for an existing backup partition. Instead, the partition GUID is used to locate the partition. The GUID does not change between distributions. 2. Use pre-bundled CentOS kickstarts for subcloud installs in Debian Since modifications are required to the CentOS kickstart files for the above, we copy the relevant pre-bundled centos kickstarts (for miniboot and prestaged ISO only) into a centos-specific directory under the Debian /var/www/pages/feed/rel-${platform_release}/kickstart directory structure, in order to be available for the gen-bootloader-iso-centos.sh utility. These files are included in the platform-kickstarts .deb package. NOTES on how the pre-bundled files are created: - We cannot use the files under bsp-file/kickstarts/*.cfg, since they are not valid for 21.12 release (e.g. they refer to /var/www) - Instead, files were taken from a valid 21.12 release and manually merged with the pre-bundled files generated from this repo GOING FORWARD: Only the bundled files at kickstart/files/centos/*.cfg will be maintained. At a later time, we may choose to remove the partial kickstarts under bsp-files/kickstarts/*.cfg, since they are not used anywhere. Test Plan PASS: - Build full ISO, verify that the /var/www/pages/feed/rel-23.09/kickstart/centos directory is populated with the pre-bundled kickstart files - Verify previous-release CentOS subcloud install/deployment under Debian (requires patched 22.12 load) - Verify current-release subcloud install under Debian Story: 2010611 Task: 48268 Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com> Change-Id: I1b7f76212e222dea7c6e586e4e9492f8a86a955e
177 lines
5.7 KiB
INI
177 lines
5.7 KiB
INI
%post --nochroot --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
KS="Prestaging post:"
|
|
|
|
#
|
|
# The /tmp/backup-guid-change.sh script assignes the Label
|
|
# and GUID to the Platform Backup partition. This script is
|
|
# dynamically created in the pre_disk_aio.cfg kickstart, which
|
|
# serves as the disk setup kickstart for the prestaging bundle.
|
|
#
|
|
# However, this script is only run afterward; in post_common.cfg
|
|
# which is not used in the prestaging bundle ; it contains too
|
|
# much in-service controller function setup stuff.
|
|
#
|
|
# Therefore, it is added here to ensure that if the prestaging
|
|
# ISO's pre_disk_aio.cfg 'created' the 'Platform Backup/platform_backup'
|
|
# partition then it will get labeled for prestaging group.
|
|
#
|
|
# This prestaging kickstart file uses the GUID to find the
|
|
# platform backup partition for its prestaging function.
|
|
#
|
|
change_guid=/tmp/backup-guid-change.sh
|
|
if [ -f "$change_guid" ]; then
|
|
wlog "${KS} applying label to backup partition"
|
|
sh $change_guid || report_post_failure_with_logfile "ERROR: Failed to update platform backup label and GUID"
|
|
else
|
|
wlog "${KS} /tmp/backup-guid-change.sh not found !!"
|
|
fi
|
|
|
|
%end
|
|
|
|
%post --nochroot --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
KS="Prestaging post:"
|
|
|
|
error=false
|
|
|
|
wlog "${KS} cmdLine: $(cat /proc/cmdline)"
|
|
|
|
if [ -d /mnt/install/source ]; then
|
|
SOURCE_DIR=/mnt/install/source
|
|
else
|
|
SOURCE_DIR=/run/install/repo
|
|
fi
|
|
wlog "${KS} install source : $SOURCE_DIR"
|
|
|
|
export SW_VERSION=xxxPLATFORM_RELEASExxx
|
|
export STAGING_DIR="platform-backup"
|
|
export BACKUP_PART_GUID="BA5EBA11-0000-1111-2222-000000000002"
|
|
export BACKUP_DEVICE=
|
|
export PRESTAGING_REPO_DIR="${SOURCE_DIR}/opt/${STAGING_DIR}"
|
|
export PRESTAGING_LOCAL_DIR="/mnt/${STAGING_DIR}"
|
|
|
|
wlog "${KS} SW_VERSION : ${SW_VERSION}"
|
|
wlog "${KS} IMAGE_MOUNT : ${SOURCE_DIR}"
|
|
wlog "${KS} PRESTAGING_REPO_DIR : ${PRESTAGING_REPO_DIR}"
|
|
wlog "${KS} PRESTAGING_LOCAL_DIR : ${PRESTAGING_LOCAL_DIR}"
|
|
|
|
# check for required directories
|
|
if [ ! -d ${SOURCE_DIR} ] ; then
|
|
msg="install source '${SOURCE_DIR}' does not exists or is not a directory"
|
|
wlog "${KS} Prestaging Failed: ${msg}"
|
|
report_pre_failure_with_msg "${msg}"
|
|
elif [ ! -d "${PRESTAGING_REPO_DIR}" ] ; then
|
|
msg="repo ${PRESTAGING_REPO_DIR} does not exist"
|
|
wlog "${KS} Prestaging Failed: ${msg}"
|
|
report_pre_failure_with_msg "${msg}"
|
|
elif [ ! -d "${PRESTAGING_REPO_DIR}/${SW_VERSION}" ] ; then
|
|
msg="repo ${PRESTAGING_REPO_DIR}/${SW_VERSION} sw version content missing"
|
|
wlog "${KS} Prestaging Failed: ${msg}"
|
|
report_prestaging_failure_with_msg "${msg}"
|
|
fi
|
|
|
|
# Poll for the platform backup GUID
|
|
for i in {1..6} ; do
|
|
# 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)"
|
|
|
|
if [ -n "${BACKUP_DEVICE}" ] ; then
|
|
break
|
|
else
|
|
wlog "${KS} searching for backup partition ${BACKUP_PART_GUID} GUID [${i}/6]"
|
|
sleep 10
|
|
fi
|
|
done
|
|
|
|
if [ -z "${BACKUP_DEVICE}" ]; then
|
|
msg="Could not find backup device from GUID ${BACKUP_PART_GUID}"
|
|
wlog "${KS} Prestaging failed: ${msg}"
|
|
report_prestaging_failure_with_msg "${msg}"
|
|
fi
|
|
|
|
errmsg=
|
|
if [ ! -d "${PRESTAGING_LOCAL_DIR}" ] ; then
|
|
wlog "${KS} mounting ${PRESTAGING_LOCAL_DIR}"
|
|
mkdir -p "${PRESTAGING_LOCAL_DIR}"
|
|
mount "${BACKUP_DEVICE}" "${PRESTAGING_LOCAL_DIR}"
|
|
rc=$?
|
|
if [ $rc -eq 0 ] ; then
|
|
sleep 2
|
|
if [ ! -d "${PRESTAGING_LOCAL_DIR}" ] ; then
|
|
errmsg="${KS} mount of staging '${PRESTAGING_LOCAL_DIR}' does not exist"
|
|
fi
|
|
else
|
|
errmsg="${KS} mount of '${BACKUP_DEVICE}' to '${PRESTAGING_LOCAL_DIR}' failed rc:${rc}"
|
|
fi
|
|
fi
|
|
if [ -n "$errmsg" ] ; then
|
|
wlog "${KS} Prestaging failed: ${errmsg}"
|
|
report_prestaging_failure_with_msg "${errmsg}"
|
|
fi
|
|
|
|
# nuke local prestaging dir - cleanup operation
|
|
if [ -d ${PRESTAGING_LOCAL_DIR}/${SW_VERSION} ] ; then
|
|
wlog "${KS} cleanup; wiping existing prestaging dir '${PRESTAGING_LOCAL_DIR}/${SW_VERSION}'"
|
|
rm -rf ${PRESTAGING_LOCAL_DIR}/${SW_VERSION}
|
|
fi
|
|
|
|
# create local prestaging dir
|
|
mkdir ${PRESTAGING_LOCAL_DIR}/${SW_VERSION}
|
|
|
|
# enter the local prestaging dir for this release
|
|
cd ${PRESTAGING_LOCAL_DIR}/${SW_VERSION}
|
|
|
|
# copy repo prestaging files to the local mount
|
|
wlog "${KS} copy prestaging files: from '${PRESTAGING_REPO_DIR}/${SW_VERSION}' to '${PRESTAGING_LOCAL_DIR}'"
|
|
cp -a "${PRESTAGING_REPO_DIR}/${SW_VERSION}" "${PRESTAGING_LOCAL_DIR}/"
|
|
rc=$?
|
|
if [ $rc -ne 0 ] ; then
|
|
msg="copy failed from '${PRESTAGING_REPO_DIR}/${SW_VERSION}' to '${PRESTAGING_LOCAL_DIR}/', rc=${rc}"
|
|
wlog "${KS} Prestaging Failed: ${msg}"
|
|
report_prestaging_failure_with_msg "${msg}"
|
|
fi
|
|
wlog "${KS} prestaging files copy done"
|
|
|
|
# loop over all the prestaged files
|
|
# - log files found
|
|
# - do md5 check on md5 files found
|
|
for file in * ; do
|
|
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"
|
|
error=true
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# handle any md5 check errors or log success/complete result
|
|
if [ "$error" = true ] ; then
|
|
msg="prestaging file(s) failed integrity check ; see logs for details"
|
|
wlog "${KS} Prestaging failed: ${msg}"
|
|
report_prestaging_failure_with_msg "${msg}"
|
|
else
|
|
wlog "${KS} prestaging integrity checks passed"
|
|
fi
|
|
|
|
wlog "${KS} prestaging complete"
|
|
|
|
%end
|
|
|