use file triggers instead of crontabs for updating cache
This commit is contained in:
parent
aa7103c50e
commit
de8a004911
@ -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
|
|
25
man-db.spec
25
man-db.spec
@ -4,7 +4,7 @@
|
|||||||
Summary: Tools for searching and reading man pages
|
Summary: Tools for searching and reading man pages
|
||||||
Name: man-db
|
Name: man-db
|
||||||
Version: 2.7.3
|
Version: 2.7.3
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
# GPLv2+ .. man-db
|
# GPLv2+ .. man-db
|
||||||
# GPLv3+ .. gnulib
|
# GPLv3+ .. gnulib
|
||||||
License: GPLv2+ and GPLv3+
|
License: GPLv2+ and GPLv3+
|
||||||
@ -12,8 +12,6 @@ Group: System Environment/Base
|
|||||||
URL: http://www.nongnu.org/man-db/
|
URL: http://www.nongnu.org/man-db/
|
||||||
|
|
||||||
Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz
|
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
|
Patch0: 1151558-switch-man-and-root-in-init-systemd-man-db.conf.patch
|
||||||
|
|
||||||
Obsoletes: man < 2.0
|
Obsoletes: man < 2.0
|
||||||
@ -22,7 +20,7 @@ Provides: man-pages-reader = %{version}
|
|||||||
# FPC exception for gnulib - copylib - https://fedorahosted.org/fpc/ticket/174
|
# FPC exception for gnulib - copylib - https://fedorahosted.org/fpc/ticket/174
|
||||||
Provides: bundled(gnulib) = %{gnulib_ver}
|
Provides: bundled(gnulib) = %{gnulib_ver}
|
||||||
|
|
||||||
Requires: coreutils, grep, groff-base, gzip, less, crontabs
|
Requires: coreutils, grep, groff-base, gzip, less
|
||||||
BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel
|
BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel
|
||||||
BuildRequires: po4a
|
BuildRequires: po4a
|
||||||
|
|
||||||
@ -62,12 +60,6 @@ rm $RPM_BUILD_ROOT%{_libdir}/man-db/*.la
|
|||||||
# install cache directory
|
# install cache directory
|
||||||
install -d -m 0755 $RPM_BUILD_ROOT%{cache}
|
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
|
|
||||||
|
|
||||||
# config for tmpfiles.d
|
# config for tmpfiles.d
|
||||||
install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/.
|
install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/.
|
||||||
|
|
||||||
@ -87,13 +79,19 @@ fi
|
|||||||
%post
|
%post
|
||||||
%{__rm} -rf %{cache}/*
|
%{__rm} -rf %{cache}/*
|
||||||
|
|
||||||
|
# update cache
|
||||||
|
%transfiletriggerin -- %{_mandir}
|
||||||
|
/usr/bin/mandb -q
|
||||||
|
|
||||||
|
# update cache
|
||||||
|
%transfiletriggerpostun -- %{_mandir}
|
||||||
|
/usr/bin/mandb -q
|
||||||
|
|
||||||
%files -f %{name}.lang -f %{name}-gnulib.lang
|
%files -f %{name}.lang -f %{name}-gnulib.lang
|
||||||
%{!?_licensedir:%global license %%doc}
|
%{!?_licensedir:%global license %%doc}
|
||||||
%license docs/COPYING
|
%license docs/COPYING
|
||||||
%doc README man-db-manual.txt man-db-manual.ps ChangeLog NEWS
|
%doc README man-db-manual.txt man-db-manual.ps ChangeLog NEWS
|
||||||
%config(noreplace) %{_sysconfdir}/man_db.conf
|
%config(noreplace) %{_sysconfdir}/man_db.conf
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/man-db
|
|
||||||
%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
|
|
||||||
%config(noreplace) /usr/lib/tmpfiles.d/man-db.conf
|
%config(noreplace) /usr/lib/tmpfiles.d/man-db.conf
|
||||||
%{_sbindir}/accessdb
|
%{_sbindir}/accessdb
|
||||||
%{_bindir}/man
|
%{_bindir}/man
|
||||||
@ -134,6 +132,9 @@ fi
|
|||||||
%lang(zh_CN) %{_datadir}/man/zh_CN/man*/*
|
%lang(zh_CN) %{_datadir}/man/zh_CN/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 10 2015 Nikola Forró <nforro@redhat.com> - 2.7.3-2
|
||||||
|
- use file triggers instead of crontabs for updating cache
|
||||||
|
|
||||||
* Thu Sep 10 2015 Nikola Forró <nforro@redhat.com> - 2.7.3-1
|
* Thu Sep 10 2015 Nikola Forró <nforro@redhat.com> - 2.7.3-1
|
||||||
- update to 2.7.3
|
- update to 2.7.3
|
||||||
resolves #1261678
|
resolves #1261678
|
||||||
|
@ -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"
|
|
Loading…
Reference in New Issue
Block a user