Force installation of prestage iso when force_install option is

provided through the kernel commandline

When there is an existing installation on the subcloud, the
kickstart will ensure that it is not overwritten by the prestaged
iso.

However, when the force_install option is provided via the kernel
commandline, the existing installation can be overwritten.

Test Plan:
PASS: Verify that the prestage iso overwrites the existing
      installation when the force_install option is provided at
      the kernel commandline.

PASS: Verify that the installation halts with a message, if there
      is an existing installation and force_install option is
      not provided at the kernel commandline.

PASS: Verify that the prestage iso installs when there is no
      pre-existing installation and force_install is provided

PASS: Verify that above tests pass on NVMe-based systems

Regression:
PASS: Verify that the prestage iso installs without force_install
      and no installation exists

Story: 2009948
Task: 44914

Signed-off-by: Shrikumar Sharma <shrikumar.sharma@windriver.com>
Change-Id: I2491d80cb4e07aa2fb38381c9e92afd7549526ef
This commit is contained in:
Shrikumar Sharma 2022-04-01 14:25:02 -04:00
parent 3ac0bcfd99
commit dc3bfbf164
1 changed files with 57 additions and 48 deletions

View File

@ -11,7 +11,11 @@ wlog "pre prestaging install check"
# First, parse /proc/cmdline to find the boot args
set -- `cat /proc/cmdline`
for I in $*; do case "$I" in *=*) eval $I 2>/dev/null;; esac; done
for J in $*; do case "$J" in force_install) force_install=${J};; esac; done
# if force_install is set, install anyway. Ignore the remainder of this section.
if [ -z ${force_install} ]; then
if [ -z "$rootfs_device" ]; then
rootfs_device=$(get_disk_dev)
fi
@ -60,7 +64,12 @@ for part in "${part_numbers[@]}"; do
# do not modify the system in any way
report_pre_failure_with_msg "Prestage rejected. Existing installation detected. Please eject the media before rebooting."
fi
wlog "Unmounting ${device}"
umount ${temp_mount}
done
wlog "Installing Prestaged content. No existing installation found."
else
# force install inspite of existing installation
wlog "Force install the prestage content"
wlog "Installing Prestaged content. All existing installations will be lost."
fi
%end