home · contact · privacy
Fix. master
authorChristian Heller <c.heller@plomlompom.de>
Thu, 3 Apr 2025 01:01:50 +0000 (03:01 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 3 Apr 2025 01:01:50 +0000 (03:01 +0200)
testing/home/desktop/.local/bin/borgplom

index 003090f8676061b22bd9294c91ee6f9137579e5e..340cbd3d319914e54dc0f32471f0a2d265c2c5a3 100755 (executable)
@@ -66,13 +66,7 @@ _check_args_beyond() {
     fi
 }
 
-_id_from_file() {
-    _ID=$(head -1 "$1" | cut -d'/' -f2)
-    if [ ! -z "$(echo ${_ID} | sed 's/[a-f0-9]//g')" ]; then
-        error_exit "inability to parse valid repo ID from alleged key file at $1"
-    fi
-    printf "${_ID}"
-}
+_id_from_file() { head -1 "$1" | cut -d'/' -f2 }
 
 HELP_ARGS_backup_keys=' PATH'
 HELP_DESC_backup_keys="copy known keys to PATH/, with their repos' server names as filenames"
@@ -117,6 +111,9 @@ CMDFNC_claim() {
     fi
     _ensure_no_overwrite_at "${_PATH_TARGET_KEY}"
     _REPO_ID="$(_id_from_file ${_PATH_SOURCE})"
+    if [ ! -z "$(echo ${_REPO_ID} | sed 's/[a-f0-9]//g')" ]; then
+        error_exit "inability to parse valid repo ID from alleged key file at $1"
+    fi
     _PATH_TARGET_LOCATION="$(path_repo_location ${_REPO_ID})"
     _ensure_no_overwrite_at "${_PATH_TARGET_LOCATION}"
     mkdir -p "${PATH_BORG_CONF_KEYS}" "$(dirname ${_PATH_TARGET_LOCATION})"