Windows: prevent backing up current directory

Don't process the array if there's no values to prevent issues on
Windows. See #125

Fixes #125
This commit is contained in:
Erik Westrup
2023-11-01 15:22:31 +01:00
parent 1c0ba09d70
commit e5e5cea35e

View File

@@ -63,9 +63,11 @@ IFS=':' read -ra backup_paths <<< "$RESTIC_BACKUP_PATHS"
# Convert to array, an preserve spaces. See #111
backup_extra_args=( )
while IFS= read -r -d ''; do
backup_extra_args+=( "$REPLY" )
done < <(xargs printf '%s\0' <<<"$RESTIC_BACKUP_EXTRA_ARGS")
if [ ! -z "$RESTIC_BACKUP_EXTRA_ARGS" ]; then
while IFS= read -r -d ''; do
backup_extra_args+=( "$REPLY" )
done < <(xargs printf '%s\0' <<<"$RESTIC_BACKUP_EXTRA_ARGS")
fi
B2_ARG=
[ -z "${B2_CONNECTIONS+x}" ] || B2_ARG=(--option b2.connections="$B2_CONNECTIONS")