diff --git a/add-return-values-to-backup-scripts.patch b/add-return-values-to-backup-scripts.patch new file mode 100644 index 0000000..d284224 --- /dev/null +++ b/add-return-values-to-backup-scripts.patch @@ -0,0 +1,56 @@ +From: Alexey Svistunov +Date: 2016-03-23 11:59:33 +0300 +Subject: add return values to the backup scripts for better results monitoring. +References: https://savannah.gnu.org/patch/?8953 +Upstream: submitted + +Index: tar-1.28/scripts/backup.in +=================================================================== +--- tar-1.28.orig/scripts/backup.in ++++ tar-1.28/scripts/backup.in +@@ -153,9 +153,16 @@ message 20 "BACKUP_FILES=$BACKUP_FILES" + # piped through 'tee' to the logfile. Doing this, instead of having + # multiple pipelines all over the place, is cleaner and allows access to + # the exit value from various commands more easily. ++set -o pipefail + ( + message 1 "preparing tapes" + $MT_BEGIN "${TAPE_FILE}" ++ RESULT=$? ++ if [ $RESULT -ne 0 ] ; then ++ echo "Tape is not ready." 1>&2 ++ exit $RESULT ++ fi ++ + rm -f "${VOLNO_FILE}" + + message 1 "processing backup directories" +@@ -245,10 +252,11 @@ message 20 "BACKUP_FILES=$BACKUP_FILES" + $MT_OFFLINE "${TAPE_FILE}" + echo "." + ) 2>&1 | tee -a "${LOGFILE}" ++RESULT=$? + + if test "${ADMINISTRATOR}" != NONE; then + echo "Sending the dump log to ${ADMINISTRATOR}" + mail -s "Results of backup started ${startdate}" ${ADMINISTRATOR} < "${LOGFILE}" + fi +- ++exit $RESULT + # EOF +Index: tar-1.28/scripts/backup.sh.in +=================================================================== +--- tar-1.28.orig/scripts/backup.sh.in ++++ tar-1.28/scripts/backup.sh.in +@@ -311,8 +311,10 @@ backup_host() { + CMD="exec ${TAR_PART1} -f \"${TAPE_FILE}\" $@" + message 10 "CMD: $CMD" + sh -c "$CMD" +- message 10 "RC: $?" ++ RC=$? ++ message 10 "RC: $RC" + fi ++ return $RC + } + + print_level() { diff --git a/tar.changes b/tar.changes index 66b147a..516912c 100644 --- a/tar.changes +++ b/tar.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Mar 23 09:37:44 UTC 2016 - svalx@svalx.net + +- Add add-return-values-to-backup-scripts.patch + ------------------------------------------------------------------- Mon Apr 13 10:37:40 UTC 2015 - vcizek@suse.com diff --git a/tar.spec b/tar.spec index ff95688..8a4ecd5 100644 --- a/tar.spec +++ b/tar.spec @@ -1,7 +1,7 @@ # # spec file for package tar # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -43,6 +43,10 @@ Patch11: tar-ignore_lone_zero_blocks.patch #https://bugzilla.opensuse.org/show_bug.cgi?id=918487 Patch12: tar-recursive--files-from.patch Patch20: add_readme-tests.patch +# PATCH-FEATURE-UPSTREAM add-return-values-to-backup-scripts.patch - +# add return values to the backup scripts for better results monitoring. +# https://savannah.gnu.org/patch/?8953 +Patch21: add-return-values-to-backup-scripts.patch %if 0%{?suse_version} >= %min_suse_ver BuildRequires: automake BuildRequires: help2man @@ -92,6 +96,7 @@ Upstream testsuite for the package %patch11 -p1 #%patch12 -p1 %patch20 -p1 +%patch21 -p1 %build %define my_cflags -W -Wall -Wpointer-arith -Wstrict-prototypes -Wformat-security -Wno-unused-parameter -fPIE