From patchwork Thu Dec 2 12:37:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 4878 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4J4b7r50Xwz3wtP for ; Thu, 2 Dec 2021 12:37:28 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4J4b7p33zWz3Yq; Thu, 2 Dec 2021 12:37:26 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4J4b7n6Ml9z2yrX; Thu, 2 Dec 2021 12:37:25 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4J4b7m6hpnz2xVx for ; Thu, 2 Dec 2021 12:37:24 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4J4b7m5WBGzjr; Thu, 2 Dec 2021 12:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1638448644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BHFTX6aGEusmBsM1P87LvY2hT39ecq97jtSp1tW2WNw=; b=Kehc9GfPiOnLUV2quHoeN+KOJ011HWwKTLJhH6smuF4S/yd2FCeiZUC5a/pAU1UMCaMjOr l/ywuJujjAVQ0jcVLDG27aO8NiMRy/igNqMttM3qrvgZF7tHKXQg3A32FvTjwxVON9AIEB hXopLAhFcz9gHGe8fWlvmh+B5HgNBWnKq8RFjCKjCFNjhRkzii3vhBT1tWwGgwb42QCPYz d8jxPpiGf5nCiDo4eShGmMH29HWi4N+yGO9/HS0wDcqXMDMuDoBNBLMPsUqfjmMCG+BraK SpVL51nMa1bcmdHMJE3ooOoCtZAcS0LU/kqJKt74B6zdeTLImygAxJaKG7to/A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1638448644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BHFTX6aGEusmBsM1P87LvY2hT39ecq97jtSp1tW2WNw=; b=qNiRzCasX0s+0vkmhCc5CPyaLyuhQ9X3Pk13sgaUL/BcfBhW2a0H1DrwDjiTAE2gibZ91v dUbOoVf/woh09cDg== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 2/3] backup: Create tarball in one pass Date: Thu, 2 Dec 2021 12:37:14 +0000 Message-Id: <20211202123715.2525482-2-michael.tremer@ipfire.org> In-Reply-To: <20211202123715.2525482-1-michael.tremer@ipfire.org> References: <20211202123715.2525482-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" 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 0b47af2d6..bed5952de 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}"