home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 4 Apr 2025 13:17:53 +0000 (15:17 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 4 Apr 2025 13:17:53 +0000 (15:17 +0200)
testing/home/desktop/.local/bin/borgplom

index 9b98c5048ec445edb69e4231465322122e18858a..ab5a3d14af5a9c3e1464436e046ec56826be928a 100755 (executable)
@@ -13,8 +13,8 @@ USAGE_LINES='COMMAND\nCOMMAND PATH'
 
 PATH_BORG_CONF_SECURITY="${PATH_BORG_CONF}/security"
 PATH_BORG_CONF_KEYS="${PATH_BORG_CONF}/keys"
-servername_to_location() { printf 'ssh://plom@%s/./borg' "$1"; }
-location_to_servername() { echo "$1" | cut -d'/' -f3 | cut -d'@' -f2; }
+location_from_servername() { printf 'ssh://plom@%s/./borg' "$1"; }
+servername_from_location() { echo "$1" | cut -d'/' -f3 | cut -d'@' -f2; }
 path_repo_location() { printf '%s' "${PATH_BORG_CONF_SECURITY}/${1}/location"; }
 
 # exits
@@ -56,7 +56,7 @@ CMDFNC_backup_keys() {
             echo "Ignoring ${_FILENAME} due to lack of matching location file."
             continue
         fi
-       _NAME_SERVER=$(location_to_servername "$(cat ${_PATH_LOC})")
+       _NAME_SERVER=$(servername_from_location "$(cat ${_PATH_LOC})")
         _PATH_TARGET="${_PATH_TARGET_DIR}/${_NAME_SERVER}"
         echo "Copying ${_FILENAME} to ${_PATH_TARGET} …"
         cp "${_FILENAME}" "${_PATH_TARGET}"
@@ -65,7 +65,7 @@ CMDFNC_backup_keys() {
 }
 
 USAGE_ARGS_claim='PATH'
-USAGE_DESC_claim="register file of PATH as key to repo at \"$(servername_to_location SERVERNAME)\", with SERVERNAME the filename portion of PATH"
+USAGE_DESC_claim="register file of PATH as key to repo at \"$(location_from_servername SERVERNAME)\", with SERVERNAME the filename portion of PATH"
 CMDFNC_claim() {
     _check_args_n 1 "$@"
     _PATH_SOURCE="$1"
@@ -91,7 +91,7 @@ CMDFNC_claim() {
     echo "Copying ${_PATH_SOURCE} to ${_PATH_TARGET_KEY} …"
     cp "${_PATH_SOURCE}" "${_PATH_TARGET_KEY}"
     echo "Writing ${_PATH_TARGET_LOCATION} …"
-    printf '%s' "$(servername_to_location ${_FILENAME})" > "${_PATH_TARGET_LOCATION}"
+    printf '%s' "$(location_from_servername ${_FILENAME})" > "${_PATH_TARGET_LOCATION}"
     chmod a-rwx,u+rw "${_PATH_TARGET_KEY}" "${_PATH_TARGET_LOCATION}"
 }
 
@@ -102,9 +102,10 @@ CMDFNC_help() {
 }
 
 USAGE_ARGS_info='SERVER_NAME [ARCHIVE]'
+USAGE_ARGS_help='run "borg info" against repo in server of SERVER_NAME'
 CMDFNC_info() {
     _check_args_n 1 "$@"
-    _TARGET="$(location_to_servername ${1})"
+    _TARGET="$(location_from_servername ${1})"
     if [ ! -z "$2" ]; then
         _TARGET="${_TARGET}::$2}"
     fi
@@ -150,7 +151,7 @@ CMDFNC_orgpull() {
     ls -1 "${PATH_BORG_CONF_SECURITY}/" > "${_PATH_PIPE}" &
     while read _FILENAME; do
         _LOCATION="$(cat $(path_repo_location ${_FILENAME}))"
-       _NAME_SERVER=$(location_to_servername "${_LOCATION}")
+       _NAME_SERVER=$(servername_from_location "${_LOCATION}")
         if ping -c1 -W2 "${_NAME_SERVER}" > /dev/null 2>&1; then
             _REPO="${_LOCATION}"
             break