From feffc638b94e4c29ef6892f9e65b7b4ddc023504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Ob=C5=AFrka?= Date: Sun, 24 Jul 2016 15:24:55 +0200 Subject: Add support for after-backup hook --- backuper.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/backuper.sh b/backuper.sh index 19ebd67..88fa769 100644 --- a/backuper.sh +++ b/backuper.sh @@ -14,6 +14,7 @@ COMMAND="" PLACES="" EXCLUDE="" STORE="" +AFTER="" ## Pipeline variables PID_GENERATE="" @@ -65,6 +66,10 @@ store() { STORE="$1" } +after() { + AFTER="$1" +} + error() { echo "ERROR: $1" >&2 exit 1 @@ -103,6 +108,14 @@ get_home() { echo "$CU_HOME" } +result_file() { + if [ -n "$DST" ]; then + echo "$DST"/"$FILENAME_ENC" + else + echo "$FILENAME_ENC" + fi +} + prepare() { echo "prepare $$" trap 'error_handler' EXIT INT QUIT TERM ABRT HUP ILL TRAP BUS FPE SEGV @@ -192,6 +205,13 @@ start_pipeline() { done } +backup_done() { + if [ -n "$AFTER" ]; then + title "After backup hook" + echo "$AFTER" | sh -s || die "After-backup hook failed" + fi +} + run() { title "Run command" echo "$@" @@ -208,6 +228,7 @@ backup() { test_input prepare start_pipeline + backup_done cleanup } -- cgit v1.2.3