[Slackbuilds-users] RFC: Proposed mandb additions to doinst/douninst template

B. Watson urchlay at slackware.uk
Mon Sep 16 08:00:26 UTC 2024



On Mon, 16 Sep 2024, Duncan Roe wrote:

> I just thought of a simpler way. Append
>
> [ ! -d usr/man ] || find usr/man -type f -a -name '*.gz' | xargs -r touch
>
> to install/doinst.sh. The man pages are now modified at install time so the
> daily mandb will process them.

It's the timestamps of the man directories that mandb checks. But yes,
this could work.

I'd invert the tests (I read your code as a double negative), avoid
xargs, and write something like:

[ -d usr/man ] && find usr/man -type d -exec touch {} +

The + will make it execute touch once, with all the filenames as
arguments.  Since it doesn't use the shell, no escaping has to be
done... find's -exec correctly handles filenames with spaces or even
embedded newlines (just checked that part).

Yes, I like this a lot better than my original idea. Simpler and
faster. Provided it works (and I don't see why it wouldn't; I just
haven't tested it in actual doinst.sh yet).

The disadvantage is that the man pages don't get added to the db until
the nightly cronjob runs, but that's totally fine (as long as they
*eventually* get added, I don't insist it has to be right away).

> Or am I missing something?

I don't think so. My hat's off to you (or, would be, were I wearing one).

I'll do some real-world testing now, get back to you tomorrow probably.


More information about the SlackBuilds-users mailing list