5f3c54297d
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
618 lines
24 KiB
INI
618 lines
24 KiB
INI
%pre --erroronfail
|
|
|
|
############################################################################
|
|
#
|
|
# This miniboot kickstart tells Anaconda to install the subcloud
|
|
# from one of the following repo sources listed in order of priority.
|
|
#
|
|
# 1. Prestaged Content ; Packages and repodata (highest priority)
|
|
#
|
|
# prestaged source ... /opt/platform-backup/rel-xx.xx/Packages
|
|
# prestaged source ... /opt/platform-backup/rel-xx.xx/repodata
|
|
# prestaged source ... xxxHTTP_URLxxx/patches
|
|
#
|
|
# Anaconda install ... /opt/platform-backup/rel-xx.xx
|
|
#
|
|
# 2. Prestaged ISO image
|
|
#
|
|
# prestaged source ... /opt/platform-backup/rel-xx.xx/bootimage.iso
|
|
# prestaged check ... /opt/platform-backup/rel-xx.xx/bootimage.md5
|
|
# prestaged source ... xxxHTTP_URLxxx/patches
|
|
#
|
|
# Anaconda install ... /mnt/bootimage
|
|
#
|
|
# 3. Staged feeds after %pre fetch from System Controller (lowest priority)
|
|
#
|
|
# stage source wget xxxHTTP_URLxxx/Packages -> /mnt/install/repo/Packages
|
|
# stage source wget xxxHTTP_URLxxx/repodata -> /mnt/install/repo/repodata
|
|
# stage source wget xxxHTTP_URLxxx/patches -> /mnt/install/repo/patches
|
|
#
|
|
# Anaconda install ... /mnt/install/repo/
|
|
#
|
|
# All of the above methods must mirror the system controller's feed,
|
|
# updates and patching repos from the staged or prestaged source.
|
|
#
|
|
# feed .... for installing system nodes /var/www/pages/feed/rel-xx.xx
|
|
#
|
|
# updates ... for managing updates /var/www/pages/updates
|
|
#
|
|
# patching .. for managing patches /opt/patching/commit
|
|
# /opt/patching/available
|
|
# /opt/patching/applied
|
|
#
|
|
# Miniboot checks and reports on found prestaged container images or
|
|
# other files with md5 checks present. Miniboot leaves them to be
|
|
# utilized by software.
|
|
#
|
|
# prestaged container images ... /opt/platform-backup/rel-xx.xx/image#
|
|
# prestaged image checks ... /opt/platform-backup/rel-xx.xx/image#.md5
|
|
#
|
|
# Miniboot also downloads the file "package_checksums" from the system
|
|
# controller and copies it to two locations: /usr/local/share/pkg-list and
|
|
# to /var/www/pages/feed/rel-<version>. This file is required for prestaging
|
|
# operations. The file is renamed to packages_list at the target location.
|
|
############################################################################
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
SW_VERSION=xxxPLATFORM_RELEASExxx
|
|
STAGING_DIR="platform-backup"
|
|
BACKUP_DEVICE=
|
|
BACKUP_PART_GUID="BA5EBA11-0000-1111-2222-000000000002"
|
|
BACKUP_MOUNT=/mnt/${STAGING_DIR}
|
|
BOOTIMAGE_ISO=""
|
|
|
|
# Staging and Prestaging Directories
|
|
INSTALL_MOUNT=/mnt/install/repo
|
|
BOOTIMAGE_MOUNT=/mnt/bootimage
|
|
PRESTAGE_DIR=${BACKUP_MOUNT}/${SW_VERSION}
|
|
|
|
KS="Miniboot pre:"
|
|
|
|
wlog "${KS} Local Install check"
|
|
|
|
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 [ -n "${BACKUP_DEVICE}" ] && [ -e "${BACKUP_DEVICE}" ]; then
|
|
mkdir -p ${BACKUP_MOUNT}
|
|
mount ${BACKUP_DEVICE} ${BACKUP_MOUNT} 2>/dev/null
|
|
rc=$?
|
|
if [ $rc -eq 0 ] ; then
|
|
sleep 2
|
|
# does the prestaging dir for the specified sw version exist
|
|
if [ -d "${BACKUP_MOUNT}/${SW_VERSION}" ] ; then
|
|
|
|
# are there files in it ?
|
|
if [ "$(ls -A ${BACKUP_MOUNT}/${SW_VERSION})" ] ; then
|
|
|
|
# change to prestaging dir and load the file names
|
|
cd ${BACKUP_MOUNT}/${SW_VERSION}
|
|
|
|
# Local Install Bundle Validation:
|
|
#
|
|
# ISO Image: There must be an iso image whose base
|
|
# filename matches an md5 check file and
|
|
# that check must pass.
|
|
#
|
|
# Container Images: Missing container image check file(s) or
|
|
# container image validation check failure
|
|
# does not reject a Local Install.
|
|
#
|
|
# Find the iso image first.
|
|
# - there should be only one so use the first one found
|
|
# just in case there are others there.
|
|
|
|
# Loop over the files if there are any looking for the iso
|
|
iso_filename=""
|
|
for file in $(ls -A .) ; do
|
|
prestaging_files=true
|
|
filename="${file%.*}"
|
|
extension="${file##*.}"
|
|
if [ "${extension}" = "iso" ] ; then
|
|
iso_filename="${filename}"
|
|
|
|
# Found the iso name for the mount operation below
|
|
BOOTIMAGE_ISO=${BACKUP_MOUNT}/${SW_VERSION}/${file}
|
|
wlog "${KS} found prestaged iso image ${BOOTIMAGE_ISO}"
|
|
if [ -f ${filename}.md5 ] ; then
|
|
md5sum -c "${filename}.md5"
|
|
if [ $? -eq 0 ] ; then
|
|
wlog "${KS} ${file} iso check passed"
|
|
iso_check=true
|
|
mkdir -p ${BOOTIMAGE_MOUNT}
|
|
mount -o loop ${BOOTIMAGE_ISO} ${BOOTIMAGE_MOUNT}
|
|
if [ $? -eq 0 ] ; then
|
|
iso_mount=true
|
|
wlog "${KS} local iso mounted ${BOOTIMAGE_MOUNT}"
|
|
else
|
|
wlog "${KS} local iso mount failed"
|
|
fi
|
|
else
|
|
wlog "${KS} ${file} iso check failed"
|
|
fi
|
|
else
|
|
wlog "${KS} no iso image check file found ${filename}.md5"
|
|
fi
|
|
break
|
|
fi
|
|
done
|
|
|
|
# Loop over the files again this time to run checks
|
|
# on md5 files that are not the iso.
|
|
# Such files are expected to be checks for container image sets.
|
|
# Failure of container image sets check will not reject
|
|
# the local install.
|
|
for file in $(ls -A .) ; do
|
|
prestaging_files=true
|
|
filename="${file%.*}"
|
|
extension="${file##*.}"
|
|
if [ "${extension}" = "md5" -a "${filename}" != "${iso_filename}" ] ; then
|
|
wlog "${KS} prestaged file : ${file}"
|
|
md5sum -c "${file}"
|
|
if [ $? -eq 0 ] ; then
|
|
wlog "${KS} ${file} check passed"
|
|
else
|
|
wlog "${KS} ${file} check failed"
|
|
fi
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if [ "${prestaging_files}" = false ] ; then
|
|
wlog "${KS} no prestaged files"
|
|
fi
|
|
else
|
|
wlog "${KS} ${BACKUP_MOUNT} not mounted"
|
|
fi
|
|
else
|
|
wlog "${KS} mount of '${BACKUP_DEVICE}' to ${BACKUP_MOUNT} failed rc:$rc"
|
|
fi
|
|
else
|
|
wlog "${KS} backup device '${BACKUP_DEVICE}' does not exist"
|
|
fi
|
|
|
|
wlog "${KS} iso_check: ${iso_check} iso_mount: ${iso_mount}"
|
|
if [ "${iso_check}" = true -a "${iso_mount}" = true ] ; then
|
|
wlog "${KS} Local Install ready"
|
|
elif [ "${iso_mount}" = false ] ; then
|
|
wlog "${KS} Prestaged ISO not present or invalid"
|
|
fi
|
|
|
|
# Make sure the prestage directory exists, as well as the required subdirectories.
|
|
exists_prestage=false
|
|
wlog "${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"
|
|
else
|
|
repodata_files_count=$(ls ${PRESTAGE_DIR}/repodata | wc -l)
|
|
if [ ${repodata_files_count} -ne 0 ]; then
|
|
packages_files_count=$(ls ${PRESTAGE_DIR}/Packages | wc -l)
|
|
if [ ${packages_files_count} -ne 0 ] ; then
|
|
exists_prestage=true
|
|
wlog "${KS} Prestaged content present"
|
|
# unmount iso image if mounted
|
|
if [ -d ${BOOTIMAGE_MOUNT} ]; then
|
|
wlog "${KS} Unmounting ${BOOTIMAGE_MOUNT} for prestaged content install"
|
|
umount ${BOOTIMAGE_MOUNT}
|
|
rmdir ${BOOTIMAGE_MOUNT}
|
|
else
|
|
wlog "${KS} ${BOOTIMAGE_MOUNT} dir does not exist"
|
|
fi
|
|
else
|
|
wlog "${KS} Prestaged Content is invalid ; no Package files present"
|
|
fi
|
|
else
|
|
wlog "${KS} Prestaged Content is invalid ; no repodata files present ${repodata_files_count}"
|
|
fi
|
|
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 if the Packages have been
|
|
# prestaged.
|
|
# If this fails, they are fetched from the System Controller - Remote Install
|
|
#
|
|
if [ "${exists_prestage}" = true ]; then
|
|
wlog "${KS} Prestage directory found: ${PRESTAGE_DIR}. Proceeding with prestaged install."
|
|
cat << EOF > /tmp/repo-include
|
|
repo --name=local-base --cost=100 --baseurl=file://${PRESTAGE_DIR}/
|
|
repo --name=local-updates --cost=100 --baseurl=file://${PRESTAGE_DIR}/patches/
|
|
repo --name=remote-base --cost=200 --baseurl=xxxHTTP_URLxxx/
|
|
repo --name=remote-updates --cost=200 --baseurl=xxxHTTP_URLxxx/patches/
|
|
EOF
|
|
elif [ "${iso_check}" = true ] && [ "${iso_mount}" = true ] ; then
|
|
wlog "${KS} Packages will be retrieved from prestage ISO. Proceeding with local (ISO) 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/
|
|
EOF
|
|
else
|
|
# Mirror remote software repositories
|
|
wlog "${KS} Staging Repo via ${feed_url}"
|
|
|
|
# Check for inst.noverifyssl
|
|
if grep -q inst.noverifyssl /proc/cmdline; then
|
|
NOVERIFYSSL_WGET_OPT="--no-check-certificate"
|
|
else
|
|
NOVERIFYSSL_WGET_OPT=""
|
|
fi
|
|
|
|
declare -i cut_dirs=NUM_DIRS
|
|
cd "${INSTALL_MOUNT}"
|
|
mkdir -p logs
|
|
mkdir -p Packages
|
|
mkdir -p repodata
|
|
feed_url=xxxHTTP_URLxxx
|
|
|
|
# Fetch Packages
|
|
wlog "${KS} Staged Install packages fetch from $feed_url/Packages"
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' --reject '*.log' \
|
|
--cut-dirs=$cut_dirs ${feed_url}/Packages/ -o ${INSTALL_MOUNT}/logs/rpmget.log \
|
|
|| report_pre_failure_with_msg "Failed to fetch Packages ; see ${INSTALL_MOUNT}/logs/rpmget.log"
|
|
wlog "${KS} Staged Packages to ${INSTALL_MOUNT}/Packages complete"
|
|
|
|
# Fetch Repodata
|
|
wlog "${KS} Staged Install repodata fetch from $feed_url/repodata"
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' --reject '*.log' \
|
|
--cut-dirs=$cut_dirs ${feed_url}/repodata/ -o ${INSTALL_MOUNT}/logs/rpmget_repo.log \
|
|
|| report_pre_failure_with_msg "Failed to fetch repodata ; see ${INSTALL_MOUNT}/logs/rpmget_repo.log"
|
|
wlog "${KS} Staged repodata to ${INSTALL_MOUNT}/repodata complete"
|
|
|
|
# Fetch Patch Package Data quietly
|
|
# - Patch Packages
|
|
# - Patches repodata
|
|
# - Patches metadata
|
|
# - Save all patch packages to /opt/patching/packages/xxxPLATFORM_RELEASExxx
|
|
patches_url=xxxHTTP_URLxxx/patches
|
|
wget ${NOVERIFYSSL_WGET_OPT} -q --spider ${patches_url}/
|
|
if [ $? -eq 0 ]; then
|
|
wlog "${KS} Staged Install patch repository from $patches_url to ${INSTALL_MOUNT}/patches"
|
|
mkdir -p ${INSTALL_MOUNT}/patches/Packages
|
|
mkdir -p ${INSTALL_MOUNT}/patches/repodata
|
|
cd ${INSTALL_MOUNT}/patches
|
|
declare -i patches_cut_dirs=$((cut_dirs+1))
|
|
|
|
wlog "${KS} Staged Install fetch patch Packages from $patches_url/Packages"
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$patches_cut_dirs $patches_url/Packages/ -o ${INSTALL_MOUNT}/logs/patches_rpmget.log \
|
|
|| report_post_failure_with_logfile ${INSTALL_MOUNT}/logs/patches_rpmget.log
|
|
|
|
wlog "${KS} Staged Install fetch patch repodata from $patches_url/repodata"
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$patches_cut_dirs $patches_url/repodata/ -o ${INSTALL_MOUNT}/logs/patches_rpmget_repo.log \
|
|
|| report_post_failure_with_logfile ${INSTALL_MOUNT}/logs/patches_rpmget_repo.log
|
|
|
|
wlog "${KS} Staged Install fetch patch metadata from $patches_url/metadata"
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$patches_cut_dirs $patches_url/metadata/ -o ${INSTALL_MOUNT}/logs/patches_rpmget_metadata.log \
|
|
|| report_post_failure_with_logfile ${INSTALL_MOUNT}/logs/patches_rpmget_metadata.log
|
|
|
|
wlog "${KS} Staged patches to ${INSTALL_MOUNT}/patches complete"
|
|
else
|
|
wlog "${KS} get from patches url '$patches_url' failed"
|
|
fi
|
|
|
|
cat << EOF > /tmp/repo-include
|
|
repo --name=local-base --cost=100 --baseurl=file://${INSTALL_MOUNT}/
|
|
repo --name=local-updates --cost=100 --baseurl=file://${INSTALL_MOUNT}/patches/
|
|
repo --name=remote-base --cost=200 --baseurl=xxxHTTP_URLxxx/
|
|
repo --name=remote-updates --cost=200 --baseurl=xxxHTTP_URLxxx/patches/
|
|
EOF
|
|
fi
|
|
wlog "Using repo config:\n$(cat /tmp/repo-include)"
|
|
%end
|
|
|
|
# Repository arguments from %pre
|
|
%include /tmp/repo-include
|
|
|
|
|
|
%post --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
KS="Miniboot post:"
|
|
|
|
# wlog "${KS} cmdLine: $(cat /proc/cmdline)"
|
|
if [ -e /dev/disk/by-label/oe_iso_boot ]; then
|
|
# This is a hybrid ISO/network install. Mount the media to ensure Anaconda
|
|
# ejects it on reboot.
|
|
mkdir /mnt/iso
|
|
wlog "${KS} mount for eject"
|
|
mount /dev/disk/by-label/oe_iso_boot /mnt/iso
|
|
else
|
|
wlog "${KS} /dev/disk/by-label/oe_iso_boot does not exist"
|
|
fi
|
|
|
|
# persist the default http port number to platform configuration. This
|
|
# will get overwritten when config_controller is run.
|
|
echo http_port=8080 >> /etc/platform/platform.conf
|
|
|
|
# Build networking scripts
|
|
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
|
|
DEVICE=lo
|
|
IPADDR=127.0.0.1
|
|
NETMASK=255.0.0.0
|
|
NETWORK=127.0.0.0
|
|
BROADCAST=127.255.255.255
|
|
ONBOOT=yes
|
|
IPV6_AUTOCONF=no
|
|
NAME=loopback
|
|
EOF
|
|
|
|
%end
|
|
|
|
%post --nochroot --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
# Mirror local software repositories
|
|
INSTALL_MOUNT=/mnt/install/repo
|
|
SYSIMAGE_MOUNT=/mnt/sysimage
|
|
FEED_DIR=${SYSIMAGE_MOUNT}/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx
|
|
UPDATES_DIR=${SYSIMAGE_MOUNT}/var/www/pages/updates/rel-xxxPLATFORM_RELEASExxx
|
|
PATCHING_DIR=${SYSIMAGE_MOUNT}/opt/patching
|
|
PACKAGES_DIR=${PATCHING_DIR}/packages/xxxPLATFORM_RELEASExxx/
|
|
|
|
KS="Miniboot post:"
|
|
|
|
need_patches=false
|
|
|
|
# Handle 3 prestaging conditions
|
|
#
|
|
# 1. Full local install ; iso present in platform-backup/rel
|
|
# 2. Prioritized install ; use prestaged content fetch what's missing remotely
|
|
# 3. Staged install ; no prestaging content
|
|
if [ -d /mnt/bootimage ]; then
|
|
srcdir=/mnt/bootimage
|
|
# Always need to fetch patches for Prestaged ISO install.
|
|
# It is not sufficient to only get committed patches from the ISO,
|
|
# There may also be non-committed patches applied to the system
|
|
# controller that are needed as well.
|
|
# Setting need_patches to true for the ISO install handles both commited
|
|
# and non-committed patch cases.
|
|
need_patches=true
|
|
wlog "${KS} Local Install from $srcdir"
|
|
elif [ -d ${INSTALL_MOUNT}/Packages ] ; then
|
|
srcdir=${INSTALL_MOUNT}
|
|
wlog "${KS} Staged Install from $srcdir"
|
|
else
|
|
srcdir=/mnt/platform-backup/xxxPLATFORM_RELEASExxx
|
|
wlog "${KS} looking for packages in ${srcdir}"
|
|
fi
|
|
|
|
# prepare to boot other hosts by mirroring sw repository
|
|
if [ -d $srcdir/Packages ] ; then
|
|
wlog "${KS} copying software repository $srcdir/Packages and $srcdir/repodata"
|
|
mkdir -p ${FEED_DIR}
|
|
if [ -d $srcdir/repodata ] ; then
|
|
repodatafilecount=$(ls ${srcdir}/repodata | wc -l)
|
|
if [ ${repodatafilecount} = 0 ]; then
|
|
report_post_failure_with_msg "$srcdir/repodata files not found."
|
|
else
|
|
wlog "${KS} copying repodata from $srcdir/repodata to ${FEED_DIR}/repodata"
|
|
cp -r $srcdir/repodata ${FEED_DIR}/repodata
|
|
fi
|
|
else
|
|
report_post_failure_with_msg "$srcdir/repodata not found."
|
|
fi
|
|
packagesfilecount=$(ls ${srcdir}/Packages | wc -l)
|
|
if [ ${packagesfilecount} = 0 ]; then
|
|
report_post_failure_with_msg "$srcdir/Packages files not found."
|
|
else
|
|
wlog "${KS} copying packages from $srcdir/Packages to ${FEED_DIR}/Packages"
|
|
cp -r $srcdir/Packages ${FEED_DIR}/Packages
|
|
fi
|
|
else
|
|
report_post_failure_with_msg "$srcdir/Packages not found."
|
|
fi
|
|
|
|
if [ -d $srcdir/patches ]; then
|
|
if [ -d $srcdir/patches/Packages ] ; then
|
|
wlog "${KS} copying patch Packages from $srcdir/patches/Packages to ${UPDATES_DIR}/Packages"
|
|
mkdir -p ${UPDATES_DIR}
|
|
cp -r $srcdir/patches/Packages ${UPDATES_DIR}/Packages
|
|
else
|
|
wlog "${KS} $srcdir/patches/Packages doesn't exist. Fetching remotely"
|
|
need_patches=true
|
|
fi
|
|
|
|
if [ -d $srcdir/patches/repodata ] ; then
|
|
wlog "${KS} copying patch repodata from $srcdir/patches/repodata to ${UPDATES_DIR}/repodata"
|
|
mkdir -p ${UPDATES_DIR}
|
|
cp -r $srcdir/patches/repodata ${UPDATES_DIR}/repodata
|
|
else
|
|
wlog "${KS} $srcdir/patches/repodata doesn't exist. Fetching remotely"
|
|
need_patches=true
|
|
fi
|
|
else
|
|
wlog "${KS} $srcdir/patches doesn't exist. Fetching remotely"
|
|
need_patches=true
|
|
fi
|
|
|
|
if [ -d $srcdir/patches/metadata -a "${need_patches}" = false ] ; then
|
|
mkdir -p ${PATCHING_DIR}
|
|
wlog "${KS} copying patch metadata from $srcdir/patches/metadata to ${PATCHING_DIR}/metadata"
|
|
cp -r $srcdir/patches/metadata ${PATCHING_DIR}/metadata
|
|
else
|
|
wlog "${KS} $srcdir/patches/metadata doesn't exist. Fetching remotely"
|
|
need_patches=true
|
|
fi
|
|
|
|
if [ -d $srcdir/patches -a "${need_patches}" = false ]; then
|
|
mkdir -p ${PACKAGES_DIR}
|
|
wlog "${KS} copying packages from ${UPDATES_DIR}/Packages to ${PACKAGES_DIR}"
|
|
find ${UPDATES_DIR}/Packages -name '*.rpm' \
|
|
| xargs --no-run-if-empty -I files cp --preserve=all files ${PACKAGES_DIR}
|
|
else
|
|
wlog "${KS} $srcdir/patches doesn't exist: fetching remotely"
|
|
need_patches=true
|
|
fi
|
|
|
|
if [ "${srcdir}" = "${INSTALL_MOUNT}" ] ; then
|
|
|
|
# save the pre stage anaconda logs
|
|
mkdir -p ${SYSIMAGE_MOUNT}/var/log/anaconda
|
|
cp -a ${INSTALL_MOUNT}/logs/* ${SYSIMAGE_MOUNT}/var/log/anaconda
|
|
fi
|
|
|
|
if [ "${need_patches}" = true ]; then
|
|
echo > ${SYSIMAGE_MOUNT}/tmp/needpatches
|
|
fi
|
|
true
|
|
%end
|
|
|
|
|
|
%post --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
KS="Miniboot post:"
|
|
|
|
FEED_DIR=/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx
|
|
|
|
# Create a uuid specific to this installation
|
|
INSTALL_UUID=`uuidgen`
|
|
echo $INSTALL_UUID > /var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid
|
|
echo "INSTALL_UUID=$INSTALL_UUID" >> /etc/platform/platform.conf
|
|
wlog "${KS} updating platform.conf with install uuid : ${INSTALL_UUID}"
|
|
|
|
# Mirror remote software repositories
|
|
anaconda_logdir=/var/log/anaconda
|
|
mkdir -p $anaconda_logdir
|
|
|
|
# Check for inst.noverifyssl
|
|
if grep -q inst.noverifyssl /proc/cmdline; then
|
|
NOVERIFYSSL_WGET_OPT="--no-check-certificate"
|
|
else
|
|
NOVERIFYSSL_WGET_OPT=""
|
|
fi
|
|
|
|
# package_checksums
|
|
# copy the package_checksums file to /usr/local/share/pkg-list
|
|
INSTALL_MOUNT=/mnt/install/repo
|
|
PKG_FILE=package_checksums
|
|
# at the target directory, this file is called "<release_id>_packages_list.txt"
|
|
DEST_PKG_FILE="xxxPLATFORM_RELEASExxx_packages_list.txt"
|
|
PKG_FILE_LOC=/usr/local/share/pkg-list
|
|
pkg_url=xxxHTTP_URLxxx
|
|
|
|
# create ${PKG_FILE_LOC} if it does not exist already.
|
|
if [ ! -d ${PKG_FILE_LOC} ]; then
|
|
wlog "${KS} Creating ${PKG_FILE_LOC}"
|
|
mkdir -p ${PKG_FILE_LOC}
|
|
fi
|
|
|
|
# There are two paths to obtain the desired file. The file is
|
|
# named package_checksums in the bootimage.iso, and it must be
|
|
# stored in two locations here as packages_list.
|
|
#
|
|
# If this server is being installed from the iso file (through
|
|
# CD/DVD etc, for example), then, if the file exists at
|
|
# ${INSTALL_MOUNT}, just copy it over. Otherwise, it is possible
|
|
# that this install is happening on a subcloud. In this case,
|
|
# download the file from the server (system controller).
|
|
#
|
|
# If the file does not exist, it is an issue as future upgrades
|
|
# may not work, so we need to exit with error.
|
|
|
|
if [ -f ${INSTALL_MOUNT}/${PKG_FILE} ]; then
|
|
wlog "${KS} copying package_checksums to ${PKG_FILE_LOC}"
|
|
cp ${INSTALL_MOUNT}/${PKG_FILE} ${PKG_FILE_LOC}/${DEST_PKG_FILE}
|
|
else
|
|
# the file does not exist because the install is not happening
|
|
# from a bootimage.iso.
|
|
# so get it from the system controller.
|
|
wlog "${KS} downloading ${DEST_PKG_FILE} from the system controller"
|
|
wget ${NOVERIFYSSL_WGET_OPT} ${pkg_url}/${DEST_PKG_FILE} \
|
|
-O ${PKG_FILE_LOC}/${DEST_PKG_FILE} \
|
|
-o $anaconda_logdir/${PKG_FILE}.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/${PKG_FILE}.log
|
|
fi
|
|
|
|
# cp the package_checksum files to the feed directory
|
|
wlog "${KS} copying ${PKG_FILE_LOC}/${DEST_PKG_FILE} to ${FEED_DIR}/${PKG_FILE}"
|
|
cp ${PKG_FILE_LOC}/${DEST_PKG_FILE} ${FEED_DIR}/${PKG_FILE}
|
|
|
|
# If the path to $FEED_DIR does not exist then proceed to create it and
|
|
# fetch the ISO content in pieces from the system controller:
|
|
#
|
|
# - Packages
|
|
# - Repodata
|
|
#
|
|
declare -i cut_dirs=NUM_DIRS
|
|
declare need_patches=
|
|
|
|
if [ -f /tmp/needpatches ]; then
|
|
wlog "${KS} patches need to be downloaded"
|
|
need_patches=true
|
|
rm /tmp/needpatches
|
|
else
|
|
need_patches=false
|
|
fi
|
|
|
|
# Fetch Patch Package Data quietly
|
|
# - Patch Packages
|
|
# - Patches repodata
|
|
# - Patches metadata
|
|
# - Save all patch packages to /opt/patching/packages/xxxPLATFORM_RELEASExxx
|
|
patches_url=xxxHTTP_URLxxx/patches
|
|
wget ${NOVERIFYSSL_WGET_OPT} -q --spider ${patches_url}/
|
|
if [ $? -eq 0 ] && [ "${need_patches}" = true ]; then
|
|
wlog "${KS} downloading patch repository $patches_url"
|
|
cd /var/www/pages
|
|
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/Packages
|
|
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/repodata
|
|
cd updates/rel-xxxPLATFORM_RELEASExxx
|
|
declare -i patches_cut_dirs=$((cut_dirs+1))
|
|
this_dir=$(pwd)
|
|
|
|
wlog "${KS} fetch patch packages from $patches_url/Packages to ${this_dir}"
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$patches_cut_dirs $patches_url/Packages/ -o $anaconda_logdir/patches_rpmget.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget.log
|
|
|
|
wlog "${KS} fetch patch repodata from $patches_url/repodata to ${this_dir}"
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$patches_cut_dirs $patches_url/repodata/ -o $anaconda_logdir/patches_rpmget_repo.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_repo.log
|
|
|
|
mkdir -p /opt/patching/metadata
|
|
mkdir -p /opt/patching/packages/xxxPLATFORM_RELEASExxx
|
|
cd /opt/patching
|
|
|
|
wlog "${KS} fetch patch metadata from $patches_url/metadata to /opt/patching/metadata"
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$patches_cut_dirs $patches_url/metadata/ -o $anaconda_logdir/patches_rpmget_metadata.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_metadata.log
|
|
|
|
wlog "${KS} save a copy of all patch packages to /opt/patching/packages/xxxPLATFORM_RELEASExxx ; preserve attributes"
|
|
find /var/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages -name '*.rpm' \
|
|
| xargs --no-run-if-empty -I files cp --preserve=all files /opt/patching/packages/xxxPLATFORM_RELEASExxx/
|
|
else
|
|
wlog "${KS} Patches are not required to be downloaded in post phase"
|
|
fi
|
|
|
|
%end
|