forked from henrik-farre/duplicity_backup_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup-restore.sh
More file actions
executable file
·42 lines (36 loc) · 971 Bytes
/
Copy pathbackup-restore.sh
File metadata and controls
executable file
·42 lines (36 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -o nounset
set -o errexit
set -o pipefail
if [[ ${EUID} -ne 0 ]]; then
echo "Needs root access"
exit 1
fi
# For PyDrive credentials
cd /root/.duplicity/
# shellcheck disable=SC1091
source /root/.duplicity/config
if [[ "${#}" -ne 3 ]]; then
echo "3 arguments are needed:"
echo "1: File to restore: relative to dir, e.g. hosts"
echo "2: Remote dir, e.g. etc"
echo "3: Restore destination, NOTE: should be full path, else it will end up in /root/.duplicity/"
exit 1
fi
FILE=${1:-}
DIR=${2:-}
CLEAN_DIR=${DIR//\//-}
RESTORE_DEST=${3:-}
echo duplicity ${COMMON_OPTS} --file-to-restore "${FILE}" "${REMOTE_DIR}/${CLEAN_DIR}" "${RESTORE_DEST}"
duplicity ${COMMON_OPTS} --file-to-restore "${FILE}" "${REMOTE_DIR}/${CLEAN_DIR}" "${RESTORE_DEST}"
unset PASSPHRASE
unset ENCRYPT_KEY
unset COMMON_OPTS
unset BACKUP_OPTS
unset EXCLUDE_OPTS
unset DIR_EXCLUDE
unset GOOGLE_DRIVE_SETTINGS
unset REMOTE_DIR
unset BACKDIRS
unset ENCRYPTDIRS
unset EMAIL