From 50f8b9f93f97fef8251d64b400d49ee7314b8e4d Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 2 Apr 2025 13:45:58 +0200 Subject: [PATCH] Fix. --- testing/home/desktop/.local/bin/borgplom | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/testing/home/desktop/.local/bin/borgplom b/testing/home/desktop/.local/bin/borgplom index e18ba76..f94d64b 100755 --- a/testing/home/desktop/.local/bin/borgplom +++ b/testing/home/desktop/.local/bin/borgplom @@ -48,8 +48,17 @@ _path_repo_location() { cmd_keys() { _PATH_CONF_KEYS="${PATH_BORG_CONF}/keys" - echo "Known keys (from ${PATH_BORG_CONF}):" - ls -1 "${_PATH_CONF_KEYS}" | while read _FILENAME; do + echo "Known keys as per ${PATH_BORG_CONF}:" + if [ ! -d "${_PATH_CONF_KEYS}" ]; then + echo "(none, since no ${_PATH_CONF_KEYS})" + exit 0 + fi + _KEYFILES="$(ls -1 ${_PATH_CONF_KEYS})" + if [ -z "${_KEYFILES}" ]; then + echo "(none, directory empty)" + exit 0 + fi + echo "${_KEYFILES}" | while read _FILENAME; do _KEY_ID=$(head -1 "${_PATH_CONF_KEYS}/${_FILENAME}" | cut -d' ' -f2) _LOCATION=? _PATH_LOC="$(cat $(_path_repo_location ${_KEY_ID}))" -- 2.30.2