backup: Don't restore excluded files

Sometimes, we restore a backup that has been created earlier before
exclude files have been changed. To avoid overwriting those files, we
will consider the exlude list upon restore.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2022-03-04 10:29:23 +00:00
parent ca1fdb6954
commit 3f8e70f6b3
2 changed files with 6 additions and 2 deletions

View File

@@ -72,7 +72,9 @@ restore_backup() {
local filename="${1}"
# Extract backup
if ! tar xvzpf "${filename}" -C /; then
if ! tar xvzpf "${filename}" -C / \
--exclude-from="/var/ipfire/backup/exclude" \
--exclude-from="/var/ipfire/backup/exclude.user"; then
echo "Could not extract backup" >&2
return 1
fi