GNU bug report logs - #47134
[PATCH] gnu: Add zfs-auto-snapshot.

Previous Next

Package: guix-patches;

Reported by: raid5atemyhomework <raid5atemyhomework <at> protonmail.com>

Date: Sun, 14 Mar 2021 08:56:01 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47134 in the body.
You can then email your comments to 47134 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#47134; Package guix-patches. (Sun, 14 Mar 2021 08:56:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to raid5atemyhomework <raid5atemyhomework <at> protonmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 14 Mar 2021 08:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: raid5atemyhomework <raid5atemyhomework <at> protonmail.com>
To: Guix Patches <guix-patches <at> gnu.org>
Subject: [PATCH] gnu: Add zfs-auto-snapshot.
Date: Sun, 14 Mar 2021 08:55:18 +0000
From be0c4d4ef73e68ace117f2a1b1396331a4fcdf84 Mon Sep 17 00:00:00 2001
From: raid5atemyhomework <raid5atemyhomework <at> protonmail.com>
Date: Sun, 14 Mar 2021 16:40:47 +0800
Subject: [PATCH] gnu: Add zfs-auto-snapshot.

* gnu/packages/file-systems.scm (zfs-auto-snapshot): New variable.
---
 gnu/packages/file-systems.scm | 54 +++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index e7d78e41fb..0543be2d82 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -975,6 +975,60 @@ 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)
+    (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-cron-scripts
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out                (assoc-ref outputs "out"))
+                     (zfs-auto-snapshot  (string-append
+                                           out
+                                           "/sbin/zfs-auto-snapshot")))
+                (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)))))
+          ;; 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 and zfs-fuse.
+
+On Guix System, you will need to invoke the installed shell scripts as @code{job}
+declarations in your @code{operating-system} configuration.")
+    (license license:gpl2+)))
+
 (define-public mergerfs
   (package
     (name "mergerfs")
--
2.30.2





Information forwarded to guix-patches <at> gnu.org:
bug#47134; Package guix-patches. (Sun, 14 Mar 2021 11:08:01 GMT) Full text and rfc822 format available.

Message #8 received at 47134 <at> debbugs.gnu.org (full text, mbox):

From: raid5atemyhomework <raid5atemyhomework <at> protonmail.com>
To: "47134 <at> debbugs.gnu.org" <47134 <at> debbugs.gnu.org>
Subject: [PATCH] gnu: Add zfs-auto-snapshot.
Date: Sun, 14 Mar 2021 11:07:09 +0000
It works if you have `zfs` installed in your profile and invoke the shell script within the profile, but not if you are running from a non-profile environment, such as from `mcron`.

Lemme think what is best to do...




Information forwarded to guix-patches <at> gnu.org:
bug#47134; Package guix-patches. (Sun, 14 Mar 2021 12:05:01 GMT) Full text and rfc822 format available.

Message #11 received at 47134 <at> debbugs.gnu.org (full text, mbox):

From: raid5atemyhomework <raid5atemyhomework <at> protonmail.com>
To: "47134 <at> debbugs.gnu.org" <47134 <at> debbugs.gnu.org>
Subject: [PATCH v2] gnu: Add zfs-auto-snapshot.
Date: Sun, 14 Mar 2021 12:04:10 +0000
Have it refer to specific zfs package.

Users that inherit from the zfs package in order to compile for a specific kernel version should also inherit from this package and pass in their zfs.

Testing done:

* `guix build -f zfs-auto-snapshot.scm` on a scheme file containing only this package.
* Ran the hourly, daily, weekly, and monthly scripts "by hand".  Also confirmed `com.sun:auto-snapshot` and `com.sun:auto-snapshot:*` settings work.
* Currently have it running in a homelab server with mcron triggers on the hourly, daily, weekly, and monthly scripts, at least one hourly trigger has passed and snapshots were indeed created without any errors in `/var/log/messages`.
* Checked the installed scripts and verified that the `zfs` and `zpool` commands refer to specific in-store binaries.

Please merge!

Thanks
raid5atemyhomework

From 7425298029dd1c9b4f2b3bba675ddbe7eb730744 Mon Sep 17 00:00:00 2001
From: raid5atemyhomework <raid5atemyhomework <at> protonmail.com>
Date: Sun, 14 Mar 2021 16:40:47 +0800
Subject: [PATCH] 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(+)

diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index e7d78e41fb..4d01b3da46 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -975,6 +975,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 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")
--
2.30.2





Reply sent to Arun Isaac <arunisaac <at> systemreboot.net>:
You have taken responsibility. (Sat, 02 Oct 2021 11:41:02 GMT) Full text and rfc822 format available.

Notification sent to raid5atemyhomework <raid5atemyhomework <at> protonmail.com>:
bug acknowledged by developer. (Sat, 02 Oct 2021 11:41:02 GMT) Full text and rfc822 format available.

Message #16 received at 47134-done <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: raid5atemyhomework <raid5atemyhomework <at> protonmail.com>
Cc: 47134-done <at> debbugs.gnu.org
Subject: Re: bug#47134: [PATCH] gnu: Add zfs-auto-snapshot.
Date: Sat, 02 Oct 2021 17:09:56 +0530
[Message part 1 (text/plain, inline)]
Hi,

It looks like Danny Milosavljevic applied this patch to master with
commit ba3b295a3ee956ac7500b5f9bb1d151b28ab30ed, but probably forgot to
close this bug. So, I'm closing now.

Thanks for contributing to Guix!
Arun
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 31 Oct 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.