home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 06:52:13 +0000 (08:52 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 06:52:13 +0000 (08:52 +0200)
testing/scripts/_setup_secrets_user.sh
testing/scripts/lib/mount_secrets

index 4662298be6e711a5f944baf79db8cc5a6a603102..a2556b962886e6bfae2c74d918a6dcc2c853786d 100644 (file)
@@ -34,7 +34,7 @@ cp -a "${PATH_SECRETS_SSH}" "${PATH_USER_SSH}"
 eval $(ssh-agent)
 stty -echo
 trapp stty echo
-retry_until 1 'echo ""' 'ssh-add -q' 'echo "Aborting due to ssh-add error"'
+retry_until 1 'echo ""' 'ssh-add -q' 'prefixed_msg "Aborting due to ssh-add error"'
 stty echo
 trapp
 
@@ -53,7 +53,7 @@ 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.'" '' 'direct'
-echo "${_OUTPUT}"
+retry_until 2 '' "${NAME_BORGAPP} orgpull" "prefixed_msg 'Aborting due to unexpected ${NAME_BORGAPP} error.'" '' 'direct'
+prefixed_msg "${_OUTPUT}"
 
 prefixed_msg_exit
index 4807cd0efd891e438c5631e8ff69b8bc35f35ec9..8e44c4a69bf6930ac7654883f8baec9360310fde 100644 (file)
@@ -2,9 +2,11 @@
 . lib/expect_n_args
 . lib/get_passphrase
 . lib/path_tmp_timestamped
+. lib/prefixed_msg
 . lib/retry_until
 
 mount_secrets() {
+    prefixed_msg_init mount_secrets
     expect_n_args 1 1 "(device name, e.g. 'sda')" $@
     SECRETS_DEV=$1
     if [ -z "${SECRETS_DEV}" ]; then
@@ -13,26 +15,29 @@ mount_secrets() {
     PATH_MOUNTED_SECRETS="${PATH_MEDIA}/${SECRETS_DEV}/${PATH_REL_SECRETS}"
     PATH_DEV="/dev/${SECRETS_DEV}"
     PATH_PMOUNT_ERR="$(path_tmp_timestamped 'err_mount')"
-    echo "Put secrets drive into slot for ${PATH_DEV}."
+    prefixed_msg "Put secrets drive into slot for ${PATH_DEV}."
     while [ ! -e "${PATH_DEV}" ]; do
         sleep 0.1
     done
-    _ON_LOOP_START='printf "Passphrase: "; PASSPHRASE=$(get_passphrase); echo ""'
+    _ON_LOOP_START='prefixed_msg_no_nl "Passphrase: "; PASSPHRASE=$(get_passphrase); echo ""'
     _TO_TEST='echo "${PASSPHRASE}" | pmount "${PATH_DEV}" 2>&1'
-    _ON_FAIL='echo "Aborting due to pmount error:"'
+    _ON_FAIL='prefixed_msg "Aborting due to pmount error:"'
     retry_until 100 "${_ON_LOOP_START}" "${_TO_TEST}" "${_ON_FAIL}"
-    echo "${_OUTPUT}"
+    prefixed_msg "${_OUTPUT}"
+    prefixed_msg_exit
 }
 
 copy_and_unmount_secrets() {
-    echo "Copying over ${PATH_REL_SECRETS}."
+    prefixed_msg_init copy_and_unmount_secrets
+    prefixed_msg "Copying over ${PATH_REL_SECRETS}."
     if [ "$1" = "out" ]; then
         cp -a "${PATH_SECRETS}" "${PATH_MOUNTED_SECRETS}"
     elif [ "$1" = "in" ]; then
         cp -a "${PATH_MOUNTED_SECRETS}" "${PATH_SECRETS}"
     else
-        echo abort "Illegal argument to unmount_secrets."
+        abort "Illegal argument to unmount_secrets."
     fi
     pumount "${SECRETS_DEV}"
-    echo "You can remove device ${SECRETS_DEV} now."
+    prefixed_msg "You can remove device ${SECRETS_DEV} now."
+    prefixed_msg_exit
 }