ports/sysutils/munin-common/files/patch-plugins_node.d_nutups__.in
Mathieu Arnold ed49e7eb1c Update to 2.0.54.
While there, document why patches are there.
2020-01-27 14:00:11 +00:00

33 lines
957 B
Text

Allow overriding some variables.
--- plugins/node.d/nutups_.in.orig 2018-07-24 11:34:38 UTC
+++ plugins/node.d/nutups_.in
@@ -7,21 +7,25 @@
#
# usage: nutups_upsid_function
#
+# env.upsc <command> (default: "/bin/upsc")
+# env.upsconf <filename> (default: "/etc/nut/ups.conf")
+#
#%# family=contrib
#%# capabilities=autoconf suggest
UPS=$(basename "$0" | cut -d_ -f2)
FUNCTION=$(basename "$0" | cut -d_ -f3)
UPSC=$(command -v upsc)
+UPSCONF=${upsconf:-/etc/nut/ups.conf}
if [ "$1" = "autoconf" ]; then
- [ -x "$UPSC" ] && [ -r /etc/nut/ups.conf ] && echo yes && exit 0
- echo "no (upsc or /etc/nut/ups.conf not found)"
+ [ -x "$UPSC" ] && [ -r "$UPSCONF" ] && echo yes && exit 0
+ echo "no ($UPSC or $UPSCONF not found)"
exit 0
fi
if [ "$1" = "suggest" ]; then
- grep '^\[[^]]*\]$' /etc/nut/ups.conf \
+ grep '^\[[^]]*\]$' "$UPSCONF" \
| tr -d '][' \
| while read -r ups; do
for i in voltages freq charge current; do