Skip to content

Commit

Permalink
restore: read from backup inventory before unmounting (xenserver#150)
Browse files Browse the repository at this point in the history
This fixes a regression introduced in e9d686a.

This is not sufficient however to get Restore to work un UEFI, as
setEfiBootEntry() assumes `mounts['efi']` is populated, which is not
the case (only `backend.mountVolumes()` would set that).

Signed-off-by: Yann Dirson <[email protected]>
  • Loading branch information
ydirson committed Jul 3, 2024
1 parent dfb85dc commit 75edd2c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ def restore_partitions():
util.assertDir(os.path.dirname(dst_file))
boot_config.commit(dst_file)

# prepare for boot loader restoration, before unmounting backup_fs
if boot_config.src_fmt == 'grub2' and efi_boot:
branding = util.readKeyValueFile(os.path.join(backup_fs.mount_point, constants.INVENTORY_FILE))
branding['product-brand'] = branding['PRODUCT_BRAND']

# repartition if needed
backup_fs.unmount()
if restore_partitions:
Expand All @@ -209,8 +214,6 @@ def restore_partitions():
# restore boot loader
if boot_config.src_fmt == 'grub2':
if efi_boot:
branding = util.readKeyValueFile(os.path.join(backup_fs.mount_point, constants.INVENTORY_FILE))
branding['product-brand'] = branding['PRODUCT_BRAND']
backend.setEfiBootEntry(mounts, disk_device, boot_partnum, constants.INSTALL_TYPE_RESTORE, branding)
else:
if location == constants.BOOT_LOCATION_MBR:
Expand Down

0 comments on commit 75edd2c

Please sign in to comment.