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

B. Watson urchlay at slackware.uk
Sun Aug 25 17:42:11 UTC 2024



On Sun, 25 Aug 2024, Arkadiusz Drabczyk wrote:

>> ### in doinst.sh:
>> # DESCRIPTION: Updates the man database (for "man -k").
>> # Use one "man -f" command for each man page in the package.
>> if [ -x usr/bin/mandb ]; then
>>   usr/bin/mandb -f usr/man/man1/program.1.gz
>> fi
>
> so there is no easier way than to run mandb for each manpage
> separately?

No easier way that I've found yet.

Well, "mandb -c" in doinst.sh would be easier, but it takes too long
to run on Slackware 15.0.

> It'll be hard to maintain, especially in case of programs
> that can add different manpages based on build options used.

The revised version of it has the redirect &>/dev/null. So if build
options prevent one of the man pages from being built, the doinst.sh
won't complain about it.

During SlackBuild development, it'll be useful to run the doinst.sh
without the &>/dev/null's, to see if mandb complains about the format
of the man page.

I've just found out something interesting... in the douninst.sh,
instead of a single "mandb" call (which takes 5 seconds on my box
with an SSD), you can actually use the same "mandb -f" command(s).

# man -k zathura
zathura (1)          - a document viewer
# removepkg zathura &>/dev/null
# man -k zathura
zathura (1)          - a document viewer
# mandb -f /usr/man/man1/zathura.1.gz &>/dev/null
# man -k zathura
zathura: nothing appropriate.

This is quicker than what I posted for douninst.sh, and it's identical
code in doinst.sh and douninst.sh. And it runs instantly. Put that in
zathura's douninst.sh and there won't be a 5-second delay on package
removal.


More information about the SlackBuilds-users mailing list