From a539fb1a4b09598844d98b89b76b5b9d3eec1bac Mon Sep 17 00:00:00 2001 From: Robert Church Date: Wed, 6 Apr 2022 10:26:20 -0400 Subject: [PATCH] Debian KS: Populate patching ostree repo from ISO To support the management of air gapped ostree patching, we need to also install a copy of the ostree repo delivered with the ISO to a location accessible to the patching subsystem. This update integrates with the current PXE boot support for this functionality. Test Plan: PASS - Build ISO PASS - Boot/install ISO and confirm that the ostree_repo is copied successfully. PASS - Confirm PXE booted system copies ostree_repo as expected Change-Id: Id3a39d232c3d028caa6cbfe66fbfce7bbe2384c7 Story: 2009964 Task: 45015 Signed-off-by: Robert Church --- kickstart/files/kickstart.cfg | 38 ++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/kickstart/files/kickstart.cfg b/kickstart/files/kickstart.cfg index c0adfcdb..74ff783e 100644 --- a/kickstart/files/kickstart.cfg +++ b/kickstart/files/kickstart.cfg @@ -1916,7 +1916,6 @@ if [ "${controller}" = true -a ${OSTREE_REPO_FETCHED} -eq 0 ] ; then $(is_system_node_install) if [ $? -ne 0 ] ; then sw_release="xxxPLATFORM_RELEASExxx" - pxeurl=$(echo $insturl | sed -e s/ostree_repo//) # -1 is all commits, positive number is that number of last commits commits="--depth=-1" @@ -1927,7 +1926,11 @@ if [ "${controller}" = true -a ${OSTREE_REPO_FETCHED} -eq 0 ] ; then ilog "Pull ostree_repo to ${repo}" ostree --repo=${repo} init --mode=archive - ostree --repo=${repo} remote add ${instbr} ${insturl} + if [ "${insturl}" = "file://NOT_SET" ] ; then + ostree --repo=${repo} remote add ${instbr} file:///instboot/ostree_repo + else + ostree --repo=${repo} remote add ${instbr} ${insturl} + fi ostree --repo=${repo} pull ${pull_options} ${instbr}:${instbr} # TODO: Figure out a way on the second run /sysroot/ostree/2 @@ -1944,18 +1947,29 @@ if [ "${controller}" = true -a ${OSTREE_REPO_FETCHED} -eq 0 ] ; then pushd ${feed} - # TODO: Remove ; This is temporary until the kernel and initrd are fetched from ostree_repo - wget ${NOVERIFYSSL_WGET_OPT} --spider --quiet ${pxeurl}/bzImage - [ $? -ne 0 ] && report_failure_with_msg "Failed to find bzImage on pxeboot server ; ${sw_release} ${pxeurl}" - wget ${NOVERIFYSSL_WGET_OPT} --reject 'index.html*' --quiet ${pxeurl}/bzImage - [ $? -ne 0 ] && report_failure_with_msg "Failed to get bzImage from pxeboot server ; ${sw_release} ${pxeurl}" + pxeurl=$(echo $insturl | sed -e s/ostree_repo//) + if [ "${pxeurl}" = "file://NOT_SET" ] ; then + cp /instboot/bzImage . + cp /instboot/initrd . + else + # TODO: Remove ; This is temporary until the kernel and initrd are fetched from ostree_repo + wget ${NOVERIFYSSL_WGET_OPT} --spider --quiet ${pxeurl}/bzImage + [ $? -ne 0 ] && report_failure_with_msg "Failed to find bzImage on pxeboot server ; ${sw_release} ${pxeurl}" + wget ${NOVERIFYSSL_WGET_OPT} --reject 'index.html*' --quiet ${pxeurl}/bzImage + [ $? -ne 0 ] && report_failure_with_msg "Failed to get bzImage from pxeboot server ; ${sw_release} ${pxeurl}" - wget ${NOVERIFYSSL_WGET_OPT} --spider --quiet ${pxeurl}/initrd - [ $? -ne 0 ] && report_failure_with_msg "Failed to find initrd on pxeboot server ; ${sw_release} ${pxeurl}" - wget ${NOVERIFYSSL_WGET_OPT} --reject 'index.html*' --quiet ${pxeurl}/initrd - [ $? -ne 0 ] && report_failure_with_msg "Failed to get initrd from pxeboot server ; ${sw_release} ${pxeurl}" + wget ${NOVERIFYSSL_WGET_OPT} --spider --quiet ${pxeurl}/initrd + [ $? -ne 0 ] && report_failure_with_msg "Failed to find initrd on pxeboot server ; ${sw_release} ${pxeurl}" + wget ${NOVERIFYSSL_WGET_OPT} --reject 'index.html*' --quiet ${pxeurl}/initrd + [ $? -ne 0 ] && report_failure_with_msg "Failed to get initrd from pxeboot server ; ${sw_release} ${pxeurl}" + fi - # TODO: Not neeed once the kickstart is in the iso + # Copy the kernel and initrd to the release based pxeboot dir + mkdir -p /var/pxeboot/${sw_release} + cp -a ${feed}/bzImage /var/pxeboot/${sw_release} + cp -a ${feed}/initrd /var/pxeboot/${sw_release} + + # TODO: Not needed once the kickstart is in the iso # Save the kickstart cp /${LAT_DIR}/lat-installer.ks ${feed}/kickstart.cfg