2
0
Fork 0

backup: add B2 account key/ID

main
Ducky 2022-03-02 00:53:31 +00:00
parent a696defb96
commit e057ffa3dc
1 changed files with 20 additions and 2 deletions

View File

@ -101,6 +101,8 @@ function test_path() {
host="$(hostname -s)" host="$(hostname -s)"
repo="b2:zio-euc-servers" repo="b2:zio-euc-servers"
b2_account_id=""
b2_account_key=""
excludes=() excludes=()
paths=() paths=()
passwd_file="" passwd_file=""
@ -121,7 +123,11 @@ else
[[ -f "$env_dir/script-pre" ]] && pre_script="$env_dir/script-pre" [[ -f "$env_dir/script-pre" ]] && pre_script="$env_dir/script-pre"
[[ -f "$env_dir/script-post" ]] && post_script="$env_dir/script-post" [[ -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) ]] && \ [[ ! -z $(get_prop "$env_dir/config" EXCLUDES) ]] && \
IFS=';' read -ra excludes <<< "$(get_prop "$env_dir/config" EXCLUDES)" IFS=';' read -ra excludes <<< "$(get_prop "$env_dir/config" EXCLUDES)"
[[ ! -z $(get_prop "$env_dir/config" PATHS) ]] && \ [[ ! -z $(get_prop "$env_dir/config" PATHS) ]] && \
@ -133,12 +139,24 @@ else
if [[ -f "$env_dir/passwd" ]]; then if [[ -f "$env_dir/passwd" ]]; then
passwd_file="$env_dir/passwd" passwd_file="$env_dir/passwd"
else else
say_warn "Password file ($passwd_file) not found." say_die "Password file ($passwd_file) not found."
fi fi
fi fi
[[ -z $paths ]] && say_die "No paths specified. Aborting..." [[ -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 if [[ ! -z $pre_script ]]; then
say_do "Executing pre-backup script..." say_do "Executing pre-backup script..."
. $pre_script . $pre_script