Skip to content

Commit

Permalink
common/common.c, scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in, sc…
Browse files Browse the repository at this point in the history
…ripts/systemd/nut*.in, scripts/Solaris/*.xml.in: when suggesting man pages for further reading, refer to correct (configurable) section identifier [#722]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Dec 30, 2024
1 parent 30d4aeb commit c8cb5eb
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 65 deletions.
10 changes: 8 additions & 2 deletions common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,15 @@ const char *suggest_doc_links(const char *progname, const char *progconf) {
snprintf(buf, sizeof(buf),
"For more information please ");
#if defined(WITH_DOCS) && WITH_DOCS
/* FIXME: Currently all NUT tools and drivers are in same
* man page section for "System Management Programs".
* If this ever changes (e.g. clients like `upsc` can be
* a "User Program" just as well), we may need an extra
method argument here.
*/
snprintfcat(buf, sizeof(buf),
"Read The Fine Manual ('man %s') and/or ",
buf2);
"Read The Fine Manual ('man %s %s') and/or ",
MAN_SECTION_CMD_SYS, buf2);
#endif
snprintfcat(buf, sizeof(buf),
"see\n\t%s/docs/man/%s.html\n",
Expand Down
12 changes: 6 additions & 6 deletions scripts/Solaris/nut-driver-enumerator.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@
</common_name>
<documentation>
<doc_link name='upsdrvsvcctl online' uri='@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html' />
<manpage title='upsdrvsvcctl' section='8' manpath='/usr/share/man' />
<manpage title='upsdrvsvcctl' section='@MAN_SECTION_CMD_SYS@' manpath='/usr/share/man' />
<doc_link name='ups.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/ups.conf.html' />
<manpage title='ups.conf' section='5' manpath='/usr/share/man' />
<manpage title='ups.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
<doc_link name='nut.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/nut.conf.html' />
<manpage title='nut.conf' section='5' manpath='/usr/share/man' />
<manpage title='nut.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
</documentation>
</template>
</instance>
Expand Down Expand Up @@ -183,11 +183,11 @@
</common_name>
<documentation>
<doc_link name='upsdrvsvcctl online' uri='@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html' />
<manpage title='upsdrvsvcctl' section='8' manpath='/usr/share/man' />
<manpage title='upsdrvsvcctl' section='@MAN_SECTION_CMD_SYS@' manpath='/usr/share/man' />
<doc_link name='ups.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/ups.conf.html' />
<manpage title='ups.conf' section='5' manpath='/usr/share/man' />
<manpage title='ups.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
<doc_link name='nut.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/nut.conf.html' />
<manpage title='nut.conf' section='5' manpath='/usr/share/man' />
<manpage title='nut.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
</documentation>
</template>
</instance>
Expand Down
6 changes: 3 additions & 3 deletions scripts/Solaris/nut-driver.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@
</common_name>
<documentation>
<doc_link name='upsdrvsvcctl online' uri='@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html' />
<manpage title='upsdrvsvcctl' section='8' manpath='/usr/share/man' />
<manpage title='upsdrvsvcctl' section='@MAN_SECTION_CMD_SYS@' manpath='/usr/share/man' />
<doc_link name='ups.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/ups.conf.html' />
<manpage title='ups.conf' section='5' manpath='/usr/share/man' />
<manpage title='ups.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
<doc_link name='nut.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/nut.conf.html' />
<manpage title='nut.conf' section='5' manpath='/usr/share/man' />
<manpage title='nut.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
</documentation>
</template>
</service>
Expand Down
6 changes: 3 additions & 3 deletions scripts/Solaris/nut-monitor.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@
</common_name>
<documentation>
<doc_link name='upsmon online' uri='@NUT_WEBSITE_BASE@/docs/man/upsmon.html' />
<manpage title='upsmon' section='8' manpath='/usr/share/man' />
<manpage title='upsmon' section='@MAN_SECTION_CMD_SYS@' manpath='/usr/share/man' />
<doc_link name='upsmon.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/upsmon.conf.html' />
<manpage title='upsmon.conf' section='5' manpath='/usr/share/man' />
<manpage title='upsmon.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
<doc_link name='nut.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/nut.conf.html' />
<manpage title='nut.conf' section='5' manpath='/usr/share/man' />
<manpage title='nut.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
</documentation>
</template>
</service>
Expand Down
10 changes: 5 additions & 5 deletions scripts/Solaris/nut-server.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@
</common_name>
<documentation>
<doc_link name='upsd online' uri='@NUT_WEBSITE_BASE@/docs/man/upsd.html' />
<manpage title='upsd' section='8' manpath='/usr/share/man' />
<manpage title='upsd' section='@MAN_SECTION_CMD_SYS@' manpath='/usr/share/man' />
<doc_link name='ups.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/ups.conf.html' />
<manpage title='ups.conf' section='5' manpath='/usr/share/man' />
<manpage title='ups.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
<doc_link name='upsd.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/upsd.conf.html' />
<manpage title='upsd.conf' section='5' manpath='/usr/share/man' />
<manpage title='upsd.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
<doc_link name='upsd.users online' uri='@NUT_WEBSITE_BASE@/docs/man/upsd.users.html' />
<manpage title='upsd.users' section='5' manpath='/usr/share/man' />
<manpage title='upsd.users' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
<doc_link name='nut.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/nut.conf.html' />
<manpage title='nut.conf' section='5' manpath='/usr/share/man' />
<manpage title='nut.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
</documentation>
</template>
</service>
Expand Down
15 changes: 5 additions & 10 deletions scripts/Solaris/nut.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,11 @@
</loctext>
</common_name>
<documentation>
<manpage title='upsdrvctl' section='8'
manpath='/usr/share/man' />
<manpage title='upsd' section='8'
manpath='/usr/share/man' />
<manpage title='ups.conf' section='5'
manpath='/usr/share/man' />
<manpage title='upsd.conf' section='5'
manpath='/usr/share/man' />
<manpage title='upsd.users' section='5'
manpath='/usr/share/man' />
<manpage title='upsdrvctl' section='@MAN_SECTION_CMD_SYS@' manpath='/usr/share/man' />
<manpage title='upsd' section='@MAN_SECTION_CMD_SYS@' manpath='/usr/share/man' />
<manpage title='ups.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
<manpage title='upsd.conf' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
<manpage title='upsd.users' section='@MAN_SECTION_CFG@' manpath='/usr/share/man' />
</documentation>
</template>
</service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ After=local-fs.target
Before=nut-driver.target
PartOf=nut.target

Documentation=man:nut-driver-enumerator(8)
Documentation=man:nut-driver-enumerator(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut-driver-enumerator.html
Documentation=man:ups.conf(5)
Documentation=man:ups.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/ups.conf.html
Documentation=man:upsdrvsvcctl(8)
Documentation=man:upsdrvsvcctl(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html
Documentation=man:nut.conf(5)
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html

[Path]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ After=local-fs.target
#Before=nut-driver.target
#PartOf=nut.target

Documentation=man:nut-driver-enumerator(8)
Documentation=man:nut-driver-enumerator(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut-driver-enumerator.html
Documentation=man:ups.conf(5)
Documentation=man:ups.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/ups.conf.html
Documentation=man:upsdrvsvcctl(8)
Documentation=man:upsdrvsvcctl(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html
Documentation=man:nut.conf(5)
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html

[Service]
Expand Down
8 changes: 4 additions & 4 deletions scripts/systemd/nut-driver-enumerator-daemon.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ After=local-fs.target
Before=nut-driver.target
PartOf=nut.target

Documentation=man:nut-driver-enumerator(8)
Documentation=man:nut-driver-enumerator(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut-driver-enumerator.html
Documentation=man:ups.conf(5)
Documentation=man:ups.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/ups.conf.html
Documentation=man:upsdrvsvcctl(8)
Documentation=man:upsdrvsvcctl(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html
Documentation=man:nut.conf(5)
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html

[Service]
Expand Down
8 changes: 4 additions & 4 deletions scripts/systemd/nut-driver-enumerator.path.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ After=local-fs.target
Before=nut-driver.target
PartOf=nut.target

Documentation=man:nut-driver-enumerator(8)
Documentation=man:nut-driver-enumerator(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut-driver-enumerator.html
Documentation=man:ups.conf(5)
Documentation=man:ups.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/ups.conf.html
Documentation=man:upsdrvsvcctl(8)
Documentation=man:upsdrvsvcctl(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html
Documentation=man:nut.conf(5)
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html

[Path]
Expand Down
8 changes: 4 additions & 4 deletions scripts/systemd/nut-driver-enumerator.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ After=local-fs.target
Before=nut-driver.target
PartOf=nut.target

Documentation=man:nut-driver-enumerator(8)
Documentation=man:nut-driver-enumerator(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut-driver-enumerator.html
Documentation=man:ups.conf(5)
Documentation=man:ups.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/ups.conf.html
Documentation=man:upsdrvsvcctl(8)
Documentation=man:upsdrvsvcctl(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html
Documentation=man:nut.conf(5)
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html

[Service]
Expand Down
6 changes: 3 additions & 3 deletions scripts/systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ After=local-fs.target
# Propagate stopping of the target:
PartOf=nut-driver.target

Documentation=man:upsdrvsvcctl(8)
Documentation=man:upsdrvsvcctl(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html
Documentation=man:ups.conf(5)
Documentation=man:ups.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/ups.conf.html
Documentation=man:nut.conf(5)
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html

# Note: The choice of "network.target" allows to schedule this unit
Expand Down
6 changes: 3 additions & 3 deletions scripts/systemd/nut-monitor.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Wants=nut-server.service
# After=network-online.target
PartOf=nut.target

Documentation=man:upsmon(8)
Documentation=man:upsmon(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsmon.html
Documentation=man:upsmon.conf(5)
Documentation=man:upsmon.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsmon.conf.html
Documentation=man:nut.conf(5)
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html

[Service]
Expand Down
10 changes: 5 additions & 5 deletions scripts/systemd/nut-server.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Requires=network.target
Before=nut-monitor.service
PartOf=nut.target

Documentation=man:upsd(8)
Documentation=man:upsd(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsd.html
Documentation=man:ups.conf(5)
Documentation=man:ups.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/ups.conf.html
Documentation=man:upsd.conf(5)
Documentation=man:upsd.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsd.conf.html
Documentation=man:upsd.users(5)
Documentation=man:upsd.users(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsd.users.html
Documentation=man:nut.conf(5)
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html

[Service]
Expand Down
4 changes: 2 additions & 2 deletions scripts/systemd/nut.target
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Wants=local-fs.target nut-driver.target nut-server.service nut-monitor.service
# network.target

# TODO: Dedicated man pages?
Documentation=man:ups.conf(5)
Documentation=man:ups.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/ups.conf.html

Documentation=man:nut.conf(5)
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html

[Install]
Expand Down
6 changes: 3 additions & 3 deletions scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -889,11 +889,11 @@ smf_setDocLink() {
[ $? = 0 ] && echo "OK" || { echo "FAILED to stash the service property group '${__PG}' for online docs">&2 ; return 1 ; }

# FIXME: Pass resolved $mandir if known
__PG="tm_man_${__DRV}8"
__PG="tm_man_${__DRV}@MAN_SECTION_CMD_SYS@"
/usr/sbin/svccfg -s "${__TARGET_FMRI}" delprop "${__PG}" 2>/dev/null || true
/usr/sbin/svccfg -s "${__TARGET_FMRI}" addpg "${__PG}" template && \
/usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/manpath" = "astring:" "/usr/share/man" && \
/usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/section" = "astring:" "8" && \
/usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/section" = "astring:" "@MAN_SECTION_CMD_SYS@" && \
/usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/title" = "astring:" "${__DRV}"
[ $? = 0 ] && echo "OK" || { echo "FAILED to stash the service property group '${__PG}' for local docs">&2 ; return 1 ; }

Expand Down Expand Up @@ -1051,7 +1051,7 @@ systemd_setDocLink() {
__DRV="`upsconf_getDriver "$2"`"
cat > "${PROPFILE}" << EOF
[Unit]
Documentation=man:${__DRV}(8)
Documentation=man:${__DRV}(@MAN_SECTION_CMD_SYS@)
Documentation=${NUT_WEBSITE_BASE}/docs/man/${__DRV}.html
EOF
unset __DRV
Expand Down

0 comments on commit c8cb5eb

Please sign in to comment.