borg-extract-archiv.sh,borg-list-backups.sh: some minor fixes in case og localhost.

This commit is contained in:
Christoph 2025-01-01 13:30:26 +01:00
parent 7f1114500a
commit 957993aff5
2 changed files with 48 additions and 40 deletions

View File

@ -221,7 +221,8 @@ DEFAULT_BORG_RSH='ssh -i /root/.ssh/id_ed25519-borg-backup'
if [[ -f "$conf_file" ]]; then if [[ -f "$conf_file" ]]; then
source "$conf_file" source "$conf_file"
else else
fatal "No configuration file '$conf_file' present!" warn "No configuration file '$conf_file' present!"
#fatal "No configuration file '$conf_file' present!"
fi fi
@ -281,7 +282,7 @@ if [[ -n "${_BORG_HOST}" ]] ; then
FQHN_BORG_HOSTNAME="${_BORG_HOST}" FQHN_BORG_HOSTNAME="${_BORG_HOST}"
break break
fi fi
if [[ ${FQHN_BORG_HOSTNAME} =~ ^127 ]] || [[ "${FQHN_BORG_HOSTNAME,,}" =~ "localhost" ]] ; then if [[ ${FQHN_BORG_HOSTNAME} =~ ^127 ]] || [[ "${FQHN_BORG_HOSTNAME,,}" = "localhost" ]] ; then
break break
fi fi
if [[ ! ${FQHN_BORG_HOSTNAME} =~ \. ]]; then if [[ ! ${FQHN_BORG_HOSTNAME} =~ \. ]]; then
@ -293,6 +294,9 @@ else
while [[ "X${FQHN_BORG_HOSTNAME}" = "X" ]]; do while [[ "X${FQHN_BORG_HOSTNAME}" = "X" ]]; do
echononl "Full borg hostname: " echononl "Full borg hostname: "
read FQHN_BORG_HOSTNAME read FQHN_BORG_HOSTNAME
if [[ ${FQHN_BORG_HOSTNAME} =~ ^127 ]] || [[ "${FQHN_BORG_HOSTNAME,,}" = "localhost" ]] ; then
break
fi
if [[ "X${FQHN_BORG_HOSTNAME}" = "X" ]]; then if [[ "X${FQHN_BORG_HOSTNAME}" = "X" ]]; then
echo -e "\n\t\033[33m\033[1mFull qualified hostname is reqired\033[m\n" echo -e "\n\t\033[33m\033[1mFull qualified hostname is reqired\033[m\n"
fi fi
@ -363,6 +367,7 @@ else
done done
fi fi
if [[ ! ${FQHN_BORG_HOSTNAME} =~ ^127 ]] && [[ ! "${FQHN_BORG_HOSTNAME,,}" = "localhost" ]] ; then
SSH_USER="" SSH_USER=""
echo -e "\033[32m--\033[m" echo -e "\033[32m--\033[m"
@ -402,6 +407,7 @@ while [[ "X${BORG_RSH}" = "X" ]]; do
BORG_RSH="${_BORG_RSH}" BORG_RSH="${_BORG_RSH}"
fi fi
done done
fi
blank_line blank_line

View File

@ -228,8 +228,10 @@ DEFAULT_BORG_RSH='ssh -i /root/.ssh/id_ed25519-borg-backup'
if [[ -f "$conf_file" ]]; then if [[ -f "$conf_file" ]]; then
source "$conf_file" source "$conf_file"
else else
if [[ -z "${BORG_HOST}" ]] || [[ -z "${BORG_REPO}" ]] || [[ -z "${BORG_PASSPHRASE}" ]] ; then
fatal "No configuration file '$conf_file' present!" fatal "No configuration file '$conf_file' present!"
fi fi
fi
# ---------- # ----------