public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Georgy Yakovlev" <gyakovlev@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-auto-snapshot/
Date: Mon, 28 Sep 2020 10:10:56 +0000 (UTC)	[thread overview]
Message-ID: <1601287845.762b42a20c94ac2abae87cbb4003f32a777b8322.gyakovlev@gentoo> (raw)

commit:     762b42a20c94ac2abae87cbb4003f32a777b8322
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 28 10:10:45 2020 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Mon Sep 28 10:10:45 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=762b42a2

sys-fs/zfs-auto-snapshot: sync live ebuild

Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 .../zfs-auto-snapshot-9999.ebuild                  | 50 +++++++++++++++++++---
 1 file changed, 44 insertions(+), 6 deletions(-)

diff --git a/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
index c880e32a760..b17e57c0c4e 100644
--- a/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
+++ b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild
@@ -1,9 +1,9 @@
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=7
 
-inherit readme.gentoo-r1
+inherit prefix readme.gentoo-r1 systemd
 
 if [[ ${PV} == 9999 ]]; then
 	inherit git-r3
@@ -20,10 +20,14 @@ HOMEPAGE="https://github.com/zfsonlinux/zfs-auto-snapshot"
 
 LICENSE="GPL-2+"
 SLOT="0"
-IUSE="+default-exclude"
+IUSE="+cron +default-exclude systemd"
 
-RDEPEND="sys-fs/zfs
-	virtual/cron"
+RDEPEND="
+	sys-fs/zfs
+	!systemd? ( virtual/cron )
+"
+
+REQUIRED_USE="!systemd? ( cron )"
 
 src_install() {
 	if use default-exclude; then
@@ -34,6 +38,27 @@ src_install() {
 	fi
 	readme.gentoo_create_doc
 	emake PREFIX="${EPREFIX}/usr" DESTDIR="${D}" install
+
+	local exclude unit
+	exclude="$(usev default-exclude)"
+	for unit in "${PN}"{-daily,-frequent,-hourly,-monthly,-weekly}.service; do
+		cp "${FILESDIR}/${unit}" "${T}/${unit}" || die
+		eprefixify "${T}/${unit}"
+		sed -i "s/@DEFAULT_EXCLUDE@/${exclude:+--default-exclude}/g" "${T}/${unit}" || die
+		systemd_dounit "${T}/${unit}"
+	done
+	for unit in "${PN}"{-daily,-frequent,-hourly,-monthly,-weekly}.timer; do
+		systemd_dounit "${FILESDIR}/${unit}"
+	done
+	systemd_dounit "${FILESDIR}/${PN}.target"
+
+	if ! use cron; then
+		ebegin "removing cron files from installation image"
+		rm -rfv "${ED}/etc" || die
+		eend "$?"
+	fi
+
+	pkg_postinst
 }
 
 pkg_postinst() {
@@ -45,8 +70,21 @@ pkg_postinst() {
 		elog
 	fi
 
-	if has_version sys-process/fcron; then
+	if use cron && 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
+
+	if use cron; then
+		if systemd_is_booted || has_version sys-apps/systemd; then
+			echo
+			ewarn "Both 'cron' and 'systemd' flags are enabled."
+			ewarn "So both ${PN}.target and cron files were installed."
+			ewarn "Please don't use 2 implementations at the same time."
+			ewarn "Cronjobs are usually enabled by default via /etc/cron.* jobs"
+			ewarn "If you want to use systemd ${PN}.target timers"
+			ewarn "disable 'cron' flag and reinstall ${PN}"
+			echo
+		fi
+	fi
 }


             reply	other threads:[~2020-09-28 10:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 10:10 Georgy Yakovlev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-16 12:59 [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-auto-snapshot/ Marc Schiffbauer
2024-02-10  6:58 Ionen Wolkens
2024-01-25  1:05 Ionen Wolkens
2023-05-30  3:28 Sam James
2022-06-26  4:47 Sam James
2022-04-28 13:35 Yixun Lan
2022-04-28 13:35 Yixun Lan
2021-05-07 12:46 Georgy Yakovlev
2021-05-07 12:46 Georgy Yakovlev
2021-05-07 12:46 Georgy Yakovlev
2021-05-07 12:46 Georgy Yakovlev
2020-09-28 10:17 Georgy Yakovlev
2020-09-28 10:10 Georgy Yakovlev
2020-09-02 20:19 Georgy Yakovlev
2020-09-02 20:19 Georgy Yakovlev
2020-09-02 20:19 Georgy Yakovlev
2020-07-31 19:19 Georgy Yakovlev
2019-12-07  1:01 Georgy Yakovlev
2019-12-07  1:01 Georgy Yakovlev
2018-06-17  1:18 Georgy Yakovlev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1601287845.762b42a20c94ac2abae87cbb4003f32a777b8322.gyakovlev@gentoo \
    --to=gyakovlev@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox