From f4d74ba4adda28c44b322ee240cf88cfff4910e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Thu, 31 Jul 2025 13:17:21 +0200 Subject: [PATCH] enhance the 300_map_disks.sh script to also print the disk sizes Resolves: RHEL-83241 --- ...t-disk-mapping-with-sizes-RHEL-83241.patch | 51 +++++++++++++++++++ rear.spec | 4 ++ 2 files changed, 55 insertions(+) create mode 100644 rear-print-disk-mapping-with-sizes-RHEL-83241.patch diff --git a/rear-print-disk-mapping-with-sizes-RHEL-83241.patch b/rear-print-disk-mapping-with-sizes-RHEL-83241.patch new file mode 100644 index 0000000..7a79c67 --- /dev/null +++ b/rear-print-disk-mapping-with-sizes-RHEL-83241.patch @@ -0,0 +1,51 @@ +diff --git a/usr/share/rear/layout/prepare/default/300_map_disks.sh b/usr/share/rear/layout/prepare/default/300_map_disks.sh +index 468aa35cf..40ba876c7 100644 +--- a/usr/share/rear/layout/prepare/default/300_map_disks.sh ++++ b/usr/share/rear/layout/prepare/default/300_map_disks.sh +@@ -110,7 +110,10 @@ done + # to current block devices in the currently running recovery system: + while read keyword orig_device orig_size junk ; do + # Continue with next original device when it is already used as source in the mapping file: +- is_mapping_source "$orig_device" && continue ++ if is_mapping_source "$orig_device" ; then ++ DebugPrint "Skip automapping $orig_device with size $orig_size (already exists as source in $MAPPING_FILE)" ++ continue ++ fi + # First, try to find if there is a current disk with same name and same size as the original: + # (possibly influenced by mapping hints if known) + if has_mapping_hint "$orig_device" ; then +@@ -162,7 +165,7 @@ while read keyword orig_device orig_size junk ; do + # Ensure the determined target device is really a block device: + if test -b "$preferred_target_device_name" ; then + add_mapping "$orig_device" "$preferred_target_device_name" +- LogPrint "Using $preferred_target_device_name (same size) for recreating $orig_device" ++ LogPrint "Using $preferred_target_device_name (same size $current_size) for recreating $orig_device" + # Break looping over all current block devices to find one + # and continue with next original device in the LAYOUT_FILE: + break +@@ -213,6 +216,7 @@ while read keyword orig_device orig_size junk ; do + Log "$preferred_target_device_name excluded from device mapping choices (is already used as mapping target)" + continue + fi ++ LogPrint "The size of $preferred_target_device_name is $(blockdev --getsize64 $current_device_path)" + # Add the current device as possible choice for the user: + possible_targets+=( "$preferred_target_device_name" ) + done +@@ -225,7 +229,7 @@ while read keyword orig_device orig_size junk ; do + # At the end the mapping file is shown and the user can edit it if he does not like an automated mapping: + if test "1" -eq "${#possible_targets[@]}" ; then + add_mapping "$orig_device" "$possible_targets" +- LogPrint "Using $possible_targets (the only appropriate) for recreating $orig_device" ++ LogPrint "Using $possible_targets (the only available of the disks) for recreating $orig_device with size $orig_size" + # Continue with next original device in the LAYOUT_FILE: + continue + fi +@@ -233,7 +237,7 @@ while read keyword orig_device orig_size junk ; do + skip_choice="Do not map $preferred_orig_device_name" + regular_choices=( "${possible_targets[@]}" "$skip_choice" ) + rear_shell_choice="Use Relax-and-Recover shell and return back to here" +- prompt="Choose an appropriate replacement for $preferred_orig_device_name" ++ prompt="Choose an appropriate replacement for $preferred_orig_device_name with size $orig_size" + choice="" + wilful_input="" + # Generate a runtime-specific user_input_ID so that for each unmapped original device diff --git a/rear.spec b/rear.spec index 02cbbcc..25bfe3c 100644 --- a/rear.spec +++ b/rear.spec @@ -107,6 +107,10 @@ Patch124: rear-support-multi-keyslot-luks-RHEL-83776.patch # https://github.com/rear/rear/commit/62d9a744ff710de34035ce15bd1b1bf810b6934a Patch125: rear-rescue-ed25519-hostkey-support-RHEL-83479.patch +# enhance the 300_map_disks.sh script to also print the disk sizes +# https://github.com/rear/rear/commit/43d62fdfcac50b35be4f99d45bac3b5340525a7a +Patch126: rear-print-disk-mapping-with-sizes-RHEL-83241.patch + ###################### # downstream patches # ######################