aboutsummaryrefslogtreecommitdiffstats
path: root/backuper.sh
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-07-24 15:24:55 +0200
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-07-24 16:34:02 +0200
commitfeffc638b94e4c29ef6892f9e65b7b4ddc023504 (patch)
tree98c6fb1a61b6aef78616041d33bf0e763864f4c8 /backuper.sh
parentAdd support for personalization process (diff)
downloadbackuper-feffc638b94e4c29ef6892f9e65b7b4ddc023504.tar.xz
Add support for after-backup hook
Diffstat (limited to 'backuper.sh')
-rw-r--r--backuper.sh21
1 files changed, 21 insertions, 0 deletions
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
}