From 4e440b4d81cae7ec18b4d312c8512b0910140245 Mon Sep 17 00:00:00 2001 From: dcrdev Date: Thu, 31 Aug 2017 12:16:03 +0100 Subject: [PATCH] Integrate rpm spec with systemd, bump version --- sanoid.spec | 84 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 71 insertions(+), 13 deletions(-) diff --git a/sanoid.spec b/sanoid.spec index 8b3b379..d35d5b6 100644 --- a/sanoid.spec +++ b/sanoid.spec @@ -1,17 +1,25 @@ -%global version 1.4.13 +%global version 1.4.14 %global git_tag v%{version} -Name: sanoid -Version: %{version} -Release: 1%{?dist} -BuildArch: noarch -Summary: A policy-driven snapshot management tool for ZFS file systems -Group: Applications/System -License: GPLv3 -URL: https://github.com/jimsalterjrs/sanoid -Source0: https://github.com/jimsalterjrs/%{name}/archive/%{git_tag}/%{name}-%{version}.tar.gz -#BuildRequires: -Requires: perl, mbuffer, lzop, pv +# Enable with systemctl "enable sanoid.timer" +%global _with_systemd 1 + +Name: sanoid +Version: %{version} +Release: 2%{?dist} +BuildArch: noarch +Summary: A policy-driven snapshot management tool for ZFS file systems +Group: Applications/System +License: GPLv3 +URL: https://github.com/jimsalterjrs/sanoid +Source0: https://github.com/jimsalterjrs/%{name}/archive/%{git_tag}/%{name}-%{version}.tar.gz + +Requires: perl, mbuffer, lzop, pv +%if 0%{?_with_systemd} +Requires: systemd >= 212 + +BuildRequires: systemd +%endif %description Sanoid is a policy-driven snapshot management @@ -24,20 +32,62 @@ human-readable TOML configuration file. %setup -q %build +echo "Nothing to build" %install %{__install} -D -m 0644 sanoid.defaults.conf %{buildroot}/etc/sanoid/sanoid.defaults.conf %{__install} -d %{buildroot}%{_sbindir} %{__install} -m 0755 sanoid syncoid findoid sleepymutex %{buildroot}%{_sbindir} +%if 0%{?_with_systemd} +%{__install} -d %{buildroot}%{_unitdir} +%endif + %if 0%{?fedora} %{__install} -D -m 0644 sanoid.conf %{buildroot}%{_docdir}/%{name}/examples/sanoid.conf -echo "* * * * * root %{_sbindir}/sanoid --cron" > %{buildroot}%{_docdir}/%{name}/examples/sanoid.cron %endif %if 0%{?rhel} %{__install} -D -m 0644 sanoid.conf %{buildroot}%{_docdir}/%{name}-%{version}/examples/sanoid.conf +%endif + +%if 0%{?_with_systemd} +cat > %{buildroot}%{_unitdir}/%{name}.service < %{buildroot}%{_unitdir}/%{name}.timer < %{buildroot}%{_docdir}/%{name}-%{version}/examples/sanoid.cron %endif +%endif + +%post +%{?_with_systemd:%{_bindir}/systemctl daemon-reload} + +%postun +%{?_with_systemd:%{_bindir}/systemctl daemon-reload} %files %doc CHANGELIST VERSION README.md FREEBSD.readme @@ -54,8 +104,16 @@ echo "* * * * * root %{_sbindir}/sanoid --cron" > %{buildroot}%{_docdir}/%{name} %if 0%{?rhel} %{_docdir}/%{name}-%{version} %endif +%if 0%{?_with_systemd} +%{_unitdir}/%{name}.service +%{_unitdir}/%{name}.timer +%endif %changelog +* Wed Aug 30 2017 Dominic Robinson - 1.4.14-2 +- Add systemd timers +* Wed Aug 30 2017 Dominic Robinson - 1.4.14-1 +- Version bump * Wed Jul 12 2017 Thomas M. Lapp - 1.4.13-1 - Version bump - Include FREEBSD.readme in docs