summaryrefslogtreecommitdiff
path: root/backup-all.sh
blob: b6637cecd91e2a32cdd729e0c51e661b07bacbda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh -euf

usage() (
	echo "backup-all.sh <dataset list> [duplicity options]"
	echo
	echo "Backups each dataset listed in the given file using Duplicity,"
	echo "each line of the file being a pair of a dataset name and a Duplicity destination URI."
	echo
)

backup_all() (
	LIST_FILE="$1"
	DUPLICITY_OPTIONS="$2"

	grep -v '^\s*#' "$LIST_FILE" | while read -r LINE; do
		backup-dataset.sh $LINE $DUPLICITY_OPTIONS
	done
)

case "${1:-help}" in
	"help")	usage;;
	*)	backup_all "$1" "${2:-}";;
esac