diff --git a/man-db.crondaily b/man-db.crondaily deleted file mode 100644 index 6e95c16..0000000 --- a/man-db.crondaily +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -if [ -e /etc/sysconfig/man-db ]; then - . /etc/sysconfig/man-db -fi - -if [ "$CRON" = "no" ]; then - exit 0 -fi - -renice +19 -p $$ >/dev/null 2>&1 -ionice -c3 -p $$ >/dev/null 2>&1 - -LOCKFILE=/var/lock/man-db.lock - -# the lockfile is not meant to be perfect, it's just in case the -# two man-db cron scripts get run close to each other to keep -# them from stepping on each other's toes. The worst that will -# happen is that they will temporarily corrupt the database -[[ -f $LOCKFILE ]] && exit 0 - -trap "{ rm -f $LOCKFILE ; exit 0; }" EXIT -touch $LOCKFILE -# create/update the mandb database -mandb $OPTS - -exit 0 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 - 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 - 2.7.0.2-1 - Update to 2.7.0.2 resolves: #1145493 diff --git a/man-db.sysconfig b/man-db.sysconfig deleted file mode 100644 index 608446d..0000000 --- a/man-db.sysconfig +++ /dev/null @@ -1,6 +0,0 @@ -# Set to no to disable daily man-db update by /etc/cron.daily/man-db.cron -CRON="yes" - -# Options used by mandb in /etc/cron.daily/man-db.cron, -# we use -q as default, too much noise without. -OPTS="-q" 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