diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2019-08-08 18:52:31 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2019-08-08 18:52:31 -0300 |
commit | ae6cb0f45884149ea2a30718dd8959156b0bbc89 (patch) | |
tree | 90dbfb8ec255b3a0c4ddcea415f0c86efad019bf | |
parent | a10069fbe13127bd5c08be54df948f4f206cbe2f (diff) | |
download | borger-ae6cb0f45884149ea2a30718dd8959156b0bbc89.tar.gz borger-ae6cb0f45884149ea2a30718dd8959156b0bbc89.tar.bz2 |
Ensure BORG_PASSPHRASES is a global variable
-rwxr-xr-x | borger | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -268,16 +268,6 @@ function borger_single { function borger_multiple { info "Multiple destination \"$DESTINATION\" found. Processing each subconfig..." - # Needs bash 4 - # https://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash - if echo $BASH_VERSION | grep -q "^3"; then - fatal "$BASENAME requires bash 4 or newer." - fi - - # Passphrase array - declare -A BORG_PASSPHRASES - export BORG_PASSCOMMAND="" - # Evaluate each config for config in `ls $CONFIG`; do # Include BORG_PASSPHRASE config for each destination in an array @@ -297,6 +287,7 @@ function borger_multiple { # Serial approach for config in `ls $CONFIG`; do info "Calling borger for $DESTINATION/$config..." + export BORG_PASSCOMMAND="" export BORG_PASSPHRASE="${BORG_PASSPHRASES[$config]}" $FULLNAME $DESTINATION/$config 2>&1 | sed -e "s/^\[borger\]/[borger] [$config]/" -e "s/^\([^\[]\)/[borger] [$config] \1/" done @@ -353,6 +344,15 @@ function borger_continuous { done } +# Strong requirement: bash 4 +# https://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash +if echo $BASH_VERSION | grep -q "^3"; then + fatal "$BASENAME requires bash 4 or newer." +fi + +# Declare global passphrase array +declare -A BORG_PASSPHRASES + # Setup borger_setup |