mirror of
https://github.com/yavook/kiwi-backup.git
synced 2024-11-22 06:53:00 +00:00
Merge branch 'release/0.3'
This commit is contained in:
commit
00e8d31c48
1 changed files with 23 additions and 11 deletions
34
do-plicity
34
do-plicity
|
@ -5,21 +5,40 @@
|
||||||
#############
|
#############
|
||||||
|
|
||||||
# commands
|
# commands
|
||||||
env_exe="$(command -v env)"
|
|
||||||
ionice_exe="$(command -v ionice)"
|
ionice_exe="$(command -v ionice)"
|
||||||
duplicity_exe="$(command -v duplicity)"
|
duplicity_exe="$(command -v duplicity)"
|
||||||
|
|
||||||
|
# files
|
||||||
|
duplicity_secrets_file='/root/duplicity_secrets'
|
||||||
|
|
||||||
|
###############
|
||||||
|
# ENVIRONMENT #
|
||||||
|
###############
|
||||||
|
|
||||||
|
# load secrets file
|
||||||
|
if [ -f "${duplicity_secrets_file}" ]; then
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
. "${duplicity_secrets_file}"
|
||||||
|
fi
|
||||||
|
|
||||||
# check if uses encryption
|
# check if uses encryption
|
||||||
if [ -n "${GPG_KEY_ID}" ]; then
|
if [ -n "${GPG_KEY_ID}" ]; then
|
||||||
# gpg key given
|
# gpg key given
|
||||||
env_changes="PASSPHRASE='${GPG_PASSPHRASE}'"
|
PASSPHRASE="${GPG_PASSPHRASE}"
|
||||||
|
export PASSPHRASE
|
||||||
encrypt_opts="--encrypt-key='${GPG_KEY_ID}'"
|
encrypt_opts="--encrypt-key='${GPG_KEY_ID}'"
|
||||||
else
|
else
|
||||||
# no key given
|
# no key given
|
||||||
env_changes=""
|
|
||||||
encrypt_opts="--no-encryption"
|
encrypt_opts="--no-encryption"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check if uses AWS
|
||||||
|
if [ -n "${AWS_ACCESS_KEY_ID}" ]; then
|
||||||
|
# export AWS credentials
|
||||||
|
export AWS_ACCESS_KEY_ID
|
||||||
|
export AWS_SECRET_ACCESS_KEY
|
||||||
|
fi
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# FUNCTIONS #
|
# FUNCTIONS #
|
||||||
#############
|
#############
|
||||||
|
@ -46,14 +65,7 @@ print_command() {
|
||||||
pc_task="${1}"
|
pc_task="${1}"
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
# if environment should be changed, call with "env"
|
pc_cmdline="${ionice_exe} -c 3 ${duplicity_exe} ${encrypt_opts}"
|
||||||
if [ -n "${env_changes}" ]; then
|
|
||||||
pc_cmdline="${env_exe} ${env_changes} "
|
|
||||||
else
|
|
||||||
pc_cmdline=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
pc_cmdline="${pc_cmdline}${ionice_exe} -c 3 ${duplicity_exe} ${encrypt_opts}"
|
|
||||||
|
|
||||||
case "${pc_task}" in
|
case "${pc_task}" in
|
||||||
backup)
|
backup)
|
||||||
|
|
Loading…
Reference in a new issue