From 0fe6cff75165cba413d033f162faf81330509245 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 7 Feb 2023 08:11:07 +0000 Subject: [PATCH] import rear-2.6-8.el8 --- SOURCES/rear-bz2091163.patch | 46 +++++++++++++ SOURCES/rear-bz2130945.patch | 20 ++++++ SOURCES/rear-bz2131946.patch | 129 +++++++++++++++++++++++++++++++++++ SPECS/rear.spec | 13 +++- 4 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 SOURCES/rear-bz2091163.patch create mode 100644 SOURCES/rear-bz2130945.patch create mode 100644 SOURCES/rear-bz2131946.patch diff --git a/SOURCES/rear-bz2091163.patch b/SOURCES/rear-bz2091163.patch new file mode 100644 index 0000000..3a68a34 --- /dev/null +++ b/SOURCES/rear-bz2091163.patch @@ -0,0 +1,46 @@ +diff --git a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh +index d3c9ae86..f21845df 100644 +--- a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh ++++ b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh +@@ -70,14 +70,20 @@ local lvs_exit_code + # Get physical_device configuration. + # Format: lvmdev [] [] + header_printed="no" +- # Example output of "lvm pvdisplay -c": +- # /dev/sda1:system:41940992:-1:8:8:-1:4096:5119:2:5117:7wwpcO-KmNN-qsTE-7sp7-JBJS-vBdC-Zyt1W7 ++ # Set pvdisplay separator to '|' to prevent issues with a colon in the path under /dev/disk/by-path ++ # that contains a ':' in the SCSI slot name. ++ # Example output of "lvm pvdisplay -C --separator '|' --noheadings --nosuffix --units=b -o pv_name,vg_name,pv_size,pv_uuid" ++ # on a system where LVM is configured to show the /dev/disk/by-path device names instead of the usual ++ # /dev/sda etc. (by using a setting like ++ # filter = [ "r|/dev/disk/by-path/.*-usb-|", "a|/dev/disk/by-path/pci-.*-nvme-|", "a|/dev/disk/by-path/pci-.*-scsi-|", "a|/dev/disk/by-path/pci-.*-ata-|", "a|/dev/disk/by-path/pci-.*-sas-|", "a|loop|", "r|.*|" ] ++ # in /etc/lvm/lvm.conf): ++ # /dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0-part1|system|107340627968|7wwpcO-KmNN-qsTE-7sp7-JBJS-vBdC-Zyt1W7 + # There are two leading blanks in the output (at least on SLES12-SP4 with LVM 2.02.180). +- lvm pvdisplay -c | while read line ; do ++ lvm pvdisplay -C --separator '|' --noheadings --nosuffix --units=b -o pv_name,vg_name,pv_size,pv_uuid | while read line ; do + +- # With the above example pdev=/dev/sda1 ++ # With the above example pdev=/dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0-part1 + # (the "echo $line" makes the leading blanks disappear) +- pdev=$( echo $line | cut -d ":" -f "1" ) ++ pdev=$( echo $line | cut -d "|" -f "1" ) + + # Skip lines that are not describing physical devices + # i.e. lines where pdev does not start with a leading / character: +@@ -91,11 +97,11 @@ local lvs_exit_code + fi + + # With the above example vgrp=system +- vgrp=$( echo $line | cut -d ":" -f "2" ) +- # With the above example size=41940992 +- size=$( echo $line | cut -d ":" -f "3" ) ++ vgrp=$( echo $line | cut -d "|" -f "2" ) ++ # With the above example size=107340627968 ++ size=$( echo $line | cut -d "|" -f "3" ) + # With the above example uuid=7wwpcO-KmNN-qsTE-7sp7-JBJS-vBdC-Zyt1W7 +- uuid=$( echo $line | cut -d ":" -f "12" ) ++ uuid=$( echo $line | cut -d "|" -f "4" ) + + # Translate pdev through diskbyid_mappings file: + pdev=$( get_device_mapping $pdev ) diff --git a/SOURCES/rear-bz2130945.patch b/SOURCES/rear-bz2130945.patch new file mode 100644 index 0000000..5291d13 --- /dev/null +++ b/SOURCES/rear-bz2130945.patch @@ -0,0 +1,20 @@ +diff --git a/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh b/usr/share/rear/finalize/Fedora/550_rebuild_initramfs.sh +similarity index 100% +rename from usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh +rename to usr/share/rear/finalize/Fedora/550_rebuild_initramfs.sh +diff --git a/usr/share/rear/finalize/Fedora/ppc64/550_rebuild_initramfs.sh b/usr/share/rear/finalize/Fedora/ppc64/550_rebuild_initramfs.sh +deleted file mode 120000 +index 22eede59..00000000 +--- a/usr/share/rear/finalize/Fedora/ppc64/550_rebuild_initramfs.sh ++++ /dev/null +@@ -1 +0,0 @@ +-../i386/550_rebuild_initramfs.sh +\ No newline at end of file +diff --git a/usr/share/rear/finalize/Fedora/ppc64le/550_rebuild_initramfs.sh b/usr/share/rear/finalize/Fedora/ppc64le/550_rebuild_initramfs.sh +deleted file mode 120000 +index 22eede59..00000000 +--- a/usr/share/rear/finalize/Fedora/ppc64le/550_rebuild_initramfs.sh ++++ /dev/null +@@ -1 +0,0 @@ +-../i386/550_rebuild_initramfs.sh +\ No newline at end of file diff --git a/SOURCES/rear-bz2131946.patch b/SOURCES/rear-bz2131946.patch new file mode 100644 index 0000000..1ee90ba --- /dev/null +++ b/SOURCES/rear-bz2131946.patch @@ -0,0 +1,129 @@ +diff --git a/usr/share/rear/layout/prepare/GNU/Linux/131_include_filesystem_code.sh b/usr/share/rear/layout/prepare/GNU/Linux/131_include_filesystem_code.sh +index 172ac032..9cff63a0 100644 +--- a/usr/share/rear/layout/prepare/GNU/Linux/131_include_filesystem_code.sh ++++ b/usr/share/rear/layout/prepare/GNU/Linux/131_include_filesystem_code.sh +@@ -143,9 +143,9 @@ function create_fs () { + # unless the user has explicitly specified XFS filesystem options: + local xfs_opts + local xfs_device_basename="$( basename $device )" +- local xfs_info_filename="$LAYOUT_XFS_OPT_DIR/$xfs_device_basename.xfs" ++ local xfs_info_filename="$LAYOUT_XFS_OPT_DIR_RESTORE/$xfs_device_basename.xfs" + # Only uppercase letters and digits are used to ensure mkfs_xfs_options_variable_name is a valid bash variable name +- # even in case of complicated device nodes e.g. things like /dev/mapper/SIBM_2810XIV_78033E7012F-part3 ++ # even in case of complicated device nodes e.g. things like /dev/mapper/SIBM_2810XIV_78033E7012F-part3 + # cf. current_orig_device_basename_alnum_uppercase in layout/prepare/default/300_map_disks.sh + local xfs_device_basename_alnum_uppercase="$( echo $xfs_device_basename | tr -d -c '[:alnum:]' | tr '[:lower:]' '[:upper:]' )" + # cf. predefined_input_variable_name in the function UserInput in lib/_input-output-functions.sh +diff --git a/usr/share/rear/layout/prepare/default/010_prepare_files.sh b/usr/share/rear/layout/prepare/default/010_prepare_files.sh +index 85964712..7a980e63 100644 +--- a/usr/share/rear/layout/prepare/default/010_prepare_files.sh ++++ b/usr/share/rear/layout/prepare/default/010_prepare_files.sh +@@ -5,6 +5,7 @@ LAYOUT_DEPS="$VAR_DIR/layout/diskdeps.conf" + LAYOUT_TODO="$VAR_DIR/layout/disktodo.conf" + LAYOUT_CODE="$VAR_DIR/layout/diskrestore.sh" + LAYOUT_XFS_OPT_DIR="$VAR_DIR/layout/xfs" ++LAYOUT_XFS_OPT_DIR_RESTORE="$LAYOUT_XFS_OPT_DIR/restore" + + FS_UUID_MAP="$VAR_DIR/layout/fs_uuid_mapping" + LUN_WWID_MAP="$VAR_DIR/layout/lun_wwid_mapping" +diff --git a/usr/share/rear/layout/prepare/default/319_rename_xfs_configs.sh b/usr/share/rear/layout/prepare/default/319_rename_xfs_configs.sh +new file mode 100644 +index 00000000..406afa61 +--- /dev/null ++++ b/usr/share/rear/layout/prepare/default/319_rename_xfs_configs.sh +@@ -0,0 +1,83 @@ ++# Cleanup directory which hold XFS configuration file for `rear recover'. ++# This will avoid possible mess in LAYOUT_XFS_OPT_DIR_RESTORE if `rear recover' ++# would be launched multiple times, where user will choose different disk ++# mapping each time. ++# Removing and creating LAYOUT_XFS_OPT_DIR_RESTORE will ensure that ReaR will ++# have only current files available during current session. ++rm -rf "$LAYOUT_XFS_OPT_DIR_RESTORE" ++mkdir -p "$LAYOUT_XFS_OPT_DIR_RESTORE" ++ ++local excluded_configs=() ++ ++# Read $MAPPING_FILE (disk_mappings) to discover final disk mapping. ++# Once mapping is known, configuration files can be renamed. ++# (e.g. sds2.xfs to sdb2.xfs, ...) ++while read source target junk ; do ++ # Disks in MAPPING_FILE are listed with full device path. Since XFS config ++ # files are created in format e.g. sda2.xfs strip prefixed path to have ++ # only short device name available. ++ base_source=$(basename "$source") ++ base_target=$(basename "$target") ++ ++ # Check if XFS configuration file for whole device (unpartitioned) ++ # is available (sda, sdb, ...). If so, rename and copy it to ++ # LAYOUT_XFS_OPT_DIR_RESTORE. ++ if [ -e "$LAYOUT_XFS_OPT_DIR/$base_source.xfs" ]; then ++ Log "Migrating XFS configuration file $base_source.xfs to $base_target.xfs" ++ cp "$v" "$LAYOUT_XFS_OPT_DIR/$base_source.xfs" \ ++ "$LAYOUT_XFS_OPT_DIR_RESTORE/$base_target.xfs" ++ ++ # Replace old device name in meta-data= option in XFS ++ # configuration file as well. ++ sed -i s#"meta-data=${source}\(\s\)"#"meta-data=${target}\1"# \ ++ "$LAYOUT_XFS_OPT_DIR_RESTORE/$base_target.xfs" ++ ++ # Mark XFS config file as processed to avoid copying it again later. ++ # More details on why are configs excluded can be found near the ++ # end of this script (near `tar' command). ++ excluded_configs+=("--exclude=$base_source.xfs") ++ fi ++ ++ # Find corresponding partitions to source disk in LAYOUT_FILE ++ # and migrate/rename them too if necessary. ++ while read _ layout_device _ _ _ _ layout_partition; do ++ if [[ "$source" = "$layout_device" ]]; then ++ base_src_layout_partition=$(basename "$layout_partition") ++ base_dst_layout_partition=${base_src_layout_partition//$base_source/$base_target} ++ dst_layout_partition=${layout_partition//$base_source/$base_target} ++ ++ if [ -e "$LAYOUT_XFS_OPT_DIR/$base_src_layout_partition.xfs" ]; then ++ Log "Migrating XFS configuration $base_src_layout_partition.xfs to $base_dst_layout_partition.xfs" ++ cp "$v" "$LAYOUT_XFS_OPT_DIR/$base_src_layout_partition.xfs" \ ++ "$LAYOUT_XFS_OPT_DIR_RESTORE/$base_dst_layout_partition.xfs" ++ ++ # Replace old device name in meta-data= option in XFS ++ # configuration file as well. ++ sed -i s#"meta-data=${layout_partition}\(\s\)"#"meta-data=${dst_layout_partition}\1"# \ ++ "$LAYOUT_XFS_OPT_DIR_RESTORE/$base_dst_layout_partition.xfs" ++ ++ # Mark XFS config file as processed to avoid copying it again later. ++ # More details on why are configs excluded can be found near the ++ # end of this script (near `tar' command). ++ excluded_configs+=("--exclude=$base_src_layout_partition.xfs") ++ fi ++ fi ++ done < <( grep -E "^part " "$LAYOUT_FILE" ) ++done < <( grep -v '^#' "$MAPPING_FILE" ) ++ ++pushd "$LAYOUT_XFS_OPT_DIR" >/dev/null ++# Copy remaining files ++# We need to copy remaining files into LAYOUT_XFS_OPT_DIR_RESTORE which will ++# serve as base dictionary where ReaR will look for XFS config files. ++# It is necessary to copy only files that were not previously processed, ++# because in LAYOUT_XFS_OPT_DIR they are still listed with ++# original name and copy to LAYOUT_XFS_OPT_DIR_RESTORE could overwrite ++# XFS configs already migrated. ++# e.g. with following disk mapping situation: ++# /dev/sda2 => /dev/sdb2 ++# /dev/sdb2 => /dev/sda2 ++# Files in LAYOUT_XFS_OPT_DIR_RESTORE would be overwritten by XFS configs with ++# wrong names. ++# tar is used to take advantage of its exclude feature. ++tar cf - --exclude=restore "${excluded_configs[@]}" . | tar xfp - -C "$LAYOUT_XFS_OPT_DIR_RESTORE" ++popd >/dev/null +diff --git a/usr/share/rear/layout/save/GNU/Linux/100_create_layout_file.sh b/usr/share/rear/layout/save/GNU/Linux/100_create_layout_file.sh +index 7895e4ee..fc0fa8fc 100644 +--- a/usr/share/rear/layout/save/GNU/Linux/100_create_layout_file.sh ++++ b/usr/share/rear/layout/save/GNU/Linux/100_create_layout_file.sh +@@ -10,6 +10,7 @@ mkdir -p $v $VAR_DIR/layout/config + # We need directory for XFS options only if XFS is in use: + if test "$( mount -t xfs )" ; then + LAYOUT_XFS_OPT_DIR="$VAR_DIR/layout/xfs" ++ rm -rf $LAYOUT_XFS_OPT_DIR + mkdir -p $v $LAYOUT_XFS_OPT_DIR + fi + diff --git a/SPECS/rear.spec b/SPECS/rear.spec index a0b586c..6ac499e 100644 --- a/SPECS/rear.spec +++ b/SPECS/rear.spec @@ -3,7 +3,7 @@ Summary: Relax-and-Recover is a Linux disaster recovery and system migration tool Name: rear Version: 2.6 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3 Group: Applications/File URL: http://relax-and-recover.org/ @@ -30,6 +30,9 @@ Patch48: rear-bz2111059.patch Patch49: pxe-rsync-output.patch Patch50: rear-bz2119501.patch Patch51: rear-bz2120736.patch +Patch52: rear-bz2091163.patch +Patch53: rear-bz2130945.patch +Patch54: rear-bz2131946.patch ### Dependencies on all distributions BuildRequires: asciidoc @@ -148,6 +151,9 @@ fi %patch49 -p1 %patch50 -p1 %patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 echo "30 1 * * * root test -f /var/lib/rear/layout/disklayout.conf && /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" >rear.cron @@ -181,6 +187,11 @@ TZ=UTC %{__make} -C doc %{_sbindir}/rear %changelog +* Sun Jan 15 2023 Pavel Cahyna - 2.6-8 +- Apply PR2903 to protect against colons in pvdisplay output +- Apply PR2873 to fix initrd regeneration on s390x +- Apply PR2431 to migrate XFS configuration files + * Wed Aug 24 2022 Pavel Cahyna - 2.6-7 - Avoid stderr message about irrelevant broken links - Changes for NetBackup (NBU) 9.x support