home · contact · privacy
Fix. master
authorChristian Heller <c.heller@plomlompom.de>
Fri, 4 Apr 2025 21:10:19 +0000 (23:10 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 4 Apr 2025 21:10:19 +0000 (23:10 +0200)
testing/home/desktop/.local/bin/borgplom

index 1b236e7e58aa80ac74304bf905032908c385d7d2..f20e1e5acc7ea628907532d717eb6ae12ac1d15b 100755 (executable)
@@ -128,7 +128,13 @@ USAGE_ARGS_init='SERVER_NAME'
 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'