summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot2017-05-18 19:56:20 +0200
committerroot2017-05-18 19:56:20 +0200
commit1cfbf20fb3336bdb0859470b09fb10740254e5a1 (patch)
treedb8c5e0875a16690292b02d8bdde39602891d72a
parent5bdbcea22a55979bcd4aa21aa4f76c9b818e1511 (diff)
downloadserver-utilities-1cfbf20fb3336bdb0859470b09fb10740254e5a1.tar.gz
Reformat options handling keys and defaults
-rwxr-xr-xbackup-dataset.sh14
1 files 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 @@
3SNAPSHOT_DIRECTORY="/var/backups/dataset-snapshots" 3SNAPSHOT_DIRECTORY="/var/backups/dataset-snapshots"
4 4
5usage() ( 5usage() (
6 echo "backup-dataset.sh <dataset> <duplicity destination> [duplicity options]" 6 echo "backup-dataset.sh <dataset> <duplicity destination> <signing key> <encryption key> [duplicity options]"
7 echo 7 echo
8 echo "Performs a duplicity incremental backup of the specified dataset." 8 echo "Performs a duplicity incremental backup of the specified dataset."
9 echo "An atomic snapshot of the dataset is taken prior to backing up." 9 echo "An atomic snapshot of the dataset is taken prior to backing up."
@@ -13,15 +13,21 @@ usage() (
13backup_dataset() ( 13backup_dataset() (
14 DATASET="$1" 14 DATASET="$1"
15 DESTINATION="$2" 15 DESTINATION="$2"
16 DUPLICITY_OPTIONS="$3" 16 SIGNING_KEY="$3"
17 ENCRYPTION_KEY="$4"
18 DUPLICITY_OPTIONS="$5"
17 19
18 sudo snap.sh snap "$DATASET" 20 sudo snap.sh snap "$DATASET"
19 PASSPHRASE="null" duplicity $DUPLICITY_OPTIONS "$SNAPSHOT_DIRECTORY/$DATASET" "$DESTINATION" 21
22 PASSPHRASE="null" duplicity $DUPLICITY_OPTIONS \
23 --sign-key="$SIGNING_KEY" --encrypt-key="$ENCRYPTION_KEY" \
24 "$SNAPSHOT_DIRECTORY/$DATASET" "$DESTINATION"
25
20 sudo snap.sh free "$DATASET" 26 sudo snap.sh free "$DATASET"
21) 27)
22 28
23case "${1:-help}" in 29case "${1:-help}" in
24 "help") usage;; 30 "help") usage;;
25 *) backup_dataset "$1" "$2" "${3:-}";; 31 *) backup_dataset "$1" "$2" "$3" "$4" "${5:-incremental}";;
26esac 32esac
27 33