From 1cfbf20fb3336bdb0859470b09fb10740254e5a1 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 18 May 2017 19:56:20 +0200 Subject: Reformat options handling keys and defaults --- backup-dataset.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/backup-dataset.sh b/backup-dataset.sh index e4303c5..b1553e5 100755 --- a/backup-dataset.sh +++ b/backup-dataset.sh @@ -3,7 +3,7 @@ SNAPSHOT_DIRECTORY="/var/backups/dataset-snapshots" usage() ( - echo "backup-dataset.sh [duplicity options]" + echo "backup-dataset.sh [duplicity options]" echo echo "Performs a duplicity incremental backup of the specified dataset." echo "An atomic snapshot of the dataset is taken prior to backing up." @@ -13,15 +13,21 @@ usage() ( backup_dataset() ( DATASET="$1" DESTINATION="$2" - DUPLICITY_OPTIONS="$3" + SIGNING_KEY="$3" + ENCRYPTION_KEY="$4" + DUPLICITY_OPTIONS="$5" sudo snap.sh snap "$DATASET" - PASSPHRASE="null" duplicity $DUPLICITY_OPTIONS "$SNAPSHOT_DIRECTORY/$DATASET" "$DESTINATION" + + PASSPHRASE="null" duplicity $DUPLICITY_OPTIONS \ + --sign-key="$SIGNING_KEY" --encrypt-key="$ENCRYPTION_KEY" \ + "$SNAPSHOT_DIRECTORY/$DATASET" "$DESTINATION" + sudo snap.sh free "$DATASET" ) case "${1:-help}" in "help") usage;; - *) backup_dataset "$1" "$2" "${3:-}";; + *) backup_dataset "$1" "$2" "$3" "$4" "${5:-incremental}";; esac -- cgit v1.2.3