mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
Allow to exclude previews from restore in the remote case too
Signed-off-by: Tim Diels <tim@diels.me>
This commit is contained in:
parent
47e0ac7b4d
commit
af3f00c3cc
1 changed files with 9 additions and 2 deletions
|
|
@ -322,8 +322,13 @@ if [ "$BORG_MODE" = restore ]; then
|
|||
|
||||
# Exclude previews from restore if selected to speed up process
|
||||
ADDITIONAL_RSYNC_EXCLUDES=()
|
||||
ADDITIONAL_BORG_EXCLUDES=()
|
||||
ADDITIONAL_FIND_EXCLUDES=()
|
||||
if [ -n "$RESTORE_EXCLUDE_PREVIEWS" ]; then
|
||||
# Keep these 3 in sync. Beware, the pattern syntax and the paths differ
|
||||
ADDITIONAL_RSYNC_EXCLUDES=(--exclude "nextcloud_aio_nextcloud_data/appdata_*/preview/**")
|
||||
ADDITIONAL_BORG_EXCLUDES=(--exclude "sh:nextcloud_aio_volumes/nextcloud_aio_nextcloud_data/appdata_*/preview/**")
|
||||
ADDITIONAL_FIND_EXCLUDES=(-o -regex 'nextcloud_aio_volumes/nextcloud_aio_nextcloud_data/appdata_[^/]*/preview\(/.*\)?')
|
||||
echo "Excluding previews from restore"
|
||||
fi
|
||||
|
||||
|
|
@ -399,7 +404,7 @@ if [ "$BORG_MODE" = restore ]; then
|
|||
#
|
||||
# Older backups may still contain files we've since excluded, so we have to exclude on extract as well.
|
||||
cd / # borg extract has no destination arg and extracts to CWD
|
||||
if ! borg extract "::$SELECTED_ARCHIVE" --progress --exclude-from /borg_excludes --pattern '+nextcloud_aio_volumes/**'
|
||||
if ! borg extract "::$SELECTED_ARCHIVE" --progress --exclude-from /borg_excludes "${ADDITIONAL_BORG_EXCLUDES[@]}" --pattern '+nextcloud_aio_volumes/**'
|
||||
then
|
||||
RESTORE_FAILED=1
|
||||
echo "Failed to extract backup archive."
|
||||
|
|
@ -407,9 +412,10 @@ if [ "$BORG_MODE" = restore ]; then
|
|||
# Delete files/dirs present locally, but not in the backup archive, excluding conf files
|
||||
# https://unix.stackexchange.com/a/759341
|
||||
# This comm does not support -z, but I doubt any file names would have \n in them
|
||||
echo "Deleting local files which do not exist in the backup"
|
||||
#
|
||||
# These find patterns need to be kept in sync with the borg_excludes file and the rsync excludes in this
|
||||
# file, which use a different syntax (patterns appear in 3 places in total)
|
||||
echo "Deleting local files which do not exist in the backup"
|
||||
if ! find nextcloud_aio_volumes \
|
||||
-not \( \
|
||||
-path nextcloud_aio_volumes/nextcloud_aio_apache/caddy \
|
||||
|
|
@ -425,6 +431,7 @@ if [ "$BORG_MODE" = restore ]; then
|
|||
-o -path nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/daily_backup_running \
|
||||
-o -path nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/session_date_file \
|
||||
-o -path "nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/id_borg*" \
|
||||
"${ADDITIONAL_FIND_EXCLUDES[@]}" \
|
||||
\) \
|
||||
| LC_ALL=C sort \
|
||||
| LC_ALL=C comm -23 - \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue