home · contact · privacy
Fix. master
authorChristian Heller <c.heller@plomlompom.de>
Mon, 7 Apr 2025 18:09:49 +0000 (20:09 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 7 Apr 2025 18:09:49 +0000 (20:09 +0200)
testing/home/desktop/.local/bin/borgplom
testing/scripts/_setup_secrets_user.sh
testing/scripts/lib/mount_secrets
testing/scripts/lib/retry_until

index 962bbed5617453fe758585e3368b403f17a36518..7e256583c9d5146289e146f0ad9e24091ef3168e 100755 (executable)
@@ -37,7 +37,7 @@ _run_borg_with_passphrase() {
             echo ""
         fi
     '
-    _TO_TEST='"$(borg '"$@"')"'
+    _TO_TEST='borg '"$@"
     _ON_FAIL='echo "unexpected borg error, code ${_RESULT}."'
     _ON_LOOP_END='export BORG_PASSPHRASE='
     retry_until 52 "${_PREPARE}" "${_TO_TEST}" "${_ON_FAIL}" "${_ON_LOOP_END}"
index 1035f92ddf10c102cfb94ce3f3bef68cfe3caaaa..a485ca005792112d98324b79ace35df02c222f82 100644 (file)
@@ -50,5 +50,5 @@ ls -1 | while read _FILENAME; do
     "${NAME_BORGAPP}" claim "${_FILENAME}"
 done
 cd -
-retry_until 2 '' "${NAME_BORGAPP} orgpull" "echo 'Aborting due to unexpected ${NAME_BORGAPP} error.'"
+retry_until 2 '' "${NAME_BORGAPP} orgpull" "echo 'Aborting due to unexpected ${NAME_BORGAPP} error.'" '' 'direct'
 echo "${_OUTPUT}"
index 53b30d94f45f926e381265f1d2eebc7a4577d007..d262c527e545d191ed3052e50688695361269850 100644 (file)
@@ -20,7 +20,7 @@ mount_secrets() {
     _PREPARE='printf "Passphrase: "; PASSPHRASE=$(get_passphrase); echo ""'
     _TO_TEST='echo "${PASSPHRASE}" | pmount "${PATH_DEV}" 2>&1'
     _ON_FAIL='echo "Aborting due to pmount error:'
-    retry_until 100 ${_PREPARE}" "${_TO_TEST}" "${_ON_FAIL}"
+    retry_until 100 "${_PREPARE}" "${_TO_TEST}" "${_ON_FAIL}"
     echo "${_OUTPUT}"
 }
 
index 2d0297d65294aabcb7b30732618ea50613c1ae98..5179ba157f4e2c6dcb5399829749789ed15ae94e 100644 (file)
@@ -4,15 +4,21 @@ retry_until() {
     _TO_TEST="$3"
     _ON_FAIL="$4"
     _ON_LOOP_END="$5"
+    _OUTPUT_MODE="$6"
     while true; do
         eval "${_ON_LOOP_START}"
         set +e
-        _OUTPUT="$(eval ${_TO_TEST})"
-        _RESULT=$?
+        if [ "${_OUTPUT_MODE}" = 'direct' ]; then
+            eval ${_TO_TEST}
+            _RESULT=$?
+        else
+            _OUTPUT="$(eval ${_TO_TEST})"
+            _RESULT=$?
+        fi
         set -e
         if [ "${_RESULT}" = '0' ]; then
             break
-        elif [ "${RESULT}" != "${_CODE_FOR_CONTINUE}" ]; then
+        elif [ "${_RESULT}" != "${_CODE_FOR_CONTINUE}" ]; then
             eval "${_ON_FAIL}"
             abort
         fi