diff options
author | Robin Obůrka <r.oburka@gmail.com> | 2016-12-04 11:50:37 +0100 |
---|---|---|
committer | Robin Obůrka <r.oburka@gmail.com> | 2016-12-04 11:50:37 +0100 |
commit | fd96957362840017d1ede4f473330faf0cb5f43d (patch) | |
tree | 4a1faf186679c186a397d3801b7166063f08577a | |
parent | Unify error and die functions. They are almost the same (diff) | |
download | backuper-fd96957362840017d1ede4f473330faf0cb5f43d.tar.xz |
Add support for tar extra params
-rw-r--r-- | backuper.sh | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/backuper.sh b/backuper.sh index ae9e289..391c6c1 100644 --- a/backuper.sh +++ b/backuper.sh @@ -26,6 +26,7 @@ GENERATE="" COMMAND="" PLACES="" EXCLUDE="" +TAR_EXTRA_PARAMS="" STORE="" AFTER="" FILE_TYPE="" @@ -135,6 +136,21 @@ exclude() { EXCLUDE="$STR" } +tar_extra_param() { + PARAM="$1" + if ! echo "$TAR_EXTRA_PARAMS" | grep -q -- "$PARAM" ; then + TAR_EXTRA_PARAMS="$TAR_EXTRA_PARAMS $PARAM" + fi +} + +no_file_change() { + tar_extra_param "--warning='no-file-changed'" +} + +numeric_owner() { + tar_extra_param "--numeric-owner" +} + store() { STORE="$@" } @@ -270,7 +286,7 @@ start_command() { echo "$COMMAND" | /usr/bin/time -f "$(time_fmt "Backup took")" $REMOTE $GENERATE sh -s > "$RUNDIR"/fifo_0 else ## Exclude keep without quotes - /usr/bin/time -f "$(time_fmt "Backup took")" $REMOTE $GENERATE tar c --preserve-permissions $EXCLUDE $PLACES > "$RUNDIR"/fifo_0 + /usr/bin/time -f "$(time_fmt "Backup took")" $REMOTE $GENERATE tar c --preserve-permissions $TAR_EXTRA_PARAMS $EXCLUDE $PLACES > "$RUNDIR"/fifo_0 fi } |