Merge "Update prestaged ostree-repo location for subcloud factory restore"
This commit is contained in:
@@ -2125,6 +2125,27 @@ else
|
||||
backup_mount=/tmp/platform-backup
|
||||
backup_mount_release="${backup_mount}"/xxxPLATFORM_RELEASExxx
|
||||
|
||||
# If this install is part of a factory auto-restore operation, the
|
||||
# prestaged ostree_repo is inside the factory backup directory
|
||||
if [[ "${include_paths}" == *"auto-restore"* ]]; then
|
||||
ilog "Auto-restore detected, mounting instboot to verify auto-restore mode..."
|
||||
mkdir -p /instboot
|
||||
if mount /dev/disk/by-label/instboot /instboot 2>/dev/null; then
|
||||
ilog "Successfully mounted /dev/disk/by-label/instboot to /instboot"
|
||||
else
|
||||
report_failure_with_msg "Failed to mount /dev/disk/by-label/instboot to /instboot"
|
||||
fi
|
||||
|
||||
restore_config="/instboot/auto-restore/backup_restore_values.yml"
|
||||
auto_restore_mode=$(grep "^auto_restore_mode:" "$restore_config" 2>/dev/null | sed 's/auto_restore_mode: *//' | tr -d '"' | tr -d "'")
|
||||
ilog "auto_restore_mode: '$auto_restore_mode'"
|
||||
if [[ "$auto_restore_mode" == "factory" ]]; then
|
||||
backup_mount_release="${backup_mount}/factory/xxxPLATFORM_RELEASExxx"
|
||||
ilog "Set backup_mount_release to factory path: $backup_mount_release"
|
||||
fi
|
||||
umount /instboot
|
||||
fi
|
||||
|
||||
ilog "Temporary backup mount: ${backup_mount}, release: ${backup_mount_release}"
|
||||
mkdir -p "${backup_mount}"
|
||||
mount "${backup_device}" "${backup_mount}" 2>/dev/null
|
||||
@@ -2177,6 +2198,12 @@ else
|
||||
# Check if auto-restore is enabled, if so, prestaged ostree_repo is mandatory
|
||||
if [[ "${include_paths}" == *"auto-restore"* ]]; then
|
||||
if [ ! -e "${backup_mount_release}/ostree_repo" ] || [ -n "${local_repo_check_fail}" ]; then
|
||||
if [ -d "${backup_mount_release}" ]; then
|
||||
elog "Contents of backup_mount_release (${backup_mount_release}):"
|
||||
elog "$(ls -la "${backup_mount_release}" 2>/dev/null || echo "Failed to list directory contents")"
|
||||
else
|
||||
elog "Directory ${backup_mount_release} does not exist"
|
||||
fi
|
||||
report_failure_with_msg "ostree_repo must be prestaged for auto-restore operation"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user