Skip to content

Fix docs recipe for PREP_SRC, and some other small issues #2990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ https://github.com/networkupstools/nut/milestone/9
(which is something NUT code tried to do since the beginning of time),
and could lead to "segmentation fault" crashes on some platforms.
[issue #2948, PR #2963]
* Documentation build recipes overly zealously pre-processed source files,
which was not applicable for each and every document type we have (e.g.
binary images for illustrations); this caused grief with some toolkits.
[issue #2989]

- common code:
* Revised common `writepid()` to use `altpidpath()` as location for the
Expand Down
5 changes: 4 additions & 1 deletion clients/upsmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -3824,7 +3824,10 @@ int main(int argc, char *argv[])
exit(check_pdflag());

if (shutdowncmd == NULL)
printf("Warning: no shutdown command defined!\n");
printf("Warning: no shutdown command defined%s\n",
(minsupplies < 1)
? ", but that is OK for a monitoring-only client."
: "!");

/* we may need to get rid of a flag from a previous shutdown */
if (powerdownflag != NULL)
Expand Down
9 changes: 7 additions & 2 deletions conf/upsmon.conf.sample.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# MINSUPPLIES (may be 0 if this system is only monitoring other NUT servers),
# and a POWERDOWNFLAG if this machine is a "primary" system connected to
# the UPS and drives its late-shutdown power-off command in an emergency.
# You should also define a SHUTDOWNCMD (like the example below, or something
# special for your deployment) if MINSUPPLIES is at least 1 and you MONITOR
# an UPS. A NOTIFYCMD integrating with `upssched` is a common situation too.

# --------------------------------------------------------------------------
# RUN_AS_USER <userid>
Expand Down Expand Up @@ -158,9 +161,11 @@ MINSUPPLIES 1
# such as posting a message with 'logger' or 'wall' or 'mailx'. Do be careful
# to plug the UPS back into the wall in a timely fashion.
#
# For Windows setup use something like:
# For Windows setup you should escape backslashes (or use forward slashes in
# recent OS releases). To shut down, use something like:
# SHUTDOWNCMD "C:\\WINDOWS\\system32\\shutdown.exe -s -t 0"
# If you have command line using space character you have to add double quote to them, like this:
# If you have a command line using space characters, you have to add double
# quote to them, like this:
# SHUTDOWNCMD "\"C:\\Program Files\\some command.bat\" -first_arg -second_arg"
# Or use the old DOS 8.3 file name, like this:
# SHUTDOWNCMD "C:\\PROGRA~1\\SOMECO~1.bat -first_arg -second_arg"
Expand Down
22 changes: 15 additions & 7 deletions docs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ $(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/
SPELLCHECK_AUTO_ONE = ( \
SPELLCHECK_SRC_ONE="`basename '$?'`" ; \
rm -f "$@".failed ; \
$(MAKE) $(AM_MAKEFLAGS) -k -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_SRC_ONE="$${SPELLCHECK_SRC_ONE}" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" "$(SPELLCHECK_BUILDDIR)/$${SPELLCHECK_SRC_ONE}-spellchecked" \
$(MAKE) $(AM_MAKEFLAGS) -k -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_SRC_ONE="$${SPELLCHECK_SRC_ONE}" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" VPATH="$(SPELLCHECK_SRCDIR):$(SPELLCHECK_BUILDDIR):$(VPATH)" "$(SPELLCHECK_BUILDDIR)/$${SPELLCHECK_SRC_ONE}-spellchecked" \
|| { RES=$$? ; touch "$@".failed; exit $$RES; } \
)

Expand Down Expand Up @@ -947,7 +947,7 @@ spellcheck:
if test "$(SPELLCHECK_ENV_DEBUG)" != no ; then \
echo "ASPELL MAKEFILE DEBUG: Will see from `pwd` if '$(SPELLCHECK_SRCDIR)/$${docsrc}-spellchecked' is up to date" >&2; \
else true ; fi ; \
$(MAKE) $(AM_MAKEFLAGS) -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_SRC_ONE="$${docsrc}" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked" \
$(MAKE) $(AM_MAKEFLAGS) -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_SRC_ONE="$${docsrc}" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" VPATH="$(SPELLCHECK_SRCDIR):$(SPELLCHECK_BUILDDIR):$(VPATH)" "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked" \
|| FAILED="$$FAILED $(SPELLCHECK_SRCDIR)/$$docsrc"; \
done ; \
else \
Expand All @@ -957,12 +957,12 @@ spellcheck:
echo "ASPELL MAKEFILE DEBUG: from `pwd`: SPELLCHECK_NOEXT_DOCS='$${SPELLCHECK_NOEXT_DOCS}' SPELLCHECK_AUTO_TGT='$${SPELLCHECK_AUTO_TGT}'" ; \
else true ; fi ; \
if [ x"$${SPELLCHECK_AUTO_TGT}" != x ] ; then \
$(MAKE) $(AM_MAKEFLAGS) -k -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" $${SPELLCHECK_AUTO_TGT} ; \
$(MAKE) $(AM_MAKEFLAGS) -k -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" VPATH="$(SPELLCHECK_SRCDIR):$(SPELLCHECK_BUILDDIR):$(VPATH)" $${SPELLCHECK_AUTO_TGT} ; \
FAILED="`for docsrc in $(SPELLCHECK_SRC); do if [ -e "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked-auto.failed" ] ; then printf '%s ' "$(SPELLCHECK_SRCDIR)/$${docsrc}" ; rm -f "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked-auto.failed" ; fi ; done`" ; \
fi ; \
if [ x"$${SPELLCHECK_NOEXT_DOCS}" != x ] ; then \
for docsrc in $${SPELLCHECK_NOEXT_DOCS} ; do \
$(MAKE) $(AM_MAKEFLAGS) -k -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_SRC_ONE="$${docsrc}" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked" \
$(MAKE) $(AM_MAKEFLAGS) -k -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_SRC_ONE="$${docsrc}" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" VPATH="$(SPELLCHECK_SRCDIR):$(SPELLCHECK_BUILDDIR):$(VPATH)" "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked" \
|| FAILED="$$FAILED $(SPELLCHECK_SRCDIR)/$$docsrc"; \
done ; \
fi ; \
Expand Down Expand Up @@ -1027,7 +1027,7 @@ spellcheck-interactive:
if test "$(SPELLCHECK_ENV_DEBUG)" != no ; then \
echo "ASPELL (INTERACTIVE) MAKEFILE DEBUG: Will see from `pwd` if '$(SPELLCHECK_SRCDIR)/$${docsrc}-spellchecked' is up to date" >&2; \
else true ; fi ; \
$(MAKE) $(AM_MAKEFLAGS) -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_INTERACTIVE="true" SPELLCHECK_SRC="" SPELLCHECK_SRC_ONE="$${docsrc}" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked" \
$(MAKE) $(AM_MAKEFLAGS) -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_INTERACTIVE="true" SPELLCHECK_SRC="" SPELLCHECK_SRC_ONE="$${docsrc}" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" VPATH="$(SPELLCHECK_SRCDIR):$(SPELLCHECK_BUILDDIR):$(VPATH)" "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked" \
|| FAILED="$$FAILED $(SPELLCHECK_SRCDIR)/$$docsrc"; \
done ; \
if test -n "$$FAILED" ; then \
Expand Down Expand Up @@ -1131,6 +1131,9 @@ $(abs_top_builddir)/docs/.prep-src-docs: $(PREP_SRC) Makefile
cd "$(abs_top_builddir)" ; \
fi ;; \
esac ; \
case "$$F" in \
*.xml|*.xsl|*.css|*.jpg|*.png|*.pdn|*.svg) ;; \
*.txt|*.adoc|*.in|*.sample|*.conf|*) \
if $$MAN_SECTIONS_DEFAULT ; then \
sed \
-e 's,\(home page:\) https://www.networkupstools.org/*$$,\1 $(NUT_WEBSITE_BASE)/,' ; \
Expand All @@ -1142,7 +1145,8 @@ $(abs_top_builddir)/docs/.prep-src-docs: $(PREP_SRC) Makefile
-e 's,\(linkman:[^ []*\[\)8\],\1$(MAN_SECTION_CMD_SYS)],g' \
-e 's,\(linkman:[^ []*\[\)1\],\1$(MAN_SECTION_CMD_USR)],g' \
-e 's,\(linkman:[^ []*\[\)7\],\1$(MAN_SECTION_MISC)],g' ; \
fi < "$${F}" > "$${F}-prepped" || exit ; \
fi < "$${F}" > "$${F}-prepped" || exit ;; \
esac; \
COUNT="`expr $$COUNT + 1`" ; \
done ; \
if ! test -e "$@" ; then touch "$@" ; fi ; \
Expand Down Expand Up @@ -1188,6 +1192,9 @@ $(abs_top_builddir)/docs/.prep-src-docs: $(PREP_SRC) Makefile
if $$IS_TEXT ; then \
grep -w linkman "$${linkroot}/$${F}" > /dev/null || IS_TEXT=false ; \
fi ; \
case "$$F" in \
*.xml|*.xsl|*.css|*.jpg|*.png|*.pdn|*.svg) ;; \
*.txt|*.adoc|*.in|*.sample|*.conf|*) \
if $$MAN_SECTIONS_DEFAULT || ! $$IS_TEXT ; then \
sed \
-e 's,\(home page:\) https://www.networkupstools.org/*$$,\1 $(NUT_WEBSITE_BASE)/,' ; \
Expand All @@ -1200,7 +1207,8 @@ $(abs_top_builddir)/docs/.prep-src-docs: $(PREP_SRC) Makefile
-e 's,\(linkman:[^ []*\[\)1\],\1$(MAN_SECTION_CMD_USR)],g' \
-e 's,\(linkman:[^ []*\[\)7\],\1$(MAN_SECTION_MISC)],g' ; \
fi < "$${linkroot}/$${F}" > "$${linkroot}/$${F}-prepped" \
|| { rm -f "[email protected]" ; exit 1 ; } ; \
|| { rm -f "[email protected]" ; exit 1 ; } ;; \
esac ; \
COUNT="`expr $$COUNT + 1`" ; \
done ; \
fi ; \
Expand Down
12 changes: 10 additions & 2 deletions docs/man/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,9 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile
cd "$(abs_top_builddir)" ; \
fi ;; \
esac ; \
case "$$F" in \
*.xml|*.xsl|*.css|*.jpg|*.png|*.pdn|*.svg) ;; \
*.txt|*.adoc|*.in|*.sample|*.conf|*) \
if $$MAN_SECTIONS_DEFAULT ; then \
sed \
-e 's,\(home page:\) https://www.networkupstools.org/*$$,\1 $(NUT_WEBSITE_BASE)/,' ; \
Expand All @@ -2081,7 +2084,8 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile
-e '1 s,\(^.*(\)8)$$,\1$(MAN_SECTION_CMD_SYS)),g' \
-e '1 s,\(^.*(\)1)$$,\1$(MAN_SECTION_CMD_USR)),g' \
-e '1 s,\(^.*(\)7)$$,\1$(MAN_SECTION_MISC)),g' ; \
fi < "$${F}" > "$${F}-prepped" || exit ; \
fi < "$${F}" > "$${F}-prepped" || exit ;; \
esac ; \
COUNT="`expr $$COUNT + 1`" ; \
done ; \
else \
Expand Down Expand Up @@ -2126,6 +2130,9 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile
if $$IS_TEXT ; then \
grep -w linkman "$${linkroot}/$${F}" > /dev/null || IS_TEXT=false ; \
fi ; \
case "$$F" in \
*.xml|*.xsl|*.css|*.jpg|*.png|*.pdn|*.svg) ;; \
*.txt|*.adoc|*.in|*.sample|*.conf|*) \
if $$MAN_SECTIONS_DEFAULT || ! $$IS_TEXT ; then \
sed \
-e 's,\(home page:\) https://www.networkupstools.org/*$$,\1 $(NUT_WEBSITE_BASE)/,' ; \
Expand All @@ -2143,7 +2150,8 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile
-e '1 s,\(^.*(\)1)$$,\1$(MAN_SECTION_CMD_USR)),g' \
-e '1 s,\(^.*(\)7)$$,\1$(MAN_SECTION_MISC)),g' ; \
fi < "$${linkroot}/$${F}" > "$${linkroot}/$${F}-prepped" \
|| { rm -f "[email protected]" ; exit 1 ; } ; \
|| { rm -f "[email protected]" ; exit 1 ; } ;; \
esac ; \
COUNT="`expr $$COUNT + 1`" ; \
done ; \
fi ; \
Expand Down
7 changes: 6 additions & 1 deletion scripts/systemd/nutshutdown.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#!/bin/sh

# Network UPS Tools (NUT) systemd-shutdown integration handler.
# Network UPS Tools (NUT) systemd-shutdown integration handler for UPS power
# cycling (or power-off) and power-race avoidance.
#
# NOTE: This script requires both nut-server package (or more specifically,
# the drivers for your device, which may be in further packages grouped
# by media/protocol and third-party dependencies), nut-client (upsmon),
# and their configuration files to be present locally and on still-mounted
# filesystems (may be read-only).
#
# It is typically installed as /usr/lib/systemd/system-shutdown/nutshutdown
# but other OSes and service management frameworks may also use an adapted
# variant of this script.
#
# Copyright (C) 2011-2025 by NUT contributors
# Michal Hlavinka, Laurent Bigonville, Arnaud Quette, Jim Klimov et al.
#
Expand Down