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 026935a137
commit e5ad6e2ab1
2 changed files with 6 additions and 2 deletions

View File

@@ -1204,7 +1204,9 @@ char* hw_find_backup_file(const char* output, const char* search_path) {
int hw_restore_backup(const char* output, const char* backup_path, const char* destination) {
char command[STRING_SIZE];
snprintf(command, sizeof(command), "/bin/tar xzpf %s -C %s", backup_path, destination);
snprintf(command, sizeof(command), "/bin/tar xzpf %s -C %s "
"--exclude-from=%s/var/ipfire/backup/exclude --exclude-from=%s/var/ipfire/backup/exclude.user",
backup_path, destination, destination, destination);
int rc = mysystem(output, command);
if (rc)