[man-db] replacing cron with systemd.timer - resolves: #1148559 adding zsoelim to {_libexecdir}/man-db/zsoeli

Jan Chaloupka jchaloup at fedoraproject.org
Wed Oct 8 15:22:58 UTC 2014


commit 3b21cf2846a866ab1a1d2099ee3cc47490696081
Author: Jan Chaloupka <jchaloup at redhat.com>
Date:   Wed Oct 8 15:04:11 2014 +0200

    replacing cron with systemd.timer
    - resolves: #1148559
    adding zsoelim to {_libexecdir}/man-db/zsoelim
    - related: #1145493

 man-db.crondaily |   27 ---------------------------
 man-db.service   |   10 ++++++++++
 man-db.spec      |   42 +++++++++++++++++++++++++++---------------
 man-db.sysconfig |    6 ------
 man-db.timer     |   10 ++++++++++
 5 files changed, 47 insertions(+), 48 deletions(-)
---
diff --git a/man-db.service b/man-db.service
new file mode 100644
index 0000000..4adc297
--- /dev/null
+++ b/man-db.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Update man-db cache
+RequiresMountsFor=/var/cache/man
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/mandb --quiet
+Nice=19
+IOSchedulingClass=best-effort
+IOSchedulingPriority=7
diff --git a/man-db.spec b/man-db.spec
index cf5f64b..6b7dd7b 100644
--- a/man-db.spec
+++ b/man-db.spec
@@ -4,7 +4,7 @@
 Summary: Tools for searching and reading man pages
 Name: man-db
 Version: 2.7.0.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 # GPLv2+ .. man-db
 # GPLv3+ .. gnulib
 License: GPLv2+ and GPLv3+
@@ -12,8 +12,8 @@ Group: System Environment/Base
 URL: http://www.nongnu.org/man-db/
 
 Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz
-Source1: man-db.crondaily
-Source2: man-db.sysconfig
+Source1: man-db.service
+Source2: man-db.timer
 
 Obsoletes: man < 2.0
 Provides: man = %{version}
@@ -21,9 +21,9 @@ Provides: man-pages-reader = %{version}
 # FPC exception for gnulib - copylib - https://fedorahosted.org/fpc/ticket/174
 Provides: bundled(gnulib) = %{gnulib_ver}
 
-Requires: coreutils, grep, groff-base, gzip, less, crontabs
+Requires: coreutils, grep, groff-base, gzip, less, systemd
 BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel
-BuildRequires: po4a
+BuildRequires: po4a, systemd
 
 %description
 The man-db package includes five tools for browsing man-pages:
@@ -52,9 +52,7 @@ make install DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} INSTALL='install -p'
 # move the documentation to the relevant place
 mv $RPM_BUILD_ROOT%{_datadir}/doc/man-db/* ./
 
-# remove zsoelim - part of groff package
-#rm $RPM_BUILD_ROOT%{_bindir}/zsoelim
-rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/zsoelim
+# remove zsoelim man page - part of groff package
 rm $RPM_BUILD_ROOT%{_datadir}/man/man1/zsoelim.1
 
 # remove libtool archives
@@ -63,11 +61,10 @@ rm $RPM_BUILD_ROOT%{_libdir}/man-db/*.la
 # install cache directory
 install -d -m 0755  $RPM_BUILD_ROOT%{cache}
 
-# install cron script for man-db creation/update
-install -D -p -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/etc/cron.daily/man-db.cron
-
-# config for cron script
-install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/man-db
+# install systemd service and timer files for man-db creation/update
+mkdir -p %{buildroot}%{_unitdir}
+install -D -p -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
+install -D -p -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/%{name}.timer
 
 # config for tmpfiles.d
 install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/.
@@ -78,14 +75,22 @@ install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.
 # clear the old cache
 %post
 %{__rm} -rf %{cache}/*
+# enable and start timer
+systemctl -q enable man-db.timer
+systemctl start man-db.timer
+
+%preun
+# stop and disable timer
+systemctl stop man-db.timer
+systemctl -q disable man-db.timer
 
 %files -f %{name}.lang -f %{name}-gnulib.lang
 %{!?_licensedir:%global license %%doc}
 %license docs/COPYING
 %doc README man-db-manual.txt man-db-manual.ps ChangeLog NEWS
 %config(noreplace) %{_sysconfdir}/man_db.conf
-%config(noreplace) %{_sysconfdir}/sysconfig/man-db
-%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
+%{_unitdir}/man-db.service
+%{_unitdir}/man-db.timer
 %config(noreplace) /usr/lib/tmpfiles.d/man-db.conf
 %{_sbindir}/accessdb
 %{_bindir}/man
@@ -100,6 +105,7 @@ install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.
 %dir %{_libexecdir}/man-db
 %{_libexecdir}/man-db/globbing
 %{_libexecdir}/man-db/manconv
+%{_libexecdir}/man-db/zsoelim
 %attr(0755,root,root)   %dir %{cache}
 # documentation and translation
 %{_mandir}/man1/apropos.1*
@@ -125,6 +131,12 @@ install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.
 %lang(zh_CN)   %{_datadir}/man/zh_CN/man*/*
 
 %changelog
+* Wed Oct 08 2014 jchaloup <jchaloup at redhat.com> - 2.7.0.2-2
+- replacing cron with systemd.timer
+  resolves: #1148559
+- adding zsoelim to {_libexecdir}/man-db/zsoelim
+  related: #1145493
+
 * Wed Oct 08 2014 jchaloup <jchaloup at redhat.com> - 2.7.0.2-1
 - Update to 2.7.0.2
   resolves: #1145493
diff --git a/man-db.timer b/man-db.timer
new file mode 100644
index 0000000..ce43df1
--- /dev/null
+++ b/man-db.timer
@@ -0,0 +1,10 @@
+[Unit]
+Description=Daily man-db cache update
+
+[Timer]
+OnCalendar=daily
+AccuracySec=12h
+Persistent=true
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list