freebsd-update: improve mandoc db generation

freebsd-update compares the dates on man pages with mandoc.db, and if
any newer pages are found it regenerates mandoc.db.

Previously, if mandoc.db did not already exist the check failed and
freebsd-update then failed to create one.  Now, check that mandoc.db
exists before performing the check for newer pages.

Reported by:	bdrewery (in D10482)
Reviewed by:	gordon
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29575
This commit is contained in:
Ed Maste 2021-04-03 20:57:26 -04:00
parent 4bbfa3d3ba
commit 741223a65c

View File

@ -2958,7 +2958,8 @@ Kernel updates have been installed. Please reboot and run
if [ ! -d ${BASEDIR}/$D ]; then
continue
fi
if [ -z "$(find ${BASEDIR}/$D -type f -newer ${BASEDIR}/$D/mandoc.db)" ]; then
if [ -f ${BASEDIR}/$D/mandoc.db ] && \
[ -z "$(find ${BASEDIR}/$D -type f -newer ${BASEDIR}/$D/mandoc.db)" ]; then
continue;
fi
makewhatis ${BASEDIR}/$D