summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Yakovlev <gyakovlev@gentoo.org>2020-09-28 03:10:45 -0700
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2020-09-28 03:10:45 -0700
commit762b42a20c94ac2abae87cbb4003f32a777b8322 (patch)
tree23a06549eba7a8311bf8456e97a339023230d42e /sys-fs/zfs-auto-snapshot
parentsys-fs/zfs-auto-snapshot: fix minor qa issues (diff)
downloadgentoo-762b42a20c94ac2abae87cbb4003f32a777b8322.tar.gz
gentoo-762b42a20c94ac2abae87cbb4003f32a777b8322.tar.bz2
gentoo-762b42a20c94ac2abae87cbb4003f32a777b8322.zip
sys-fs/zfs-auto-snapshot: sync live ebuild
Package-Manager: Portage-3.0.8, Repoman-3.0.1 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'sys-fs/zfs-auto-snapshot')
-rw-r--r--sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-9999.ebuild50
1 files 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 c880e32a7601..b17e57c0c4ea 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
}