Merge "Fix prestage ISO install abort if previous subcloud install exists"

This commit is contained in:
Zuul 2023-05-23 21:55:34 +00:00 committed by Gerrit Code Review
commit a1acf1a0d1
1 changed files with 16 additions and 18 deletions

View File

@ -1103,30 +1103,28 @@ if check_prestage -eq 0 ; then
ilog "Searching for existing installation..."
device_list=()
# Build up device_list to search for existing installation.
# We will look for the install_uuid file on each of the devices in the list.
# First, if volume groups have been enabled, we can mount /dev/cgts-vg/var-lv
device_list=("/dev/cgts-vg/var-lv")
# Now add the rest of the rootfs partitions to device_list
for part in "${part_numbers[@]}"; do
device=${rootfs_part_prefix}${part}
device_list+=(${device})
ilog "Adding ${device}"
device_list+=("${rootfs_part_prefix}${part}")
done
# adding the following device to the device list to search
# for the filesystem. If Volume Groups have been enabled,
# it is possible to perform the checks for install_guid below
# by mounting /dev/cgts-vg/var-lv.
device_list+=("/dev/cgts-vg/var-lv")
ilog "Adding /dev/cgts-vg/var-lv"
for part in "${device_list[@]}"; do
ilog "Checking device_list: ${device_list[*]}"
for device in "${device_list[@]}"; do
# mount this part at a temporary mount point
mount ${device} ${temp_mount}
if [ $? -ne 0 ]; then
wlog "Unable to mount ${device}"
ilog "Checking device: ${device}"
mount "${device}" "${temp_mount}"
rc=$?
if [ "${rc}" -ne 0 ]; then
wlog "Unable to mount ${device}, rc=${rc}"
continue
fi
# Check for the presence of install_uuid in one of the partitions on
# the root device
if [[ -e "${temp_mount}/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid" ]]; then
# Check for the presence of install_uuid in one of the partitions on the device_list
if [ -e "${temp_mount}/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid" ]; then
wlog "Found valid installation on ${device}"
umount ${temp_mount}
# Do not modify the system in any way