From patchwork Thu Dec 2 12:37:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 4877 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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4J4b7r2Fhdz3wt3 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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4J4b7p2Jtjz1QM; 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 4J4b7n5kL9z2yXK; 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 4J4b7m6JkMz2xSB 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 4J4b7m2sYTzB0; Thu, 2 Dec 2021 12:37:24 +0000 (UTC) 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; bh=t7qfw4BB51qJOtJ+fqONGih2DSR2q/ApXv3KFEuCoMI=; b=JOH0hKur9ZgLTwXD7dLKLI7G8RP2iN9q66rhrs6BWuv9vv6KyhgVC5Oc6qRr66nj4V954+ at1Av9btD9IThwCg== 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; bh=t7qfw4BB51qJOtJ+fqONGih2DSR2q/ApXv3KFEuCoMI=; b=AysmaLmFgQ+LxoxlUpVAzEsDDQnuYKnT9J97aW4UREUZb7wnm/Y/liSwr5z8rB70ZHVCQR f9Q7SU4iSPGmyE4NuoTTUW0yEKrrveTepvK/urYlEgtqGPy7fa6ZDs2j4u+jJCG0QWfZHa KSKKpsvK2DwhxQob0bAhmGMPFRjO1kUQpoVoCcRscpGLuRWmpe5SI0kE5htZAXXgxCzk1D 9KVkwVZ9fdiYzKjJI0O4wZ7ihQmbfbx+gAL4ulXRe5fcczvmJEmZyS1N1D1RdFdphgQyi1 I9bk0S6tAdGyDQjhCbstvVopto+QI+gLIxHUD+GPhIjvv5lClSrJxckyp/pKYg== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 1/3] backup: Use filename as specified on console Date: Thu, 2 Dec 2021 12:37:13 +0000 Message-Id: <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" Signed-off-by: Michael Tremer --- config/backup/backup.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/backup/backup.pl b/config/backup/backup.pl index 8dffbf2e1..0b47af2d6 100644 --- a/config/backup/backup.pl +++ b/config/backup/backup.pl @@ -238,7 +238,7 @@ main() { filename="/tmp/restore.ipf" fi - restore_backup "/tmp/restore.ipf" + restore_backup "${filename}" ;; addonbackup) 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}" From patchwork Thu Dec 2 12:37:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 4879 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 4J4b7t222Wz3wt3 for ; Thu, 2 Dec 2021 12:37:30 +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 4J4b7p51YCz3ZZ; 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 4J4b7n6vSCz30Gj; 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 4J4b7n08dtz2yRy for ; Thu, 2 Dec 2021 12:37:25 +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 4J4b7m64VWz1QK; Thu, 2 Dec 2021 12:37:24 +0000 (UTC) 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=CGKgct7LeSnuH1BuN+Ql+IfHmVJFr655tTq4Z1yQh98=; b=MQGw7XsySesbCWateRDrGdvzZHiDOtF5SbbjcYxaR6xoq79D2Ma7H4IH1gcP6tuMexGenc lVu90npZi8K3ErDA== 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=CGKgct7LeSnuH1BuN+Ql+IfHmVJFr655tTq4Z1yQh98=; b=C8/pgU/Q0Co/Wbf4SEiqRYHnIZHp40G6Zx5xXEL5vHcs/0A1sJf3XuP5xfi8C2sVpy37fi kwhxg1kmAwIeXKeW5S/e/XM0o25pXVFtC/DcsaVIz27O0UhPbzhXzlqAyyYbxTGQ/4zx3X 8KYikiSygNSlNBkWsGpLxWRkjbzd+c/lwg0ovRRZyPDfPSsvvjDE/Waqa85W4Ci0pser2H xFMEp/+3GbHnShJcY3FydpkdnqTULqWVV/FYZO01yg2pq7WJPNqbvZx4LJTHNHPdw/YQ9m kSl1tTkI++cESknd8uhf5OiUxfO1SjGxDnN/1bNr+fb+aM9hnEDEINRE98o/Yw== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 3/3] backup: Fork ISO job into the background in CGI script Date: Thu, 2 Dec 2021 12:37:15 +0000 Message-Id: <20211202123715.2525482-3-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" In order to be able to run the ISO command on command line it is helpful that the script does not go into background halfway through the process. We should rather start it as a background job straight from the CGI script. Signed-off-by: Michael Tremer --- config/backup/backup.pl | 2 +- html/cgi-bin/backup.cgi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/backup/backup.pl b/config/backup/backup.pl index bed5952de..afd8d1663 100644 --- a/config/backup/backup.pl +++ b/config/backup/backup.pl @@ -247,7 +247,7 @@ main() { local filename="/var/ipfire/backup/${NOW}.ipf" if make_backup "${filename}"; then - /usr/local/bin/backupiso "${NOW}" & + /usr/local/bin/backupiso "${NOW}" fi ;; diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 84c015314..1b1ccb4a8 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -119,7 +119,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) } elsif ( $cgiparams{'BACKUPLOGS'} eq "exclude" ) { &General::system("/usr/local/bin/backupctrl", "exclude"); } elsif ( $cgiparams{'BACKUPLOGS'} eq "iso" ) { - &General::system("/usr/local/bin/backupctrl", "iso"); + &General::system_background("/usr/local/bin/backupctrl", "iso"); } } if ( $cgiparams{'ACTION'} eq "addonbackup" )