Merge "debian: Improve disk cleanup from previous installs"

This commit is contained in:
Zuul 2022-09-09 21:14:11 +00:00 committed by Gerrit Code Review
commit c0333ac22e
1 changed files with 14 additions and 6 deletions

View File

@ -1176,13 +1176,21 @@ do
part_type_flags=$(echo "$sgdisk_part_info" | grep "$part_type_flags_str" | awk '{print $3;}')
BACKUP_PART_FLAGS=${part_type_flags}
ilog "Platform Backup: ${BACKUP_PART_NAME}:${BACKUP_PART_FIRST}:${BACKUP_PART_END}:${BACKUP_PART_SIZE}:${part_type_guid}"
ilog "Discovered Platform Backup: ${BACKUP_PART_NAME}:${BACKUP_PART_FIRST}:${BACKUP_PART_END}:${BACKUP_PART_SIZE}:${part_type_guid}"
part_fstype=$(exec_retry 5 0.5 "blkid -s TYPE -o value $part")
if [ "${part_fstype}" == "ext4" ]; then
ilog "Skipping wipe of persistent partition $part"
BACKUP_CREATED=1
continue
# Only keep a backup partition that is in the expected location
# and contains a proper filesystem
if [ "${part_number}" == "${BACKUP_PART_NO}" ] ; then
part_fstype=$(exec_retry 5 0.5 "blkid -s TYPE -o value $part")
if [ "${part_fstype}" == "ext4" ]; then
ilog "Skipping wipe of discovered persistent backup partition ${part}"
BACKUP_CREATED=1
continue
else
ilog "Discovered persistent backup partition at ${part}, filesystem is not ext4. Recreating."
fi
else
ilog "Discovered persistent backup partition at ${part}, expected ${BACKUP_PART}. Recreating."
fi
fi
fi