From bf8b26a40ac04213468b7574f1c1a8bb0cc01e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=98=C3=ADdk=C3=BD?= Date: Tue, 9 Feb 2021 09:24:09 +0100 Subject: [PATCH 1/3] Restore should be available in RHEL only --- dump-replacement.patch | 51 +++++++++++++++++++++++ dump.patch | 95 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 dump-replacement.patch create mode 100644 dump.patch diff --git a/dump-replacement.patch b/dump-replacement.patch new file mode 100644 index 0000000..58d3611 --- /dev/null +++ b/dump-replacement.patch @@ -0,0 +1,51 @@ +diff -urNp a/common/dumprmt.c b/common/dumprmt.c +--- a/common/dumprmt.c 2021-02-08 13:23:33.366826516 +0100 ++++ b/common/dumprmt.c 2021-02-08 13:26:13.725243819 +0100 +@@ -83,7 +83,6 @@ + #endif + + #include +-#include "dump.h" /* for X_STARTUP, X_ABORT etc */ + + #define TS_CLOSED 0 + #define TS_OPEN 1 +@@ -150,7 +149,7 @@ rmtconnaborted(UNUSED(int signo)) + } + } + if (abortifconnerr) +- exit(X_ABORT); ++ exit(3); + } + + static int +@@ -196,7 +195,7 @@ rmtgetconn(void) + *cp = '\0'; + if (!okname(tuser)) { + if (abortifconnerr) { +- exit(X_STARTUP); ++ exit(1); + } else { + return 0; + } +diff -urNp a/configure.ac b/configure.ac +--- a/configure.ac 2021-02-08 13:23:33.353826407 +0100 ++++ b/configure.ac 2021-02-08 14:44:18.373749348 +0100 +@@ -479,7 +479,6 @@ AC_CONFIG_FILES(m4_flatten([ + Makefile + common/Makefile + compat/lib/Makefile +- dump/Makefile + restore/Makefile + rmt/Makefile + ])) +diff -urNp a/Makefile.am b/Makefile.am +--- a/Makefile.am 2021-02-08 13:23:33.355826423 +0100 ++++ b/Makefile.am 2021-02-08 13:45:19.619244125 +0100 +@@ -1,6 +1,6 @@ + ACLOCAL_AMFLAGS = -I m4 + +-SUBDIRS = compat/lib common dump restore ++SUBDIRS = compat/lib common restore + if BUILD_RMT + SUBDIRS += rmt + endif diff --git a/dump.patch b/dump.patch new file mode 100644 index 0000000..e555955 --- /dev/null +++ b/dump.patch @@ -0,0 +1,95 @@ +diff --git a/dump.spec b/dump.spec +index 266c65a..bac2d9b 100644 +--- a/dump.spec ++++ b/dump.spec +@@ -3,8 +3,13 @@ + + %define _legacy_common_support 1 + ++%if 0%{?rhel} ++Summary: Program for restoring ext2/ext3 filesystems ++Name: restore ++%else + Summary: Programs for backing up and restoring ext2/ext3/ext4 filesystems + Name: dump ++%endif + Epoch: 1 + Version: 0.4 + Release: 0.45.%{PREVER}%{?dist} +@@ -20,13 +25,28 @@ BuildRequires: lzo-devel, libtool + # group is created before installation (#60461) + Requires: setup + Requires: rmt +-Obsoletes: dump-static ++%if 0%{?fedora} ++Obsoletes: dump-static <= 0.4 + Provides: dump-static ++%endif + + Patch0: dump-buildfix.patch + Patch1: dump-remove-lzo.patch + Patch2: dump-glibc_xattr.patch + ++# No dump package in RHEL (restore remains) ++Patch101: dump-replacement.patch ++ ++%if 0%{?rhel} ++%description ++The restore command performs the inverse function of dump; it can ++restore a full backup of a filesystem. Subsequent incremental backups ++can then be layered on top of the full backup. Single files and ++directory subtrees may also be restored from full or partial backups. ++ ++Install restore if you need restoring filesystems after backups ++made by dump. ++%else + %description + The dump package contains both dump and restore. Dump examines files + in a filesystem, determines which ones need to be backed up, and +@@ -38,6 +58,7 @@ directory subtrees may also be restored from full or partial backups. + + Install dump if you need a system for both backing up filesystems and + restoring filesystems after backups. ++%endif + + %prep + %setup -q -n dump-%{DUMP_VERSION} +@@ -46,6 +67,11 @@ restoring filesystems after backups. + %patch1 -p1 -b .remove-lzo + %patch2 -p1 -b .glibc_xattr + ++%if 0%{?rhel} ++rm -rf dump ++%patch101 -p1 ++%endif ++ + for i in MAINTAINERS COPYING ChangeLog; do + iconv -f iso-8859-1 -t utf-8 $i -o $i.new + touch -r $i $i.new +@@ -87,7 +113,9 @@ mkdir -p %{buildroot}%{_mandir}/man8 + MANGRP=$(id -gn) + + pushd %{buildroot} ++%if 0%{?fedora} + ln -sf dump .%{_sbindir}/rdump ++%endif + ln -sf restore .%{_sbindir}/rrestore + mkdir -p .%{_sysconfdir} + > .%{_sysconfdir}/dumpdates +@@ -97,12 +125,14 @@ popd + %doc AUTHORS COPYING INSTALL KNOWNBUGS MAINTAINERS NEWS README REPORTING-BUGS TODO + %doc dump.lsm + %attr(0664,root,disk) %config(noreplace) %{_sysconfdir}/dumpdates ++%if 0%{?fedora} + %{_sbindir}/dump + %{_sbindir}/rdump +-%{_sbindir}/restore +-%{_sbindir}/rrestore + %{_mandir}/man8/dump.8* + %{_mandir}/man8/rdump.8* ++%endif ++%{_sbindir}/restore ++%{_sbindir}/rrestore + %{_mandir}/man8/restore.8* + %{_mandir}/man8/rrestore.8* + From 1d904c3db49a3547d8ffbbd1a51f0709b4aa49a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=98=C3=ADdk=C3=BD?= Date: Tue, 9 Feb 2021 10:31:07 +0100 Subject: [PATCH 2/3] Apply patch 101 only in RHEL environment --- dump.spec | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/dump.spec b/dump.spec index 266c65a..eed606d 100644 --- a/dump.spec +++ b/dump.spec @@ -3,8 +3,13 @@ %define _legacy_common_support 1 +%if 0%{?rhel} +Summary: Program for restoring ext2/ext3 filesystems +Name: restore +%else Summary: Programs for backing up and restoring ext2/ext3/ext4 filesystems Name: dump +%endif Epoch: 1 Version: 0.4 Release: 0.45.%{PREVER}%{?dist} @@ -20,13 +25,28 @@ BuildRequires: lzo-devel, libtool # group is created before installation (#60461) Requires: setup Requires: rmt -Obsoletes: dump-static +%if 0%{?fedora} +Obsoletes: dump-static <= 0.4 Provides: dump-static +%endif Patch0: dump-buildfix.patch Patch1: dump-remove-lzo.patch Patch2: dump-glibc_xattr.patch +%if 0%{?rhel} +# No dump package in RHEL (restore remains) +Patch101: dump-replacement.patch + +%description +The restore command performs the inverse function of dump; it can +restore a full backup of a filesystem. Subsequent incremental backups +can then be layered on top of the full backup. Single files and +directory subtrees may also be restored from full or partial backups. + +Install restore if you need restoring filesystems after backups +made by dump. +%else %description The dump package contains both dump and restore. Dump examines files in a filesystem, determines which ones need to be backed up, and @@ -38,6 +58,7 @@ directory subtrees may also be restored from full or partial backups. Install dump if you need a system for both backing up filesystems and restoring filesystems after backups. +%endif %prep %setup -q -n dump-%{DUMP_VERSION} @@ -46,6 +67,11 @@ restoring filesystems after backups. %patch1 -p1 -b .remove-lzo %patch2 -p1 -b .glibc_xattr +%if 0%{?rhel} +rm -rf dump +%patch101 -p1 +%endif + for i in MAINTAINERS COPYING ChangeLog; do iconv -f iso-8859-1 -t utf-8 $i -o $i.new touch -r $i $i.new @@ -87,7 +113,9 @@ mkdir -p %{buildroot}%{_mandir}/man8 MANGRP=$(id -gn) pushd %{buildroot} +%if 0%{?fedora} ln -sf dump .%{_sbindir}/rdump +%endif ln -sf restore .%{_sbindir}/rrestore mkdir -p .%{_sysconfdir} > .%{_sysconfdir}/dumpdates @@ -97,12 +125,14 @@ popd %doc AUTHORS COPYING INSTALL KNOWNBUGS MAINTAINERS NEWS README REPORTING-BUGS TODO %doc dump.lsm %attr(0664,root,disk) %config(noreplace) %{_sysconfdir}/dumpdates +%if 0%{?fedora} %{_sbindir}/dump %{_sbindir}/rdump -%{_sbindir}/restore -%{_sbindir}/rrestore %{_mandir}/man8/dump.8* %{_mandir}/man8/rdump.8* +%endif +%{_sbindir}/restore +%{_sbindir}/rrestore %{_mandir}/man8/restore.8* %{_mandir}/man8/rrestore.8* From cfc2c230ee9f0af4dde0c5c71e7cf5ca36e9af6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=98=C3=ADdk=C3=BD?= Date: Tue, 9 Feb 2021 10:32:54 +0100 Subject: [PATCH 3/3] dump.patch file shouldn't be part of repository --- dump.patch | 95 ------------------------------------------------------ 1 file changed, 95 deletions(-) delete mode 100644 dump.patch diff --git a/dump.patch b/dump.patch deleted file mode 100644 index e555955..0000000 --- a/dump.patch +++ /dev/null @@ -1,95 +0,0 @@ -diff --git a/dump.spec b/dump.spec -index 266c65a..bac2d9b 100644 ---- a/dump.spec -+++ b/dump.spec -@@ -3,8 +3,13 @@ - - %define _legacy_common_support 1 - -+%if 0%{?rhel} -+Summary: Program for restoring ext2/ext3 filesystems -+Name: restore -+%else - Summary: Programs for backing up and restoring ext2/ext3/ext4 filesystems - Name: dump -+%endif - Epoch: 1 - Version: 0.4 - Release: 0.45.%{PREVER}%{?dist} -@@ -20,13 +25,28 @@ BuildRequires: lzo-devel, libtool - # group is created before installation (#60461) - Requires: setup - Requires: rmt --Obsoletes: dump-static -+%if 0%{?fedora} -+Obsoletes: dump-static <= 0.4 - Provides: dump-static -+%endif - - Patch0: dump-buildfix.patch - Patch1: dump-remove-lzo.patch - Patch2: dump-glibc_xattr.patch - -+# No dump package in RHEL (restore remains) -+Patch101: dump-replacement.patch -+ -+%if 0%{?rhel} -+%description -+The restore command performs the inverse function of dump; it can -+restore a full backup of a filesystem. Subsequent incremental backups -+can then be layered on top of the full backup. Single files and -+directory subtrees may also be restored from full or partial backups. -+ -+Install restore if you need restoring filesystems after backups -+made by dump. -+%else - %description - The dump package contains both dump and restore. Dump examines files - in a filesystem, determines which ones need to be backed up, and -@@ -38,6 +58,7 @@ directory subtrees may also be restored from full or partial backups. - - Install dump if you need a system for both backing up filesystems and - restoring filesystems after backups. -+%endif - - %prep - %setup -q -n dump-%{DUMP_VERSION} -@@ -46,6 +67,11 @@ restoring filesystems after backups. - %patch1 -p1 -b .remove-lzo - %patch2 -p1 -b .glibc_xattr - -+%if 0%{?rhel} -+rm -rf dump -+%patch101 -p1 -+%endif -+ - for i in MAINTAINERS COPYING ChangeLog; do - iconv -f iso-8859-1 -t utf-8 $i -o $i.new - touch -r $i $i.new -@@ -87,7 +113,9 @@ mkdir -p %{buildroot}%{_mandir}/man8 - MANGRP=$(id -gn) - - pushd %{buildroot} -+%if 0%{?fedora} - ln -sf dump .%{_sbindir}/rdump -+%endif - ln -sf restore .%{_sbindir}/rrestore - mkdir -p .%{_sysconfdir} - > .%{_sysconfdir}/dumpdates -@@ -97,12 +125,14 @@ popd - %doc AUTHORS COPYING INSTALL KNOWNBUGS MAINTAINERS NEWS README REPORTING-BUGS TODO - %doc dump.lsm - %attr(0664,root,disk) %config(noreplace) %{_sysconfdir}/dumpdates -+%if 0%{?fedora} - %{_sbindir}/dump - %{_sbindir}/rdump --%{_sbindir}/restore --%{_sbindir}/rrestore - %{_mandir}/man8/dump.8* - %{_mandir}/man8/rdump.8* -+%endif -+%{_sbindir}/restore -+%{_sbindir}/rrestore - %{_mandir}/man8/restore.8* - %{_mandir}/man8/rrestore.8* -