SHA256
3
0
forked from pool/tar

Accepting request 378522 from home:svalx

OBS-URL: https://build.opensuse.org/request/show/378522
OBS-URL: https://build.opensuse.org/package/show/Base:System/tar?expand=0&rev=69
This commit is contained in:
Dirk Mueller 2016-03-29 19:54:20 +00:00 committed by Git OBS Bridge
parent d8ff2b6777
commit ef38e164b1
3 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,56 @@
From: Alexey Svistunov <svalx@svalx.net>
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() {

View File

@ -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

View File

@ -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