From 3b03ad8b25c585a461b94639195657a23ce66651 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 03 2016 06:13:02 +0000 Subject: import rear-1.17.2-6.el7 --- diff --git a/SOURCES/36_teaming.sh b/SOURCES/36_teaming.sh new file mode 100644 index 0000000..5214d3e --- /dev/null +++ b/SOURCES/36_teaming.sh @@ -0,0 +1,107 @@ +# 36_teaming.sh +# +# record teaming information (network and routing) for Relax-and-Recover +# +# Relax-and-Recover is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# Relax-and-Recover is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Relax-and-Recover; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# BUG: Supports Ethernet only (so far) + +# where to build networking configuration +netscript=$ROOTFS_DIR/etc/scripts/system-setup.d/63-teaming.sh + +### Skip netscript if noip is configured on the command line +cat <> ${netscript} +if [[ -e /proc/cmdline ]] ; then + if grep -q 'noip' /proc/cmdline ; then + return + fi +fi +EOT + +# add a line at the top of netscript to skip if dhclient will be used +cat - < ${netscript} +# if USE_DHCLIENT=y then use DHCP instead and skip 60-network-devices.sh +[[ ! -z "\$USE_DHCLIENT" && -z "\$USE_STATIC_NETWORKING" ]] && return +# if IPADDR=1.2.3.4 has been defined at boot time via ip=1.2.3.4 then configure +if [[ "\$IPADDR" ]] && [[ "\$NETMASK" ]] ; then + device=\${NETDEV:-eth0} + ip link set dev "\$device" up + ip addr add "\$IPADDR"/"\$NETMASK" dev "\$device" + if [[ "\$GATEWAY" ]] ; then + ip route add default via "\$GATEWAY" + fi + return +fi +EOT + +# store virtual devices, because teaming interfaces are declared as virtual +VIRTUAL_DEVICES=$(ls /sys/devices/virtual/net) + +TEAMINGS=() + +# check if virtual interface is a teaming interface +for VIRT_DEV in ${VIRTUAL_DEVICES} +do + if ethtool -i ${VIRT_DEV} | grep -w "driver:" | grep -qw team + then + TEAMINGS+=($VIRT_DEV) + fi + +done + +for TEAM in "${TEAMINGS[@]}" +do + # catch all ip-addresses for the teaming interface + ADDR=() + for x in $(ip ad show dev ${TEAM} scope global | grep "inet.*\ " | tr -s " " | cut -d " " -f 3) + do + ADDR+=($x) + done + + # create netscript only when the interface has at least one configured ip + # to simplify we attach the configured ip-addresses to the first teaming-member + if [[ ${ADDR[*]} ]] + then + # find out one member interface. Greping for "active port:" will not work for all possible teaming configs (e.g. roundrobin, loadbalance, ...) + FIRST_PORT=$(teamdctl ${TEAM} state | grep -A1 -w ports: | tail -1 | sed 's/[[:blank:]]*//g') + + for TEAM_IP in ${ADDR[@]} + do + echo "ip addr add ${TEAM_IP} dev ${FIRST_PORT}" >>${netscript} + done + + echo "ip link set dev ${FIRST_PORT} up" >>${netscript} + + PORT_MTU="$(cat /sys/class/net/${FIRST_PORT}/mtu)" + echo "ip link set dev ${FIRST_PORT} mtu ${PORT_MTU}" >>${netscript} + fi + + # catch the routing for the teaming interface as we disabled it in 35_routing.sh + for table in $( { echo "254 main" ; cat /etc/iproute2/rt_tables ; } |\ + grep -E '^[0-9]+' |\ + tr -s " \t" " " |\ + cut -d " " -f 2 | sort -u | grep -Ev '(local|default|unspec)' ) ; + do + ip route list table $table |\ + grep -Ev 'scope (link|host)' |\ + while read destination via gateway dev device junk; + do + if [[ "${device}" == "${TEAM}" ]] + then + echo "ip route add ${destination} ${via} ${gateway} ${dev} ${FIRST_PORT} table ${table}" >>${netscript} + fi + done + done +done diff --git a/SOURCES/rear-grep-fix.patch b/SOURCES/rear-grep-fix.patch new file mode 100644 index 0000000..ade831c --- /dev/null +++ b/SOURCES/rear-grep-fix.patch @@ -0,0 +1,52 @@ +diff --git a/usr/share/rear/layout/save/default/31_autoexclude_usb.sh b/usr/share/rear/layout/save/default/31_autoexclude_usb.sh +index 6ee0e45..75b4080 100644 +--- a/usr/share/rear/layout/save/default/31_autoexclude_usb.sh ++++ b/usr/share/rear/layout/save/default/31_autoexclude_usb.sh +@@ -36,7 +36,7 @@ do + + grep -q "^$REAL_USB_DEVICE " /proc/mounts + if [[ $? -eq 0 ]]; then +- local usb_mntpt=$(grep -P "^$REAL_USB_DEVICE\s" /proc/mounts | cut -d" " -f2 | tail -1) ++ local usb_mntpt=$(grep -E "^$REAL_USB_DEVICE\s" /proc/mounts | cut -d" " -f2 | tail -1) + if ! IsInArray "$usb_mntpt" "${AUTOEXCLUDE_USB_PATH[@]}" ; then + AUTOEXCLUDE_USB_PATH=( ${AUTOEXCLUDE_USB_PATH[@]} $usb_mntpt ) + Log "Auto-excluding USB path $usb_mntpt [device $REAL_USB_DEVICE]" +diff --git a/usr/share/rear/output/USB/Linux-i386/30_create_extlinux.sh b/usr/share/rear/output/USB/Linux-i386/30_create_extlinux.sh +index fdbb3e9..efdd558 100644 +--- a/usr/share/rear/output/USB/Linux-i386/30_create_extlinux.sh ++++ b/usr/share/rear/output/USB/Linux-i386/30_create_extlinux.sh +@@ -3,7 +3,7 @@ + function get_usb_syslinux_version { + for file in $BUILD_DIR/outputfs/{boot/syslinux,}/{ld,ext}linux.sys; do + if [[ -s "$file" ]]; then +- strings $file | grep -P -m1 "^(EXT|SYS)LINUX \\d+.\\d+" | cut -d' ' -f2 ++ strings $file | grep -E -m1 "^(EXT|SYS)LINUX \\d+.\\d+" | cut -d' ' -f2 + return 0 + fi + done +diff --git a/usr/share/rear/output/USB/Linux-i386/85_make_USB_bootable.sh b/usr/share/rear/output/USB/Linux-i386/85_make_USB_bootable.sh +index 49739d4..3cffc94 100644 +--- a/usr/share/rear/output/USB/Linux-i386/85_make_USB_bootable.sh ++++ b/usr/share/rear/output/USB/Linux-i386/85_make_USB_bootable.sh +@@ -22,7 +22,7 @@ if [[ "$usb_syslinux_version" ]] && version_newer "$usb_syslinux_version" "$sysl + fi + + # Make the USB bootable +-usb_filesystem=$(grep -P "^($USB_DEVICE|$REAL_USB_DEVICE)\\s" /proc/mounts | cut -d' ' -f3 | tail -1) ++usb_filesystem=$(grep -E "^($USB_DEVICE|$REAL_USB_DEVICE)\\s" /proc/mounts | cut -d' ' -f3 | tail -1) + case "$usb_filesystem" in + (ext?) + if [[ "$FEATURE_SYSLINUX_EXTLINUX_INSTALL" ]]; then +diff --git a/usr/share/rear/prep/USB/Linux-i386/35_check_usb_disk.sh b/usr/share/rear/prep/USB/Linux-i386/35_check_usb_disk.sh +index 4d280c1..a166f94 100644 +--- a/usr/share/rear/prep/USB/Linux-i386/35_check_usb_disk.sh ++++ b/usr/share/rear/prep/USB/Linux-i386/35_check_usb_disk.sh +@@ -9,7 +9,7 @@ REAL_USB_DEVICE=$(readlink -f $USB_DEVICE) + StopIfError "USB device '$USB_DEVICE' is not a block device" + + ! grep -q "^$REAL_USB_DEVICE " /proc/mounts +-StopIfError "USB device '$USB_DEVICE' is already mounted on $(grep -P "^$REAL_USB_DEVICE\\s" /proc/mounts | cut -d' ' -f2 |tail -1)" ++StopIfError "USB device '$USB_DEVICE' is already mounted on $(grep -E "^$REAL_USB_DEVICE\\s" /proc/mounts | cut -d' ' -f2 |tail -1)" + + # We cannot use the layout dependency code in the backup phase (yet) + #RAW_USB_DEVICE=$(find_disk $REAL_USB_DEVICE) diff --git a/SOURCES/rear-teaming-interface.patch b/SOURCES/rear-teaming-interface.patch new file mode 100644 index 0000000..a34efb1 --- /dev/null +++ b/SOURCES/rear-teaming-interface.patch @@ -0,0 +1,24 @@ +diff --git a/usr/share/rear/rescue/GNU/Linux/35_routing.sh b/usr/share/rear/rescue/GNU/Linux/35_routing.sh +index a1dddab..186d01f 100644 +--- a/usr/share/rear/rescue/GNU/Linux/35_routing.sh ++++ b/usr/share/rear/rescue/GNU/Linux/35_routing.sh +@@ -83,7 +83,8 @@ else # use original routes + ifslaves=($(cat /proc/net/bonding/$device | grep "Slave Interface:" | cut -d : -f 2)) + Log "X${ifslaves[@]}X" + echo "ip route add $destination $via $gateway $dev ${ifslaves[0]} table $table" >>$netscript +- else ++ # be sure that it is not a teaming-interface ++ elif ! ethtool -i $device | grep -w "driver:" | grep -qw team ; then + echo "ip route add $destination $via $gateway $dev $device table $table" >>$netscript + fi + done +@@ -95,7 +96,8 @@ else # use original routes + ifslaves=($(cat /proc/net/bonding/$device | grep "Slave Interface:" | cut -d : -f 2)) + Log "X${ifslaves[@]}X" + echo "ip route add $destination $via $gateway $dev ${ifslaves[0]} table $table" >>$netscript +- else ++ # be sure that it is not a teaming-interface ++ elif ! ethtool -i $device | grep -w "driver:" | grep -qw team ; then + echo "ip route add $destination $via $gateway $dev $device table $table" >>$netscript + fi + done diff --git a/SPECS/rear.spec b/SPECS/rear.spec index f96b216..15c1b8c 100644 --- a/SPECS/rear.spec +++ b/SPECS/rear.spec @@ -1,101 +1,64 @@ -%define rpmrelease %{nil} -### Work-around the fact that OpenSUSE/SLES _always_ defined both :-/ -%if 0%{?sles_version} == 0 -%undefine sles_version -%endif - -Summary: Relax-and-Recover is a Linux disaster recovery and system migration tool -Name: rear -Version: 1.17.2 -Release: 1%{?rpmrelease}%{?dist} -License: GPLv3 -Group: Applications/File -URL: http://relax-and-recover.org/ +Summary: Relax-and-Recover is a Linux disaster recovery and system migration tool +Name: rear +Version: 1.17.2 +Release: 6%{?dist} +License: GPLv3 +Group: Applications/File +URL: http://relax-and-recover.org/ # as GitHub stopped with download section we need to go back to Sourceforge for downloads -Source: https://sourceforge.net/projects/rear/files/rear/1.17/%{version}/rear-%{version}.tar.gz - -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) - -BuildArch: noarch +Source0: https://sourceforge.net/projects/rear/files/rear/1.17/%{version}/rear-%{version}.tar.gz +Source1: 36_teaming.sh +Patch0: rear-grep-fix.patch +Patch1: rear-teaming-interface.patch +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) ### Dependencies on all distributions -Requires: binutils -Requires: ethtool -Requires: gzip -Requires: iputils -Requires: parted -Requires: tar -Requires: openssl -Requires: gawk -Requires: attr +Requires: binutils +Requires: ethtool +Requires: gzip +Requires: iputils +Requires: parted +Requires: tar +Requires: openssl +Requires: gawk +Requires: attr ### If you require NFS, you may need the below packages -#Requires: nfsclient portmap rpcbind +#Requires: nfsclient portmap rpcbind ### We drop LSB requirements because it pulls in too many dependencies ### The OS is hardcoded in /etc/rear/os.conf instead -#Requires: redhat-lsb +#Requires: redhat-lsb ### Required for Bacula/MySQL support -#Requires: bacula-mysql +#Requires: bacula-mysql ### Required for OBDR -#Requires: lsscsi sg3_utils +#Requires: lsscsi sg3_utils ### Optional requirement -#Requires: cfg2html +#Requires: cfg2html -%ifarch %ix86 x86_64 -Requires: syslinux +%ifarch x86_64 i686 +Requires: syslinux %endif %ifarch ppc ppc64 -Requires: yaboot +Requires: yaboot %endif -%if %{?suse_version:1}0 -Requires: iproute2 -### recent SuSE versions have an extra nfs-client package -### and switched to genisoimage/wodim -%if 0%{?suse_version} >= 1020 -Requires: genisoimage -%else -Requires: mkisofs -%endif -### -#%if %{!?sles_version:1}0 -#Requires: lsb -#%endif -%endif - -%if %{?mandriva_version:1}0 -Requires: iproute2 -### Mandriva switched from 2008 away from mkisofs, -### and as a specialty call the package cdrkit-genisoimage! -%if 0%{?mandriva_version} >= 2008 -Requires: cdrkit-genisoimage -%else -Requires: mkisofs -%endif -#Requires: lsb -%endif - -### On RHEL/Fedora the genisoimage packages provides mkisofs -%if %{?centos_version:1}%{?fedora_version:1}%{?rhel_version:1}0 -Requires: crontabs -Requires: iproute -Requires: mkisofs -#Requires: redhat-lsb -%endif +Requires: crontabs +Requires: iproute +Requires: mkisofs # 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 %if 0%{?rhel} && 0%{?rhel} > 6 -Requires: util-linux +Requires: util-linux %else -Requires: mingetty -Requires: util-linux +Requires: mingetty +Requires: util-linux %endif ### The rear-snapshot package is no more @@ -130,51 +93,14 @@ fi %prep %setup -q +%patch0 -p1 +%patch1 -p1 + echo "30 1 * * * root /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" >rear.cron ### Add a specific os.conf so we do not depend on LSB dependencies %{?fedora:echo -e "OS_VENDOR=Fedora\nOS_VERSION=%{?fedora}" >etc/rear/os.conf} -%{?mdkversion:echo -e "OS_VENDOR=Mandriva\nOS_VERSION=%{distro_rel}" >etc/rear/os.conf} %{?rhel:echo -e "OS_VENDOR=RedHatEnterpriseServer\nOS_VERSION=%{?rhel}" >etc/rear/os.conf} -#%{?sles_version:echo -e "OS_VENDOR=SUSE_LINUX\nOS_VERSION=%{?sles_version}" >etc/rear/os.conf} -#%{?suse_version:echo -e "OS_VENDOR=SUSE_LINUX\nOS_VERSION=%{?suse_version}" >etc/rear/os.conf} -%if 0%{?suse_version} == 1110 -# SLE 11 -OS_VERSION="11" -%endif -%if 0%{?suse_version} == 1130 -# openSUSE 11.3 -OS_VERSION="11.3" -%endif -%if 0%{?suse_version} == 1140 -# openSUSE 11.4 -OS_VERSION="11.4" -%endif -%if 0%{?suse_version} == 1210 -# openSUSE 12.1 -OS_VERSION="12.1" -%endif -%if 0%{?suse_version} == 1220 -# openSUSE 12.2 -OS_VERSION="12.2" -%endif -%if 0%{?suse_version} == 1230 -# openSUSE 12.3 -OS_VERSION="12.3" -%endif -%if 0%{?suse_version} == 1310 -# openSUSE 13.1 -OS_VERSION="13.1" -%endif -%if 0%{?suse_version} == 1315 -# SLE 12 -OS_VERSION="12" -%endif -%if 0%{?suse_version} == 1320 -# openSUSE 13.2 -OS_VERSION="13.2" -%endif -%{?suse_version:echo -e "OS_VENDOR=SUSE_LINUX\nOS_VERSION=$OS_VERSION" >etc/rear/os.conf} %build @@ -183,7 +109,7 @@ OS_VERSION="13.2" %{__make} install DESTDIR="%{buildroot}" %{__install} -Dp -m0644 rear.cron %{buildroot}%{_sysconfdir}/cron.d/rear #%{__install} -Dp -m0644 etc/udev/rules.d/62-rear-usb.rules %{buildroot}%{_sysconfdir}/udev/rules.d/62-rear-usb.rules - +cp %{SOURCE1} %{buildroot}%{_datadir}/rear/rescue/GNU/Linux/36_teaming.sh %clean %{__rm} -rf %{buildroot} @@ -199,6 +125,27 @@ OS_VERSION="13.2" %{_sbindir}/rear %changelog +* Tue Jul 19 2016 Petr Hracek - 1.17.2-6 +- Replace experimental grep -P with grep -E +Resolves: #1290205 + +* Wed Mar 23 2016 Petr Hracek - 1.17.2-5 +- Remove backuped patched files +Related: #1283930 + +* Wed Mar 23 2016 Petr Hracek - 1.17.2-4 +- Rear recovery over teaming interface will not work +Resolves: #1283930 + +* Tue Mar 08 2016 Petr Hracek - 1.17.2-3 +- Replace experimental grep -P with grep -E +Resolves: #1290205 + +* Tue Feb 23 2016 Petr Hracek - 1.17.2-2 +- rear does not require syslinux +- changing to arch package so that syslinux is installed +- Resolves: #1283927 + * Mon Sep 14 2015 Petr Hracek - 1.17.2-1 - New upstream release 1.17.2 Related: #1059196