Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-auto-snapshot/files/, sys-fs/zfs-auto-snapshot/
Date: Fri, 11 May 2018 17:36:05
Message-Id: 1526060150.5d769a2585b1de6503acc1c1ecabb69623b7bd78.mgorny@gentoo
1 commit: 5d769a2585b1de6503acc1c1ecabb69623b7bd78
2 Author: Georgy Yakovlev <ya <AT> sysdump <DOT> net>
3 AuthorDate: Sun Apr 1 06:33:13 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri May 11 17:35:50 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d769a25
7
8 sys-fs/zfs-auto-snapshot: new package
9
10 Closes: https://bugs.gentoo.org/437636
11 Closes: https://github.com/gentoo/gentoo/pull/7763
12 Package-Manager: Portage-2.3.27, Repoman-2.3.9
13
14 sys-fs/zfs-auto-snapshot/Manifest | 1 +
15 sys-fs/zfs-auto-snapshot/files/README.gentoo | 22 +++++++++
16 sys-fs/zfs-auto-snapshot/metadata.xml | 28 ++++++++++++
17 .../zfs-auto-snapshot-1.2.4.ebuild | 52 ++++++++++++++++++++++
18 .../zfs-auto-snapshot-9999.ebuild | 52 ++++++++++++++++++++++
19 5 files changed, 155 insertions(+)
20
21 diff --git a/sys-fs/zfs-auto-snapshot/Manifest b/sys-fs/zfs-auto-snapshot/Manifest
22 new file mode 100644
23 index 00000000000..f0991007173
24 --- /dev/null
25 +++ b/sys-fs/zfs-auto-snapshot/Manifest
26 @@ -0,0 +1 @@
27 +DIST zfs-auto-snapshot-upstream-1.2.4.tar.gz 13375 BLAKE2B 2a44cdecb7c4bb432c1804dba9a6674289aced9664ae0fcc6a33b604b128d852fce459367316f11961747594516916da51072ed10f84d0c01ea8cca553ce7eec SHA512 26382303fce8b90dfb40f69fcab92308e88c17c147b4a566c5d32f2e9aa241d64f5da56ad82b4becb824ba01a470037a724460d35676a1d46de9c578c02a57d9
28
29 diff --git a/sys-fs/zfs-auto-snapshot/files/README.gentoo b/sys-fs/zfs-auto-snapshot/files/README.gentoo
30 new file mode 100644
31 index 00000000000..cb712d317ea
32 --- /dev/null
33 +++ b/sys-fs/zfs-auto-snapshot/files/README.gentoo
34 @@ -0,0 +1,22 @@
35 +Use com.sun:auto-snapshot attribute to enable snapshots for datasets
36 +the syntax is:
37 +
38 +zfs set com.sun:auto-snapshot=[true|false]
39 +
40 +or:
41 +
42 +zfs set com.sun:auto-snapshot:<frequent|hourly|daily|weekly|monthly>=[true|false]
43 +
44 +for example:
45 +
46 +# zfs set com.sun:auto-snapshot=false zroot
47 +Will disalbe all snapshots for zroot and all nested datasets will inherit the property.
48 +
49 +# zfs set com.sun:auto-snapshot=true zroot/ROOT/default
50 +Will enable all types of snapshots for given dataset.
51 +
52 +# zfs set com.sun:auto-snapshot:weekly=true pool/var
53 +Will enable only weekly snapshots for given dataset.
54 +
55 +for details please visit:
56 +https://docs.oracle.com/cd/E19120-01/open.solaris/817-2271/ghzuk/index.html
57
58 diff --git a/sys-fs/zfs-auto-snapshot/metadata.xml b/sys-fs/zfs-auto-snapshot/metadata.xml
59 new file mode 100644
60 index 00000000000..c89306c4869
61 --- /dev/null
62 +++ b/sys-fs/zfs-auto-snapshot/metadata.xml
63 @@ -0,0 +1,28 @@
64 +<?xml version="1.0" encoding="UTF-8"?>
65 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
66 +<pkgmetadata>
67 + <maintainer type="person">
68 + <email>ya@×××××××.net</email>
69 + <name>Georgy Yakovlev</name>
70 + </maintainer>
71 + <maintainer type="project">
72 + <email>proxy-maint@g.o</email>
73 + <name>Proxy Maintainers</name>
74 + </maintainer>
75 + <longdescription lang="en">
76 + An alternative implementation of the zfs-auto-snapshot service for Linux
77 + that is compatible with zfs-linux and zfs-fuse.
78 +
79 + Automatically create, rotate, and destroy periodic ZFS snapshots. This is
80 + the utility that creates the @zfs-auto-snap_frequent, @zfs-auto-snap_hourly,
81 + @zfs-auto-snap_daily, @zfs-auto-snap_weekly, and @zfs-auto-snap_monthly
82 + snapshots if it is installed.
83 + </longdescription>
84 + <use>
85 + <flag name="default-exclude">Only take snapshots if dataset has com.sun:auto-snapshot=true property set</flag>
86 + </use>
87 +
88 + <upstream>
89 + <remote-id type="github">zfsonlinux/zfs-auto-snapshot</remote-id>
90 + </upstream>
91 +</pkgmetadata>
92
93 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
94 new file mode 100644
95 index 00000000000..e9006a5b9aa
96 --- /dev/null
97 +++ b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-1.2.4.ebuild
98 @@ -0,0 +1,52 @@
99 +# Copyright 1999-2018 Gentoo Foundation
100 +# Distributed under the terms of the GNU General Public License v2
101 +
102 +EAPI=6
103 +
104 +inherit readme.gentoo-r1
105 +
106 +if [[ ${PV} == 9999 ]]; then
107 + inherit git-r3
108 + EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"
109 +else
110 + MY_P="${PN}-upstream-${PV}"
111 + SRC_URI="https://github.com/zfsonlinux/${PN}/archive/upstream/${PV}.tar.gz -> ${MY_P}.tar.gz"
112 + KEYWORDS="~amd64"
113 + S="${WORKDIR}/${MY_P}"
114 +fi
115 +
116 +DESCRIPTION="ZFS Automatic Snapshot Service for Linux"
117 +HOMEPAGE="https://github.com/zfsonlinux/zfs-auto-snapshot"
118 +
119 +LICENSE="GPL-2+"
120 +SLOT="0"
121 +IUSE="+default-exclude"
122 +
123 +RDEPEND="sys-fs/zfs
124 + virtual/cron"
125 +
126 +src_install() {
127 + if use default-exclude; then
128 + for cronfile in etc/"${PN}".cron.{daily,hourly,monthly,weekly}; do
129 + sed -i "s/\(^exec ${PN}\)/\1 --default-exclude/" "${cronfile}" || die
130 + done
131 + sed -i "s/\(; ${PN}\)/\1 --default-exclude/" etc/"${PN}".cron.frequent || die
132 + fi
133 + readme.gentoo_create_doc
134 + emake PREFIX="${EPREFIX}/usr" DESTDIR="${D}" install
135 +}
136 +
137 +pkg_postinst() {
138 + readme.gentoo_print_elog
139 +
140 + if ! use default-exclude; then
141 + ewarn "snapshots are enabled by default for ALL zfs datasets"
142 + ewarn "set com.sun:auto-snapshot=false or enable 'default-exclude' flag"
143 + elog
144 + fi
145 +
146 + if has_version sys-process/fcron; then
147 + ewarn "frequent snapshot may not work if you are using fcron"
148 + ewarn "you should add frequent job to crontab manually"
149 + fi
150 +}
151
152 diff --git a/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
153 new file mode 100644
154 index 00000000000..e9006a5b9aa
155 --- /dev/null
156 +++ b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
157 @@ -0,0 +1,52 @@
158 +# Copyright 1999-2018 Gentoo Foundation
159 +# Distributed under the terms of the GNU General Public License v2
160 +
161 +EAPI=6
162 +
163 +inherit readme.gentoo-r1
164 +
165 +if [[ ${PV} == 9999 ]]; then
166 + inherit git-r3
167 + EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"
168 +else
169 + MY_P="${PN}-upstream-${PV}"
170 + SRC_URI="https://github.com/zfsonlinux/${PN}/archive/upstream/${PV}.tar.gz -> ${MY_P}.tar.gz"
171 + KEYWORDS="~amd64"
172 + S="${WORKDIR}/${MY_P}"
173 +fi
174 +
175 +DESCRIPTION="ZFS Automatic Snapshot Service for Linux"
176 +HOMEPAGE="https://github.com/zfsonlinux/zfs-auto-snapshot"
177 +
178 +LICENSE="GPL-2+"
179 +SLOT="0"
180 +IUSE="+default-exclude"
181 +
182 +RDEPEND="sys-fs/zfs
183 + virtual/cron"
184 +
185 +src_install() {
186 + if use default-exclude; then
187 + for cronfile in etc/"${PN}".cron.{daily,hourly,monthly,weekly}; do
188 + sed -i "s/\(^exec ${PN}\)/\1 --default-exclude/" "${cronfile}" || die
189 + done
190 + sed -i "s/\(; ${PN}\)/\1 --default-exclude/" etc/"${PN}".cron.frequent || die
191 + fi
192 + readme.gentoo_create_doc
193 + emake PREFIX="${EPREFIX}/usr" DESTDIR="${D}" install
194 +}
195 +
196 +pkg_postinst() {
197 + readme.gentoo_print_elog
198 +
199 + if ! use default-exclude; then
200 + ewarn "snapshots are enabled by default for ALL zfs datasets"
201 + ewarn "set com.sun:auto-snapshot=false or enable 'default-exclude' flag"
202 + elog
203 + fi
204 +
205 + if has_version sys-process/fcron; then
206 + ewarn "frequent snapshot may not work if you are using fcron"
207 + ewarn "you should add frequent job to crontab manually"
208 + fi
209 +}