diff options
author | Georgy Yakovlev <gyakovlev@gentoo.org> | 2020-09-28 00:40:05 -0700 |
---|---|---|
committer | Georgy Yakovlev <gyakovlev@gentoo.org> | 2020-09-28 02:29:36 -0700 |
commit | 76c83257c2f3496d7a3af17290109d7714527a3f (patch) | |
tree | 0b3de2d1b0459bc943bb92c36fb4124603653ec0 /sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-1.2.4-r1.ebuild | |
parent | dev-db/oracle-instantclient: fix unpack problem (diff) | |
download | gentoo-76c83257c2f3496d7a3af17290109d7714527a3f.tar.gz gentoo-76c83257c2f3496d7a3af17290109d7714527a3f.tar.bz2 gentoo-76c83257c2f3496d7a3af17290109d7714527a3f.zip |
sys-fs/zfs-auto-snapshot: revbump, add systemd timers
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/zfs-auto-snapshot-1.2.4-r1.ebuild')
-rw-r--r-- | sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-1.2.4-r1.ebuild | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-1.2.4-r1.ebuild b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-1.2.4-r1.ebuild new file mode 100644 index 000000000000..b1c288f934d1 --- /dev/null +++ b/sys-fs/zfs-auto-snapshot/zfs-auto-snapshot-1.2.4-r1.ebuild @@ -0,0 +1,90 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit prefix readme.gentoo-r1 systemd + +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 ~arm64 ~ppc64" + 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="+cron +default-exclude systemd" + +RDEPEND=" + sys-fs/zfs + !systemd? ( virtual/cron ) +" + +REQUIRED_USE="!systemd? ( 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 + + 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() { + 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 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 +} |