commit:     5d769a2585b1de6503acc1c1ecabb69623b7bd78
Author:     Georgy Yakovlev <ya <AT> sysdump <DOT> net>
AuthorDate: Sun Apr  1 06:33:13 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri May 11 17:35:50 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d769a25

sys-fs/zfs-auto-snapshot: new package

Closes: https://bugs.gentoo.org/437636
Closes: https://github.com/gentoo/gentoo/pull/7763
Package-Manager: Portage-2.3.27, Repoman-2.3.9

 sys-fs/zfs-auto-snapshot/Manifest                  |  1 +
 sys-fs/zfs-auto-snapshot/files/README.gentoo       | 22 +++++++++
 sys-fs/zfs-auto-snapshot/metadata.xml              | 28 ++++++++++++
 .../zfs-auto-snapshot-1.2.4.ebuild                 | 52 ++++++++++++++++++++++
 .../zfs-auto-snapshot-9999.ebuild                  | 52 ++++++++++++++++++++++
 5 files changed, 155 insertions(+)

diff --git a/sys-fs/zfs-auto-snapshot/Manifest 
b/sys-fs/zfs-auto-snapshot/Manifest
new file mode 100644
index 00000000000..f0991007173
--- /dev/null
+++ b/sys-fs/zfs-auto-snapshot/Manifest
@@ -0,0 +1 @@
+DIST zfs-auto-snapshot-upstream-1.2.4.tar.gz 13375 BLAKE2B 
2a44cdecb7c4bb432c1804dba9a6674289aced9664ae0fcc6a33b604b128d852fce459367316f11961747594516916da51072ed10f84d0c01ea8cca553ce7eec
 SHA512 
26382303fce8b90dfb40f69fcab92308e88c17c147b4a566c5d32f2e9aa241d64f5da56ad82b4becb824ba01a470037a724460d35676a1d46de9c578c02a57d9

diff --git a/sys-fs/zfs-auto-snapshot/files/README.gentoo 
b/sys-fs/zfs-auto-snapshot/files/README.gentoo
new file mode 100644
index 00000000000..cb712d317ea
--- /dev/null
+++ b/sys-fs/zfs-auto-snapshot/files/README.gentoo
@@ -0,0 +1,22 @@
+Use com.sun:auto-snapshot attribute to enable snapshots for datasets
+the syntax is:
+
+zfs set com.sun:auto-snapshot=[true|false]
+
+or:
+
+zfs set 
com.sun:auto-snapshot:<frequent|hourly|daily|weekly|monthly>=[true|false]
+
+for example:
+
+# zfs set com.sun:auto-snapshot=false zroot
+Will disalbe all snapshots for zroot and all nested datasets will inherit the 
property.
+
+# zfs set com.sun:auto-snapshot=true zroot/ROOT/default
+Will enable all types of snapshots for given dataset.
+
+# zfs set com.sun:auto-snapshot:weekly=true pool/var
+Will enable only weekly snapshots for given dataset.
+
+for details please visit:
+https://docs.oracle.com/cd/E19120-01/open.solaris/817-2271/ghzuk/index.html

diff --git a/sys-fs/zfs-auto-snapshot/metadata.xml 
b/sys-fs/zfs-auto-snapshot/metadata.xml
new file mode 100644
index 00000000000..c89306c4869
--- /dev/null
+++ b/sys-fs/zfs-auto-snapshot/metadata.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Georgy Yakovlev</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>[email protected]</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <longdescription lang="en">
+               An alternative implementation of the zfs-auto-snapshot service 
for Linux
+               that is compatible with zfs-linux and zfs-fuse.
+
+               Automatically create, rotate, and destroy periodic ZFS 
snapshots. This is
+               the utility that creates the @zfs-auto-snap_frequent, 
@zfs-auto-snap_hourly,
+               @zfs-auto-snap_daily, @zfs-auto-snap_weekly, and 
@zfs-auto-snap_monthly
+               snapshots if it is installed.
+       </longdescription>
+       <use>
+               <flag name="default-exclude">Only take snapshots if dataset has 
com.sun:auto-snapshot=true property set</flag>
+       </use>
+
+       <upstream>
+               <remote-id 
type="github">zfsonlinux/zfs-auto-snapshot</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-1.2.4.ebuild 
b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-1.2.4.ebuild
new file mode 100644
index 00000000000..e9006a5b9aa
--- /dev/null
+++ b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-1.2.4.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit readme.gentoo-r1
+
+if [[ ${PV} == 9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git";
+else
+       MY_P="${PN}-upstream-${PV}"
+       
SRC_URI="https://github.com/zfsonlinux/${PN}/archive/upstream/${PV}.tar.gz -> 
${MY_P}.tar.gz"
+       KEYWORDS="~amd64"
+       S="${WORKDIR}/${MY_P}"
+fi
+
+DESCRIPTION="ZFS Automatic Snapshot Service for Linux"
+HOMEPAGE="https://github.com/zfsonlinux/zfs-auto-snapshot";
+
+LICENSE="GPL-2+"
+SLOT="0"
+IUSE="+default-exclude"
+
+RDEPEND="sys-fs/zfs
+       virtual/cron"
+
+src_install() {
+       if use default-exclude; then
+               for cronfile in etc/"${PN}".cron.{daily,hourly,monthly,weekly}; 
do
+                       sed -i "s/\(^exec ${PN}\)/\1 --default-exclude/" 
"${cronfile}" || die
+               done
+               sed -i "s/\(; ${PN}\)/\1 --default-exclude/" 
etc/"${PN}".cron.frequent || die
+       fi
+       readme.gentoo_create_doc
+       emake PREFIX="${EPREFIX}/usr" DESTDIR="${D}" install
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
+
+       if ! use default-exclude; then
+               ewarn "snapshots are enabled by default for ALL zfs datasets"
+               ewarn "set com.sun:auto-snapshot=false or enable 
'default-exclude' flag"
+               elog
+       fi
+
+       if has_version sys-process/fcron; then
+               ewarn "frequent snapshot may not work if you are using fcron"
+               ewarn "you should add frequent job to crontab manually"
+       fi
+}

diff --git a/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild 
b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
new file mode 100644
index 00000000000..e9006a5b9aa
--- /dev/null
+++ b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit readme.gentoo-r1
+
+if [[ ${PV} == 9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git";
+else
+       MY_P="${PN}-upstream-${PV}"
+       
SRC_URI="https://github.com/zfsonlinux/${PN}/archive/upstream/${PV}.tar.gz -> 
${MY_P}.tar.gz"
+       KEYWORDS="~amd64"
+       S="${WORKDIR}/${MY_P}"
+fi
+
+DESCRIPTION="ZFS Automatic Snapshot Service for Linux"
+HOMEPAGE="https://github.com/zfsonlinux/zfs-auto-snapshot";
+
+LICENSE="GPL-2+"
+SLOT="0"
+IUSE="+default-exclude"
+
+RDEPEND="sys-fs/zfs
+       virtual/cron"
+
+src_install() {
+       if use default-exclude; then
+               for cronfile in etc/"${PN}".cron.{daily,hourly,monthly,weekly}; 
do
+                       sed -i "s/\(^exec ${PN}\)/\1 --default-exclude/" 
"${cronfile}" || die
+               done
+               sed -i "s/\(; ${PN}\)/\1 --default-exclude/" 
etc/"${PN}".cron.frequent || die
+       fi
+       readme.gentoo_create_doc
+       emake PREFIX="${EPREFIX}/usr" DESTDIR="${D}" install
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
+
+       if ! use default-exclude; then
+               ewarn "snapshots are enabled by default for ALL zfs datasets"
+               ewarn "set com.sun:auto-snapshot=false or enable 
'default-exclude' flag"
+               elog
+       fi
+
+       if has_version sys-process/fcron; then
+               ewarn "frequent snapshot may not work if you are using fcron"
+               ewarn "you should add frequent job to crontab manually"
+       fi
+}

Reply via email to