You are not logged in.

#1 2025-01-04 19:00:17

Immobile
Member
Registered: 2015-02-07
Posts: 8

[Solved] Local man pages - extending default Sections

Hi all,

I am writing local man pages for my computer, to better keep track of details/quirks of the way I have set up the packages on my system (which have accumulated over the years). I have placed these man pages in

 /home/<user>/man 

and have extended man-db's search path by exporting

 MANPATH = ":/home/<user>/man" 

in my bashrc as recommended in manpath(5) and everything seems to be working fine.

I then tried to create a custom section "local" in which to place these local man pages, to separate them from those provided by the packages themselves. I am not able to do this in a satisfactory manner. The man-db man pages say that I can use the MANSECT environment variable, but adding

 MANSECT = ":local" 

to bashrc completely overrides the default sections instead of appending to them like MANPATH does (man only recognises "local" and does not recognise 1, 2...7 anymore). Creating a .manpath file and adding a SECTION directive with "local" in it also gives me the same result. Adding a SECTION directive to the systemwide config at /etc/man_db.conf works, and copying the default SECTION list from /etc/man_db.conf into my user's MANSECT environment variable also works, but both of these require me to keep track of changes to the upstream conf file and merge pacnew files or copy the default SECTION list whenever there are any changes, and I'd prefer a solution that didn't involve that. Is there anything that I've overlooked or any mistakes I've made in my configuration that would solve this?

Thanks!

Last edited by Immobile (2025-01-06 19:02:20)

Offline

#2 2025-01-04 21:51:26

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,787

Re: [Solved] Local man pages - extending default Sections

man man wrote:

The order of sections to search may be overridden by the environment variable $MANSECT or by
the SECTION directive in /etc/man_db.conf.  By default it is as follows: …

export MANSECT="$(sed '/^SECTION/!d;s/SECTION\s*//;s/\s\+/:/g' /etc/man_db.conf):local"

?

Offline

#3 2025-01-06 19:01:44

Immobile
Member
Registered: 2015-02-07
Posts: 8

Re: [Solved] Local man pages - extending default Sections

seth wrote:
export MANSECT="$(sed '/^SECTION/!d;s/SECTION\s*//;s/\s\+/:/g' /etc/man_db.conf):local"

Ah thank you, I have no idea why this didn't occur to me. This won't work if there are multiple SECTION(S) directives in the file (which is a possibility, as per the manual), so I've concatenated the output with paste just in case

 export MANSECT="$(sed '/^SECTION/!d;s/SECTIONS*\s*//;s/\s\+/:/g' /etc/man_db.conf | paste -s -d ':'):local" 

Thanks a lot! Marking this as solved.

Offline

Board footer

Powered by FluxBB