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

B. Watson urchlay at slackware.uk
Wed Sep 11 06:15:44 UTC 2024



On Wed, 11 Sep 2024, K. Eugene Carlson wrote:

> >   find usr/man -type f -a -name '*.gz' | \
> >     sed -e 's,^,chroot . /usr/bin/mandb -f "/,' \
> >         -e 's,$," \&>/dev/null,' \
> >     >> install/doinst.sh
> 
> My only suggestion would be to use "-type f,l". Almost 20% of all man pages are symlinks on a clean Slackware installation.

I was thinking adding symlinks to the database wouldn't be helpful.
For man -k or apropos (which search the descriptions and return the
pages), it wouldn't be. For whatis I suppose it would be (takes a page
name, which might be a symlink, and gives you the description).

> Anyway, I've started trying this out on my own builds (albeit with awk instead of sed; just personal preference), and it appears to work.

Someone on IRC pointed out that rewriting it to use awk would be less
ugly. I tend to reach for sed first due to familiarity, but I think in
this case you and him are right.

Something like this, maybe?

find usr/man -type f -a -name '*.gz' | \
   awk '{ print "chroot . /usr/bin/mandb -f \"/"$1"\" &>/dev/null" }' \
   >> install/doinst.sh

It would be less ugly if we could assume man pages never have spaces
or shell metacharacters in them... I don't think the man command can
handle spaces in the man page filenames, and it would be bizarre to
have $ or * or such in the filename... But better to leave the quotes
there I suppose.


More information about the SlackBuilds-users mailing list