From unknown Sat Jun 21 02:55:02 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#71661 <71661@debbugs.gnu.org> To: bug#71661 <71661@debbugs.gnu.org> Subject: Status: [PATCH v2 1/5] services: backup: Support bootstrapping an initial restic backup Reply-To: bug#71661 <71661@debbugs.gnu.org> Date: Sat, 21 Jun 2025 09:55:02 +0000 retitle 71661 [PATCH v2 1/5] services: backup: Support bootstrapping an ini= tial restic backup reassign 71661 guix-patches submitter 71661 Richard Sent severity 71661 normal tag 71661 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 19 23:45:24 2024 Received: (at submit) by debbugs.gnu.org; 20 Jun 2024 03:45:24 +0000 Received: from localhost ([127.0.0.1]:41516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sK8jk-0006Wi-Bn for submit@debbugs.gnu.org; Wed, 19 Jun 2024 23:45:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:55410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sK8ji-0006WV-II for submit@debbugs.gnu.org; Wed, 19 Jun 2024 23:45:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sK8je-0006go-MB for guix-patches@gnu.org; Wed, 19 Jun 2024 23:45:18 -0400 Received: from mail-108-mta184.mxroute.com ([136.175.108.184]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sK8jc-0007Dl-Ju for guix-patches@gnu.org; Wed, 19 Jun 2024 23:45:18 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta184.mxroute.com (ZoneMTA) with ESMTPSA id 19033bf912d00017a3.002 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 20 Jun 2024 03:45:10 +0000 X-Zone-Loop: 85195fd8e0fffd1ff96d061759273e1257b252238144 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XuD2yRINfgfD1RxfCnun9Fbl0b2Udso5fzV/vwuymPk=; b=iH+5ATU6mhxxQ8dDht0NQlabJ9 ofVRq2IeEXVDFkdqrxRWhVp/0uizYuAbS0WNE9OWW417aZ6hY5mCAyVixHRFyEAlBGMtXVjcEL9Oa KLYtc20QwnQ2EOLyzNJ2peWtO4JP+IKVJiyyPSVfXgBtf952Lu77MvFyo6bUCpvSngRpfm/fny/2J NYoqpFzWwuR+e/C4XgIjnB6HFdRu0rLiNi1+YX3WG6SdBNf4KWSp8uMjwnJGzoOOXRPvvppO1I0g6 Pg5LADgSLTN19/sdSvJ0dgynu1kd1SQewZILlzB838Ccvv9IJuFGQvSDlhu8nconbm5iJyAhJ3wwQ PbpglJhw==; From: Richard Sent To: guix-patches@gnu.org, 71639@debbugs.gnu.org Subject: [PATCH v2 1/5] services: backup: Support bootstrapping an initial restic backup Date: Wed, 19 Jun 2024 23:44:12 -0400 Message-ID: <93ff43dbc77df724597c7c27ae955581a31a851e.1718854920.git.richard@freakingpenguin.com> In-Reply-To: References: MIME-Version: 1.0 X-Debbugs-Cc: Florian Pelz , Ludovic Courtès , Matthew Trzcinski , Maxim Cournoyer Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.184; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta184.mxroute.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: Richard Sent X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * gnu/services/backup.scm: (restic-backup-job): Add init? field. (restic-backup-job-program): Initialize repository if init? is set and repository does not already exist. * doc/guix.texi (Miscellaneous Services): Document it. Change-Id: I71d0cbaac646b9d160e662b69286f229b9a9f64d --- doc/guix.texi | 4 ++++ gnu/services/backup.scm | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 0102fd0fad..63c9cbd1a7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41353,6 +41353,10 @@ Miscellaneous Services The list of files or directories to be backed up. It must be a list of values that can be lowered to strings. +@item @code{init?} (default: @code{#f}) (type: boolean) +Whether restic-backup-service should check and (if it does not exist) +initialize the repository before running the backup. + @item @code{verbose?} (default: @code{#f}) (type: boolean) Whether to enable verbose output for the current backup job. diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm index 555e9fc959..1279ece88f 100644 --- a/gnu/services/backup.scm +++ b/gnu/services/backup.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2024 Giacomo Leidi +;;; Copyright © 2024 Richard Sent ;;; ;;; This file is part of GNU Guix. ;;; @@ -38,6 +39,7 @@ (define-module (gnu services backup) restic-backup-job-password-file restic-backup-job-schedule restic-backup-job-files + restic-backup-job-init? restic-backup-job-verbose? restic-backup-job-extra-flags @@ -94,6 +96,9 @@ (define-configuration/no-serialization restic-backup-job (verbose? (boolean #f) "Whether to enable verbose output for the current backup job.") + (init? + (boolean #f) + "Whether to attempt to initialize a new repository for automated bootstrap purposes.") (extra-flags (list-of-lowerables '()) "A list of values that are lowered to strings. These will be passed as @@ -118,6 +123,8 @@ (define (restic-backup-job-program config) (restic-backup-job-files config)) (extra-flags (restic-backup-job-extra-flags config)) + (init? + (restic-backup-job-init? config)) (verbose (if (restic-backup-job-verbose? config) '("--verbose") @@ -130,6 +137,18 @@ (define (restic-backup-job-program config) (setenv "RESTIC_PASSWORD" (with-input-from-file #$password-file read-line)) + (when #$init? + ;; Use cat config to check if the repository exists. See + ;; https://github.com/restic/restic/issues/1690 and + ;; https://github.com/NixOS/nixpkgs/pull/307962. + ;; + ;; XXX: restic returns values other than 1 on failure. Check + ;; EXIT_SUCCESS instead of EXIT_FAILURE. + (unless (or (equal? EXIT_SUCCESS (system* #$restic "cat" "config" + "-r" #$repository)) + (equal? EXIT_SUCCESS (system* #$restic "init" + "-r" #$repository))) + (error "Failed to initialize restic repository: " #$repository))) (execlp #$restic #$restic #$@verbose "-r" #$repository #$@extra-flags -- 2.45.1 From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 20 16:58:32 2024 Received: (at control) by debbugs.gnu.org; 20 Jun 2024 20:58:32 +0000 Received: from localhost ([127.0.0.1]:43925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKOrY-0004YK-A0 for submit@debbugs.gnu.org; Thu, 20 Jun 2024 16:58:32 -0400 Received: from mail-108-mta205.mxroute.com ([136.175.108.205]:35869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKOrW-0004Y6-CK for control@debbugs.gnu.org; Thu, 20 Jun 2024 16:58:30 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta205.mxroute.com (ZoneMTA) with ESMTPSA id 190377179a800017a3.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 20 Jun 2024 20:58:21 +0000 X-Zone-Loop: 34181c9d5a3ed241a26bece669b9d0f79a9192f1f14f X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Subject:From:To:Message-Id:Date:Sender:Reply-To :Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GMVYNkNtZLwvVkLIcd8h/O1ftYiGzZqJ6afbexaMzDQ=; b=XSbd73GUGejrZAthQCyaZ8OfFy Nnl0cKn8vVrrMgFKZFA3Rf4K/Q4+yMpOPWB/xZ+y4OmnVeFU1QEhq7bOnN+85cIavLopOOaC1yLKe rQqWyJfsCg4M6RzkBeQloa8ppuderVz3mgIzLDGRg2mfu+mDINwd4kX8jwHXRw07xF+++AtZLxCQ/ PNndmltvmhGT3+MDsmM23Ew33MsVzo5Zd2deR7Eqas6Yo5EUWda5k2J7NspOVWH8FE+FOyN7/Kmve kPj/lxv7oZ+N/o8MPtk8zvJ1R76qTuF6Ch+VQjD8GwgpcqzCsLoS8DpD5G6bxDQhi9WSDKvxVStw+ UU+ITkwA==; Date: Thu, 20 Jun 2024 16:58:18 -0400 Message-Id: <87cyobqql1.fsf@freakingpenguin.com> To: control@debbugs.gnu.org From: Richard Sent Subject: control message for bug #71661 X-Authenticated-Id: richard@freakingpenguin.com X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 71661 quit From unknown Sat Jun 21 02:55:02 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 20 Jul 2024 11:24:10 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator