diff --git a/bsp-files/kickstarts/post_miniboot_controller.cfg b/bsp-files/kickstarts/post_miniboot_controller.cfg index 95b4f002..fc2604da 100644 --- a/bsp-files/kickstarts/post_miniboot_controller.cfg +++ b/bsp-files/kickstarts/post_miniboot_controller.cfg @@ -121,12 +121,17 @@ if [ "${iso_check}" = true -a "${iso_mount}" = true ] ; then wlog "${KS} Local Install ready" fi +if [ "${iso_mount}" = false ] ; then + wlog "${KS} Prestage ISO is not available" +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 the System Controller - Remote Install +# Otherwise, they are fetched from platform backup. +# 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}/ @@ -191,7 +196,6 @@ PACKAGES_DIR=${PATCHING_DIR}/packages/xxxPLATFORM_RELEASExxx/ KS="Miniboot post:" if [ -d ${SYSIMAGE_MOUNT} ] ; then - files="$(ls -lrt ${SYSIMAGE_MOUNT})" wlog "${KS} ${SYSIMAGE_MOUNT} files : $files[@]" if [ -d ${FEED_DIR} ] ; then @@ -244,30 +248,58 @@ if [ -d ${SYSIMAGE_MOUNT} ] ; then else wlog "${KS} $PACKAGES_DIR does not exist" fi - + wlog "${KS} end of sysimage_mount ${SYSIMAGE_MOUNT}" else wlog "${KS} Error : $SYSIMAGE_MOUNT does not exists or is not a directory" fi -# Decide on install mode ; local or remote +# # Handle 3 prestaging conditions +# +# 1. Full local install ; iso present in platform-backup/rel +# 2. Prioritized install ; use prestaged content and fetch what's missing remotely +# 3. Full remote install ; no prestaging content in platform-backup/rel if [ -d /mnt/bootimage ]; then + wlog "${KS} /mnt/bootimage" srcdir=/mnt/bootimage +elif [ -d /mnt/platform-backup/xxxPLATFORM_RELEASExxx ] ; then + wlog "${KS} looking for packages in /mnt/platform_backup" + srcdir=/mnt/platform-backup/xxxPLATFORM_RELEASExxx else # Remote System Controller + wlog "${KS} /mnt/install/source" srcdir=/mnt/install/source fi +need_packages=false +need_patches=false + # prepare to boot other hosts by mirroring sw repository if [ -d $srcdir/Packages ] ; then wlog "${KS} copying software repository $srcdir/Packages" mkdir -p ${FEED_DIR} - cp -r $srcdir/Packages ${FEED_DIR}/Packages - if [ -d $srcdir/repodata ] ; then - cp -r $srcdir/repodata ${FEED_DIR}/repodata + packagefilecount=$(ls ${srcdir}/Packages | wc -l) + if [ ${packagefilecount} = 0 ]; then + wlog "${KS} ${srcdir}/Packages is empty. Fetching remotely" + need_packages=true else - wlog "${KS} $srcdir/repodata dir does not exist" + cp -r $srcdir/Packages ${FEED_DIR}/Packages + if [ -d $srcdir/repodata ] ; then + repodatafilecount=$(ls ${srcdir}/repodata | wc -l) + if [ ${repodatafilecount} = 0 ]; then + wlog "${KS} ${srcdir}/repodata is empty.Fetching remotely" + need_packages=true + else + cp -r $srcdir/repodata ${FEED_DIR}/repodata + fi + else + wlog "${KS} $srcdir/repodata dir does not exist. Fetching remotely" + need_packages=true + fi fi +else + wlog "${KS} $srcdir/Packages not found. Fetching remotely" + need_packages=true fi if [ -d $srcdir/patches ]; then @@ -276,7 +308,8 @@ if [ -d $srcdir/patches ]; then mkdir -p ${UPDATES_DIR} cp -r $srcdir/patches/Packages ${UPDATES_DIR}/Packages else - wlog "${KS} $srcdir/patches/Packages does not exist" + wlog "${KS} $srcdir/patches/Packages does not exist. Fetching remotely" + need_patches=true fi if [ -d $srcdir/patches/repodata ] ; then @@ -284,21 +317,39 @@ if [ -d $srcdir/patches ]; then mkdir -p ${UPDATES_DIR} cp -r $srcdir/patches/repodata ${UPDATES_DIR}/repodata else - wlog "${KS} $srcdir/patches/repodata does not exist" + wlog "${KS} $srcdir/patches/repodata does not exist. Fetching remotely" + need_patches=true fi +else + wlog "${KS} $srcdir/patches does not exist. Fetching remotely" + need_patches=true fi -if [ -d $srcdir/patches/metadata ] ; then +if [ -d $srcdir/patches/metadata -a "${need_patches}" = false ] ; then mkdir -p ${PATCHING_DIR} wlog "${KS} copying $srcdir/patches/metadata to ${PATCHING_DIR}" 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 ]; then +if [ -d $srcdir/patches -a "${need_patches}" = false ]; then mkdir -p ${PACKAGES_DIR} wlog "${KS} copying packages" 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 [ "${need_packages}" = true ]; then + echo > ${SYSIMAGE_MOUNT}/tmp/needpackages +fi + +if [ "${need_patches}" = true ]; then + echo > ${SYSIMAGE_MOUNT}/tmp/needpatches fi %end @@ -329,7 +380,7 @@ else fi -# If the patch to $FEED_DIR does not exist then proceed to create it and +# 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 @@ -337,7 +388,28 @@ fi # FEED_DIR=/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx declare -i cut_dirs=NUM_DIRS -if [ ! -d "${FEED_DIR}/Packages" ]; then + +declare need_packages= +declare need_patches= + +if [ -f /tmp/needpackages ]; then + wlog "${KS} Packages need to be downloaded" + need_packages=true + rm /tmp/needpackages +else + need_packages=false +fi + + +if [ -f /tmp/needpatches ]; then + wlog "${KS} patches need to be downloaded" + need_patches=true + rm /tmp/needpatches +else + need_patches=false +fi + +if ( [ ! -d "${FEED_DIR}/Packages" ] || [ ! -d "${FEED_DIR}/repodata" ] ) && [ "${need_packages}" = true ]; then mkdir -p "${FEED_DIR}/Packages" mkdir -p "${FEED_DIR}/repodata" cd "${FEED_DIR}" @@ -354,7 +426,8 @@ if [ ! -d "${FEED_DIR}/Packages" ]; then wlog "${KS} download of $feed_url/Packages/ complete" - # Fetch Repodata + # Fetch Repodata. In the case of "${need_packages} = yes", it is better to fetch + # both the Packages as well as the repodata (since repodata is correlated with the Packages) wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \ --cut-dirs=$cut_dirs $feed_url/repodata/ -o $anaconda_logdir/rpmget_repo.log \ || report_post_failure_with_logfile $anaconda_logdir/rpmget_repo.log @@ -371,7 +444,7 @@ fi # - 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 +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 @@ -402,7 +475,7 @@ if [ $? -eq 0 ]; then 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} get from patches url '$patches_url' failed" + wlog "${KS} Patches are not required to be downloaded" fi %end