Use / on end of mountpoint test in do-backup.

This commit is contained in:
Darren 'Tadgy' Austin 2023-11-06 20:38:43 +00:00
commit 70443978b6

View file

@ -9,7 +9,8 @@
# Base configuration.
RSYNC_OPTIONS=( '-a' '-H' '-A' '--timeout=300' '--partial' '--partial-dir=.rsync-tmp' '--delete-delay' '--delay-updates' )
RSYNC_OPTIONS_VERBOSE=( '--verbose' '--stats' '--human-readable' )
RSYNC_LOG="/tmp/${0##*/}-$$.log"
RSYNC_LOG="/tmp/${0##*/}-$$-$RANDOM.log"
LOCK_FILE="/tmp/${0##*/}-$$-$RANDOM.lock"
# Sanity checks.
(( $# != 1 )) || [[ -z "$1" ]] || [[ "$1" =~ ^(-h|-help|--help)$ ]] && {
@ -17,6 +18,9 @@ RSYNC_LOG="/tmp/${0##*/}-$$.log"
exit 1
}
# Remove temporary files upon exit.
trap 'rm -f "$RSYNC_LOG"; rm -f "$LOCK_FILE"' EXIT
# Get backup definition specific configuration.
case "$1" in
'gv0')
@ -93,7 +97,8 @@ source /etc/mail.conf "backups" 2>/dev/null || {
}
# Make sure BACKUP_MOUNTPOINT is a mountpoint.
mountpoint "$BACKUP_MOUNTPOINT" >/dev/null 2>&1 || {
# Note: The / on the end if required for automount mountpoints.
mountpoint "$BACKUP_MOUNTPOINT/" >/dev/null 2>&1 || {
[[ -x /opt/bin/pushover-client ]] && /opt/bin/pushover-client "backups" -p -1 -m "Backup failure: ${ERRORS_SOURCE:-$RSYNC_SOURCE}"
if [[ -n "${EMAIL_TO[*]}" ]]; then
mailx "${MAILX_ARGS[@]}" -S "from=$EMAIL_FROM" -s "Backup failure: ${ERRORS_SOURCE:-$RSYNC_SOURCE}" "${EMAIL_TO[@]}" <<-EOF 2>/dev/null || \
@ -138,13 +143,11 @@ ERR="$?"
Output:
$(< "$RSYNC_LOG")
EOF
RET=1
exit 1
else
printf "%s: %s\\n" "${0##*/}" "no recipient configured for mail delivery" >&2
RET=1
exit 1
fi
}
rm -f "$RSYNC_LOG"
exit "${RET:-0}"
exit 0