backup: add B2 account key/ID
parent
a696defb96
commit
e057ffa3dc
|
@ -101,6 +101,8 @@ function test_path() {
|
|||
host="$(hostname -s)"
|
||||
repo="b2:zio-euc-servers"
|
||||
|
||||
b2_account_id=""
|
||||
b2_account_key=""
|
||||
excludes=()
|
||||
paths=()
|
||||
passwd_file=""
|
||||
|
@ -121,7 +123,11 @@ else
|
|||
[[ -f "$env_dir/script-pre" ]] && pre_script="$env_dir/script-pre"
|
||||
[[ -f "$env_dir/script-post" ]] && post_script="$env_dir/script-post"
|
||||
|
||||
if [[ -f "$env_dir/confi" ]]; then
|
||||
if [[ -f "$env_dir/config" ]]; then
|
||||
[[ ! -z $(get_prop "$env_dir/config" B2_ACCOUNT_KEY) ]] && \
|
||||
b2_account_key="$(get_prop "$env_dir/config" B2_ACCOUNT_KEY)"
|
||||
[[ ! -z $(get_prop "$env_dir/config" EXCLUDES) ]] && \
|
||||
b2_account_id="$(get_prop "$env_dir/config" B2_ACCOUNT_ID)"
|
||||
[[ ! -z $(get_prop "$env_dir/config" EXCLUDES) ]] && \
|
||||
IFS=';' read -ra excludes <<< "$(get_prop "$env_dir/config" EXCLUDES)"
|
||||
[[ ! -z $(get_prop "$env_dir/config" PATHS) ]] && \
|
||||
|
@ -133,12 +139,24 @@ else
|
|||
if [[ -f "$env_dir/passwd" ]]; then
|
||||
passwd_file="$env_dir/passwd"
|
||||
else
|
||||
say_warn "Password file ($passwd_file) not found."
|
||||
say_die "Password file ($passwd_file) not found."
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -z $paths ]] && say_die "No paths specified. Aborting..."
|
||||
|
||||
if [[ -z $b2_account_key ]]; then
|
||||
say_die "B2_ACCOUNT_KEY (in $env_dir/config) not set. Aborting..."
|
||||
else
|
||||
export B2_ACCOUNT_KEY="$b2_account_key"
|
||||
fi
|
||||
|
||||
if [[ -z $b2_account_id ]]; then
|
||||
say_die "B2_ACCOUNT_ID (in $env_dir/config) not set. Aborting..."
|
||||
else
|
||||
export B2_ACCOUNT_ID="$b2_account_ID"
|
||||
fi
|
||||
|
||||
if [[ ! -z $pre_script ]]; then
|
||||
say_do "Executing pre-backup script..."
|
||||
. $pre_script
|
||||
|
|
Loading…
Reference in New Issue