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

B. Watson urchlay at slackware.uk
Tue Sep 10 02:34:39 UTC 2024



On Sun, 8 Sep 2024, Arkadiusz Drabczyk wrote:

> Yeah I get the same behavior on -current and on Debian, this must be
> the intended behavior of mandb. Anyway, sounds good but why should we
> hide errors from the user? And it's a bit worrying that mandb manpage
> says that -f 'is not for general use', I hope they'll not remove it
> someday.

I think Debian's man page postinstall trigger stuff uses -f, so I
doubt it'll go away (or if it's going to, there will be plenty of
advance notice).

I had a thought. Instead of including a doinst.sh with all the man pages
listed in it, how about having the SlackBuild generate one?

Change the last 2 lines of a script, insert doinst-generation code between
the 'cd $PKG' and the makepkg command... something like this:

   cd $PKG

   find usr/man -type f -a -name '*.gz' | \
     sed -e 's,^,chroot . /usr/bin/mandb -f "/,' \
         -e 's,$," \&>/dev/null,' \
     >> install/doinst.sh

   /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

...it uses >> so if there's already a doinst.sh, it'll append to it. The
resulting doinst.sh will look something like:

   chroot . /usr/bin/mandb -f "/usr/man/man1/foo.1.gz" &>/dev/null
   chroot . /usr/bin/mandb -f "/usr/man/man1/bar.1.gz" &>/dev/null
   chroot . /usr/bin/mandb -f "/usr/man/man1/baz.1.gz" &>/dev/null

It doesn't have the "if [ -x usr/man/mandb ]" check, but it doesn't
really need it: the commands always run, but will silenty (and
quickly) fail, if there's no mandb command to run.

So, no need to manually maintain a doinst.sh script with all the man
pages listed in it. This should Just Work, everyone please try it on
some of your own builds and let me know if you have problems.


More information about the SlackBuilds-users mailing list