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
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}"
}
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"
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}"
}
}
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
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