From patchwork Mon Mar 22 14:34:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: raid5atemyhomework X-Patchwork-Id: 28020 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6C74627BC59; Mon, 22 Mar 2021 15:06:43 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id AAD1527BC58 for ; Mon, 22 Mar 2021 15:06:42 +0000 (GMT) Received: from localhost ([::1]:45814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOM8f-0000pr-T3 for patchwork@mira.cbaines.net; Mon, 22 Mar 2021 11:06:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOLe3-0000hD-6z for guix-patches@gnu.org; Mon, 22 Mar 2021 10:35:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOLe2-0006fU-U1 for guix-patches@gnu.org; Mon, 22 Mar 2021 10:35:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lOLe2-0001wT-Rr for guix-patches@gnu.org; Mon, 22 Mar 2021 10:35:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#45692] [PATCH v3 2/3] gnu: Add zfs-auto-snapshot. References: In-Reply-To: Resent-From: raid5atemyhomework Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 22 Mar 2021 14:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45692 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "45692@debbugs.gnu.org" <45692@debbugs.gnu.org> Received: via spool by 45692-submit@debbugs.gnu.org id=B45692.16164236817427 (code B ref 45692); Mon, 22 Mar 2021 14:35:02 +0000 Received: (at 45692) by debbugs.gnu.org; 22 Mar 2021 14:34:41 +0000 Received: from localhost ([127.0.0.1]:58244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOLdh-0001vj-A7 for submit@debbugs.gnu.org; Mon, 22 Mar 2021 10:34:41 -0400 Received: from mail-40141.protonmail.ch ([185.70.40.141]:34184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOLdf-0001vX-KP for 45692@debbugs.gnu.org; Mon, 22 Mar 2021 10:34:40 -0400 Date: Mon, 22 Mar 2021 14:34:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1616423673; bh=QQM+qwaT1UTcQHbQW8JOM7Zj5IQqKU2fIhbum0hDGSM=; h=Date:To:From:Reply-To:Subject:From; b=IE2RzgCDCj6AUqxMq/WkpEeEYxhA+hUlqW2gKt4E5xpGdjAQ+sJl4l4EupiS5waR/ ZRkkPsPmF3jIXBNUIF4FqXI5reNMxZNWw4WXMLfwFSGHzfRUmJ2KcziK3ieIDMYjNf N8tTGC0D8Hs9TaqJQpYvMiHUMwS6jG2OwVax5FzQ= Message-ID: <2c97vRukDGd4mnnPwPzLZOBq6qR5EqiBvaevyGcaoh1zc8NQkJO8y2DvtaMuafb6R9m5_Hhizx41nJjyggYPiHNXmnYKkQCejKsw_n1-wec=@protonmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: raid5atemyhomework X-ACL-Warn: , raid5atemyhomework via Guix-patches X-Patchwork-Original-From: raid5atemyhomework via Guix-patches via From: raid5atemyhomework X-getmail-retrieved-from-mailbox: Patches From 481dc87f77743b7a282777656e78615ea57d19cc Mon Sep 17 00:00:00 2001 From: raid5atemyhomework Date: Sun, 14 Mar 2021 16:40:47 +0800 Subject: [PATCH 2/3] gnu: Add zfs-auto-snapshot. * gnu/packages/file-systems.scm (zfs-auto-snapshot): New variable. --- gnu/packages/file-systems.scm | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) -- 2.31.0 diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm index 198653c639..6877f89f6e 100644 --- a/gnu/packages/file-systems.scm +++ b/gnu/packages/file-systems.scm @@ -976,6 +976,81 @@ originally developed for Solaris and is now maintained by the OpenZFS community.") (license license:cddl1.0))) +(define-public zfs-auto-snapshot + (package + (name "zfs-auto-snapshot") + (version "1.2.4") + (source + (origin + (method url-fetch) + (uri (string-append + "https://github.com/zfsonlinux/zfs-auto-snapshot/archive/upstream/" + version ".tar.gz")) + (sha256 + (base32 "16ry1w43i44xc67gr73x6fa48ninfhqxr498ad4m3kya93vp2zrh")))) + (build-system gnu-build-system) + (inputs + ;; Note: if you are inheriting from the above zfs package in order + ;; to provide a specific stable kernel version, you should also + ;; inherit this package and replace the sole input below. + `(("zfs" ,zfs))) + (arguments + `(#:tests? #f ; No tests + #:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'build) + ;; Guix System may not have a traditional cron system, but + ;; the cron scripts installed by this package are convenient + ;; to use as targets for an mcron job specification, so make + ;; sure they can be run in-store. + (add-before 'install 'fix-scripts + (lambda* (#:key outputs inputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (zfs-auto-snapshot (string-append + out + "/sbin/zfs-auto-snapshot")) + (zfs-package (assoc-ref inputs "zfs")) + (zpool (string-append + zfs-package + "/sbin/zpool")) + (zfs (string-append + zfs-package + "/sbin/zfs"))) + (substitute* '("etc/zfs-auto-snapshot.cron.daily" + "etc/zfs-auto-snapshot.cron.frequent" + "etc/zfs-auto-snapshot.cron.hourly" + "etc/zfs-auto-snapshot.cron.monthly" + "etc/zfs-auto-snapshot.cron.weekly") + (("zfs-auto-snapshot") + zfs-auto-snapshot)) + (substitute* "src/zfs-auto-snapshot.sh" + (("LC_ALL=C zfs list") + (string-append "LC_ALL=C " zfs " list")) + (("LC_ALL=C zpool status") + (string-append "LC_ALL=C " zpool " status")) + (("zfs snapshot") + (string-append zfs " snapshot")) + (("zfs destroy") + (string-append zfs " destroy")))))) + ;; Provide DESTDIR and PREFIX on make command. + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (invoke "make" "install" + "PREFIX=" + (string-append "DESTDIR=" out))) + #t))))) + (home-page "https://github.com/zfsonlinux/zfs-auto-snapshot") + (synopsis "Automatically create, rotate, and destroy periodic ZFS snapshots") + (description + "An alternative implementation of the zfs-auto-snapshot service for Linux +that is compatible with zfs-linux (now OpenZFS) and zfs-fuse. + +On Guix System, you will need to invoke the included shell scripts as @code{job} +definitions in your @code{operating-system} declaration.") + (license license:gpl2+))) + (define-public mergerfs (package (name "mergerfs")