Skip to content

Commit

Permalink
Windows: prevent backing up current directory
Browse files Browse the repository at this point in the history
Don't process the array if there's no values to prevent issues on
Windows. See #125

Fixes #125
  • Loading branch information
erikw committed Nov 1, 2023
1 parent 1c0ba09 commit e5e5cea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bin/restic_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit e5e5cea

Please sign in to comment.