USAGE_DESC_init="create repo at \"$(location_from_servername SERVER_NAME)\""
CMDFNC_init() {
expect_n_args 1 1 "${USAGE_ARGS_init}" $@
- BORG_PASSPHRASE= borg init --encryption=keyfile "$(location_from_servername $1)"
+ _STASHED_BORG_PASSPHRASE="$(env | grep -E '^BORG_PASSPHRASE=' | cut -d'=' -f2-)"
+ unset BORG_PASSPHRASE
+ borg init --encryption=keyfile "$(location_from_servername $1)"
+ if [ ! -z "${_STASHED_BORG_PASSPHRASE}" ]; then
+ export BORG_PASSPHRASE="${_STASHED_BORG_PASSPHRASE}"
+ _STASHED_BORG_PASSPHRASE=
+ fi
}
USAGE_DESC_keys='list known repos in ID, key filename, and alleged location'