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
"${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
. 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
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
}