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 <heitorvieira.matsui@windriver.com>
This commit is contained in:
Heitor Matsui 2024-03-06 13:02:36 -03:00
parent 33a4be37bc
commit 3d66eb4c49

View File

@ -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