diff --git a/SOURCES/rear-bz1882060.patch b/SOURCES/rear-bz1882060.patch new file mode 100644 index 0000000..2c15299 --- /dev/null +++ b/SOURCES/rear-bz1882060.patch @@ -0,0 +1,14 @@ +diff -up rear-2.4/usr/share/rear/conf/default.conf.orig rear-2.4/usr/share/rear/conf/default.conf +--- rear-2.4/usr/share/rear/conf/default.conf.orig 2020-12-02 10:12:49.617305887 +0100 ++++ rear-2.4/usr/share/rear/conf/default.conf 2020-12-02 10:12:49.628306023 +0100 +@@ -592,8 +592,8 @@ ISO_MAX_SIZE= + # ebiso (https://github.com/gozora/ebiso/) can be used as alternative + # for mkisofs/genisoimage on UEFI bootable systems + # to use ebiso, specify ISO_MKISOFS_BIN=/ebiso +-# in /etc/rear/local.conf or /etc/rear/site.conv +-# xorisofs is now used as the preferred method for generating the iso image ++# in /etc/rear/local.conf or /etc/rear/site.conf ++# xorrisofs is now used as the preferred method for generating the iso image + # with mkisofs and genisoimage as second and third option + ISO_MKISOFS_BIN="$( type -p xorrisofs || type -p mkisofs || type -p genisoimage )" + diff --git a/SOURCES/rear-bz2131948.patch b/SOURCES/rear-bz2131948.patch new file mode 100644 index 0000000..3411719 --- /dev/null +++ b/SOURCES/rear-bz2131948.patch @@ -0,0 +1,126 @@ +diff --git a/usr/share/rear/layout/prepare/GNU/Linux/130_include_filesystem_code.sh b/usr/share/rear/layout/prepare/GNU/Linux/130_include_filesystem_code.sh +index f8a078b8..b9bafcc5 100644 +--- a/usr/share/rear/layout/prepare/GNU/Linux/130_include_filesystem_code.sh ++++ b/usr/share/rear/layout/prepare/GNU/Linux/130_include_filesystem_code.sh +@@ -140,7 +140,7 @@ function create_fs () { + # xfs_opts will be used as additional parameter for mkfs.xfs and + # ensures that xfs filesystem will be created exactly as original. + local xfs_opts +- xfs_opts=$(xfs_parse $LAYOUT_XFS_OPT_DIR/$(basename ${device}.xfs)) ++ xfs_opts=$(xfs_parse $LAYOUT_XFS_OPT_DIR_RESTORE/$(basename ${device}.xfs)) + + # Decide if mkfs.xfs or xfs_admin will set uuid. + # Uuid set by xfs_admin will set incompatible flag on systems with +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 27d0be07..4742efb3 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 496a2d0c..e992bfc7 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 +@@ -9,6 +9,7 @@ mkdir -p $v $VAR_DIR/layout/config >&2 + # We need directory for XFS options only if XFS is in use + if [ -n "$(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 >&2 + fi + diff --git a/SPECS/rear.spec b/SPECS/rear.spec index 6e0f702..107e235 100644 --- a/SPECS/rear.spec +++ b/SPECS/rear.spec @@ -2,7 +2,7 @@ Summary: Relax-and-Recover is a Linux disaster recovery and system migration tool Name: rear Version: 2.4 -Release: 16%{?dist} +Release: 17%{?dist} License: GPLv3 Group: Applications/File URL: http://relax-and-recover.org/ @@ -28,6 +28,7 @@ Patch22: rear-bz1692575.patch Patch23: rear-sfdc02343208.patch Patch24: rear-bz1726043.patch Patch25: rear-bz1842984-skip-longhorn.patch +Patch28: rear-bz1882060.patch Patch30: rear-sfdc02772301.patch Patch31: rear-bz1945869.patch Patch32: rear-bz1958247.patch @@ -36,6 +37,7 @@ Patch35: rear-bz1983013.patch Patch38: rear-bz1983000.patch Patch39: rear-pr2675.patch Patch42: rear-bz2061521.patch +Patch54: rear-bz2131948.patch ExcludeArch: s390x ExcludeArch: s390 @@ -147,6 +149,7 @@ fi %patch23 -p1 %patch24 -p1 %patch25 -p1 +%patch28 -p1 %patch30 -p1 %patch31 -p1 %patch32 -p1 @@ -155,6 +158,7 @@ fi %patch38 -p1 %patch39 -p1 %patch42 -p1 +%patch54 -p1 echo "30 1 * * * root /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" >rear.cron @@ -189,6 +193,11 @@ TZ=UTC %{__make} -C doc %{_sbindir}/rear %changelog +* Mon Jun 19 2023 Pavel Cahyna - 2.4-17 +- Apply PR2431 to migrate XFS configuration files +- Fix typo in default.conf + Resolves: #1882060 + * Tue Apr 26 2022 Pavel Cahyna - 2.4-16 - Apply upstream PR2237 to include multipath disks in backup