From 51ed815f5ebb4668b54f4715b1273a6ce6f16764 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 2 Dec 2021 12:37:14 +0000 Subject: [PATCH] backup: Create tarball in one pass This patch is changing the behaviour of the backup script so that it creates one tarball and compresses it in one go. This will save storing the original tarball on disk before compressing it which on my test system requires significant disk space. This patch also solves a bug where the backup file included with the ISO image could not be extracted because it was not gzip-compressed when it was expected to be. Signed-off-by: Michael Tremer --- config/backup/backup.pl | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/config/backup/backup.pl b/config/backup/backup.pl index 0b47af2d65..bed5952def 100644 --- a/config/backup/backup.pl +++ b/config/backup/backup.pl @@ -58,20 +58,13 @@ make_backup() { done # Backup using global exclude/include definitions - tar cvf "${filename}" \ + tar cvfz "${filename}" \ --exclude-from="/var/ipfire/backup/exclude" \ - $(process_includes "/var/ipfire/backup/include") \ - "$@" - - # Backup using user exclude/include definitions and append to global backup - tar rvf "${filename}" \ --exclude-from="/var/ipfire/backup/exclude.user" \ + $(process_includes "/var/ipfire/backup/include") \ $(process_includes "/var/ipfire/backup/include.user") \ "$@" - # gzip the combined global/user backup and use .ipf suffix - gzip --suffix .ipf "${filename}" - return 0 } @@ -215,7 +208,7 @@ main() { local filename="${1}" if [ -z "${filename}" ]; then - filename="/var/ipfire/backup/${NOW}" + filename="/var/ipfire/backup/${NOW}.ipf" fi make_backup "${filename}" $(find_logfiles) @@ -225,7 +218,7 @@ main() { local filename="${1}" if [ -z "${filename}" ]; then - filename="/var/ipfire/backup/${NOW}" + filename="/var/ipfire/backup/${NOW}.ipf" fi make_backup "${filename}" -- 2.39.5