From 3d66eb4c49efa4a3de0d21811ff3fff19fac8351 Mon Sep 17 00:00:00 2001 From: Heitor Matsui Date: Wed, 6 Mar 2024 13:02:36 -0300 Subject: [PATCH] Copy USM scripts to software dir on fresh install This commit copies the USM scripts to a versioned script directory under /opt/software during a fresh install, so that in the future, when deploy precheck is supported for patches, the patches can use the GA major release precheck if they don't contain a new precheck script, and also for the scenario where an user wants to remove all the patches from the system, reverting to the GA release. Note: the file for subcloud install, miniboot.cfg, will be covered on another commit. Test Plan PASS: run "software deploy precheck" for current running release PASS: run "software deploy precheck" for a patch that does not include a precheck script and that uses the GA script instead Story: 2010676 Task: 49681 Change-Id: I1e6313789204107f56fce8da09f6b785994817ee Signed-off-by: Heitor Matsui --- kickstart/files/kickstart.cfg | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kickstart/files/kickstart.cfg b/kickstart/files/kickstart.cfg index a8cb299c..16026979 100644 --- a/kickstart/files/kickstart.cfg +++ b/kickstart/files/kickstart.cfg @@ -3140,6 +3140,20 @@ else fi fi +# Copy current release scripts to software directory +highest_patch_version="0" +for metadata_file in /instboot/patches/*; do + patch_version=$(grep "sw_version" $metadata_file | cut -d"." -f3 | cut -d'<' -f1) + if [ $patch_version -gt $highest_patch_version ]; then + highest_patch_version=$patch_version; + fi; +done; + +versioned_dir="/opt/software/rel-${sw_release}.${highest_patch_version}/bin" +ilog "Creating versioned USM scripts directory $versioned_dir for current release" +mkdir -p "${IMAGE_ROOTFS}/var/rootdirs/${versioned_dir}" +cp -r /instboot/upgrades/software-deploy/* ${IMAGE_ROOTFS}/var/rootdirs/${versioned_dir} + # Save the install scripts and kickstart logs mount /dev/mapper/cgts--vg-log--lv "${IMAGE_ROOTFS}/${LOG_DIR}" if [ ${?} -ne 0 ] ; then