From 3df91bf2d72e97f048fb217b8b30c2ffec2f8cae Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 07 2022 00:19:35 +0000 Subject: import rear-2.6-4.el8 --- diff --git a/SOURCES/rear-bz2035939.patch b/SOURCES/rear-bz2035939.patch new file mode 100644 index 0000000..30771c9 --- /dev/null +++ b/SOURCES/rear-bz2035939.patch @@ -0,0 +1,56 @@ +diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf +index 0c230f38..f231bf3d 100644 +--- a/usr/share/rear/conf/default.conf ++++ b/usr/share/rear/conf/default.conf +@@ -2707,6 +2707,15 @@ WARN_MISSING_VOL_ID=1 + USE_CFG2HTML= + # The SKIP_CFG2HTML variable is no longer supported since ReaR 1.18 + ++# IP addresses that are present on the system but must be excluded when ++# building the network configuration used in recovery mode; this is typically ++# used when floating IP addresses are used on the system ++EXCLUDE_IP_ADDRESSES=() ++ ++# Network interfaces that are present on the system but must be excluded when ++# building the network configuration used in recovery mode ++EXCLUDE_NETWORK_INTERFACES=() ++ + # Simplify bonding setups by configuring always the first active device of a + # bond, except when mode is 4 (IEEE 802.3ad policy) + SIMPLIFY_BONDING=no +diff --git a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh +index f806bfbf..2385f5b6 100644 +--- a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh ++++ b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh +@@ -355,6 +355,11 @@ function is_interface_up () { + local network_interface=$1 + local sysfspath=/sys/class/net/$network_interface + ++ if IsInArray "$network_interface" "${EXCLUDE_NETWORK_INTERFACES[@]}"; then ++ LogPrint "Excluding '$network_interface' per EXCLUDE_NETWORK_INTERFACES directive." ++ return 1 ++ fi ++ + local state=$( cat $sysfspath/operstate ) + if [ "$state" = "down" ] ; then + return 1 +@@ -403,11 +408,19 @@ function ipaddr_setup () { + if [ -n "$ipaddrs" ] ; then + # If some IP is found for the network interface, then use them + for ipaddr in $ipaddrs ; do ++ if IsInArray "${ipaddr%%/*}" "${EXCLUDE_IP_ADDRESSES[@]}"; then ++ LogPrint "Excluding IP address '$ipaddr' per EXCLUDE_IP_ADDRESSES directive even through it's defined in mapping file '$CONFIG_DIR/mappings/ip_addresses'." ++ continue ++ fi + echo "ip addr add $ipaddr dev $mapped_as" + done + else + # Otherwise, collect IP addresses for the network interface on the system + for ipaddr in $( ip a show dev $network_interface scope global | grep "inet.*\ " | tr -s " " | cut -d " " -f 3 ) ; do ++ if IsInArray "${ipaddr%%/*}" "${EXCLUDE_IP_ADDRESSES[@]}"; then ++ LogPrint "Excluding IP address '$ipaddr' per EXCLUDE_IP_ADDRESSES directive." ++ continue ++ fi + echo "ip addr add $ipaddr dev $mapped_as" + done + fi diff --git a/SOURCES/rear-bz2048454.patch b/SOURCES/rear-bz2048454.patch new file mode 100644 index 0000000..428505e --- /dev/null +++ b/SOURCES/rear-bz2048454.patch @@ -0,0 +1,78 @@ +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 35be1721..d3c9ae86 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 +@@ -103,12 +103,7 @@ local lvs_exit_code + pdev=$( get_device_name $pdev ) + + # Output lvmdev entry to DISKLAYOUT_FILE: +- # With the above example the output is: +- # lvmdev /dev/system /dev/sda1 7wwpcO-KmNN-qsTE-7sp7-JBJS-vBdC-Zyt1W7 41940992 +- echo "lvmdev /dev/$vgrp $pdev $uuid $size" +- +- # After the 'lvmdev' line was written to disklayout.conf so that the user can inspect it +- # check that the required positional parameters in the 'lvmdev' line are non-empty ++ # Check that the required positional parameters in the 'lvmdev' line are non-empty + # because an empty positional parameter would result an invalid 'lvmdev' line + # which would cause invalid parameters are 'read' as input during "rear recover" + # cf. "Verifying ... 'lvm...' entries" in layout/save/default/950_verify_disklayout_file.sh +@@ -117,13 +112,24 @@ local lvs_exit_code + # so that this also checks that the variables do not contain blanks or more than one word + # because blanks (actually $IFS characters) are used as field separators in disklayout.conf + # which means the positional parameter values must be exactly one non-empty word. +- # Two separated simple 'test $vgrp && test $pdev' commands are used here because +- # 'test $vgrp -a $pdev' does not work when $vgrp is empty or only blanks +- # because '-a' has two different meanings: "EXPR1 -a EXPR2" and "-a FILE" (see "help test") +- # so that when $vgrp is empty 'test $vgrp -a $pdev' tests if file $pdev exists +- # which is usually true because $pdev is usually a partition device node (e.g. /dev/sda1) +- # so that when $vgrp is empty 'test $vgrp -a $pdev' would falsely succeed: +- test $vgrp && test $pdev || Error "LVM 'lvmdev' entry in $DISKLAYOUT_FILE where volume_group or device is empty or more than one word" ++ test $pdev || Error "Cannot make 'lvmdev' entry in disklayout.conf (PV device '$pdev' empty or more than one word)" ++ if ! test $vgrp ; then ++ # Valid $pdev but invalid $vgrp (empty or more than one word): ++ # When $vgrp is empty it means it is a PV that is not part of a VG so the PV exists but it is not used. ++ # PVs that are not part of a VG are documented as comment in disklayout.conf but they are not recreated ++ # because they were not used on the original system so there is no need to recreate them by "rear recover" ++ # (the user can manually recreate them later in his recreated system when needed) ++ # cf. https://github.com/rear/rear/issues/2596 ++ DebugPrint "Skipping PV $pdev that is not part of a valid VG (VG '$vgrp' empty or more than one word)" ++ echo "# Skipping PV $pdev that is not part of a valid VG (VG '$vgrp' empty or more than one word):" ++ contains_visible_char "$vgrp" || vgrp='' ++ echo "# lvmdev /dev/$vgrp $pdev $uuid $size" ++ # Continue with the next line in the output of "lvm pvdisplay -c" ++ continue ++ fi ++ # With the above example the output is: ++ # lvmdev /dev/system /dev/sda1 7wwpcO-KmNN-qsTE-7sp7-JBJS-vBdC-Zyt1W7 41940992 ++ echo "lvmdev /dev/$vgrp $pdev $uuid $size" + + done + # Check the exit code of "lvm pvdisplay -c" +@@ -161,8 +167,15 @@ local lvs_exit_code + # lvmgrp /dev/system 4096 5119 20967424 + echo "lvmgrp /dev/$vgrp $extentsize $nrextents $size" + +- # Check that the required positional parameters in the 'lvmgrp' line are non-empty +- # cf. the code above to "check that the required positional parameters in the 'lvmdev' line are non-empty": ++ # Check that the required positional parameters in the 'lvmgrp' line are non-empty. ++ # The tested variables are intentionally not quoted here, cf. the code above to ++ # "check that the required positional parameters in the 'lvmdev' line are non-empty". ++ # Two separated simple 'test $vgrp && test $extentsize' commands are used here because ++ # 'test $vgrp -a $extentsize' does not work when $vgrp is empty or only blanks ++ # because '-a' has two different meanings: "EXPR1 -a EXPR2" and "-a FILE" (see "help test") ++ # so with empty $vgrp it becomes 'test -a $extentsize' that tests if a file $extentsize exists ++ # which is unlikely to be true but it is not impossible that a file $extentsize exists ++ # so when $vgrp is empty (or blanks) 'test $vgrp -a $extentsize' might falsely succeed: + test $vgrp && test $extentsize || Error "LVM 'lvmgrp' entry in $DISKLAYOUT_FILE where volume_group or extentsize is empty or more than one word" + + done +@@ -305,7 +318,8 @@ local lvs_exit_code + fi + already_processed_lvs+=( "$vg/$lv" ) + # Check that the required positional parameters in the 'lvmvol' line are non-empty +- # cf. the code above to "check that the required positional parameters in the 'lvmdev' line are non-empty": ++ # cf. the code above to "check that the required positional parameters in the 'lvmdev' line are non-empty" ++ # and the code above to "check that the required positional parameters in the 'lvmgrp' line are non-empty": + test $vg && test $lv && test $size && test $layout || Error "LVM 'lvmvol' entry in $DISKLAYOUT_FILE where volume_group or name or size or layout is empty or more than one word" + fi + diff --git a/SOURCES/rear-bz2049091.patch b/SOURCES/rear-bz2049091.patch new file mode 100644 index 0000000..9f5e12d --- /dev/null +++ b/SOURCES/rear-bz2049091.patch @@ -0,0 +1,25 @@ +diff --git a/usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh b/usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh +index 040e9eec..e731c994 100644 +--- a/usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh ++++ b/usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh +@@ -19,9 +19,9 @@ while read lvmdev name mpdev junk ; do + # Remember, multipath devices from a volume group that is "excluded" should be 'commented out' + device=$(echo $mpdev | cut -c1-45) + while read LINE ; do +- # Now we need to comment all lines that contain "$devices" in the LAYOUT_FILE ++ # Now we need to comment all lines that contain "$device" in the LAYOUT_FILE + sed -i "s|^$LINE|\#$LINE|" "$LAYOUT_FILE" +- done < <(grep "$device" $LAYOUT_FILE | grep -v "^#") ++ done < <(grep " $device " $LAYOUT_FILE | grep -v "^#") + Log "Excluding multipath device $device" + done < <(grep "^#lvmdev" $LAYOUT_FILE) + +@@ -31,7 +31,7 @@ done < <(grep "^#lvmdev" $LAYOUT_FILE) + while read LINE ; do + # multipath /dev/mapper/360060e8007e2e3000030e2e300002065 /dev/sdae,/dev/sdat,/dev/sdbi,/dev/sdp + device=$(echo $LINE | awk '{print $2}' | cut -c1-45) +- num=$(grep "$device" $LAYOUT_FILE | grep -v "^#" | wc -l) ++ num=$(grep " $device " $LAYOUT_FILE | grep -v "^#" | wc -l) + if [ $num -lt 2 ] ; then + # If the $device is only seen once (in a uncommented line) then the multipath is not in use + sed -i "s|^$LINE|\#$LINE|" "$LAYOUT_FILE" diff --git a/SOURCES/rear-pr2675.patch b/SOURCES/rear-pr2675.patch new file mode 100644 index 0000000..7d11071 --- /dev/null +++ b/SOURCES/rear-pr2675.patch @@ -0,0 +1,60 @@ +diff --git a/usr/share/rear/lib/framework-functions.sh b/usr/share/rear/lib/framework-functions.sh +index 4878216b..e919bdbf 100644 +--- a/usr/share/rear/lib/framework-functions.sh ++++ b/usr/share/rear/lib/framework-functions.sh +@@ -121,7 +121,7 @@ function cleanup_build_area_and_end_program () { + sleep 2 + umount_mountpoint_lazy $BUILD_DIR/outputfs + fi +- remove_temporary_mountpoint '$BUILD_DIR/outputfs' || BugError "Directory $BUILD_DIR/outputfs not empty, can not remove" ++ remove_temporary_mountpoint "$BUILD_DIR/outputfs" || BugError "Directory $BUILD_DIR/outputfs not empty, can not remove" + rmdir $v $BUILD_DIR >&2 + fi + Log "End of program reached" +diff --git a/usr/share/rear/lib/global-functions.sh b/usr/share/rear/lib/global-functions.sh +index c1a11615..0f8f362d 100644 +--- a/usr/share/rear/lib/global-functions.sh ++++ b/usr/share/rear/lib/global-functions.sh +@@ -317,7 +317,20 @@ function url_path() { + + ### Returns true if one can upload files to the URL + function scheme_accepts_files() { +- local scheme=$1 ++ # Be safe against 'set -eu' which would exit 'rear' with "bash: $1: unbound variable" ++ # when scheme_accepts_files is called without an argument ++ # by bash parameter expansion with using an empty default value if $1 is unset or null. ++ # Bash parameter expansion with assigning a default value ${1:=} does not work ++ # (then it would still exit with "bash: $1: cannot assign in this way") ++ # but using a default value is practicable here because $1 is used only once ++ # cf. https://github.com/rear/rear/pull/2675#discussion_r705018956 ++ local scheme=${1:-} ++ # Return false if scheme is empty or blank (e.g. when OUTPUT_URL is unset or empty or blank) ++ # cf. https://github.com/rear/rear/issues/2676 ++ # and https://github.com/rear/rear/issues/2667#issuecomment-914447326 ++ # also return false if scheme is more than one word (so no quoted "$scheme" here) ++ # cf. https://github.com/rear/rear/pull/2675#discussion_r704401462 ++ test $scheme || return 1 + case $scheme in + (null|tape|obdr) + # tapes do not support uploading arbitrary files, one has to handle them +@@ -341,7 +354,10 @@ function scheme_accepts_files() { + ### Returning true does not imply that the URL is currently mounted at a filesystem and usable, + ### only that it can be mounted (use mount_url() first) + function scheme_supports_filesystem() { +- local scheme=$1 ++ # Be safe against 'set -eu' exit if scheme_supports_filesystem is called without argument ++ local scheme=${1:-} ++ # Return false if scheme is empty or blank or more than one word, cf. scheme_accepts_files() above ++ test $scheme || return 1 + case $scheme in + (null|tape|obdr|rsync|fish|ftp|ftps|hftp|http|https|sftp) + return 1 +@@ -560,7 +576,7 @@ function umount_url() { + + RemoveExitTask "perform_umount_url '$url' '$mountpoint' lazy" + +- remove_temporary_mountpoint '$mountpoint' && RemoveExitTask "remove_temporary_mountpoint '$mountpoint'" ++ remove_temporary_mountpoint "$mountpoint" && RemoveExitTask "remove_temporary_mountpoint '$mountpoint'" + return 0 + } + diff --git a/SPECS/rear.spec b/SPECS/rear.spec index c36c266..c35c67b 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: 3%{?dist} +Release: 4%{?dist} License: GPLv3 Group: Applications/File URL: http://relax-and-recover.org/ @@ -19,6 +19,10 @@ Patch34: rear-asciidoc.patch Patch35: rear-bz1983013.patch Patch36: rear-bz1993296.patch Patch37: rear-bz1747468.patch +Patch38: rear-bz2049091.patch +Patch39: rear-pr2675.patch +Patch40: rear-bz2048454.patch +Patch41: rear-bz2035939.patch ### Dependencies on all distributions BuildRequires: asciidoc @@ -67,8 +71,10 @@ Requires: /usr/sbin/bootlist Requires: crontabs Requires: iproute -#Requires: mkisofs +# No ISO image support on s390x (may change when we add support for LPARs) +%ifnarch s390x Requires: xorriso +%endif # mingetty is not available anymore with RHEL 7 (use agetty instead via systemd) # Note that CentOS also has rhel defined so there is no need to use centos @@ -120,6 +126,10 @@ fi %patch35 -p1 %patch36 -p1 %patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 echo "30 1 * * * root test -f /var/lib/rear/layout/disklayout.conf && /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" >rear.cron @@ -153,6 +163,14 @@ TZ=UTC %{__make} -C doc %{_sbindir}/rear %changelog +* Sun Feb 27 2022 Pavel Cahyna - 2.6-4 +- Apply PR2675 to fix leftover temp dir bug (introduced in backported PR2625) +- Apply PR2603 to ignore unused PV devices +- Apply upstream PR2750 to avoid exclusion of wanted multipath devices +- Remove unneeded xorriso dep on s390x (no ISO image support there) +- Apply upstream PR2736 to add the EXCLUDE_{IP_ADDRESSES,NETWORK_INTERFACES} + options + * Mon Aug 30 2021 Pavel Cahyna - 2.6-3 - Add patch for better handling of thin pools and other LV types not supported by vgcfgrestore