add cron subpackage

This commit is contained in:
Nikola Forró 2015-10-13 14:14:19 +02:00
parent 392b95f2ce
commit 12bf2ad289
3 changed files with 63 additions and 1 deletions

27
man-db.crondaily Normal file
View File

@ -0,0 +1,27 @@
#!/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

View File

@ -4,7 +4,7 @@
Summary: Tools for searching and reading man pages
Name: man-db
Version: 2.7.4
Release: 1%{?dist}
Release: 2%{?dist}
# GPLv2+ .. man-db
# GPLv3+ .. gnulib
License: GPLv2+ and GPLv3+
@ -12,6 +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
Patch0: 1151558-switch-man-and-root-in-init-systemd-man-db.conf.patch
Obsoletes: man < 2.0
@ -32,6 +34,18 @@ manual page names and descriptions. manpath determines search path
for manual pages. lexgrog directly reads header information in
manual pages.
%package cron
Summary: Periodic update of man-db cache
Group: System Environment/Base
Requires: %{name} = %{version}-%{release}
Requires: crontabs
BuildArch: noarch
%description cron
This package provides periodic update of man-db cache.
%prep
%autosetup -p1
@ -60,6 +74,14 @@ 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
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily
install -D -p -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/man-db.cron
# config for cron script
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/man-db
# config for tmpfiles.d
install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/.
@ -131,7 +153,14 @@ fi
%lang(ru) %{_datadir}/man/ru/man*/*
%lang(zh_CN) %{_datadir}/man/zh_CN/man*/*
%files cron
%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
%config(noreplace) %{_sysconfdir}/sysconfig/man-db
%changelog
* Tue Oct 13 2015 Nikola Forró <nforro@redhat.com> - 2.7.4-2
- add cron subpackage
* Tue Oct 13 2015 Nikola Forró <nforro@redhat.com> - 2.7.4-1
- update to 2.7.4
resolves #1270078

6
man-db.sysconfig Normal file
View File

@ -0,0 +1,6 @@
# 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"