schedule interrupted cache update for the next boot, instead of blocking system reboot/shutdown

- resolves #1678464
This commit is contained in:
Nikola Forró 2019-09-27 13:06:44 +02:00
parent 9c0f8d2201
commit 75b683fe49
3 changed files with 22 additions and 6 deletions

View File

@ -1,14 +1,11 @@
[Unit]
DefaultDependencies=no
After=local-fs.target
Before=reboot.target shutdown.target halt.target
JobTimeoutSec=15min
[Service]
Type=oneshot
TimeoutStartSec=infinity
Environment=MAN_NO_LOCALE_WARNING=1
EnvironmentFile=/etc/sysconfig/man-db
ExecStart=/bin/sh -c '[ "$SERVICE" != "no" ] && /usr/bin/mandb $OPTS || true'
ExecStopPost=/bin/sh -c '[ "$SERVICE_RESULT" == "signal" ] && /usr/bin/systemctl enable man-db-restart-cache-update.service || true'
Nice=19
IOWeight=20

View File

@ -0,0 +1,11 @@
[Unit]
Before=multi-user.target
[Service]
Type=oneshot
ExecStartPre=/usr/bin/rm -rf /var/cache/man/*
ExecStart=/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update.service
ExecStartPost=/usr/bin/systemctl disable man-db-restart-cache-update.service
[Install]
WantedBy=multi-user.target

View File

@ -4,7 +4,7 @@
Summary: Tools for searching and reading man pages
Name: man-db
Version: 2.8.7
Release: 1%{?dist}
Release: 2%{?dist}
# GPLv2+ .. man-db
# GPLv3+ .. gnulib
License: GPLv2+ and GPLv3+
@ -14,6 +14,7 @@ Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.ta
Source1: man-db.crondaily
Source2: man-db.sysconfig
Source3: man-db-cache-update.service
Source4: man-db-restart-cache-update.service
Patch0: man-db-2.8.3-change-owner-of-man-cache.patch
# http://lists.nongnu.org/archive/html/man-db-devel/2017-01/msg00013.html
@ -91,8 +92,9 @@ 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/.
# man-db-cache-update.service
# man-db-cache-update.service and man-db-restart-cache-update.service
install -D -p -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/man-db-cache-update.service
install -D -p -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_unitdir}/man-db-restart-cache-update.service
%find_lang %{name}
%find_lang %{name}-gnulib
@ -131,6 +133,7 @@ fi
%config(noreplace) %{_sysconfdir}/sysconfig/man-db
%config(noreplace) %{_tmpfilesdir}/man-db.conf
%{_unitdir}/man-db-cache-update.service
%{_unitdir}/man-db-restart-cache-update.service
%{_sbindir}/accessdb
%{_bindir}/man
%{_bindir}/whatis
@ -178,6 +181,11 @@ fi
%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
%changelog
* Fri Sep 27 2019 Nikola Forró <nforro@redhat.com> - 2.8.7-2
- schedule interrupted cache update for the next boot, instead of blocking
system reboot/shutdown
resolves #1678464
* Fri Aug 30 2019 Nikola Forró <nforro@redhat.com> - 2.8.7-1
- update to 2.8.7
resolves #1747042