Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-auto-snapshot/
Date: Mon, 28 Sep 2020 10:11:00
Message-Id: 1601287845.762b42a20c94ac2abae87cbb4003f32a777b8322.gyakovlev@gentoo
1 commit: 762b42a20c94ac2abae87cbb4003f32a777b8322
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 28 10:10:45 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 28 10:10:45 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=762b42a2
7
8 sys-fs/zfs-auto-snapshot: sync live ebuild
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.1
11 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
12
13 .../zfs-auto-snapshot-9999.ebuild | 50 +++++++++++++++++++---
14 1 file changed, 44 insertions(+), 6 deletions(-)
15
16 diff --git a/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
17 index c880e32a760..b17e57c0c4e 100644
18 --- a/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
19 +++ b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
20 @@ -1,9 +1,9 @@
21 # Copyright 1999-2020 Gentoo Authors
22 # Distributed under the terms of the GNU General Public License v2
23
24 -EAPI=6
25 +EAPI=7
26
27 -inherit readme.gentoo-r1
28 +inherit prefix readme.gentoo-r1 systemd
29
30 if [[ ${PV} == 9999 ]]; then
31 inherit git-r3
32 @@ -20,10 +20,14 @@ HOMEPAGE="https://github.com/zfsonlinux/zfs-auto-snapshot"
33
34 LICENSE="GPL-2+"
35 SLOT="0"
36 -IUSE="+default-exclude"
37 +IUSE="+cron +default-exclude systemd"
38
39 -RDEPEND="sys-fs/zfs
40 - virtual/cron"
41 +RDEPEND="
42 + sys-fs/zfs
43 + !systemd? ( virtual/cron )
44 +"
45 +
46 +REQUIRED_USE="!systemd? ( cron )"
47
48 src_install() {
49 if use default-exclude; then
50 @@ -34,6 +38,27 @@ src_install() {
51 fi
52 readme.gentoo_create_doc
53 emake PREFIX="${EPREFIX}/usr" DESTDIR="${D}" install
54 +
55 + local exclude unit
56 + exclude="$(usev default-exclude)"
57 + for unit in "${PN}"{-daily,-frequent,-hourly,-monthly,-weekly}.service; do
58 + cp "${FILESDIR}/${unit}" "${T}/${unit}" || die
59 + eprefixify "${T}/${unit}"
60 + sed -i "s/@DEFAULT_EXCLUDE@/${exclude:+--default-exclude}/g" "${T}/${unit}" || die
61 + systemd_dounit "${T}/${unit}"
62 + done
63 + for unit in "${PN}"{-daily,-frequent,-hourly,-monthly,-weekly}.timer; do
64 + systemd_dounit "${FILESDIR}/${unit}"
65 + done
66 + systemd_dounit "${FILESDIR}/${PN}.target"
67 +
68 + if ! use cron; then
69 + ebegin "removing cron files from installation image"
70 + rm -rfv "${ED}/etc" || die
71 + eend "$?"
72 + fi
73 +
74 + pkg_postinst
75 }
76
77 pkg_postinst() {
78 @@ -45,8 +70,21 @@ pkg_postinst() {
79 elog
80 fi
81
82 - if has_version sys-process/fcron; then
83 + if use cron && has_version sys-process/fcron; then
84 ewarn "frequent snapshot may not work if you are using fcron"
85 ewarn "you should add frequent job to crontab manually"
86 fi
87 +
88 + if use cron; then
89 + if systemd_is_booted || has_version sys-apps/systemd; then
90 + echo
91 + ewarn "Both 'cron' and 'systemd' flags are enabled."
92 + ewarn "So both ${PN}.target and cron files were installed."
93 + ewarn "Please don't use 2 implementations at the same time."
94 + ewarn "Cronjobs are usually enabled by default via /etc/cron.* jobs"
95 + ewarn "If you want to use systemd ${PN}.target timers"
96 + ewarn "disable 'cron' flag and reinstall ${PN}"
97 + echo
98 + fi
99 + fi
100 }