new upstream 2.8.0

This commit is contained in:
lagertonne 2022-06-29 12:37:36 +02:00
parent fc7f4b43c1
commit b2b0c9995a
836 changed files with 137090 additions and 30018 deletions

171
scripts/Aix/nut.init.in Executable file
View file

@ -0,0 +1,171 @@
#! /bin/sh
#
# ups: Starts the Network UPS Tools
#
# chkconfig: - 26 74
# description: Network UPS Tools is a collection of programs which provide a common \
# interface for monitoring and administering UPS hardware.
# processname: upsd
# config: /usr/local/ups/etc
# config: /etc/rc.ups
#
### BEGIN INIT INFO
# Provides: ups
# Required-Start: $syslog $network $named
# Required-Stop: $local_fs
# Default-Stop: 0 1 6
# Short-Description: Starts the Network UPS tools
# Description: Network UPS Tools is a collection of programs which provide a common \
# interface for monitoring and administering UPS hardware.
### END INIT INFO
success() {
echo OK
}
failure() {
echo FAILED
}
# Resolve what processes should run
SERVER="no"
CLIENT="no"
NUT_DIR="@prefix@"
NUT_SBIN_DIR="${NUT_DIR}/sbin"
NUT_LIB_DIR="${NUT_DIR}/lib"
NUT_RUN_DIR="@PIDPATH@/nut"
CONFIG="@CONFPATH@/nut.conf"
NUTUSER="@RUN_AS_USER@"
NUTGROUP="@RUN_AS_GROUP@"
NUT_VAR_LOCK="/var/locks/ups"
if [ -f "$CONFIG" ] ; then
. "$CONFIG"
case "$MODE" in
standalone|netserver)
SERVER="yes"
;;
esac
rpm -q nut-client >/dev/null 2>&1 && CLIENT="yes"
fi
do_start() {
RETVAL=0
if [ ! -d "$NUT_RUN_DIR" ]; then
mkdir -p "$NUT_RUN_DIR" && \
chown "root:$NUTGROUP" "$NUT_RUN_DIR" && \
chmod 770 "$NUT_RUN_DIR"
RETVAL=$?
fi
if [ "$SERVER" = "yes" ]; then
echo "Starting UPS driver controller: \c"
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsdrvctl start >/dev/null 2>&1 && success || { RETVAL=$?; failure; }
echo "Starting upsd: \c"
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsd $UPSD_OPTIONS >/dev/null 2>&1 && success || { RETVAL=$?; failure; }
fi
if [ "$CLIENT" = "yes" ]; then
echo "Starting UPS monitor: \c"
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsmon >/dev/null 2>&1 && success || { RETVAL=$?; failure; }
fi
[ "$RETVAL" = 0 ] && touch "${NUT_VAR_LOCK}"
return $RETVAL
}
do_stop() {
RETVAL=0
if test -e "${NUT_RUN_DIR}"/upsmon.pid; then
echo "Stopping UPS monitor: \c"
PID="`cat "${NUT_RUN_DIR}"/upsmon.pid`"
kill -15 $PID && success || { RETVAL=$?; failure; }
rm "${NUT_RUN_DIR}"/upsmon.pid
fi
if [ "$SERVER" = "yes" ]; then
if test -e "${NUT_RUN_DIR}"/upsd.pid; then
echo "Stopping upsd: \c"
PID="`cat "${NUT_RUN_DIR}"/upsd.pid`"
kill -15 $PID && success || { RETVAL=$?; failure; }
rm "${NUT_RUN_DIR}"/upsd.pid
fi
echo "Shutting down UPS driver controller: \c"
"${NUT_SBIN_DIR}"/upsdrvctl stop > /dev/null 2>&1 && success || { RETVAL=$?; failure; }
fi
[ "$RETVAL" = 0 ] && rm -f "${NUT_VAR_LOCK}"
return $RETVAL
}
do_restart() {
do_stop
waitmore=5
while [ -n "$(ls "${NUT_RUN_DIR}"/)" -a $waitmore -ge 1 ]
do
sleep 1
waitmore="$(expr $waitmore - 1)"
done
do_start
}
do_reload() {
# FIXME: upsd and upsmon always return 0
# => can't tell if reload was successful
RETVAL=0
if [ "$SERVER" = "yes" ]; then
echo "Reloading upsd"
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsd -c reload && success || { RETVAL=$?; failure; }
fi
echo "Reloading upsmon"
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsmon -c reload && success || { RETVAL=$?; failure; }
return $RETVAL
}
# See how we are called.
case "$1" in
start)
do_start ;;
stop)
do_stop ;;
restart)
do_restart ;;
try-restart)
[ -f "${NUT_VAR_LOCK}" ] && do_restart || true
;;
reload)
do_reload ;;
force-reload)
do_restart ;;
status)
if [ "$SERVER" = "yes" ]; then
if test -f "${NUT_VAR_LOCK}"; then
echo "upsd is running with PID" `cat "${NUT_RUN_DIR}"/upsd.pid`
fi
fi
if test -e "${NUT_RUN_DIR}"/upsmon.pid; then
echo "upsmon is running with PID" `cat "${NUT_RUN_DIR}"/upsmon.pid`
elif rpm -q nut-client >/dev/null 2>&1; then
echo "upsmon isn't running"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}"
RETVAL=3
esac
exit $RETVAL

View file

@ -25,4 +25,6 @@ EXTRA_DIST = README \
Windows/halt.c \
Windows/Makefile
SUBDIRS = augeas devd hotplug python systemd udev Solaris
SUBDIRS = augeas devd hotplug python systemd udev ufw Solaris upsdrvsvcctl
MAINTAINERCLEANFILES = Makefile.in .dirstamp

View file

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -14,7 +14,17 @@
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -79,18 +89,24 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = scripts
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
@ -99,11 +115,17 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
@ -142,7 +164,7 @@ am__recursive_targets = \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
distdir distdir-am
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
@ -163,6 +185,7 @@ am__define_uniq_tagged_files = \
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@ -196,6 +219,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -206,6 +230,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
@ -219,6 +244,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
@ -231,6 +257,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -248,6 +275,8 @@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
@ -258,21 +287,29 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
@ -292,6 +329,9 @@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
@ -305,6 +345,7 @@ STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
@ -322,6 +363,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@ -335,6 +377,9 @@ datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@ -360,12 +405,14 @@ pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemshutdowndir = @systemdsystemshutdowndir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
@ -402,7 +449,8 @@ EXTRA_DIST = README \
Windows/halt.c \
Windows/Makefile
SUBDIRS = augeas devd hotplug python systemd udev Solaris
SUBDIRS = augeas devd hotplug python systemd udev ufw Solaris upsdrvsvcctl
MAINTAINERCLEANFILES = Makefile.in .dirstamp
all: all-recursive
.SUFFIXES:
@ -418,14 +466,13 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -542,7 +589,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -632,6 +682,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
@ -713,6 +764,8 @@ uninstall-am:
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -1,17 +1,88 @@
EXTRA_DIST = makelocal.sh
EXTRA_DIST = makelocal.sh precheck.py.in preproto.pl.in README
PROTOTYPE_DIR = $(DESTDIR)@prefix@
SOLARIS_CHECK_TARGETS =
PYTHON = @PYTHON@
package: makelocal.sh pkginfo
$ cd @prefix@; $ find . -print | pkgproto > prototype1
$ cp makelocal.sh precheck.py pkginfo nut preinstall postinstall preremove postremove preproto.pl @prefix@
$ cd @prefix@; perl preproto.pl
$ cd @prefix@; python precheck.py
$ cd @prefix@; rm -f prototype1
$ cd @prefix@; ./makelocal.sh
$ cp @prefix@/*.gz $(srcdir)
if test `uname -p` = "i386"; then \
mv NUT_solaris_package.local.gz NUT_solaris_i386_package@PACKAGE_VERSION@.local.gz; \
else \
if test `uname -p` = "sparc"; then \
mv NUT_solaris_package.local.gz NUT_solaris_sparc_package@PACKAGE_VERSION@.local.gz; \
fi; \
fi;
SOLARIS_SMF_MANIFESTS = \
nut.xml \
nut-server.xml \
nut-monitor.xml \
nut-driver.xml \
nut-driver-enumerator.xml
SOLARIS_SMF_METHODSCRIPTS = \
svc-nut-server \
svc-nut-monitor
if WITH_SOLARIS_SMF
# OS equivalent of /lib/svc/method and /var/svc/manifest/application
# but we can just use then from this location
solarissmfmethoddir = @datadir@/solaris-smf/method
solarissmfmanifestdir = @datadir@/solaris-smf/manifest
solarissmfmethod_SCRIPTS = $(SOLARIS_SMF_METHODSCRIPTS)
solarissmfmanifest_DATA = $(SOLARIS_SMF_MANIFESTS)
libexec_SCRIPTS = ../upsdrvsvcctl/nut-driver-enumerator.sh
sbin_SCRIPTS = ../upsdrvsvcctl/upsdrvsvcctl
SOLARIS_CHECK_TARGETS += check-local-solaris-smf
endif
solarisinitscriptdir = @datadir@/solaris-init
solarisinitscript_SCRIPTS = nut
SOLARIS_PACKAGE_TARGETS =
if WITH_SOLARIS_PKG_IPS
SOLARIS_PACKAGE_TARGETS += package-solaris-ips
endif
if WITH_SOLARIS_PKG_SVR4
SOLARIS_PACKAGE_TARGETS += package-solaris-svr4
endif
package: $(SOLARIS_PACKAGE_TARGETS)
# TODO: Reduce build dependencies (implicit!) on python and perl
# by shelling the scripts used below
# NOTE: This assumes the rest of the product has already been built
# and installed under PROTOTYPE_DIR, but declares no explicit
# dependency on that
SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS = makelocal.sh precheck.py preproto.pl
SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS = preinstall postinstall preremove postremove
SOLARIS_PACKAGE_SVR4_INSTALLDATA = pkginfo
package-solaris-svr4: $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA)
if test -n "@auglensdir@" && test -d "$(DESTDIR)@auglensdir@" ; then \
mkdir -p "$(DESTDIR)@datadir@/augeas-lenses" && \
cd "$(DESTDIR)@auglensdir@" && \
( cp -prf ./ "$(DESTDIR)@datadir@/augeas-lenses/" || cp -rf ./ "$(DESTDIR)@datadir@/augeas-lenses/" ) ; fi
cd $(PROTOTYPE_DIR) && find . -print | pkgproto > prototype1
cp $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA) $(PROTOTYPE_DIR)
cd $(PROTOTYPE_DIR) && chmod +x $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS)
cd $(PROTOTYPE_DIR) && perl preproto.pl
if HAVE_PYTHON
cd $(PROTOTYPE_DIR) && $(PYTHON) precheck.py
endif
cd $(PROTOTYPE_DIR) && rm -f prototype1
cd $(PROTOTYPE_DIR) && ./makelocal.sh
cp $(PROTOTYPE_DIR)/*.gz $(builddir)
UNAME_P="`uname -p`" && case "$${UNAME_P}" in \
i386|sparc) \
mv -f NUT_solaris_package.local.gz "$(abs_top_builddir)/NUT_solaris_$${UNAME_P}_package@PACKAGE_VERSION@.local.gz" ;; \
esac
# TODO: Define support for IPS packaging (provide p5m files and make rules)
package-solaris-ips:
@echo "SKIPPED : Target $@ is not implemented yet"
check-local: $(SOLARIS_CHECK_TARGETS)
check-local-solaris-smf: $(SOLARIS_SMF_MANIFESTS)
@[ -x /usr/sbin/svccfg ] || { echo "WARNING : Target $@ skipped due to absent /usr/sbin/svccfg" >&2; return 0; } ; \
RES=0 ; for F in $^ ; do \
echo " SVCCFG-VALIDATE $$F"; \
/usr/sbin/svccfg validate "$$F" || RES=$$? ; \
done; exit $$RES
MAINTAINERCLEANFILES = Makefile.in .dirstamp

View file

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -13,8 +13,20 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -78,21 +90,28 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@WITH_SOLARIS_SMF_TRUE@am__append_1 = check-local-solaris-smf
@WITH_SOLARIS_PKG_IPS_TRUE@am__append_2 = package-solaris-ips
@WITH_SOLARIS_PKG_SVR4_TRUE@am__append_3 = package-solaris-svr4
subdir = scripts/Solaris
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/pkginfo.in $(srcdir)/postinstall.in \
$(srcdir)/preremove.in $(srcdir)/nut.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
@ -101,15 +120,57 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = pkginfo postinstall preremove nut
CONFIG_CLEAN_FILES = nut-driver-enumerator.xml nut-driver.xml \
nut-monitor.xml nut-server.xml nut.xml pkginfo svc-nut-server \
svc-nut-monitor precheck.py preinstall postinstall preremove \
postremove preproto.pl nut
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" \
"$(DESTDIR)$(solarisinitscriptdir)" \
"$(DESTDIR)$(solarissmfmethoddir)" \
"$(DESTDIR)$(solarissmfmanifestdir)"
SCRIPTS = $(libexec_SCRIPTS) $(sbin_SCRIPTS) \
$(solarisinitscript_SCRIPTS) $(solarissmfmethod_SCRIPTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@ -129,7 +190,18 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DATA = $(solarissmfmanifest_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in \
$(srcdir)/nut-driver-enumerator.xml.in \
$(srcdir)/nut-driver.xml.in $(srcdir)/nut-monitor.xml.in \
$(srcdir)/nut-server.xml.in $(srcdir)/nut.in \
$(srcdir)/nut.xml.in $(srcdir)/pkginfo.in \
$(srcdir)/postinstall.in $(srcdir)/postremove.in \
$(srcdir)/precheck.py.in $(srcdir)/preinstall.in \
$(srcdir)/preproto.pl.in $(srcdir)/preremove.in \
$(srcdir)/svc-nut-monitor.in $(srcdir)/svc-nut-server.in \
README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
@ -138,6 +210,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -148,6 +221,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
@ -161,6 +235,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
@ -173,6 +248,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -190,6 +266,8 @@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
@ -200,21 +278,29 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
@ -234,6 +320,9 @@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
@ -247,6 +336,7 @@ STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
@ -264,6 +354,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@ -277,6 +368,9 @@ datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@ -302,12 +396,14 @@ pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemshutdowndir = @systemdsystemshutdowndir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
@ -317,7 +413,42 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udevdir = @udevdir@
EXTRA_DIST = makelocal.sh
EXTRA_DIST = makelocal.sh precheck.py.in preproto.pl.in README
PROTOTYPE_DIR = $(DESTDIR)@prefix@
SOLARIS_CHECK_TARGETS = $(am__append_1)
SOLARIS_SMF_MANIFESTS = \
nut.xml \
nut-server.xml \
nut-monitor.xml \
nut-driver.xml \
nut-driver-enumerator.xml
SOLARIS_SMF_METHODSCRIPTS = \
svc-nut-server \
svc-nut-monitor
# OS equivalent of /lib/svc/method and /var/svc/manifest/application
# but we can just use then from this location
@WITH_SOLARIS_SMF_TRUE@solarissmfmethoddir = @datadir@/solaris-smf/method
@WITH_SOLARIS_SMF_TRUE@solarissmfmanifestdir = @datadir@/solaris-smf/manifest
@WITH_SOLARIS_SMF_TRUE@solarissmfmethod_SCRIPTS = $(SOLARIS_SMF_METHODSCRIPTS)
@WITH_SOLARIS_SMF_TRUE@solarissmfmanifest_DATA = $(SOLARIS_SMF_MANIFESTS)
@WITH_SOLARIS_SMF_TRUE@libexec_SCRIPTS = ../upsdrvsvcctl/nut-driver-enumerator.sh
@WITH_SOLARIS_SMF_TRUE@sbin_SCRIPTS = ../upsdrvsvcctl/upsdrvsvcctl
solarisinitscriptdir = @datadir@/solaris-init
solarisinitscript_SCRIPTS = nut
SOLARIS_PACKAGE_TARGETS = $(am__append_2) $(am__append_3)
# TODO: Reduce build dependencies (implicit!) on python and perl
# by shelling the scripts used below
# NOTE: This assumes the rest of the product has already been built
# and installed under PROTOTYPE_DIR, but declares no explicit
# dependency on that
SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS = makelocal.sh precheck.py preproto.pl
SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS = preinstall postinstall preremove postremove
SOLARIS_PACKAGE_SVR4_INSTALLDATA = pkginfo
MAINTAINERCLEANFILES = Makefile.in .dirstamp
all: all-am
.SUFFIXES:
@ -333,14 +464,13 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Solaris/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/Solaris/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -351,20 +481,203 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
nut-driver-enumerator.xml: $(top_builddir)/config.status $(srcdir)/nut-driver-enumerator.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut-driver.xml: $(top_builddir)/config.status $(srcdir)/nut-driver.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut-monitor.xml: $(top_builddir)/config.status $(srcdir)/nut-monitor.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut-server.xml: $(top_builddir)/config.status $(srcdir)/nut-server.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut.xml: $(top_builddir)/config.status $(srcdir)/nut.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
pkginfo: $(top_builddir)/config.status $(srcdir)/pkginfo.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
svc-nut-server: $(top_builddir)/config.status $(srcdir)/svc-nut-server.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
svc-nut-monitor: $(top_builddir)/config.status $(srcdir)/svc-nut-monitor.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
precheck.py: $(top_builddir)/config.status $(srcdir)/precheck.py.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
preinstall: $(top_builddir)/config.status $(srcdir)/preinstall.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
postinstall: $(top_builddir)/config.status $(srcdir)/postinstall.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
preremove: $(top_builddir)/config.status $(srcdir)/preremove.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
postremove: $(top_builddir)/config.status $(srcdir)/postremove.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
preproto.pl: $(top_builddir)/config.status $(srcdir)/preproto.pl.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut: $(top_builddir)/config.status $(srcdir)/nut.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-libexecSCRIPTS: $(libexec_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(libexec_SCRIPTS)'; test -n "$(libexecdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n' \
-e 'h;s|.*|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
if (++n[d] == $(am__install_max)) { \
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
else { print "f", d "/" $$4, $$1 } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
} \
; done
uninstall-libexecSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(libexec_SCRIPTS)'; test -n "$(libexecdir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(libexecdir)'; $(am__uninstall_files_from_dir)
install-sbinSCRIPTS: $(sbin_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n' \
-e 'h;s|.*|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
if (++n[d] == $(am__install_max)) { \
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
else { print "f", d "/" $$4, $$1 } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
} \
; done
uninstall-sbinSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir)
install-solarisinitscriptSCRIPTS: $(solarisinitscript_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(solarisinitscript_SCRIPTS)'; test -n "$(solarisinitscriptdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(solarisinitscriptdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(solarisinitscriptdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n' \
-e 'h;s|.*|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
if (++n[d] == $(am__install_max)) { \
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
else { print "f", d "/" $$4, $$1 } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(solarisinitscriptdir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(solarisinitscriptdir)$$dir" || exit $$?; \
} \
; done
uninstall-solarisinitscriptSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(solarisinitscript_SCRIPTS)'; test -n "$(solarisinitscriptdir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(solarisinitscriptdir)'; $(am__uninstall_files_from_dir)
install-solarissmfmethodSCRIPTS: $(solarissmfmethod_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(solarissmfmethod_SCRIPTS)'; test -n "$(solarissmfmethoddir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(solarissmfmethoddir)'"; \
$(MKDIR_P) "$(DESTDIR)$(solarissmfmethoddir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n' \
-e 'h;s|.*|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
if (++n[d] == $(am__install_max)) { \
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
else { print "f", d "/" $$4, $$1 } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(solarissmfmethoddir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(solarissmfmethoddir)$$dir" || exit $$?; \
} \
; done
uninstall-solarissmfmethodSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(solarissmfmethod_SCRIPTS)'; test -n "$(solarissmfmethoddir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(solarissmfmethoddir)'; $(am__uninstall_files_from_dir)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-solarissmfmanifestDATA: $(solarissmfmanifest_DATA)
@$(NORMAL_INSTALL)
@list='$(solarissmfmanifest_DATA)'; test -n "$(solarissmfmanifestdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(solarissmfmanifestdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(solarissmfmanifestdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(solarissmfmanifestdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(solarissmfmanifestdir)" || exit $$?; \
done
uninstall-solarissmfmanifestDATA:
@$(NORMAL_UNINSTALL)
@list='$(solarissmfmanifest_DATA)'; test -n "$(solarissmfmanifestdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(solarissmfmanifestdir)'; $(am__uninstall_files_from_dir)
tags TAGS:
ctags CTAGS:
@ -372,7 +685,10 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -403,9 +719,13 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-local
check: check-am
all-am: Makefile
all-am: Makefile $(SCRIPTS) $(DATA)
installdirs:
for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(solarisinitscriptdir)" "$(DESTDIR)$(solarissmfmethoddir)" "$(DESTDIR)$(solarissmfmanifestdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -436,6 +756,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
@ -456,13 +777,14 @@ info: info-am
info-am:
install-data-am:
install-data-am: install-solarisinitscriptSCRIPTS \
install-solarissmfmanifestDATA install-solarissmfmethodSCRIPTS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-exec-am: install-libexecSCRIPTS install-sbinSCRIPTS
install-html: install-html-am
@ -500,38 +822,65 @@ ps: ps-am
ps-am:
uninstall-am:
uninstall-am: uninstall-libexecSCRIPTS uninstall-sbinSCRIPTS \
uninstall-solarisinitscriptSCRIPTS \
uninstall-solarissmfmanifestDATA \
uninstall-solarissmfmethodSCRIPTS
.MAKE: install-am install-strip
.MAKE: check-am install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
.PHONY: all all-am check check-am check-local clean clean-generic \
clean-libtool cscopelist-am ctags-am distclean \
distclean-generic distclean-libtool distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-libexecSCRIPTS install-man install-pdf \
install-pdf-am install-ps install-ps-am install-sbinSCRIPTS \
install-solarisinitscriptSCRIPTS \
install-solarissmfmanifestDATA install-solarissmfmethodSCRIPTS \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
tags-am uninstall uninstall-am uninstall-libexecSCRIPTS \
uninstall-sbinSCRIPTS uninstall-solarisinitscriptSCRIPTS \
uninstall-solarissmfmanifestDATA \
uninstall-solarissmfmethodSCRIPTS
.PRECIOUS: Makefile
package: makelocal.sh pkginfo
$ cd @prefix@; $ find . -print | pkgproto > prototype1
$ cp makelocal.sh precheck.py pkginfo nut preinstall postinstall preremove postremove preproto.pl @prefix@
$ cd @prefix@; perl preproto.pl
$ cd @prefix@; python precheck.py
$ cd @prefix@; rm -f prototype1
$ cd @prefix@; ./makelocal.sh
$ cp @prefix@/*.gz $(srcdir)
if test `uname -p` = "i386"; then \
mv NUT_solaris_package.local.gz NUT_solaris_i386_package@PACKAGE_VERSION@.local.gz; \
else \
if test `uname -p` = "sparc"; then \
mv NUT_solaris_package.local.gz NUT_solaris_sparc_package@PACKAGE_VERSION@.local.gz; \
fi; \
fi;
package: $(SOLARIS_PACKAGE_TARGETS)
package-solaris-svr4: $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA)
if test -n "@auglensdir@" && test -d "$(DESTDIR)@auglensdir@" ; then \
mkdir -p "$(DESTDIR)@datadir@/augeas-lenses" && \
cd "$(DESTDIR)@auglensdir@" && \
( cp -prf ./ "$(DESTDIR)@datadir@/augeas-lenses/" || cp -rf ./ "$(DESTDIR)@datadir@/augeas-lenses/" ) ; fi
cd $(PROTOTYPE_DIR) && find . -print | pkgproto > prototype1
cp $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA) $(PROTOTYPE_DIR)
cd $(PROTOTYPE_DIR) && chmod +x $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS)
cd $(PROTOTYPE_DIR) && perl preproto.pl
@HAVE_PYTHON_TRUE@ cd $(PROTOTYPE_DIR) && $(PYTHON) precheck.py
cd $(PROTOTYPE_DIR) && rm -f prototype1
cd $(PROTOTYPE_DIR) && ./makelocal.sh
cp $(PROTOTYPE_DIR)/*.gz $(builddir)
UNAME_P="`uname -p`" && case "$${UNAME_P}" in \
i386|sparc) \
mv -f NUT_solaris_package.local.gz "$(abs_top_builddir)/NUT_solaris_$${UNAME_P}_package@PACKAGE_VERSION@.local.gz" ;; \
esac
# TODO: Define support for IPS packaging (provide p5m files and make rules)
package-solaris-ips:
@echo "SKIPPED : Target $@ is not implemented yet"
check-local: $(SOLARIS_CHECK_TARGETS)
check-local-solaris-smf: $(SOLARIS_SMF_MANIFESTS)
@[ -x /usr/sbin/svccfg ] || { echo "WARNING : Target $@ skipped due to absent /usr/sbin/svccfg" >&2; return 0; } ; \
RES=0 ; for F in $^ ; do \
echo " SVCCFG-VALIDATE $$F"; \
/usr/sbin/svccfg validate "$$F" || RES=$$? ; \
done; exit $$RES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

38
scripts/Solaris/README Normal file
View file

@ -0,0 +1,38 @@
This directory contains init-scripts and SMF manifests and methods
for integration of NUT services with Solaris and descendant OSes.
This also includes the nut-driver-enumerator.sh (service and implementation
method) and upsdrvsvcctl (tool) to manage NUT drivers as service instances,
which are stored in ../upsdrvsvcctl/ subdirectory (portable codebase shared
with Linux systemd).
The default implementation (runs once) can be enabled with:
svcadm enable nut-driver-enumerator:default
Note that at the moment there is no out-of-the-box integration for triggering
a restart/refresh of the nut-driver-enumerator SMF service at the very instant
when the `ups.conf` file is modified, like there is with systemd path unit type.
Due to this, the systems administrator is expected to either invoke
`svcadm refresh nut-driver-enumerator` after changing the NUT configuration
or wait until the daemonized mode, if enabled, picks up the change (should do
so within a minute by default). However, a DTrace script or a tool like
https://github.com/emcrisostomo/fswatch wrapped into a service might be used
for equivalent effect.
Alternatively, but somewhat more expensively, the same `nut-driver-enumerator.sh`
script can be executed in a loop as the payload of the SMF service to keep
inspecting the configuration and apply changes to the running system. It is
not a common use-case to keep changing device setups, so this solution is not
enforced by default ;) although a service variant is provided...
Note that only one of these can be enabled at the same time:
svcadm disable nut-driver-enumerator:default
svcadm enable nut-driver-enumerator:daemon
Init-script solution contributed by numerous authors
SMF solution contributed by Jim Klimov <jimklimov@gmail.com>
For special notes about USB-connected device monitoring with NUT under Solaris
and related operating systems, see docs/solaris-usb.txt

View file

@ -1,5 +1,11 @@
#!/bin/sh
pkgmk -o -d `pwd`
pkgtrans `pwd` `pwd`/NUT_solaris_package.local
gzip `pwd`/NUT_solaris_package.local
# Creates the package file from current-directory contents
# Called by Makefile starting from installed prototype directory
echo "Making Solaris SVR4 package metadata..." && \
pkgmk -o -d "`pwd`" && \
echo "Making Solaris SVR4 package archive file..." && \
( yes "" | pkgtrans "`pwd`" "`pwd`/NUT_solaris_package.local" ) && \
echo "Compressing Solaris SVR4 package archive file..." && \
gzip "`pwd`/NUT_solaris_package.local"

View file

@ -0,0 +1,178 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
#
# Copyright 2016-2018 Jim Klimov
# Template manifest for instantiated NUT drivers
#
-->
<service_bundle type='manifest' name='nut-driver-enumerator'>
<service name='system/power/nut-driver-enumerator' type='service' version='1.1'>
<!--
Wait for all local and usr filesystem to be mounted - project is
usually located in /usr/sbin.
-->
<dependency
name='fs-local'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>
<dependency
name='filesystem-usr'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default'/>
</dependency>
<dependency
name='config-files'
type='path'
grouping='require_all'
restart_on='refresh'>
<service_fmri value='file://localhost@CONFPATH@/ups.conf' />
</dependency>
<!--
Prerequisite for NUT upsd to be started, if it's enabled
Note that drivers are optional: if one fails to start, do not block
the upsd from publishing others. While this script will start and
stop (and define/undefine) services for the drivers, based on the
changes in ups.conf, such changes also need to reflect in nut-server
so it would know that it republishes a changed list of drivers.
-->
<dependent
name='nut-daemon-service'
grouping='optional_all'
restart_on='error'>
<service_fmri value='svc:/system/power/nut-server' />
</dependent>
<instance name='default' enabled='false'>
<!--
There can be only one...
-->
<dependency name='enumerator_daemon' grouping='exclude_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/power/nut-driver-enumerator:daemon'/>
</dependency>
<!--
The nut-driver-enumerator start/stop methods for single-fire variant.
-->
<exec_method
type='method'
name='start'
exec='@NUT_LIBEXECDIR@/nut-driver-enumerator.sh'
timeout_seconds='0'/>
<exec_method
type='method'
name='refresh'
exec='@NUT_LIBEXECDIR@/nut-driver-enumerator.sh'
timeout_seconds='0'/>
<!-- a :KILL does not really apply to a transient service... -->
<exec_method
type='method'
name='stop'
exec='/bin/true'
timeout_seconds='60' />
<property_group name='startd' type='framework'>
<!--
Sub-process core dumps and external kill signals are not
considered errors, so the service should be restarted.
-->
<propval name='ignore_error' type='astring'
value='core,signal' />
<propval name='duration' type='astring' value='transient' />
</property_group>
<property_group name='general' type='framework'>
<propval name='package' type='astring' value='NUT'/>
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
NUT power device driver instance enumerator (generates nut-driver:* instances)
</loctext>
</common_name>
<documentation>
<manpage title='upsdrvsvcctl' section='8'
manpath='/usr/share/man' />
<manpage title='ups.conf' section='5'
manpath='/usr/share/man' />
</documentation>
</template>
</instance>
<instance name='daemon' enabled='false'>
<!--
There can be only one...
-->
<dependency name='enumerator_default' grouping='exclude_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/power/nut-driver-enumerator:default'/>
</dependency>
<!--
The nut-driver-enumerator start/stop methods for infinite loop variant.
-->
<exec_method
type='method'
name='start'
exec='@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --daemon'
timeout_seconds='0'/>
<exec_method
type='method'
name='refresh'
exec=':kill -SIGHUP'
timeout_seconds='0'/>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60' />
<property_group name='startd' type='framework'>
<!--
Sub-process core dumps and external kill signals are not
considered errors, so the service should be restarted.
-->
<propval name='ignore_error' type='astring'
value='core,signal' />
<propval name='duration' type='astring' value='contract' />
</property_group>
<property_group name='general' type='framework'>
<propval name='package' type='astring' value='NUT'/>
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
NUT power device driver instance enumerator (generates nut-driver:* instances and keeps watch of ups.conf in a loop)
</loctext>
</common_name>
<documentation>
<manpage title='upsdrvsvcctl' section='8'
manpath='/usr/share/man' />
<manpage title='ups.conf' section='5'
manpath='/usr/share/man' />
</documentation>
</template>
</instance>
<!-- Really unstable - this service should be evolved! -->
<stability value='Unstable' />
</service>
</service_bundle>

View file

@ -0,0 +1,124 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
#
# Copyright 2016 - 2019 Jim Klimov
# Template manifest for instantiated NUT drivers
#
-->
<service_bundle type='manifest' name='nut-driver'>
<service name='system/power/nut-driver' type='service' version='1.1'>
<!--
Wait for all local and usr filesystem to be mounted - project is
usually located in /usr/sbin.
-->
<dependency
name='fs-local'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>
<dependency
name='filesystem-usr'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default'/>
</dependency>
<dependency
name='config-files'
type='path'
grouping='require_all'
restart_on='refresh'>
<service_fmri value='file://localhost@CONFPATH@/ups.conf' />
</dependency>
<!--
Wait for syslog to be started in order to write system
messages from the kernel and drivers, where enabled.
-->
<dependency
name='syslog'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/system-log:default'/>
</dependency>
<!--
Wait for enumerator to have ensured that all configured sections
have a corresponding SMF instance. Do not restart all driver
instances if there was just a reconfiguration of enumerator.
-->
<dependency
name='nut-driver-enumerator'
grouping='optional_all'
restart_on='error'
type='service'>
<service_fmri value='svc:/system/power/nut-driver-enumerator' />
</dependency>
<!--
Prerequisite for NUT upsd to be started, if it's enabled
Note that drivers are optional: if one fails to start, do not block
the upsd from publishing others.
-->
<dependent
name='nut-service_needs_drivers'
grouping='optional_all'
restart_on='none'>
<service_fmri value='svc:/system/power/nut-server' />
</dependent>
<!--
The nut start/stop methods.
-->
<exec_method
type='method'
name='start'
exec='/sbin/sh -c &apos;NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" &amp;&amp; [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&amp;2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl %m "$NUTDEV"&apos;'
timeout_seconds='0'/>
<exec_method
type='method'
name='stop'
exec='/sbin/sh -c &apos;NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" &amp;&amp; [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&amp;2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl %m "$NUTDEV"&apos;'
timeout_seconds='60' />
<property_group name='startd' type='framework'>
<!--
Sub-process core dumps and external kill signals are not
considered errors, so the service should be restarted.
-->
<propval name='ignore_error' type='astring'
value='core,signal' />
</property_group>
<!-- Really unstable - this service should be evolved! -->
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>
NUT power device driver instance wrapper
</loctext>
</common_name>
<documentation>
<manpage title='upsdrvctl' section='8'
manpath='/usr/share/man' />
<manpage title='ups.conf' section='5'
manpath='/usr/share/man' />
</documentation>
</template>
</service>
</service_bundle>

View file

@ -0,0 +1,127 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
#
# Copyright 2016-2017 Jim Klimov
# Service for NUT upsmon
#
-->
<service_bundle type='manifest' name='nut-monitor'>
<service name='system/power/nut-monitor' type='service' version='1'>
<!--
Configure a default instance for the service since it doesn't
require additional configuration intervention before it starts.
-->
<create_default_instance enabled='false' />
<!--
Wait for all local and usr filesystem to be mounted - project is
usually located in /usr/sbin.
-->
<dependency
name='fs-local'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>
<dependency
name='filesystem-usr'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default'/>
</dependency>
<dependency
name='config-files'
type='path'
grouping='require_all'
restart_on='refresh'>
<service_fmri value='file://localhost@CONFPATH@/upsmon.conf' />
</dependency>
<!--
Wait for syslog to be started in order to write system
messages from the kernel.
-->
<dependency
name='syslog'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/system-log:default'/>
</dependency>
<!--
Wait for network to be started in order to reach remote hosts.
-->
<dependency
name='network-service'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/service' />
</dependency>
<!--
Wait for NUT upsd to be started, if it's enabled
-->
<dependency
name='nut-service'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/power/nut-server' />
</dependency>
<!--
The nut start/stop methods.
-->
<exec_method
type='method'
name='start'
exec='@NUT_DATADIR@/solaris-smf/method/svc-nut-monitor %m'
timeout_seconds='60'/>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60' />
<property_group name='startd' type='framework'>
<!--
Sub-process core dumps and external kill signals are not
considered errors, so the service should be restarted.
-->
<propval name='ignore_error' type='astring'
value='core,signal' />
</property_group>
<!-- Really unstable - this service should be evolved! -->
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>
NUT ups monitoring service
</loctext>
</common_name>
<documentation>
<manpage title='upsmon' section='8'
manpath='/usr/share/man' />
<manpage title='upsmon.conf' section='5'
manpath='/usr/share/man' />
</documentation>
</template>
</service>
</service_bundle>

View file

@ -0,0 +1,154 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
#
# Copyright 2016-2017 Jim Klimov
# Service for the upsd daemon (and drivers, if available)
#
-->
<service_bundle type='manifest' name='nut-server'>
<service name='system/power/nut-server' type='service' version='1'>
<!--
Configure a default instance for the service since it doesn't
require additional configuration intervention before it starts.
-->
<create_default_instance enabled='false' />
<!--
Wait for all local and usr filesystem to be mounted - project is
usually located in /usr/sbin.
-->
<dependency
name='fs-local'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>
<dependency
name='filesystem-usr'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default'/>
</dependency>
<dependency
name='config-files'
type='path'
grouping='require_all'
restart_on='refresh'>
<service_fmri value='file://localhost@CONFPATH@/ups.conf' />
<service_fmri value='file://localhost@CONFPATH@/upsd.conf' />
<service_fmri value='file://localhost@CONFPATH@/upsd.users' />
</dependency>
<!--
Wait for syslog to be started in order to write system
messages from the kernel.
-->
<dependency
name='syslog'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/system-log:default'/>
</dependency>
<!--
Wait for network to be started in order to reach remote hosts.
-->
<dependency
name='network-service'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/service' />
</dependency>
<!--
Wait for drivers to be wrapped in service instances
Note that drivers are optional: if one fails to start or get configured,
do not block the upsd from publishing others.
-->
<dependency
name='nut-driver-enumerator'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/power/nut-driver-enumerator' />
</dependency>
<!--
Prerequisite for NUT upsmon to be started, if it's enabled
Although that may (also) be a client to some other server...
-->
<dependent
name='nut-monitor-service'
grouping='optional_all'
restart_on='none'>
<service_fmri value='svc:/system/power/nut-monitor' />
</dependent>
<!--
The nut start/stop methods.
-->
<exec_method
type='method'
name='start'
exec='@NUT_DATADIR@/solaris-smf/method/svc-nut-server %m'
timeout_seconds='60'/>
<exec_method
type='method'
name='refresh'
exec='@NUT_DATADIR@/solaris-smf/method/svc-nut-server %m'
timeout_seconds='60'/>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60' />
<property_group name='startd' type='framework'>
<!--
Sub-process core dumps and external kill signals are not
considered errors, so the service should be restarted.
-->
<propval name='ignore_error' type='astring'
value='core,signal' />
</property_group>
<!-- Really unstable - this service should be evolved! -->
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>
NUT data server
</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' />
</documentation>
</template>
</service>
</service_bundle>

29
scripts/Solaris/nut.in Normal file → Executable file
View file

@ -3,29 +3,31 @@
#init.d script to start nut services
NUT_DIR="@prefix@"
CONFIG=$NUT_DIR/etc/nut.conf
NUT_SBIN_DIR="${NUT_DIR}/sbin"
NUT_LIB_DIR="${NUT_DIR}/lib"
CONFIG="@CONFPATH@/nut.conf"
if [ -f $CONFIG ] ; then
. $CONFIG
if [ -f "$CONFIG" ] ; then
. "$CONFIG"
fi
ups_stop () {
pkill -n upsmon
pkill -n upsd
${NUT_DIR}/sbin/upsdrvctl stop > /dev/null 2>&1
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsdrvctl" stop > /dev/null 2>&1
}
ups_start () {
if [ "$MODE" = "none" ];then
echo No mode set
echo "No NUT mode set, not starting anything" >&2
exit 1
fi
if [ ! "$MODE" = "netclient" ];then
$NUT_DIR/sbin/upsdrvctl start #> /dev/null 2>&1
$NUT_DIR/sbin/upsd #> /dev/null 2>&1
if [ "$MODE" != "netclient" ] ; then
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsdrvctl" start #> /dev/null 2>&1
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsd" #> /dev/null 2>&1
fi
$NUT_DIR/sbin/upsmon #> /dev/null 2>&1
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsmon" #> /dev/null 2>&1
}
case $1 in
@ -46,10 +48,11 @@ case $1 in
ups_start
;;
'poweroff')
$NUT_DIR/sbin/upsmon -K >/dev/null 2>&1
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsmon" -K >/dev/null 2>&1
if [ $? = 0 ]; then
echo "Shutting down the UPS ..."
#$NUT_DIR/sbin/upsdrvctl shutdown
echo "Shutting down the UPS(es) ..."
echo "WARNING: UPS shutdown is currently disabled, please uncomment it in the init-script if desired" >&2
#${NUT_SBIN_DIR}/upsdrvctl shutdown
fi
;;
*)
@ -57,7 +60,7 @@ case $1 in
echo "Usage: '$0' {start | stop | restart }"
echo ""
exit 64
;;
;;
esac
exit $?

102
scripts/Solaris/nut.xml.in Normal file
View file

@ -0,0 +1,102 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
#
# Copyright 2016-2017 Jim Klimov
# Service for common startup or shutdown of NUT-related services
#
-->
<service_bundle type='manifest' name='nut'>
<service name='system/power/nut' type='service' version='1'>
<!--
Configure a default instance for the service since it doesn't
require additional configuration intervention before it starts.
-->
<create_default_instance enabled='true' />
<!--
Not all deployments have both the drivers+data server and client
on the same box, so this service only triggers whatever is enabled
and waits for other system resources according to dependencies of
those actual services.
-->
<dependency
name='syslog'
grouping='optional_all'
restart_on='error'
type='service'>
<service_fmri value='svc:/system/power/nut-server:default'/>
<service_fmri value='svc:/system/power/nut-monitor:default'/>
</dependency>
<!--
The nut start/stop methods.
-->
<!-- The startup is expected to trigger enabled dependency services
and not-trigger those which were not administratively enabled.
There is nothing to do by itself, so it is not-persistent. -->
<exec_method
type='method'
name='start'
exec='/bin/true'
timeout_seconds='60'/>
<!-- The shutdown temporarily-disables all components (if they were
enabled and running in the first place, no-op otherwise) -->
<exec_method
type='method'
name='stop'
exec='/usr/sbin/svcadm disable -ts svc:/system/power/nut-monitor:default || /bin/true ; /usr/sbin/svcadm disable -ts svc:/system/power/nut-server:default || /bin/true ; @SBINDIR@/upsdrvsvcctl stop || /bin/true ; /bin/true'
timeout_seconds='120' />
<!-- When users "refresh nut" they are likely interested
in a new config being applied... -->
<exec_method
type='method'
name='refresh'
exec='@NUT_LIBEXECDIR@/nut-driver-enumerator.sh'
timeout_seconds='0'/>
<property_group name='startd' type='framework'>
<!--
Sub-process core dumps and external kill signals are not
considered errors, so the service should be restarted.
-->
<propval name='ignore_error' type='astring'
value='core,signal' />
<!--
A transient service executes the start method once and does
not execute it again if the method exits with $SMF_EXIT_OK.
-->
<propval name='duration' type='astring' value='transient' />
</property_group>
<!-- Really unstable - this service should be evolved! -->
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>
Service for common startup or shutdown of NUT-related services
</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' />
</documentation>
</template>
</service>
</service_bundle>

View file

@ -1,6 +1,6 @@
PKG="NUT"
NAME="Network UPS Tools"
ARCH="@OS_NAME@"
ARCH="@target_cpu@"
VERSION="@PACKAGE_VERSION@"
CATEGORY="application"
VENDOR="http://www.networkupstools.org"

129
scripts/Solaris/postinstall.in Normal file → Executable file
View file

@ -1,65 +1,126 @@
#!/bin/sh
#Postinstall script
# Postinstall script for Network UPS Tools package
NUT_DIR="@prefix@"
prefix="@prefix@" # expanded as part of some autoconf macros below
# TODO/FIXME : Should "/var/run" be a configure variable?
# Note that "/var/run" is transient tmpfs, so upgrade has to be done during same uptime.
ACTIVE_ENUMERATOR_FMRI_FILE="/var/run/nut-driver-enumerator-fmri.prev"
# make sure the nut user exists and has correct memberships
res=`getent group nut`
res="`getent group @RUN_AS_GROUP@`" || res=""
if [ -z "$res" ]; then
groupadd nut
/usr/sbin/groupadd "@RUN_AS_GROUP@"
fi
res=`getent passwd nut`
res="`getent passwd @RUN_AS_USER@`" || res=""
if [ -z "$res" ]; then
useradd -g nut -G root -d ${NUT_DIR}/bin nut
/usr/sbin/useradd -c "Network UPS Tools" -g "@RUN_AS_GROUP@" -G root -d "@STATEPATH@" -s /bin/false @RUN_AS_USER@
fi
res=`groups nut | grep -w nut`
res="`groups "@RUN_AS_GROUP@" | grep -w "@RUN_AS_USER@"`" || res=""
if [ -z "$res" ]; then
usermod -g nut -G root nut
/usr/sbin/usermod -g "@RUN_AS_GROUP@" -G root "@RUN_AS_USER@"
fi
# make sure that conffiles are secured and have the correct ownerships
if [ -d @CONFPATH@ ] ; then
chown root:nut @CONFPATH@
if [ -d "@CONFPATH@" ] ; then
chown "root:@RUN_AS_GROUP@" "@CONFPATH@"
fi
for file in nut.conf ups.conf upsd.conf upsmon.conf upsd.users upssched.conf; do
if [ -f @CONFPATH@/$file ] ; then
chown root:nut @CONFPATH@/$file
chmod 640 @CONFPATH@/$file
for file in nut.conf ups.conf upsd.conf upsmon.conf upsd.users upssched.conf nut-driver-enumerator.conf; do
if [ -f "@CONFPATH@/$file" ] ; then
chown "root:@RUN_AS_GROUP@" "@CONFPATH@/$file"
chmod 640 "@CONFPATH@/$file"
fi
done
# make sure that /var/run/nut exists and has the correct ownerships
if [ ! -d @PIDPATH@/nut ] ; then
mkdir -p @PIDPATH@/nut
if [ ! -d "@PIDPATH@/nut" ] ; then
mkdir -p "@PIDPATH@/nut"
fi
if [ -d @PIDPATH@/nut ] ; then
chown root:nut @PIDPATH@/nut
chmod 770 @PIDPATH@/nut
if [ -d "@PIDPATH@/nut" ] ; then
chown "root:@RUN_AS_GROUP@" "@PIDPATH@/nut"
chmod 770 "@PIDPATH@/nut"
fi
# make sure that /var/state/ups exists and has the correct ownerships
if [ ! -d @STATEPATH@ ] ; then
mkdir -p @STATEPATH@
if [ ! -d "@STATEPATH@" ] ; then
mkdir -p "@STATEPATH@"
fi
if [ -d @STATEPATH@ ] ; then
chown root:nut @STATEPATH@
chmod 770 @STATEPATH@
if [ -d "@STATEPATH@" ] ; then
chown "root:@RUN_AS_GROUP@" "@STATEPATH@"
chmod 770 "@STATEPATH@"
fi
# Put init script in /etc/init.d
if [ -n "@auglensdir@" ] && [ -d "@auglensdir@" ] && [ -d "@datarootdir@/augeas-lenses" ] ; then
( cd "@datarootdir@/augeas-lenses" && cp -prf ./ "@auglensdir@"/ )
fi
cp $NUT_DIR/nut /etc/init.d
chmod 744 /etc/init.d/nut
if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs ; then
echo "Register SMF services..."
for S in nut-driver-enumerator nut-driver nut-server nut-monitor nut ; do
echo "Importing NUT service manifest: $S..."
/usr/sbin/svccfg import "@datarootdir@/solaris-smf/manifest/$S.xml"
done
# Enable services if the system already has a configuration (e.g. upgrade)
if test -s "@CONFPATH@/ups.conf" ; then
echo "Stopping NUT drivers, if any (in case of upgrade)..."
@SBINDIR@/upsdrvsvcctl stop
@SBINDIR@/upsdrvctl -DDDDD stop
sleep 5
echo "(Re-)register NUT drivers (if any)..."
REPORT_RESTART_42=no AUTO_START=no "@NUT_LIBEXECDIR@/nut-driver-enumerator.sh" --reconfigure
sleep 2
echo "Enable NUT drivers (if any)..."
# Note: we now provide two services, a daemon that keeps checking
# the config for changes and a default one that should be refreshed
# manually to reconfigure nut-driver instances - and is "cheaper".
# This may still fail if the daemon instance is somehow enabled (admin)
PREV_ACTIVE_ENUMERATOR=""
if test -s "${ACTIVE_ENUMERATOR_FMRI_FILE}" ; then
PREV_ACTIVE_ENUMERATOR="`head -1 "${ACTIVE_ENUMERATOR_FMRI_FILE}"`"
fi
[ x"nut-driver-enumerator:default" = x"${PREV_ACTIVE_ENUMERATOR}" ] && PREV_ACTIVE_ENUMERATOR=""
for ACTIVE_ENUMERATOR in ${PREV_ACTIVE_ENUMERATOR} nut-driver-enumerator:default ; do
/usr/sbin/svcadm enable -s ${ACTIVE_ENUMERATOR} || \
{ /usr/sbin/svcadm clear ${ACTIVE_ENUMERATOR} 2>/dev/null ; \
/usr/sbin/svcadm enable -s ${ACTIVE_ENUMERATOR} ; } && break || true
done
@SBINDIR@/upsdrvsvcctl start
else
echo "NOT ENABLING nut-driver-enumerator at this time : missing or empty @CONFPATH@/ups.conf" >&2
fi
if test -s "@CONFPATH@/ups.conf" && test -e "@CONFPATH@/upsd.conf" && test -e "@CONFPATH@/upsd.users" ; then
# Note on the mix of "-s" and "-e" in tests above:
# it is a valid use-case for an admin to have just touched an
# empty upsd.conf and so use default settings for the daemon
echo "Enable NUT upsd data server..."
/usr/sbin/svcadm enable -s nut-server
else
echo "NOT ENABLING nut-server at this time : missing at least one of : @CONFPATH@/ups.conf @CONFPATH@/upsd.conf @CONFPATH@/upsd.users" >&2
fi
if test -s "@CONFPATH@/upsmon.conf" ; then
echo "Enable NUT upsmon client..."
/usr/sbin/svcadm enable -s nut-monitor
else
echo "NOT ENABLING nut-monitor at this time : missing or empty @CONFPATH@/upsmon.conf" >&2
fi
echo "Enable NUT umbrella service..."
/usr/sbin/svcadm enable -s nut
else
echo "Put init script in /etc/init.d..."
cp -pf "@NUT_DATADIR@/solaris-init/nut" /etc/init.d
chown root:bin /etc/init.d/nut
chmod 744 /etc/init.d/nut
ln -s /etc/init.d/nut /etc/rc3.d/S100nut > /dev/null 2>&1
ln -s /etc/init.d/nut /etc/rc3.d/K100nut > /dev/null 2>&1
ln -s ../init.d/nut /etc/rc3.d/S90nut > /dev/null 2>&1
ln -s ../init.d/nut /etc/rc3.d/K10nut > /dev/null 2>&1
# Start nut services
#echo "Starting nut services"
#$NUT_DIR/sbin/upsdrvctl start #> /dev/null 2>&1
#$NUT_DIR/sbin/upsd #> /dev/null 2>&1
#$NUT_DIR/sbin/upsmon #> /dev/null 2>&1
# Start nut services
#echo "Starting nut services"
#$NUT_DIR/sbin/upsdrvctl start #> /dev/null 2>&1
#$NUT_DIR/sbin/upsd #> /dev/null 2>&1
#$NUT_DIR/sbin/upsmon #> /dev/null 2>&1
fi

19
scripts/Solaris/postremove.in Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
# Postremove script for Network UPS Tools package
# Remove init script from /etc/init.d - created by scripts not packaging
rm -f /etc/init.d/nut
rm -f /etc/rc3.d/S90nut
rm -f /etc/rc3.d/K10nut
# Remove nut group and user
/usr/sbin/userdel "@RUN_AS_USER@"
/usr/sbin/groupdel "@RUN_AS_GROUP@"
# Remove /var/run/nut
rm -rf "@PIDPATH@/nut"

48
scripts/Solaris/precheck.py.in Executable file
View file

@ -0,0 +1,48 @@
#!@PYTHON@
import sys
if sys.version_info >= ( 2, 6 ):
import subprocess
p = subprocess.Popen(["uname", "-s"], stdout=subprocess.PIPE)
platform = p.communicate()[0]
if p.returncode != 0:
raise Exception("FAILED to get platform from 'uname -s'!")
p = subprocess.Popen(["uname", "-p"], stdout=subprocess.PIPE)
architecture = p.communicate()[0]
if p.returncode != 0:
raise Exception("FAILED to get architecture from 'uname -p'!")
else:
import commands
platform = commands.getoutput('uname -s')
architecture = commands.getoutput('uname -p')
# checkinstall script creation
fp=open("checkinstall","w")
# Note: same arch is relevant for different bitnesses that
# can be discerned via `isainfo` further (if ever needed)
fp.write("#!/bin/sh\n")
fp.write("\nexpected_platform=SunOS\n")
if platform == "SunOS" and architecture == "i386":
fp.write("expected_architecture=i386\n")
elif platform == "SunOS" and architecture == "sparc":
fp.write("expected_architecture=sparc\n")
fp.write("platform=\"`uname -s`\"\n")
fp.write("architecture=\"`uname -p`\"\n\n")
fp.write("if [ \"${platform}\" -eq \"${expected_platform}\" ]; then\n")
fp.write("\tif [ \"${architecture}\" -eq \"${expected_architecture}\" ]; then\n")
fp.write("\t\techo \"Checkinstall complete\"\n")
fp.write("\telse\n")
fp.write("\t\techo \"This is not Solaris $architecture machine: platform='${platform}' expected_platform='${expected_platform}'\"\n")
fp.write("\t\texit 1\n")
fp.write("\tfi\n")
fp.write("else\n")
fp.write("\techo \"This is not Solaris machine: architecture='${architecture}' expected_architecture='${expected_architecture}'\"\n")
fp.write("\texit 1\n")
fp.write("fi\n")
fp.write("exit 0\n")
fp.close()

23
scripts/Solaris/preinstall.in Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
# Preinstall script for Network UPS Tools package
NUT_DIR="@prefix@"
# Create group nut
grep -w "@RUN_AS_GROUP@" /etc/group
if [ "$?" != 0 ]; then
/usr/sbin/groupadd "@RUN_AS_GROUP@"
fi
# Create user for installing "Network UPS Tools"
grep -w "@RUN_AS_USER@" /etc/passwd
if [ "$?" != 0 ]; then
/usr/sbin/useradd -c "Network UPS Tools" -g "@RUN_AS_GROUP@" -G root -d "@STATEPATH@" -s /bin/false "@RUN_AS_USER@"
fi
res="`groups "@RUN_AS_GROUP@" | grep -w "@RUN_AS_USER@"`" || res=""
if [ -z "$res" ]; then
/usr/sbin/usermod -g "@RUN_AS_GROUP@" -G root "@RUN_AS_USER@"
fi

39
scripts/Solaris/preproto.pl.in Executable file
View file

@ -0,0 +1,39 @@
#!/usr/bin/env perl
$temp = "prototype1";
$prototype="prototype";
$pkginfo = "pkginfo";
$checkinstall = "checkinstall";
$preinstall = "preinstall";
$postinstall = "postinstall";
$preremove = "preremove";
$postremove = "postremove";
$nutuser = "@RUN_AS_USER@";
$nutgroup = "@RUN_AS_GROUP@";
open (PREPROTO,"< $temp") || die "Unable to read prototype information ($!)\n";
open (PROTO,"> $prototype") || die "Unable to write file prototype ($!)\n";
print PROTO "i pkginfo=./$pkginfo\n";
print PROTO "i checkinstall=./$checkinstall\n";
print PROTO "i preinstall=./$preinstall\n";
print PROTO "i postinstall=./$postinstall\n";
print PROTO "i preremove=./$preremove\n";
print PROTO "i postremove=./$postremove\n";
while (<PREPROTO>) {
# Read the prototype information from /tmp/prototype$$
chomp;
$thisline = $_;
if ($thisline =~ " prototype1 ") {
# We don't need that line
} elsif ($thisline =~ "^[fd] ") {
# Change the ownership for files and directories
($dir, $none, $file, $mode, $user, $group) = split / /,$thisline;
print PROTO "$dir $none $file=$file $mode $nutuser $nutgroup\n";
} else {
# Symlinks and other stuff should be printed as well ofcourse
print PROTO "$thisline\n";
}
}
#print PROTO "f $none nut $mode root $nutgroup\n";
close PROTO;
close PREPROTO;

67
scripts/Solaris/preremove.in Normal file → Executable file
View file

@ -1,8 +1,71 @@
#!bin/sh
#!/bin/sh
# Preremove script for Network UPS Tools package
# Stop all nut services
NUT_DIR="@prefix@"
prefix="@prefix@" # expanded as part of some autoconf macros below
#$NUT_DIR/sbin/upsdrvctl stop
# TODO/FIXME : Should "/var/run" be a configure variable?
# Note that "/var/run" is transient tmpfs, so upgrade has to be done during same uptime.
ACTIVE_ENUMERATOR_FMRI_FILE="/var/run/nut-driver-enumerator-fmri.prev"
if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs ; then
# Unconfigure SMF services
# First detect the first active (online, maintenance, etc.)
# instance of nut-driver-enumerator so we can pass it to the
# next lifetime in case of re-install of NUT and keep the
# user's previously declared preference.
ACTIVE_ENUMERATOR="`/usr/bin/svcs -H -o state,fmri '*/nut-driver-enumerator:*' | while read S F ; do [ "$S" != "disabled" ] && [ "$S" != "offline" ] && echo "$F" && break ; done`"
if [ -n "$ACTIVE_ENUMERATOR" ]; then
rm -f "${ACTIVE_ENUMERATOR_FMRI_FILE}"
touch "${ACTIVE_ENUMERATOR_FMRI_FILE}"
chmod 600 "${ACTIVE_ENUMERATOR_FMRI_FILE}"
chown 0:0 "${ACTIVE_ENUMERATOR_FMRI_FILE}"
echo "${ACTIVE_ENUMERATOR}" > "${ACTIVE_ENUMERATOR_FMRI_FILE}"
fi
# First tell the automagic to stop, so it does not interfere; diligently clean it out below
/usr/sbin/svcadm disable nut-driver-enumerator:default || true
/usr/sbin/svcadm disable nut-driver-enumerator:daemon || true
for S in nut nut-monitor nut-server ; do
echo "Stopping NUT service: $S..."
/usr/sbin/svcadm clear "$S" 2>/dev/null
/usr/sbin/svcadm disable -s "$S"
echo "Removing NUT service: $S..."
/usr/sbin/svccfg delete "$S" || \
/usr/sbin/svccfg -s "$S" delete || \
/usr/sbin/svccfg -s "$S" delete default
done
echo "Stopping NUT drivers, if any..."
@SBINDIR@/upsdrvsvcctl stop
@SBINDIR@/upsdrvctl -DDDDD stop
sleep 5
for S in `/usr/bin/svcs -H -o fmri '*/nut-driver:*'` `/usr/bin/svcs -H -o fmri '*/nut-driver-enumerator:*'` ; do
echo "Stopping NUT service: $S..."
/usr/sbin/svcadm clear "$S" 2>/dev/null
/usr/sbin/svcadm disable -s "$S"
done
sleep 5
for S in `/usr/bin/svcs -H -o fmri '*/nut-driver:*' | grep -wv default` `/usr/bin/svcs -H -o fmri '*/nut-driver-enumerator:*' | grep -wv default` ; do
echo "Removing NUT service: $S..."
# Note: S here is a full FMRI URL
SB="`echo "$S" | sed 's,:[^:]*$,,'`"
SI="`echo "$S" | sed 's,^.*:\([^:]*\)$,\1,'`"
/usr/sbin/svcadm disable -s "$S"
/usr/sbin/svccfg -s "$SB" delete -f "$SI" || \
/usr/sbin/svccfg delete "$S"
done
for S in nut-driver-enumerator nut-driver ; do
echo "Removing NUT service: $S..." && \
/usr/sbin/svccfg delete "$S" || \
/usr/sbin/svccfg -s "$S" delete || \
/usr/sbin/svccfg -s "$S" delete default
done
else
[ -x /etc/init.d/nut ] && /etc/init.d/nut stop
fi
if [ -n "@auglensdir@" ] && [ -d "@auglensdir@" ] && [ -d "@datarootdir@/augeas-lenses" ] ; then
( cd "@datarootdir@/augeas-lenses" && find . -type f -exec rm -f "@auglensdir@"/'{}' \; )
fi

View file

@ -0,0 +1,56 @@
#!/sbin/sh
# Trivial (better is yet to come) SMF method script to start nut services
# Adapted for OpenIndiana userland from init.d script template in NUT sources
# Adaptation copyright (C) 2016-2017 Jim Klimov
if [ -z "$SMF_FMRI" ]; then
echo "$0 must be called in SMF context!" >&2
exit 1
fi
# smf(5)
. /lib/svc/share/smf_include.sh || exit
prefix="@prefix@"
NUT_DIR="@prefix@"
NUT_SBIN_DIR="${NUT_DIR}/sbin"
NUT_LIB_DIR="${NUT_DIR}/lib"
NUT_RUN_DIR="@PIDPATH@/nut"
CONFIG="@CONFPATH@/nut.conf"
NUTUSER="@RUN_AS_USER@"
NUTGROUP="@RUN_AS_GROUP@"
if [ -f "$CONFIG" ] ; then
. "$CONFIG"
fi
ups_start () {
if [ "$MODE" = "none" ];then
echo "No NUT mode set, not starting anything" >&2
exit $SMF_EXIT_ERR_CONFIG
fi
# Default rights inspired by NUT scripts/Solaris/postinstall.in
mkdir -p "$NUT_RUN_DIR" && \
chown "root:$NUTGROUP" "$NUT_RUN_DIR" && \
chmod 770 "$NUT_RUN_DIR" \
|| exit $SMF_EXIT_ERR_FATAL
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsmon #> /dev/null 2>&1
}
case "$1" in
'start')
ups_start
;;
*)
echo ""
echo "Usage: '$0' {start}"
echo ""
exit $SMF_EXIT_ERR_CONFIG
;;
esac
exit $?

View file

@ -0,0 +1,64 @@
#!/sbin/sh
# Trivial (better is yet to come) SMF method script to start nut services
# Adapted for OpenIndiana userland from init.d script template in NUT sources
# Adaptation copyright (C) 2016 Jim Klimov
if [ -z "$SMF_FMRI" ]; then
echo "$0 must be called in SMF context!" >&2
exit 1
fi
# smf(5)
. /lib/svc/share/smf_include.sh || exit
prefix="@prefix@"
NUT_DIR="@prefix@"
NUT_SBIN_DIR="$NUT_DIR/sbin"
NUT_LIB_DIR="${NUT_DIR}/lib"
NUT_RUN_DIR="@PIDPATH@/nut"
CONFIG="@CONFPATH@/nut.conf"
NUTUSER="@RUN_AS_USER@"
NUTGROUP="@RUN_AS_GROUP@"
if [ -f "$CONFIG" ] ; then
. "$CONFIG"
fi
ups_start () {
# Default rights inspired by NUT scripts/Solaris/postinstall.in
mkdir -p "$NUT_RUN_DIR" && \
chown "root:$NUTGROUP" "$NUT_RUN_DIR" && \
chmod 770 "$NUT_RUN_DIR" \
|| exit $SMF_EXIT_ERR_FATAL
if [ "$MODE" = "none" ];then
echo "No NUT mode set, not starting anything" >&2
exit 1
fi
if [ "$MODE" != "netclient" ] ; then
# In this distribution, UPS drivers are wrapped by service instances
#LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsdrvctl" start #> /dev/null 2>&1
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsd" #> /dev/null 2>&1
fi
}
case "$1" in
'start')
ups_start
;;
'refresh'|'reload')
LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsd" -c reload
;;
*)
echo ""
echo "Usage: '$0' {start}"
echo ""
exit $SMF_EXIT_ERR_CONFIG
;;
esac
exit $?

View file

@ -1,16 +1,49 @@
EXTRA_DIST = gen-nutupsconf-aug.py nutupsconf.aug.tpl \
EXTRA_DIST = gen-nutupsconf-aug.py.in nutupsconf.aug.tpl \
README tests/test_nut.aug
PYTHON = @PYTHON@
# only call the script to generate Augeas ups.conf lens upon "make dist",
# and if Python is present
# and if Python is present; the distributed gen-nutupsconf-aug.py.in template
# is assumed to only differ from a generated gen-nutupsconf-aug.py by the
# @PYTHON@ shebang.
dist-hook:
@if python -c "import re,glob,codecs"; then \
echo "Regenerating Augeas ups.conf lens."; \
$(distdir)/gen-nutupsconf-aug.py $(distdir)/; \
@if [ -n "$(PYTHON)" ] && $(PYTHON) -c "import re,glob,codecs"; then \
echo "Regenerating Augeas ups.conf lens with '$(PYTHON)'."; \
$(PYTHON) $(distdir)/gen-nutupsconf-aug.py.in $(distdir)/; \
else \
echo "----------------------------------------------------------------------"; \
echo "Warning: Python is not available."; \
echo "Skipping Augeas ups.conf lens regeneration."; \
echo "Skipping regeneration of Augeas lens for ups.conf parsing." ; \
echo "----------------------------------------------------------------------"; \
fi
# This needs augparse from augeas-tools
if HAVE_AUGPARSE
check-local:
@echo "augparse proceeding to lenses verification job..."; \
echo "DISABLED for now due to https://github.com/networkupstools/nut/issues/657"
endif
# FIXME
# augparse -I $(srcdir)/ $(srcdir)/tests/test_nut.aug
if WITH_AUGLENS
# Now "make install" should cover delivery of Augeas lenses...
# The "auglensdir" value should be set up by configure
# The *.aug files are generated by rule above or by autogen.sh and/or configure
auglens_DATA = \
nuthostsconf.aug nutupsconf.aug nutupsdusers.aug nutupsschedconf.aug \
nutnutconf.aug nutupsdconf.aug nutupsmonconf.aug nutupssetconf.aug
endif
MAINTAINERCLEANFILES = Makefile.in .dirstamp
CLEANFILES = *-spellchecked
# Can be re-generated by configure script and/or make:
DISTCLEANFILES = gen-nutupsconf-aug.py
# Generated by autogen.sh and needed to run the configure script:
MAINTAINERCLEANFILES += nutupsconf.aug.in
DISTCLEANFILES += *.aug

View file

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -13,8 +13,19 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -79,23 +90,24 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = scripts/augeas
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/nutnutconf.aug.in $(srcdir)/nutupsconf.aug.in \
$(srcdir)/nutupsdconf.aug.in $(srcdir)/nutupsdusers.aug.in \
$(srcdir)/nutupsmonconf.aug.in \
$(srcdir)/nutupsschedconf.aug.in $(srcdir)/nuthostsconf.aug.in \
$(srcdir)/nutupssetconf.aug.in README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
@ -104,16 +116,22 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = nutnutconf.aug nutupsconf.aug nutupsdconf.aug \
nutupsdusers.aug nutupsmonconf.aug nutupsschedconf.aug \
nuthostsconf.aug nutupssetconf.aug
CONFIG_CLEAN_FILES = nutnutconf.aug nutupsdconf.aug nutupsdusers.aug \
nutupsmonconf.aug nutupsschedconf.aug nuthostsconf.aug \
nutupssetconf.aug gen-nutupsconf-aug.py nutupsconf.aug
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@ -134,7 +152,43 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(auglensdir)"
DATA = $(auglens_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in \
$(srcdir)/gen-nutupsconf-aug.py.in \
$(srcdir)/nuthostsconf.aug.in $(srcdir)/nutnutconf.aug.in \
$(srcdir)/nutupsconf.aug.in $(srcdir)/nutupsdconf.aug.in \
$(srcdir)/nutupsdusers.aug.in $(srcdir)/nutupsmonconf.aug.in \
$(srcdir)/nutupsschedconf.aug.in \
$(srcdir)/nutupssetconf.aug.in README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
@ -143,6 +197,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -153,6 +208,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
@ -166,6 +222,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
@ -178,6 +235,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -195,6 +253,8 @@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
@ -205,21 +265,29 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
@ -239,6 +307,9 @@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
@ -252,6 +323,7 @@ STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
@ -269,6 +341,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@ -282,6 +355,9 @@ datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@ -307,12 +383,14 @@ pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemshutdowndir = @systemdsystemshutdowndir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
@ -322,9 +400,26 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udevdir = @udevdir@
EXTRA_DIST = gen-nutupsconf-aug.py nutupsconf.aug.tpl \
EXTRA_DIST = gen-nutupsconf-aug.py.in nutupsconf.aug.tpl \
README tests/test_nut.aug
# FIXME
# augparse -I $(srcdir)/ $(srcdir)/tests/test_nut.aug
# Now "make install" should cover delivery of Augeas lenses...
# The "auglensdir" value should be set up by configure
# The *.aug files are generated by rule above or by autogen.sh and/or configure
@WITH_AUGLENS_TRUE@auglens_DATA = \
@WITH_AUGLENS_TRUE@ nuthostsconf.aug nutupsconf.aug nutupsdusers.aug nutupsschedconf.aug \
@WITH_AUGLENS_TRUE@ nutnutconf.aug nutupsdconf.aug nutupsmonconf.aug nutupssetconf.aug
# Generated by autogen.sh and needed to run the configure script:
MAINTAINERCLEANFILES = Makefile.in .dirstamp nutupsconf.aug.in
CLEANFILES = *-spellchecked
# Can be re-generated by configure script and/or make:
DISTCLEANFILES = gen-nutupsconf-aug.py *.aug
all: all-am
.SUFFIXES:
@ -340,14 +435,13 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/augeas/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/augeas/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -360,8 +454,6 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
nutnutconf.aug: $(top_builddir)/config.status $(srcdir)/nutnutconf.aug.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nutupsconf.aug: $(top_builddir)/config.status $(srcdir)/nutupsconf.aug.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nutupsdconf.aug: $(top_builddir)/config.status $(srcdir)/nutupsdconf.aug.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nutupsdusers.aug: $(top_builddir)/config.status $(srcdir)/nutupsdusers.aug.in
@ -374,12 +466,37 @@ nuthostsconf.aug: $(top_builddir)/config.status $(srcdir)/nuthostsconf.aug.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nutupssetconf.aug: $(top_builddir)/config.status $(srcdir)/nutupssetconf.aug.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
gen-nutupsconf-aug.py: $(top_builddir)/config.status $(srcdir)/gen-nutupsconf-aug.py.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nutupsconf.aug: $(top_builddir)/config.status $(srcdir)/nutupsconf.aug.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-auglensDATA: $(auglens_DATA)
@$(NORMAL_INSTALL)
@list='$(auglens_DATA)'; test -n "$(auglensdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(auglensdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(auglensdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(auglensdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(auglensdir)" || exit $$?; \
done
uninstall-auglensDATA:
@$(NORMAL_UNINSTALL)
@list='$(auglens_DATA)'; test -n "$(auglensdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(auglensdir)'; $(am__uninstall_files_from_dir)
tags TAGS:
ctags CTAGS:
@ -387,7 +504,10 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -420,10 +540,15 @@ distdir: $(DISTFILES)
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
@HAVE_AUGPARSE_FALSE@check-local:
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-local
check: check-am
all-am: Makefile
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(auglensdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -446,14 +571,17 @@ install-strip:
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
@ -474,7 +602,7 @@ info: info-am
info-am:
install-data-am:
install-data-am: install-auglensDATA
install-dvi: install-dvi-am
@ -518,36 +646,46 @@ ps: ps-am
ps-am:
uninstall-am:
uninstall-am: uninstall-auglensDATA
.MAKE: install-am install-strip
.MAKE: check-am install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am dist-hook distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
.PHONY: all all-am check check-am check-local clean clean-generic \
clean-libtool cscopelist-am ctags-am dist-hook distclean \
distclean-generic distclean-libtool distdir dvi dvi-am html \
html-am info info-am install install-am install-auglensDATA \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
uninstall-am uninstall-auglensDATA
.PRECIOUS: Makefile
# only call the script to generate Augeas ups.conf lens upon "make dist",
# and if Python is present
# and if Python is present; the distributed gen-nutupsconf-aug.py.in template
# is assumed to only differ from a generated gen-nutupsconf-aug.py by the
# @PYTHON@ shebang.
dist-hook:
@if python -c "import re,glob,codecs"; then \
echo "Regenerating Augeas ups.conf lens."; \
$(distdir)/gen-nutupsconf-aug.py $(distdir)/; \
@if [ -n "$(PYTHON)" ] && $(PYTHON) -c "import re,glob,codecs"; then \
echo "Regenerating Augeas ups.conf lens with '$(PYTHON)'."; \
$(PYTHON) $(distdir)/gen-nutupsconf-aug.py.in $(distdir)/; \
else \
echo "----------------------------------------------------------------------"; \
echo "Warning: Python is not available."; \
echo "Skipping Augeas ups.conf lens regeneration."; \
echo "Skipping regeneration of Augeas lens for ups.conf parsing." ; \
echo "----------------------------------------------------------------------"; \
fi
# This needs augparse from augeas-tools
@HAVE_AUGPARSE_TRUE@check-local:
@HAVE_AUGPARSE_TRUE@ @echo "augparse proceeding to lenses verification job..."; \
@HAVE_AUGPARSE_TRUE@ echo "DISABLED for now due to https://github.com/networkupstools/nut/issues/657"
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -57,7 +57,7 @@ These are the *.aug files in the present directory.
You can either install the files to the right location on your system,
generally in '/usr/share/augeas/lenses/', or use these from NUT
source directory ('nut/scripts/augeas'). The latter is to be prefered for
source directory ('nut/scripts/augeas'). The latter is to be preferred for
the time being.
@ -240,7 +240,7 @@ a.set(("/files/etc/nut/upsd.users/%s/instcmds" % user), "ALL")
monuser = "monuser"
monpasswd = "******"
a.set(("/files/etc/nut/upsd.users/%s/password" % monuser), monpasswd)
a.set(("/files/etc/nut/upsd.users/%s/upsmon" % monuser), "master")
a.set(("/files/etc/nut/upsd.users/%s/upsmon" % monuser), "primary")
# Generate upsmon.conf
a.set("/files/etc/nut/upsmon.conf/MONITOR/system/upsname", device_name)
@ -250,7 +250,7 @@ a.set("/files/etc/nut/upsmon.conf/MONITOR/system/upsname", device_name)
a.set("/files/etc/nut/upsmon.conf/MONITOR/powervalue", "1")
a.set("/files/etc/nut/upsmon.conf/MONITOR/username", monuser)
a.set("/files/etc/nut/upsmon.conf/MONITOR/password", monpasswd)
a.set("/files/etc/nut/upsmon.conf/MONITOR/type", "master")
a.set("/files/etc/nut/upsmon.conf/MONITOR/type", "primary")
# FIXME: glitch on the generated content
a.set("/files/etc/nut/upsmon.conf/SHUTDOWNCMD", "/sbin/shutdown -h +0")

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!@PYTHON@
# Copyright (C) 2010 - Arnaud Quette <arnaud.quette@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
@ -18,6 +18,8 @@
# This program extracts all drivers specific variables, declared
# using 'addvar()' and output a complete ups.conf lens for Augeas
from __future__ import print_function
import sys
import re
import glob
@ -57,11 +59,11 @@ def grep(string,list):
if __name__ == '__main__':
rawCount = 0
global finalCount
#global finalCount
variableNames = []
specificVars = ""
global inLensContent
global finalLensContent
#global inLensContent
#global finalLensContent
Exceptionlist = ['../../drivers/main.c', '../../drivers/skel.c']
outputFilename = 'nutupsconf.aug.in'
templateFilename = 'nutupsconf.aug.tpl'
@ -69,7 +71,7 @@ if __name__ == '__main__':
if (len(sys.argv) == 2):
dirPrefix = sys.argv[1]
print dirPrefix
print(dirPrefix)
# 1/ Extract all specific drivers parameters, in a sorted list with unique entries
# 1.1/ List all drivers implementation files

View file

@ -47,14 +47,42 @@ let ups_fields = "driver"
| "ignorelb"
| "maxstartdelay"
| "synchronous"
| "BYPASS"
| "CHRG_addr"
| "CHRG_noro"
| "CHRG_regtype"
| "CP"
| "CS"
| "Could not addvar(%s)"
| "DISCHRG_addr"
| "DISCHRG_noro"
| "DISCHRG_regtype"
| "FSD_addr"
| "FSD_noro"
| "FSD_pulse_duration"
| "FSD_regtype"
| "HB_addr"
| "HB_noro"
| "HB_regtype"
| "ID"
| "LB"
| "LB_addr"
| "LB_noro"
| "LB_regtype"
| "LowBatt"
| "OB_addr"
| "OB_noro"
| "OB_regtype"
| "OL"
| "OL_addr"
| "OL_noro"
| "OL_regtype"
| "OffDelay"
| "OnDelay"
| "RB"
| "RB_addr"
| "RB_noro"
| "RB_regtype"
| "SD"
| "advanced_eco_mode"
| "advorder"
@ -83,12 +111,23 @@ let ups_fields = "driver"
| "community"
| "constant_phase_angle"
| "converter_mode"
| "cshdelay"
| "daysoff"
| "daysweek"
| "dev_slave_id"
| "device"
| "device_mfr"
| "device_model"
| "do_convert_deci"
| "dumbterm"
| "eco_mode"
| "explore"
| "fake_lowbatt"
| "fault_1"
| "fault_2"
| "fault_3"
| "fault_4"
| "fault_5"
| "flash"
| "frequency"
| "fruid"
@ -96,8 +135,10 @@ let ups_fields = "driver"
| "hb"
| "houroff"
| "houron"
| "i2c_address"
| "idleload"
| "ignoresab"
| "input_fault_voltage"
| "input_timeout"
| "interruptonly"
| "interruptsize"
@ -115,6 +156,7 @@ let ups_fields = "driver"
| "max_bypass_freq"
| "max_bypass_volt"
| "max_load"
| "max_polls_without_data"
| "maxreport"
| "methodOfFlowControl"
| "mfr"
@ -123,21 +165,31 @@ let ups_fields = "driver"
| "min_bypass_volt"
| "mincharge"
| "minruntime"
| "mod_byte_to_s"
| "mod_byte_to_us"
| "mod_resp_to_s"
| "mod_resp_to_us"
| "model"
| "modelname"
| "nobt"
| "nohang"
| "nombattvolt"
| "nominal_cell_voltage"
| "norating"
| "noscanlangid"
| "notification"
| "notransferoids"
| "novendor"
| "nowarn_noimp"
| "numOfBytesFromUPS"
| "number_of_battery_cells"
| "offdelay"
| "oldmac"
| "ondelay"
| "onlinedischarge"
| "output_pace"
| "output_phase_angle"
| "output_voltages"
| "password"
| "pins_shutdown_mode"
| "pollfreq"
@ -151,20 +203,31 @@ let ups_fields = "driver"
| "productid"
| "protocol"
| "rebootdelay"
| "recharge_time"
| "reset_to_default"
| "rio_slave_id"
| "runtime_full"
| "runtime_half"
| "runtimecal"
| "sdtime"
| "sdtype"
| "secLevel"
| "secName"
| "semistaticfreq"
| "ser_baud_rate"
| "ser_data_bit"
| "ser_parity"
| "ser_stop_bit"
| "serial"
| "serialnumber"
| "series"
| "shutdownArguments"
| "shutdown_delay"
| "shutdown_duration"
| "shutdown_timer"
| "silent"
| "site_fault_detection"
| "slave_address"
| "snmp_retries"
| "snmp_timeout"
| "snmp_version"
@ -173,6 +236,7 @@ let ups_fields = "driver"
| "stayoff"
| "subdriver"
| "subscribe"
| "symmetrathreephase"
| "testing"
| "testtime"
| "timeout"

View file

@ -39,6 +39,8 @@ let comment = Util.comment
let path = word
let upsd_maxage = [ opt_spc . key "MAXAGE" . sep_spc . store num . eol ]
let upsd_trackingdelay = [ opt_spc . key "TRACKINGDELAY" . sep_spc . store num . eol ]
let upsd_allow_no_device = [ opt_spc . key "ALLOW_NO_DEVICE" . sep_spc . store num . eol ]
let upsd_statepath = [ opt_spc . key "STATEPATH" . sep_spc . store path . eol ]
let upsd_listen = [ opt_spc . key "LISTEN" . sep_spc
. [ label "interface" . store ip ]
@ -49,13 +51,15 @@ let upsd_certfile = [ opt_spc . key "CERTFILE" . sep_spc . store path . eol ]
(************************************************************************
* MAXAGE seconds
* TRACKINGDELAY seconds
* ALLOW_NO_DEVICE Boolean
* STATEPATH path
* LISTEN interface port
* Multiple LISTEN addresses may be specified. The default is to bind to 0.0.0.0 if no LISTEN addresses are specified.
* LISTEN 127.0.0.1 LISTEN 192.168.50.1 LISTEN ::1 LISTEN 2001:0db8:1234:08d3:1319:8a2e:0370:7344
*
*************************************************************************)
let upsd_other = upsd_maxage | upsd_statepath | upsd_listen_list | upsd_maxconn | upsd_certfile
let upsd_other = upsd_maxage | upsd_trackingdelay | upsd_allow_no_device | upsd_statepath | upsd_listen_list | upsd_maxconn | upsd_certfile
let upsd_lns = (upsd_other|comment|empty)*

View file

@ -67,7 +67,7 @@ let upsd_users_instcmds = [ del_spc
let upsd_users_upsmon = [ del_spc
. key "upsmon" . sep_spc
. store /master|slave/ . eol ]
. store /master|primary|slave|secondary/ . eol ]
let upsd_users_title = IniFile.indented_title IniFile.record_re

View file

@ -27,6 +27,8 @@ test NutUpsConf.ups_lns get ups_conf =
let upsd_conf = "
MAXAGE 30
TRACKINGDELAY 600
ALLOW_NO_DEVICE 1
LISTEN 0.0.0.0 3493
MAXCONN 1024
"
@ -34,6 +36,8 @@ MAXCONN 1024
test NutUpsdConf.upsd_lns get upsd_conf =
{ }
{ "MAXAGE" = "30" }
{ "TRACKINGDELAY" = "600" }
{ "ALLOW_NO_DEVICE" = "1" }
{ "LISTEN"
{ "interface" = "0.0.0.0" }
{ "port" = "3493" } }
@ -50,13 +54,13 @@ let upsd_users = "
instcmds = test.panel.start
instcmds = test.panel.stop
[monmaster]
[upswired]
password = blah
upsmon master
upsmon primary
[monslave]
[observer]
password = abcd
upsmon slave
upsmon secondary
"
test NutUpsdUsers.upsd_users_lns get upsd_users =
@ -73,16 +77,16 @@ test NutUpsdUsers.upsd_users_lns get upsd_users =
{ "instcmds" = "test.panel.start" }
{ "instcmds" = "test.panel.stop" }
{ } }
{ "monmaster"
{ "upswired"
{ "password" = "blah" }
{ "upsmon" = "master" }
{ "upsmon" = "primary" }
{ } }
{ "monslave"
{ "observer"
{ "password" = "abcd" }
{ "upsmon" = "slave" } }
{ "upsmon" = "secondary" } }
let upsmon_conf = "
MONITOR testups@localhost 1 monmaster blah master
MONITOR testups@localhost 1 upswired blah primary
MINSUPPLIES 1
SHUTDOWNCMD /sbin/shutdown -h +0
@ -103,9 +107,9 @@ test NutUpsmonConf.upsmon_lns get upsmon_conf =
{ "upsname" = "testups" }
{ "hostname" = "localhost" } }
{ "powervalue" = "1" }
{ "username" = "monmaster" }
{ "username" = "upswired" }
{ "password" = "blah" }
{ "type" = "master" } }
{ "type" = "primary" } }
{ }
{ "MINSUPPLIES" = "1" }
{ "SHUTDOWNCMD" = "/sbin/shutdown -h +0" }

View file

@ -9,6 +9,18 @@ endif
EXTRA_DIST = README
MAINTAINERCLEANFILES = Makefile.in .dirstamp
# Generated by configure script:
DISTCLEANFILES = nut-usb.conf
# we should never remove this one, apart from a distclean-check
#MAINTAINERCLEANFILES = nut-usbups.rules.in
# Generated by autogen.sh and needed to run the configure script
# (technically, generated by tools/nut-usbinfo.pl script among
# GENERATED_USB_OS_FILES):
MAINTAINERCLEANFILES += nut-usbups.rules.in
MAINTAINERCLEANFILES += nut-usbups.rules.in.AUTOGEN_WITHOUT
MAINTAINERCLEANFILES += nut-usb.conf.in
MAINTAINERCLEANFILES += nut-usb.conf.in.AUTOGEN_WITHOUT

View file

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -15,7 +15,17 @@
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -81,19 +91,24 @@ host_triplet = @host@
target_triplet = @target@
@WITH_DEVD_TRUE@@WITH_USB_TRUE@am__append_1 = nut-usb.conf
subdir = scripts/devd
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/nut-usb.conf.in README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
@ -102,11 +117,17 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = nut-usb.conf
@ -160,6 +181,8 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(devdconfdir)"
DATA = $(devdconf_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/nut-usb.conf.in \
README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
@ -168,6 +191,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -178,6 +202,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
@ -191,6 +216,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
@ -203,6 +229,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -220,6 +247,8 @@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
@ -230,21 +259,29 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
@ -264,6 +301,9 @@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
@ -277,6 +317,7 @@ STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
@ -294,6 +335,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@ -307,6 +349,9 @@ datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@ -332,12 +377,14 @@ pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemshutdowndir = @systemdsystemshutdowndir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
@ -350,6 +397,18 @@ udevdir = @udevdir@
@WITH_DEVD_TRUE@devdconfdir = $(devddir)
@WITH_DEVD_TRUE@devdconf_DATA = $(am__append_1)
EXTRA_DIST = README
# we should never remove this one, apart from a distclean-check
#MAINTAINERCLEANFILES = nut-usbups.rules.in
# Generated by autogen.sh and needed to run the configure script
# (technically, generated by tools/nut-usbinfo.pl script among
# GENERATED_USB_OS_FILES):
MAINTAINERCLEANFILES = Makefile.in .dirstamp nut-usbups.rules.in \
nut-usbups.rules.in.AUTOGEN_WITHOUT nut-usb.conf.in \
nut-usb.conf.in.AUTOGEN_WITHOUT
# Generated by configure script:
DISTCLEANFILES = nut-usb.conf
all: all-am
@ -366,14 +425,13 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/devd/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/devd/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -420,7 +478,10 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -488,6 +549,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
@ -569,8 +631,8 @@ uninstall-am: uninstall-devdconfDATA
mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
uninstall-am uninstall-devdconfDATA
# we should never remove this one, apart from a distclean-check
#MAINTAINERCLEANFILES = nut-usbups.rules.in
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -1,7 +1,7 @@
# This file is generated and installed by the Network UPS Tools package.
# Homepage: http://www.networkupstools.org/
# ATCL FOR UPS - nutdrv_atcl_usb
# SNR-UPS-LID-XXXX UPSes - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -178,7 +178,9 @@ notify 100 {
match "product" "0xffff";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# TS Shara UPSes - nutdrv_qx
# ST Microelectronics
# TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -187,6 +189,26 @@ notify 100 {
match "product" "0x0035";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# USB IDs device table - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x0483";
match "product" "0xa113";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# IBM
# 6000 VA LCD 4U Rack UPS; 5396-1Kx - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x04b3";
match "product" "0x0001";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Riello (Cypress Semiconductor Corp.)
# various models - riello_usb
@ -359,7 +381,7 @@ notify 100 {
match "product" "0x0004";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Agiler UPS - blazer_usb
# Agiler UPS - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -368,7 +390,27 @@ notify 100 {
match "product" "0x0000";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Belkin F6C1200-UNV - blazer_usb
# Delta UPS
# Delta UPS Amplon R Series, Single Phase UPS, 1/2/3 kVA - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x05dd";
match "product" "0x041b";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Delta/Minuteman Enterprise Plus E1500RM2U - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x05dd";
match "product" "0xa011";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Belkin F6C1200-UNV/Voltronic Power UPSes - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -379,7 +421,7 @@ notify 100 {
};
# Phoenixtec Power Co., Ltd
# various models - bcmxcp_usb
# Online Yunto YQ450 - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -388,7 +430,7 @@ notify 100 {
match "product" "0x0002";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Mustek Powermust - blazer_usb
# Mustek Powermust - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -397,7 +439,7 @@ notify 100 {
match "product" "0x0003";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Phoenixtec Innova 3/1 T - blazer_usb
# Phoenixtec Innova 3/1 T - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -406,7 +448,7 @@ notify 100 {
match "product" "0x0004";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Phoenixtec Innova RT - blazer_usb
# Phoenixtec Innova RT - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -415,7 +457,7 @@ notify 100 {
match "product" "0x0005";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Phoenixtec Innova T - blazer_usb
# Phoenixtec Innova T - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -424,7 +466,7 @@ notify 100 {
match "product" "0x0201";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Online Zinto A - blazer_usb
# Online Zinto A - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -433,7 +475,7 @@ notify 100 {
match "product" "0x0601";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# various models - usbhid-ups
# PROTECT B / NAS - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -547,6 +589,15 @@ notify 100 {
match "product" "0x1010";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# e.g. TrippLite SU3000LCD2UHV - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x09ae";
match "product" "0x1330";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# e.g. TrippLite OMNI1000LCD - usbhid-ups
notify 100 {
match "system" "USB";
@ -709,6 +760,15 @@ notify 100 {
match "product" "0x3016";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# e.g. TrippLite AVR750U (newer unit) - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x09ae";
match "product" "0x3024";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) - usbhid-ups
notify 100 {
match "system" "USB";
@ -846,7 +906,7 @@ notify 100 {
match "product" "0x00a6";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Unitek Alpha 1200Sx - blazer_usb
# Unitek Alpha 1200Sx - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -884,7 +944,7 @@ notify 100 {
match "product" "0x0008";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# GE EP series - blazer_usb
# GE EP series - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
@ -894,6 +954,93 @@ notify 100 {
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Legrand
# Legrand Keor SP - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x1cb0";
match "product" "0x0032";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Legrand Daker DK / DK Plus - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x1cb0";
match "product" "0x0035";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Legrand Keor PDU - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x1cb0";
match "product" "0x0038";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Arduino
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2341";
match "product" "0x0036";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2341";
match "product" "0x8036";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Arduino
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2A03";
match "product" "0x0036";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2A03";
match "product" "0x0040";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2A03";
match "product" "0x8036";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2A03";
match "product" "0x8040";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# AEG
# PROTECT B / NAS - usbhid-ups
notify 100 {
@ -904,7 +1051,76 @@ notify 100 {
match "product" "0xffff";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Ablerex 625L USB - blazer_usb
# Ever
# USB IDs device table - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2e51";
match "product" "0x0000";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# USB IDs device table - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2e51";
match "product" "0xffff";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Salicru
# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2e66";
match "product" "0x0201";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2e66";
match "product" "0x0202";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2e66";
match "product" "0x0203";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# https://www.salicru.com/sps-home.html - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x2e66";
match "product" "0x0300";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Powervar
# Powervar - usbhid-ups
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";
match "type" "ATTACH";
match "vendor" "0x4234";
match "product" "0x0002";
action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev";
};
# Ablerex 625L USB (Note: earlier best-fit was "krauler_subdriver" before PR #1135) - nutdrv_qx
notify 100 {
match "system" "USB";
match "subsystem" "DEVICE";

View file

@ -6,6 +6,16 @@ if WITH_HOTPLUG
endif
EXTRA_DIST = README
MAINTAINERCLEANFILES = Makefile.in .dirstamp
# Generated by configure script:
DISTCLEANFILES = libhidups
# we should never remove this one, apart from a distclean-check
#MAINTAINERCLEANFILES = libhid.usermap
# Generated by autogen.sh and needed to run the configure script
# (technically, generated by tools/nut-usbinfo.pl script among
# GENERATED_USB_OS_FILES):
MAINTAINERCLEANFILES += libhid.usermap

View file

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,7 +16,17 @@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -81,19 +91,24 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = scripts/hotplug
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/libhidups.in $(am__dist_hotplugusb_DATA_DIST) README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
@ -102,11 +117,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_hotplugusb_DATA_DIST) \
$(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = libhidups
@ -163,6 +185,7 @@ am__can_run_installinfo = \
am__dist_hotplugusb_DATA_DIST = libhid.usermap
DATA = $(dist_hotplugusb_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libhidups.in README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
@ -171,6 +194,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -181,6 +205,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
@ -194,6 +219,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
@ -206,6 +232,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -223,6 +250,8 @@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
@ -233,21 +262,29 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
@ -267,6 +304,9 @@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
@ -280,6 +320,7 @@ STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
@ -297,6 +338,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@ -310,6 +352,9 @@ datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@ -335,12 +380,14 @@ pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemshutdowndir = @systemdsystemshutdowndir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
@ -354,6 +401,16 @@ udevdir = @udevdir@
@WITH_HOTPLUG_TRUE@dist_hotplugusb_DATA = libhid.usermap
@WITH_HOTPLUG_TRUE@hotplugusb_SCRIPTS = libhidups
EXTRA_DIST = README
# we should never remove this one, apart from a distclean-check
#MAINTAINERCLEANFILES = libhid.usermap
# Generated by autogen.sh and needed to run the configure script
# (technically, generated by tools/nut-usbinfo.pl script among
# GENERATED_USB_OS_FILES):
MAINTAINERCLEANFILES = Makefile.in .dirstamp libhid.usermap
# Generated by configure script:
DISTCLEANFILES = libhidups
all: all-am
@ -370,14 +427,13 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/hotplug/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/hotplug/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -459,7 +515,10 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -527,6 +586,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
@ -610,8 +670,8 @@ uninstall-am: uninstall-dist_hotplugusbDATA \
ps ps-am tags-am uninstall uninstall-am \
uninstall-dist_hotplugusbDATA uninstall-hotplugusbSCRIPTS
# we should never remove this one, apart from a distclean-check
#MAINTAINERCLEANFILES = libhid.usermap
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -4,7 +4,7 @@
# libhidups 0x0003 0xVVVV 0xPPPP 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
#
# usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
# ATCL FOR UPS
# SNR-UPS-LID-XXXX UPSes
libhidups 0x0003 0x0001 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Hewlett Packard
@ -48,8 +48,16 @@ libhidups 0x0003 0x0463 0xffff 0x0000 0x0000 0x00
# Dell
# various models
libhidups 0x0003 0x047c 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# TS Shara UPSes
# ST Microelectronics
# TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs
libhidups 0x0003 0x0483 0x0035 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# USB IDs device table
libhidups 0x0003 0x0483 0xa113 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# IBM
# 6000 VA LCD 4U Rack UPS; 5396-1Kx
libhidups 0x0003 0x04b3 0x0001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Riello (Cypress Semiconductor Corp.)
# various models
@ -98,11 +106,17 @@ libhidups 0x0003 0x0592 0x0002 0x0000 0x0000 0x00
libhidups 0x0003 0x0592 0x0004 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Agiler UPS
libhidups 0x0003 0x05b8 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Belkin F6C1200-UNV
# Delta UPS
# Delta UPS Amplon R Series, Single Phase UPS, 1/2/3 kVA
libhidups 0x0003 0x05dd 0x041b 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Delta/Minuteman Enterprise Plus E1500RM2U
libhidups 0x0003 0x05dd 0xa011 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Belkin F6C1200-UNV/Voltronic Power UPSes
libhidups 0x0003 0x0665 0x5161 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Phoenixtec Power Co., Ltd
# various models
# Online Yunto YQ450
libhidups 0x0003 0x06da 0x0002 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Mustek Powermust
libhidups 0x0003 0x06da 0x0003 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
@ -114,7 +128,7 @@ libhidups 0x0003 0x06da 0x0005 0x0000 0x0000 0x00
libhidups 0x0003 0x06da 0x0201 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Online Zinto A
libhidups 0x0003 0x06da 0x0601 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# various models
# PROTECT B / NAS
libhidups 0x0003 0x06da 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# iDowell
@ -144,6 +158,8 @@ libhidups 0x0003 0x09ae 0x1008 0x0000 0x0000 0x00
libhidups 0x0003 0x09ae 0x1009 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite ECO550UPS
libhidups 0x0003 0x09ae 0x1010 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite SU3000LCD2UHV
libhidups 0x0003 0x09ae 0x1330 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite OMNI1000LCD
libhidups 0x0003 0x09ae 0x2005 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite OMNI900LCD
@ -180,6 +196,8 @@ libhidups 0x0003 0x09ae 0x3014 0x0000 0x0000 0x00
libhidups 0x0003 0x09ae 0x3015 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite Smart1500LCD (newer unit)
libhidups 0x0003 0x09ae 0x3016 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite AVR750U (newer unit)
libhidups 0x0003 0x09ae 0x3024 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?)
libhidups 0x0003 0x09ae 0x4001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite SmartOnline SU6000RT4U?
@ -225,8 +243,52 @@ libhidups 0x0003 0x10af 0x0008 0x0000 0x0000 0x00
# GE EP series
libhidups 0x0003 0x14f0 0x00c9 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Legrand
# Legrand Keor SP
libhidups 0x0003 0x1cb0 0x0032 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Legrand Daker DK / DK Plus
libhidups 0x0003 0x1cb0 0x0035 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Legrand Keor PDU
libhidups 0x0003 0x1cb0 0x0038 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Arduino
# Arduino Leonardo, Leonardo ETH and Pro Micro
libhidups 0x0003 0x2341 0x0036 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Arduino Leonardo, Leonardo ETH and Pro Micro
libhidups 0x0003 0x2341 0x8036 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Arduino
# Arduino Leonardo, Leonardo ETH and Pro Micro
libhidups 0x0003 0x2A03 0x0036 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Arduino Leonardo, Leonardo ETH and Pro Micro
libhidups 0x0003 0x2A03 0x0040 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Arduino Leonardo, Leonardo ETH and Pro Micro
libhidups 0x0003 0x2A03 0x8036 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Arduino Leonardo, Leonardo ETH and Pro Micro
libhidups 0x0003 0x2A03 0x8040 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# AEG
# PROTECT B / NAS
libhidups 0x0003 0x2b2d 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Ablerex 625L USB
# Ever
# USB IDs device table
libhidups 0x0003 0x2e51 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# USB IDs device table
libhidups 0x0003 0x2e51 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Salicru
# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450
libhidups 0x0003 0x2e66 0x0201 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450
libhidups 0x0003 0x2e66 0x0202 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450
libhidups 0x0003 0x2e66 0x0203 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# https://www.salicru.com/sps-home.html
libhidups 0x0003 0x2e66 0x0300 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Powervar
# Powervar
libhidups 0x0003 0x4234 0x0002 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Ablerex 625L USB (Note: earlier best-fit was "krauler_subdriver" before PR #1135)
libhidups 0x0003 0xffff 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

View file

@ -164,7 +164,7 @@ sub _initialize {
# Author: Kit Peters
my $self = shift;
my %arg = @_;
my $host = $arg{HOST} || 'localhost'; # Host running master upsd
my $host = $arg{HOST} || 'localhost'; # Host running upsd and probably drivers
my $port = $arg{PORT} || '3493'; # 3493 is IANA assigned port for NUT
my $proto = $arg{PROTO} || 'tcp'; # use tcp unless user tells us to
my $user = $arg{USERNAME} || undef; # username passed to upsd
@ -591,6 +591,8 @@ sub Master { # check for MASTER level access
# Author: Kit Peters
# ### changelog: uses the new _send command
#
# TODO: API change pending to replace MASTER with PRIMARY
# (and backwards-compatible alias handling)
my $self = shift;
my $req = "MASTER $self->{name}"; # build request
@ -841,6 +843,9 @@ It is automatically done if connection closed.
Use this to find out whether or not we have MASTER privileges for
this UPS. Returns 1 if we have MASTER privileges, returns 0 otherwise.
TODO: API change pending to replace MASTER with PRIMARY
(and backwards-compatible alias handling)
=item ListVar($variable, ...)
This is an implementation of "LIST VAR" command.

View file

@ -1,11 +1,24 @@
# Network UPS Tools: data/html
EXTRA_DIST_PY2GTK2 = \
app/ui/gui-1.3.glade \
app/NUT-Monitor-py2gtk2.in \
app/nut-monitor-py2gtk2.desktop
EXTRA_DIST_PY3QT5 = \
app/ui/aboutdialog1.ui \
app/ui/dialog1.ui \
app/ui/dialog2.ui \
app/ui/window1.ui \
app/NUT-Monitor-py3qt5.in \
app/nut-monitor-py3qt5.desktop
EXTRA_DIST = README \
app/gui-1.3.glade \
app/NUT-Monitor \
app/nut-monitor.appdata.xml \
app/nut-monitor.desktop \
app/nut-monitor.png \
app/icons/48x48/nut-monitor.png \
app/icons/64x64/nut-monitor.png \
app/icons/256x256/nut-monitor.png \
app/icons/scalable/nut-monitor.svg \
app/README \
app/pixmaps/var-rw.png \
app/pixmaps/on_line.png \
@ -14,6 +27,14 @@ EXTRA_DIST = README \
app/pixmaps/var-ro.png \
app/locale/fr/LC_MESSAGES/NUT-Monitor.mo \
app/locale/it/LC_MESSAGES/NUT-Monitor.mo \
module/PyNUT.py \
module/test_nutclient.py
module/PyNUT.py.in \
module/test_nutclient.py.in
# TODO: Make py2/py3-only builds, delivered preferred symlinks, etc. optional:
EXTRA_DIST += $(EXTRA_DIST_PY2GTK2)
EXTRA_DIST += $(EXTRA_DIST_PY3QT5)
MAINTAINERCLEANFILES = Makefile.in .dirstamp
clean-local:
rm -rf *.pyc __pycache__ */*.pyc */__pycache__ */*/*.pyc */*/__pycache__

View file

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,7 +16,17 @@
# Network UPS Tools: data/html
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -81,18 +91,24 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = scripts/python
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
@ -101,11 +117,17 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
@ -130,6 +152,7 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
@ -138,6 +161,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -148,6 +172,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
@ -161,6 +186,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
@ -173,6 +199,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -190,6 +217,8 @@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
@ -200,21 +229,29 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
@ -234,6 +271,9 @@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
@ -247,6 +287,7 @@ STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
@ -264,6 +305,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@ -277,6 +319,9 @@ datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@ -302,12 +347,14 @@ pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemshutdowndir = @systemdsystemshutdowndir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
@ -317,23 +364,34 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udevdir = @udevdir@
EXTRA_DIST = README \
app/gui-1.3.glade \
app/NUT-Monitor \
app/nut-monitor.appdata.xml \
app/nut-monitor.desktop \
app/nut-monitor.png \
app/README \
app/pixmaps/var-rw.png \
app/pixmaps/on_line.png \
app/pixmaps/warning.png \
app/pixmaps/on_battery.png \
app/pixmaps/var-ro.png \
app/locale/fr/LC_MESSAGES/NUT-Monitor.mo \
app/locale/it/LC_MESSAGES/NUT-Monitor.mo \
module/PyNUT.py \
module/test_nutclient.py
EXTRA_DIST_PY2GTK2 = \
app/ui/gui-1.3.glade \
app/NUT-Monitor-py2gtk2.in \
app/nut-monitor-py2gtk2.desktop
EXTRA_DIST_PY3QT5 = \
app/ui/aboutdialog1.ui \
app/ui/dialog1.ui \
app/ui/dialog2.ui \
app/ui/window1.ui \
app/NUT-Monitor-py3qt5.in \
app/nut-monitor-py3qt5.desktop
# TODO: Make py2/py3-only builds, delivered preferred symlinks, etc. optional:
EXTRA_DIST = README app/nut-monitor.appdata.xml \
app/icons/48x48/nut-monitor.png \
app/icons/64x64/nut-monitor.png \
app/icons/256x256/nut-monitor.png \
app/icons/scalable/nut-monitor.svg app/README \
app/pixmaps/var-rw.png app/pixmaps/on_line.png \
app/pixmaps/warning.png app/pixmaps/on_battery.png \
app/pixmaps/var-ro.png \
app/locale/fr/LC_MESSAGES/NUT-Monitor.mo \
app/locale/it/LC_MESSAGES/NUT-Monitor.mo module/PyNUT.py.in \
module/test_nutclient.py.in $(EXTRA_DIST_PY2GTK2) \
$(EXTRA_DIST_PY3QT5)
MAINTAINERCLEANFILES = Makefile.in .dirstamp
all: all-am
.SUFFIXES:
@ -349,14 +407,13 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/python/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/python/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -380,7 +437,10 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -444,9 +504,10 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
clean-am: clean-generic clean-libtool clean-local mostlyclean-am
distclean: distclean-am
-rm -f Makefile
@ -513,7 +574,7 @@ uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
clean-local cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
@ -524,6 +585,11 @@ uninstall-am:
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
.PRECIOUS: Makefile
clean-local:
rm -rf *.pyc __pycache__ */*.pyc */__pycache__ */*/*.pyc */*/__pycache__
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -7,6 +7,7 @@ David Goncalves, and released under GPL v3.
* "module": this directory contains PyNUT.py, which is a Python abstraction
class to access NUT server(s). You can use it in Python programs to access NUT's
upsd data server in a simple way, without having to know the NUT protocol.
The same module should work for Python 2 and Python 3.
To import it on Python programs you have to use the following (case sensitive) :
'import PyNUT'
@ -17,16 +18,24 @@ data from an upsd data server.
To install the PyNUT module on Debian/Ubuntu, copy it to:
/usr/share/python-support/python-pynut/
For quick tests, just make sure its directory is exported in `PYTHONPATH`
environment variable.
This directory also contains test_nutclient.py, which is a PyNUT test program.
For this to be fully functional, you will need to adapt the login, password and
upsname to fit your configuration.
upsname to fit your configuration. A NUT data server should be running for the
test program to verify connection and protocol support.
* "app": this directory contains the NUT-Monitor application, that uses the
PyNUT class, along with its resources.
To install it, you will either need to keep the files together, or to install:
- NUT-Monitor to /usr/bin, /usr/X11R6/bin/ or something like that,
- gui.glade to /usr/share/nut-monitor/,
- Depending on the Python version(s) your system has, put NUT-Monitor-py2gtk2
or NUT-Monitor-py3qt5 to /usr/bin/, /usr/X11R6/bin/ or something like that
(optionally making a simple NUT-Monitor symlink to the preferred version),
- ui/*.glade (for NUT-Monitor-py2gtk2) or ui/*.ui (for NUT-Monitor-py3qt5)
to /usr/share/nut-monitor/,
- nut-monitor.png to something like /usr/share/pixmaps/
- and nut-monitor.desktop to /usr/share/applications
- finally, nut-monitor-py2gtk2.desktop and/or nut-monitor-py3qt5.desktop
(optionally symlinked as nut-monitor.desktop) to /usr/share/applications/

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!@PYTHON2@
# -*- coding: utf-8 -*-
# 2009-12-27 David Goncalves - Version 1.2
@ -76,7 +76,7 @@ class interface :
( cmd_opts, args ) = opt_parser.parse_args()
self.__glade_file = os.path.join( os.path.dirname( sys.argv[0] ), "gui-1.3.glade" )
self.__glade_file = os.path.join( os.path.dirname( sys.argv[0] ), "ui/gui-1.3.glade" )
self.__widgets["interface"] = gtk.glade.XML( self.__glade_file, "window1", APP )
self.__widgets["main_window"] = self.__widgets["interface"].get_widget("window1")
@ -486,7 +486,7 @@ class interface :
self.gui_status_message( error_msg )
except :
# Failed to get informations from the treeview... skip action
# Failed to get information from the treeview... skip action
pass
#-------------------------------------------------------------------
@ -813,7 +813,7 @@ class gui_updater( threading.Thread ) :
self.__parent_class.gui_status_notification( _("Device is running on batteries"), "on_battery.png" )
was_online = False
# Check for additionnal informations
# Check for additionnal information
for k,v in status_mapper.iteritems() :
if vars.get("ups.status").find(k) != -1 :
if ( text_right != "" ) :

View file

@ -0,0 +1,944 @@
#!@PYTHON3@
# -*- coding: utf-8 -*-
# 2009-12-27 David Goncalves - Version 1.2
# Total rewrite of NUT-Monitor to optimize GUI interaction.
# Added favorites support (saved to user's home)
# Added status icon on the notification area
#
# 2010-02-26 David Goncalves
# Added UPS vars display and the possibility to change values
# when user double-clicks on a RW var.
#
# 2010-05-01 David Goncalves
# Added support for PyNotify (if available)
#
# 2010-05-05 David Goncalves
# Added support for command line options
# -> --start-hidden
# -> --favorite
#
# NUT-Monitor now tries to detect if there is a NUT server
# on localhost and if there is 1 UPS, connects to it.
#
# 2010-10-06 David Goncalves - Version 1.3
# Added localisation support
#
# 2015-02-14 Michal Fincham - Version 1.3.1
# Corrected unsafe permissions on ~/.nut-monitor (Debian #777706)
#
# 2022-02-20 Luke Dashjr - Version 2.0
# Port to Python 3 with PyQt5.
import PyQt5.uic
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
import base64
import os, os.path
import stat
import platform
import time
import threading
import optparse
import configparser
import locale
import gettext
import PyNUT
class interface :
DESIRED_FAVORITES_DIRECTORY_MODE = 0o700
__widgets = {}
__callbacks = {}
__favorites = {}
__favorites_file = None
__favorites_path = ""
__fav_menu_items = list()
__window_visible = True
__ui_file = None
__connected = False
__ups_handler = None
__ups_commands = None
__ups_vars = None
__ups_rw_vars = None
__gui_thread = None
__current_ups = None
def __init__( self, argv ) :
# Before anything, parse command line options if any present...
opt_parser = optparse.OptionParser()
opt_parser.add_option( "-H", "--start-hidden", action="store_true", default=False, dest="hidden", help="Start iconified in tray" )
opt_parser.add_option( "-F", "--favorite", dest="favorite", help="Load the specified favorite and connect to UPS" )
( cmd_opts, args ) = opt_parser.parse_args()
self.__app = QApplication( argv )
self.__ui_file = self.__find_res_file( 'ui', "window1.ui" )
self.__widgets["interface"] = PyQt5.uic.loadUi( self.__ui_file )
self.__widgets["main_window"] = self.__widgets["interface"]
self.__widgets["status_bar"] = self.__widgets["interface"].statusbar2
self.__widgets["ups_host_entry"] = self.__widgets["interface"].entry1
self.__widgets["ups_port_entry"] = self.__widgets["interface"].spinbutton1
self.__widgets["ups_refresh_button"] = self.__widgets["interface"].button1
self.__widgets["ups_authentication_check"] = self.__widgets["interface"].checkbutton1
self.__widgets["ups_authentication_frame"] = self.__widgets["interface"].hbox1
self.__widgets["ups_authentication_login"] = self.__widgets["interface"].entry2
self.__widgets["ups_authentication_password"] = self.__widgets["interface"].entry3
self.__widgets["ups_list_combo"] = self.__widgets["interface"].combobox1
self.__widgets["ups_commands_combo"] = self.__widgets["interface"].ups_commands_combo
self.__widgets["ups_commands_button"] = self.__widgets["interface"].button8
self.__widgets["ups_connect"] = self.__widgets["interface"].button2
self.__widgets["ups_disconnect"] = self.__widgets["interface"].button7
self.__widgets["ups_params_box"] = self.__widgets["interface"].vbox6
self.__widgets["ups_infos"] = self.__widgets["interface"].notebook1
self.__widgets["ups_vars_tree"] = self.__widgets["interface"].treeview1
self.__widgets["ups_vars_refresh"] = self.__widgets["interface"].button9
self.__widgets["ups_status_image"] = self.__widgets["interface"].image1
self.__widgets["ups_status_left"] = self.__widgets["interface"].label10
self.__widgets["ups_status_right"] = self.__widgets["interface"].label11
self.__widgets["ups_status_time"] = self.__widgets["interface"].label15
self.__widgets["menu_favorites_root"] = self.__widgets["interface"].menu2
self.__widgets["menu_favorites"] = self.__widgets["interface"].menu2
self.__widgets["menu_favorites_add"] = self.__widgets["interface"].menuitem4
self.__widgets["menu_favorites_del"] = self.__widgets["interface"].menuitem5
self.__widgets["progress_battery_charge"] = self.__widgets["interface"].progressbar1
self.__widgets["progress_battery_load"] = self.__widgets["interface"].progressbar2
# Create the tray icon and connect it to the show/hide method...
self.__widgets["status_icon"] = QSystemTrayIcon( QIcon( self.__find_res_file( "pixmaps", "on_line.png" ) ) )
self.__widgets["status_icon"].setVisible( True )
self.__widgets["status_icon"].activated.connect( self.tray_activated )
self.__widgets["ups_status_image"].setPixmap( QPixmap( self.__find_res_file( "pixmaps", "on_line.png" ) ) )
# Connect interface callbacks actions
self.__widgets["main_window"].destroyed.connect( self.quit )
self.__widgets["interface"].imagemenuitem1.triggered.connect( self.gui_about_dialog )
self.__widgets["interface"].imagemenuitem5.triggered.connect( self.quit )
self.__widgets["ups_host_entry"].textChanged.connect( self.__check_gui_fields )
self.__widgets["ups_authentication_login"].textChanged.connect( self.__check_gui_fields )
self.__widgets["ups_authentication_password"].textChanged.connect( self.__check_gui_fields )
self.__widgets["ups_authentication_check"].stateChanged.connect( self.__check_gui_fields )
self.__widgets["ups_port_entry"].valueChanged.connect( self.__check_gui_fields )
self.__widgets["ups_refresh_button"].clicked.connect( self.__update_ups_list )
self.__widgets["ups_connect"].clicked.connect( self.connect_to_ups )
self.__widgets["ups_disconnect"].clicked.connect( self.disconnect_from_ups )
self.__widgets["ups_vars_refresh"].clicked.connect( self.__gui_update_ups_vars_view )
self.__widgets["menu_favorites_add"].triggered.connect( self.__gui_add_favorite )
self.__widgets["menu_favorites_del"].triggered.connect( self.__gui_delete_favorite )
self.__widgets["ups_vars_tree"].doubleClicked.connect( self.__gui_ups_vars_selected )
# Remove the dummy combobox entry on UPS List and Commands
self.__widgets["ups_list_combo"].removeItem( 0 )
# Set UPS vars treeview properties -----------------------------
store = QStandardItemModel( 0, 3, self.__widgets["ups_vars_tree"] )
self.__widgets["ups_vars_tree"].setModel( store )
self.__widgets["ups_vars_tree"].setHeaderHidden( False )
self.__widgets["ups_vars_tree"].setRootIsDecorated( False )
# Column 0
store.setHeaderData( 0, Qt.Horizontal, '' )
# Column 1
store.setHeaderData( 1, Qt.Horizontal, _('Var name') )
# Column 2
store.setHeaderData( 2, Qt.Horizontal, _('Value') )
self.__widgets["ups_vars_tree"].header().setStretchLastSection( True )
self.__widgets["ups_vars_tree"].sortByColumn( 1, Qt.AscendingOrder )
self.__widgets["ups_vars_tree_store"] = store
self.__widgets["ups_vars_tree"].setMinimumSize( 0, 50 )
#---------------------------------------------------------------
# UPS Commands combo box creation ------------------------------
ups_commands_height = self.__widgets["ups_commands_combo"].size().height() * 2
self.__widgets["ups_commands_combo"].setMinimumSize(0, ups_commands_height)
self.__widgets["ups_commands_combo"].setCurrentIndex( 0 )
self.__widgets["ups_commands_button"].setMinimumSize(0, ups_commands_height)
self.__widgets["ups_commands_button"].clicked.connect( self.__gui_send_ups_command )
self.__widgets["ups_commands_combo_store"] = self.__widgets["ups_commands_combo"]
#---------------------------------------------------------------
self.gui_init_unconnected()
if ( cmd_opts.hidden != True ) :
self.__widgets["main_window"].show()
# Define favorites path and load favorites
if ( platform.system() == "Linux" ) :
self.__favorites_path = os.path.join( os.environ.get("HOME"), ".nut-monitor" )
elif ( platform.system() == "Windows" ) :
self.__favorites_path = os.path.join( os.environ.get("USERPROFILE"), "Application Data", "NUT-Monitor" )
self.__favorites_file = os.path.join( self.__favorites_path, "favorites.ini" )
self.__parse_favorites()
self.gui_status_message( _("Welcome to NUT Monitor") )
if ( cmd_opts.favorite != None ) :
if ( cmd_opts.favorite in self.__favorites ) :
self.__gui_load_favorite( fav_name=cmd_opts.favorite )
self.connect_to_ups()
else :
# Try to scan localhost for available ups and connect to it if there is only one
self.__widgets["ups_host_entry"].setText( "localhost" )
self.__update_ups_list()
if self.__widgets["ups_list_combo"].count() == 1:
self.connect_to_ups()
def exec( self ) :
self.__app.exec()
def __find_res_file( self, ftype, filename ) :
filename = os.path.join( ftype, filename )
# TODO: Skip checking application directory if installed
path = os.path.join( os.path.dirname( sys.argv[0] ), filename )
if os.path.exists(path):
return path
path = QStandardPaths.locate(QStandardPaths.AppDataLocation, filename)
if os.path.exists(path):
return path
raise RuntimeError("Cannot find %s resource %s" % (ftype, filename))
def __find_icon_file( self ) :
filename = 'nut-monitor.png'
# TODO: Skip checking application directory if installed
path = os.path.join( os.path.dirname( sys.argv[0] ), "icons", "256x256", filename )
if os.path.exists(path):
return path
path = QStandardPaths.locate(QStandardPaths.AppDataLocation, os.path.join( "icons", "hicolor", "256x256", "apps", filename ) )
if os.path.exists(path):
return path
raise RuntimeError("Cannot find %s resource %s" % ('icon', filename))
# Check if correct fields are filled to enable connection to the UPS
def __check_gui_fields( self, widget=None ) :
# If UPS list contains something, clear it
if self.__widgets["ups_list_combo"].currentIndex() != -1 :
self.__widgets["ups_list_combo"].clear()
self.__widgets["ups_connect"].setEnabled( False )
self.__widgets["menu_favorites_add"].setEnabled( False )
# Host/Port selection
if len( self.__widgets["ups_host_entry"].text() ) > 0 :
sensitive = True
# If authentication is selected, check that we have a login and password
if self.__widgets["ups_authentication_check"].isChecked() :
if len( self.__widgets["ups_authentication_login"].text() ) == 0 :
sensitive = False
if len( self.__widgets["ups_authentication_password"].text() ) == 0 :
sensitive = False
self.__widgets["ups_refresh_button"].setEnabled( sensitive )
if not sensitive :
self.__widgets["ups_connect"].setEnabled( False )
self.__widgets["menu_favorites_add"].setEnabled( False )
else :
self.__widgets["ups_refresh_button"].setEnabled( False )
self.__widgets["ups_connect"].setEnabled( False )
self.__widgets["menu_favorites_add"].setEnabled( False )
# Use authentication fields...
if self.__widgets["ups_authentication_check"].isChecked() :
self.__widgets["ups_authentication_frame"].setEnabled( True )
else :
self.__widgets["ups_authentication_frame"].setEnabled( False )
self.gui_status_message()
#-------------------------------------------------------------------
# This method is used to show/hide the main window when user clicks on the tray icon
def tray_activated( self, widget=None, data=None ) :
if self.__window_visible :
self.__widgets["main_window"].hide()
else :
self.__widgets["main_window"].show()
self.__window_visible = not self.__window_visible
#-------------------------------------------------------------------
# Change the status icon and tray icon
def change_status_icon( self, icon="on_line", blink=False ) :
self.__widgets["status_icon"].setIcon( QIcon( self.__find_res_file( "pixmaps", "%s.png" % icon ) ) )
self.__widgets["ups_status_image"].setPixmap( QPixmap( self.__find_res_file( "pixmaps", "%s.png" % icon ) ) )
# TODO self.__widgets["status_icon"].set_blinking( blink )
#-------------------------------------------------------------------
# This method connects to the NUT server and retrieve availables UPSes
# using connection parameters (host, port, login, pass...)
def __update_ups_list( self, widget=None ) :
host = self.__widgets["ups_host_entry"].text()
port = int( self.__widgets["ups_port_entry"].value() )
login = None
password = None
if self.__widgets["ups_authentication_check"].isChecked() :
login = self.__widgets["ups_authentication_login"].text()
password = self.__widgets["ups_authentication_password"].text()
try :
nut_handler = PyNUT.PyNUTClient( host=host, port=port, login=login, password=password )
upses = nut_handler.GetUPSList()
ups_list = list(key.decode('ascii') for key in upses.keys())
ups_list.sort()
# If UPS list contains something, clear it
self.__widgets["ups_list_combo"].clear()
for current in ups_list :
self.__widgets["ups_list_combo"].addItem( current )
self.__widgets["ups_list_combo"].setCurrentIndex( 0 )
self.__widgets["ups_connect"].setEnabled( True )
self.__widgets["menu_favorites_add"].setEnabled( True )
self.gui_status_message( _("Found {0} devices on {1}").format( len( ups_list ), host ) )
except :
error_msg = _("Error connecting to '{0}' ({1})").format( host, sys.exc_info()[1] )
self.gui_status_message( error_msg )
#-------------------------------------------------------------------
# Quit program
def quit( self, widget=None ) :
# If we are connected to an UPS, disconnect first...
if self.__connected :
self.gui_status_message( _("Disconnecting from device") )
self.disconnect_from_ups()
self.__app.quit()
#-------------------------------------------------------------------
# Method called when user wants to add a new favorite entry. It
# displays a dialog to enable user to select the name of the favorite
def __gui_add_favorite( self, widget=None ) :
dialog_ui_file = self.__find_res_file( 'ui', "dialog1.ui" )
dialog = PyQt5.uic.loadUi( dialog_ui_file )
# Define interface callbacks actions
def check_entry(val):
if self.__gui_add_favorite_check_gui_fields(val):
dialog.buttonBox.button(QDialogButtonBox.Ok).setEnabled( True )
else:
dialog.buttonBox.button(QDialogButtonBox.Ok).setEnabled( False )
dialog.entry4.textChanged.connect( check_entry )
self.__widgets["main_window"].setEnabled( False )
rc = dialog.exec()
if rc == QDialog.Accepted :
fav_data = {}
fav_data["host"] = self.__widgets["ups_host_entry"].text()
fav_data["port"] = "%d" % self.__widgets["ups_port_entry"].value()
fav_data["ups"] = self.__widgets["ups_list_combo"].currentText()
fav_data["auth"] = self.__widgets["ups_authentication_check"].isChecked()
if fav_data["auth"] :
fav_data["login"] = self.__widgets["ups_authentication_login"].text()
fav_data["password"] = base64.b64encode( self.__widgets["ups_authentication_password"].text().encode('ascii') ).decode('ascii')
fav_name = dialog.entry4.text()
self.__favorites[ fav_name ] = fav_data
self.__gui_refresh_favorites_menu()
# Save all favorites
self.__save_favorites()
self.__widgets["main_window"].setEnabled( True )
#-------------------------------------------------------------------
# Method called when user wants to delete an entry from favorites
def __gui_delete_favorite( self, widget=None ) :
dialog_ui_file = self.__find_res_file( 'ui', "dialog2.ui" )
dialog = PyQt5.uic.loadUi( dialog_ui_file )
# Remove the dummy combobox entry on list
dialog.combobox2.removeItem( 0 )
favs = list(self.__favorites.keys())
favs.sort()
for current in favs :
dialog.combobox2.addItem( current )
dialog.combobox2.setCurrentIndex( 0 )
self.__widgets["main_window"].setEnabled( False )
rc = dialog.exec()
fav_name = dialog.combobox2.currentText()
self.__widgets["main_window"].setEnabled( True )
if ( rc == QDialog.Accepted ) :
# Remove entry, show confirmation dialog
resp = QMessageBox.question( None, self.__widgets["main_window"].windowTitle(), _("Are you sure that you want to remove this favorite ?"), QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes )
if ( resp == QMessageBox.Yes ) :
del self.__favorites[ fav_name ]
self.__gui_refresh_favorites_menu()
self.__save_favorites()
self.gui_status_message( _("Removed favorite '%s'") % fav_name )
#-------------------------------------------------------------------
# Method called when user selects a favorite from the favorites menu
def __gui_load_favorite( self, fav_name="" ) :
if ( fav_name in self.__favorites ) :
# If auth is activated, process it before other fields to avoir weird
# reactions with the 'check_gui_fields' function.
if ( self.__favorites[fav_name].get("auth", False ) ) :
self.__widgets["ups_authentication_check"].setChecked( True )
self.__widgets["ups_authentication_login"].setText( self.__favorites[fav_name].get("login","") )
self.__widgets["ups_authentication_password"].setText( self.__favorites[fav_name].get("password","") )
self.__widgets["ups_host_entry"].setText( self.__favorites[fav_name].get("host","") )
self.__widgets["ups_port_entry"].setValue( int( self.__favorites[fav_name].get( "port", 3493 ) ) )
# Clear UPS list and add current UPS name
self.__widgets["ups_list_combo"].clear()
self.__widgets["ups_list_combo"].addItem( self.__favorites[fav_name].get("ups","") )
self.__widgets["ups_list_combo"].setCurrentIndex( 0 )
# Activate the connect button
self.__widgets["ups_connect"].setEnabled( True )
self.gui_status_message( _("Loaded '%s'") % fav_name )
#-------------------------------------------------------------------
# Send the selected command to the UPS
def __gui_send_ups_command( self, widget=None ) :
offset = self.__widgets["ups_commands_combo"].currentIndex()
cmd = self.__ups_commands[ offset ].decode('ascii')
self.__widgets["main_window"].setEnabled( False )
resp = QMessageBox.question( None, self.__widgets["main_window"].windowTitle(), _("Are you sure that you want to send '%s' to the device ?") % cmd, QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes )
self.__widgets["main_window"].setEnabled( True )
if ( resp == QMessageBox.Yes ) :
try :
self.__ups_handler.RunUPSCommand( self.__current_ups, cmd )
self.gui_status_message( _("Sent '{0}' command to {1}").format( cmd, self.__current_ups ) )
except :
self.gui_status_message( _("Failed to send '{0}' ({1})").format( cmd, sys.exc_info()[1] ) )
#-------------------------------------------------------------------
# Method called when user clicks on the UPS vars treeview. If the user
# performs a double click on a RW var, the GUI shows the update var dialog.
def __gui_ups_vars_selected( self, index ) :
if True :
model = self.__widgets["ups_vars_tree_store"]
try :
ups_var = model.data( index.siblingAtColumn(1) ).encode('ascii')
if ( ups_var in self.__ups_rw_vars ) :
# The selected var is RW, then we can show the update dialog
cur_val = self.__ups_rw_vars.get(ups_var).decode('ascii')
self.__widgets["main_window"].setEnabled( False )
new_val, rc = QInputDialog.getText( None, self.__widgets["main_window"].windowTitle(), _("Enter a new value for the variable.<br><br>{0} = {1} <font color=\"#606060\"><i>(current value)</i></font>").format( ups_var, cur_val), QLineEdit.Normal, cur_val )
self.__widgets["main_window"].setEnabled( True )
if ( rc ) :
try :
self.__ups_handler.SetRWVar( ups=self.__current_ups, var=ups_var.decode('ascii'), value=new_val )
self.gui_status_message( _("Updated variable on %s") % self.__current_ups )
# Change the value on the local dict to update the GUI
new_val = new_val.encode('ascii')
self.__ups_vars[ups_var] = new_val
self.__ups_rw_vars[ups_var] = new_val
self.__gui_update_ups_vars_view()
except :
error_msg = _("Error updating variable on '{0}' ({1})").format( self.__current_ups, sys.exc_info()[1] )
self.gui_status_message( error_msg )
else :
# User cancelled modification...
error_msg = _("No variable modified on %s - User cancelled") % self.__current_ups
self.gui_status_message( error_msg )
except :
# Failed to get information from the treeview... skip action
pass
#-------------------------------------------------------------------
# Refresh the content of the favorites menu according to the defined favorites
def __gui_refresh_favorites_menu( self ) :
for current in self.__fav_menu_items :
self.__widgets["menu_favorites"].removeAction(current)
self.__fav_menu_items = list()
items = list(self.__favorites.keys())
items.sort()
for current in items :
menu_item = QAction( current )
self.__fav_menu_items.append( menu_item )
self.__widgets["menu_favorites"].addAction( menu_item )
menu_item.triggered.connect( lambda: self.__gui_load_favorite( current ) )
if len( items ) > 0 :
self.__widgets["menu_favorites_del"].setEnabled( True )
else :
self.__widgets["menu_favorites_del"].setEnabled( False )
#-------------------------------------------------------------------
# In 'add favorites' dialog, this method compares the content of the
# text widget representing the name of the new favorite with existing
# ones. If they match, the 'add' button will be set to non sensitive
# to avoid creating entries with the same name.
def __gui_add_favorite_check_gui_fields( self, fav_name ) :
if ( len( fav_name ) > 0 ) and ( fav_name not in list(self.__favorites.keys()) ) :
return True
else :
return False
#-------------------------------------------------------------------
# Load and parse favorites
def __parse_favorites( self ) :
if ( not os.path.exists( self.__favorites_file ) ) :
# There is no favorites files, do nothing
return
try :
if ( not stat.S_IMODE( os.stat( self.__favorites_path ).st_mode ) == self.DESIRED_FAVORITES_DIRECTORY_MODE ) : # unsafe pre-1.2 directory found
os.chmod( self.__favorites_path, self.DESIRED_FAVORITES_DIRECTORY_MODE )
conf = configparser.ConfigParser()
conf.read( self.__favorites_file )
for current in conf.sections() :
# Check if mandatory fields are present
if ( conf.has_option( current, "host" ) and conf.has_option( current, "ups" ) ) :
# Valid entry found, add it to the list
fav_data = {}
fav_data["host"] = conf.get( current, "host" )
fav_data["ups"] = conf.get( current, "ups" )
if ( conf.has_option( current, "port" ) ) :
fav_data["port"] = conf.get( current, "port" )
else :
fav_data["port"] = "3493"
# If auth is defined the section must have login and pass defined
if ( conf.has_option( current, "auth" ) ) :
if( conf.has_option( current, "login" ) and conf.has_option( current, "password" ) ) :
# Add the entry
fav_data["auth"] = conf.getboolean( current, "auth" )
fav_data["login"] = conf.get( current, "login" )
try :
fav_data["password"] = base64.decodebytes( conf.get( current, "password" ).encode('ascii') ).decode('ascii')
except :
# If the password is not in base64, let the field empty
print(( _("Error parsing favorites, password for '%s' is not in base64\nSkipping password for this entry") % current ))
fav_data["password"] = ""
else :
fav_data["auth"] = False
self.__favorites[current] = fav_data
self.__gui_refresh_favorites_menu()
except :
self.gui_status_message( _("Error while parsing favorites file (%s)") % sys.exc_info()[1] )
#-------------------------------------------------------------------
# Save favorites to the defined favorites file using ini format
def __save_favorites( self ) :
# If path does not exists, try to create it
if ( not os.path.exists( self.__favorites_file ) ) :
try :
os.makedirs( self.__favorites_path, mode=self.DESIRED_FAVORITES_DIRECTORY_MODE, exist_ok=True )
except :
self.gui_status_message( _("Error while creating configuration folder (%s)") % sys.exc_info()[1] )
save_conf = configparser.ConfigParser()
for current in list(self.__favorites.keys()) :
save_conf.add_section( current )
for k, v in self.__favorites[ current ].items() :
if isinstance( v, bool ) :
v = str( v )
save_conf.set( current, k, v )
try :
fh = open( self.__favorites_file, "w" )
save_conf.write( fh )
fh.close()
self.gui_status_message( _("Saved favorites...") )
except :
self.gui_status_message( _("Error while saving favorites (%s)") % sys.exc_info()[1] )
#-------------------------------------------------------------------
# Display the about dialog
def gui_about_dialog( self, widget=None ) :
self.__widgets["main_window"].adjustSize()
dialog_ui_file = self.__find_res_file( 'ui', "aboutdialog1.ui" )
dialog = PyQt5.uic.loadUi( dialog_ui_file )
dialog.icon.setPixmap( QPixmap( self.__find_icon_file() ) )
credits_button = QPushButton( dialog )
credits_button.setText( _("C&redits") )
credits_button.setIcon( dialog.style().standardIcon( QStyle.SP_MessageBoxInformation ) )
credits_button.clicked.connect( self.gui_about_credits )
licence_button = QPushButton( dialog )
licence_button.setText( _("&Licence") )
licence_button.clicked.connect( self.gui_about_licence )
dialog.buttonBox.addButton( credits_button, QDialogButtonBox.HelpRole )
dialog.buttonBox.addButton( licence_button, QDialogButtonBox.HelpRole )
self.__widgets["main_window"].setEnabled( False )
dialog.exec()
self.__widgets["main_window"].setEnabled( True )
def gui_about_credits( self ) :
QMessageBox.about( None, _("Credits"), _("""
Written by:
David Goncalves <david@lestat.st>
Translated by:
David Goncalves <david@lestat.st> - Français
Daniele Pezzini <hyouko@gmail.com> - Italiano
""").strip() )
def gui_about_licence( self ) :
QMessageBox.about( None, _("Licence"), _("""
Copyright (C) 2010 David Goncalves <david@lestat.st>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
""").strip() )
#-------------------------------------------------------------------
# Display a message on the status bar. The message is also set as
# tooltip to enable users to see long messages.
def gui_status_message( self, msg="" ) :
text = msg
message_id = self.__widgets["status_bar"].showMessage( text.replace("\n", "") )
self.__widgets["status_bar"].setToolTip( text )
#-------------------------------------------------------------------
# Display a notification using QSystemTrayIcon with an optional icon
def gui_status_notification( self, message="", icon_file="" ) :
if ( icon_file != "" ) :
icon = QIcon( os.path.abspath( self.__find_res_file( "pixmaps", icon_file ) ) )
else :
icon = None
self.__widgets["status_icon"].showMessage( "NUT Monitor", message, icon )
#-------------------------------------------------------------------
# Connect to the selected UPS using parameters (host,port,login,pass)
def connect_to_ups( self, widget=None ) :
host = self.__widgets["ups_host_entry"].text()
port = int( self.__widgets["ups_port_entry"].value() )
login = None
password = None
if self.__widgets["ups_authentication_check"].isChecked() :
login = self.__widgets["ups_authentication_login"].text()
password = self.__widgets["ups_authentication_password"].text()
try :
self.__ups_handler = PyNUT.PyNUTClient( host=host, port=port, login=login, password=password )
except :
self.gui_status_message( _("Error connecting to '{0}' ({1})").format( host, sys.exc_info()[1] ) )
self.gui_status_notification( _("Error connecting to '{0}'\n{1}").format( host, sys.exc_info()[1] ), "warning.png" )
return
# Check if selected UPS exists on server...
srv_upses = self.__ups_handler.GetUPSList()
self.__current_ups = self.__widgets["ups_list_combo"].currentText()
if self.__current_ups.encode('ascii') not in srv_upses :
self.gui_status_message( _("Device '%s' not found on server") % self.__current_ups )
self.gui_status_notification( _("Device '%s' not found on server") % self.__current_ups, "warning.png" )
return
self.__connected = True
self.__widgets["ups_connect"].hide()
self.__widgets["ups_disconnect"].show()
self.__widgets["ups_infos"].show()
self.__widgets["ups_params_box"].setEnabled( False )
self.__widgets["menu_favorites_root"].setEnabled( False )
self.__widgets["ups_params_box"].hide()
commands = self.__ups_handler.GetUPSCommands( self.__current_ups )
self.__ups_commands = list(commands.keys())
self.__ups_commands.sort()
# Refresh UPS commands combo box
self.__widgets["ups_commands_combo_store"].clear()
for desc in self.__ups_commands :
# TODO: Style as "%s<br><font color=\"#707070\">%s</font>"
self.__widgets["ups_commands_combo_store"].addItem( "%s\n%s" % ( desc.decode('ascii'), commands[desc].decode('ascii') ) )
self.__widgets["ups_commands_combo"].setCurrentIndex( 0 )
# Update UPS vars manually before the thread
self.__ups_vars = self.__ups_handler.GetUPSVars( self.__current_ups )
self.__ups_rw_vars = self.__ups_handler.GetRWVars( self.__current_ups )
self.__gui_update_ups_vars_view()
# Try to resize the main window...
# FIXME: For some reason, calling this immediately doesn't work right
QTimer.singleShot(10, self.__widgets["main_window"].adjustSize)
# Start the GUI updater thread
self.__gui_thread = gui_updater( self )
self.__gui_thread.start()
self.gui_status_message( _("Connected to '{0}' on {1}").format( self.__current_ups, host ) )
#-------------------------------------------------------------------
# Refresh UPS vars in the treeview
def __gui_update_ups_vars_view( self, widget=None ) :
if self.__ups_handler :
vars = self.__ups_vars
rwvars = self.__ups_rw_vars
self.__widgets["ups_vars_tree_store"].removeRows(0, self.__widgets["ups_vars_tree_store"].rowCount())
for k,v in vars.items() :
if ( k in rwvars ) :
icon_file = self.__find_res_file( "pixmaps", "var-rw.png" )
else :
icon_file = self.__find_res_file( "pixmaps", "var-ro.png" )
icon = QIcon( icon_file )
item_icon = QStandardItem(icon, '')
item_icon.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemNeverHasChildren)
item_var_name = QStandardItem( k.decode('ascii') )
item_var_name.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemNeverHasChildren)
item_var_val = QStandardItem( v.decode('ascii') )
item_var_val.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemNeverHasChildren)
self.__widgets["ups_vars_tree_store"].appendRow( (item_icon, item_var_name, item_var_val) )
self.__widgets["ups_vars_tree"].resizeColumnToContents( 0 )
self.__widgets["ups_vars_tree"].resizeColumnToContents( 1 )
def gui_init_unconnected( self ) :
self.__connected = False
self.__widgets["ups_connect"].show()
self.__widgets["ups_disconnect"].hide()
self.__widgets["ups_infos"].hide()
self.__widgets["ups_params_box"].setEnabled( True )
self.__widgets["menu_favorites_root"].setEnabled( True )
self.__widgets["status_icon"].setToolTip( _("<i>Not connected</i>") )
self.__widgets["ups_params_box"].show()
# Try to resize the main window...
self.__widgets["main_window"].adjustSize()
#-------------------------------------------------------------------
# Disconnect from the UPS
def disconnect_from_ups( self, widget=None ) :
self.gui_init_unconnected()
# Stop the GUI updater thread
self.__gui_thread.stop_thread()
del self.__ups_handler
self.gui_status_message( _("Disconnected from '%s'") % self.__current_ups )
self.change_status_icon( "on_line", blink=False )
self.__current_ups = None
#-----------------------------------------------------------------------
# GUI Updater class
# This class updates the main gui with data from connected UPS
class gui_updater :
__parent_class = None
__stop_thread = False
def __init__( self, parent_class ) :
threading.Thread.__init__( self )
self.__parent_class = parent_class
def start( self ) :
self.__timer = QTimer()
self.__timer.timeout.connect(self.__update)
self.__timer.start(1000)
def __update( self ) :
ups = self.__parent_class._interface__current_ups
was_online = True
# Define a dict containing different UPS status
status_mapper = { b"LB" : "<font color=\"#BB0000\"><b>%s</b></font>" % _("Low batteries"),
b"RB" : "<font color=\"#FF0000\"><b>%s</b></font>" % _("Replace batteries !"),
b"BYPASS" : "<font color=\"#BB0000\">Bypass</font> <i>%s</i>" % _("(no battery protection)"),
b"CAL" : _("Performing runtime calibration"),
b"OFF" : "<font color=\"#000090\">%s</font> <i>(%s)</i>" % ( _("Offline"), _("not providing power to the load") ),
b"OVER" : "<font color=\"#BB0000\">%s</font> <i>(%s)</i>" % ( _("Overloaded !"), _("there is too much load for device") ),
b"TRIM" : _("Triming <i>(UPS is triming incoming voltage)</i>"),
b"BOOST" : _("Boost <i>(UPS is boosting incoming voltage)</i>")
}
if not self.__stop_thread :
try :
vars = self.__parent_class._interface__ups_handler.GetUPSVars( ups )
self.__parent_class._interface__ups_vars = vars
# Text displayed on the status frame
text_left = ""
text_right = ""
status_text = ""
text_left += "<b>%s</b><br>" % _("Device status :")
if ( vars.get(b"ups.status").find(b"OL") != -1 ) :
text_right += "<font color=\"#009000\"><b>%s</b></font>" % _("Online")
if not was_online :
self.__parent_class.change_status_icon( "on_line", blink=False )
was_online = True
if ( vars.get(b"ups.status").find(b"OB") != -1 ) :
text_right += "<font color=\"#900000\"><b>%s</b></font>" % _("On batteries")
if was_online :
self.__parent_class.change_status_icon( "on_battery", blink=True )
self.__parent_class.gui_status_notification( _("Device is running on batteries"), "on_battery.png" )
was_online = False
# Check for additionnal information
for k,v in status_mapper.items() :
if vars.get(b"ups.status").find(k) != -1 :
if ( text_right != "" ) :
text_right += " - %s" % v
else :
text_right += "%s" % v
# CHRG and DISCHRG cannot be trated with the previous loop ;)
if ( vars.get(b"ups.status").find(b"DISCHRG") != -1 ) :
text_right += " - <i>%s</i>" % _("discharging")
elif ( vars.get(b"ups.status").find(b"CHRG") != -1 ) :
text_right += " - <i>%s</i>" % _("charging")
status_text += text_right
text_right += "<br>"
if ( b"ups.mfr" in vars ) :
text_left += "<b>%s</b><br><br>" % _("Model :")
text_right += "%s<br>%s<br>" % (
vars.get(b"ups.mfr",b"").decode('ascii'),
vars.get(b"ups.model",b"").decode('ascii'),
)
if ( b"ups.temperature" in vars ) :
text_left += "<b>%s</b><br>" % _("Temperature :")
text_right += "%s<br>" % int( float( vars.get( b"ups.temperature", 0 ) ) )
if ( b"battery.voltage" in vars ) :
text_left += "<b>%s</b><br>" % _("Battery voltage :")
text_right += "%sv<br>" % (vars.get( b"battery.voltage", 0 ).decode('ascii'),)
self.__parent_class._interface__widgets["ups_status_left"].setText( text_left[:-4] )
self.__parent_class._interface__widgets["ups_status_right"].setText( text_right[:-4] )
# UPS load and battery charge progress bars
self.__parent_class._interface__widgets["progress_battery_charge"].setRange( 0, 100 )
if ( b"battery.charge" in vars ) :
charge = vars.get( b"battery.charge", "0" )
self.__parent_class._interface__widgets["progress_battery_charge"].setValue( int( float( charge ) ) )
self.__parent_class._interface__widgets["progress_battery_charge"].resetFormat()
status_text += "<br>%s %s%%" % ( _("Battery charge :"), int( float( charge ) ) )
else :
self.__parent_class._interface__widgets["progress_battery_charge"].setValue( 0 )
self.__parent_class._interface__widgets["progress_battery_charge"].setFormat( _("Not available") )
# FIXME: Some themes don't draw text, so swap it with a QLabel?
self.__parent_class._interface__widgets["progress_battery_load"].setRange( 0, 100 )
if ( b"ups.load" in vars ) :
load = vars.get( b"ups.load", "0" )
self.__parent_class._interface__widgets["progress_battery_load"].setValue( int( float( load ) ) )
self.__parent_class._interface__widgets["progress_battery_load"].resetFormat()
status_text += "<br>%s %s%%" % ( _("UPS load :"), int( float( load ) ) )
else :
self.__parent_class._interface__widgets["progress_battery_load"].setValue( 0 )
self.__parent_class._interface__widgets["progress_battery_load"].setFormat( _("Not available") )
# FIXME: Some themes don't draw text, so swap it with a QLabel?
if ( b"battery.runtime" in vars ) :
autonomy = int( float( vars.get( b"battery.runtime", 0 ) ) )
if ( autonomy >= 3600 ) :
info = time.strftime( _("<b>%H hours %M minutes %S seconds</b>"), time.gmtime( autonomy ) )
elif ( autonomy > 300 ) :
info = time.strftime( _("<b>%M minutes %S seconds</b>"), time.gmtime( autonomy ) )
else :
info = time.strftime( _("<b><font color=\"#DD0000\">%M minutes %S seconds</font></b>"), time.gmtime( autonomy ) )
else :
info = _("Not available")
self.__parent_class._interface__widgets["ups_status_time"].setText( info )
# Display UPS status as tooltip for tray icon
self.__parent_class._interface__widgets["status_icon"].setToolTip( status_text )
except :
self.__parent_class.gui_status_message( _("Error from '{0}' ({1})").format( ups, sys.exc_info()[1] ) )
self.__parent_class.gui_status_notification( _("Error from '{0}'\n{1}").format( ups, sys.exc_info()[1] ), "warning.png" )
def stop_thread( self ) :
self.__timer.stop()
#-----------------------------------------------------------------------
# The main program starts here :-)
if __name__ == "__main__" :
# Init the localisation
APP = "NUT-Monitor"
DIR = "locale"
gettext.bindtextdomain( APP, DIR )
gettext.textdomain( APP )
_ = gettext.gettext
for module in ( gettext, ) :
module.bindtextdomain( APP, DIR )
module.textdomain( APP )
gui = interface(sys.argv)
gui.exec()

View file

@ -1,7 +1,55 @@
NUT-Monitor is a graphical application to access and manager UPSes connected to
NUT-Monitor
===========
NUT-Monitor is a graphical application to access and manage UPSes connected to
a NUT (Network UPS Tools) server.
This application (written in Python + GTK) uses the python-pynut class
(available at http://www.lestat.st)
Dependencies
------------
David Goncalves <david@lestat.st>
This application (variants written in Python 2 + GTK2, and in Python 3 + Qt5)
uses the python-pynut class (available at http://www.lestat.st), delivered
as PyNUT in the NUT source tree.
Refer to your OS packaging and/or install custom modules with `pip` (or `pip3`)
to get required dependencies (GTK + GObject or QT5).
Path to PyNUT module
--------------------
For quick tests (e.g. during development), you can run the clients like this:
````
:; PYTHONPATH=../module/ python2 ./NUT-Monitor-py2gtk2.in
````
or:
````
:; PYTHONPATH=../module/ python3 ./NUT-Monitor-py3qt5.in
````
Localization
------------
For localized UI, also `export LANG=fr_FR.UTF-8` or `export LANG=ru_RU.UTF-8`
(see and feel welcome to improve the choice of languages in `locale` directory).
NOTE: Currently localization only works for Python 2 client, PRs are welcome.
Desktop menu integration
------------------------
This component ships both implementation-specific `nut-monitor-py2gtk2.desktop`
and `nut-monitor-py3qt5.desktop` files which allows a user to have icons for
both variants separately, as well as the legacy-named `nut-monitor.desktop`
for running the wrapper script `NUT-Monitor` which picks an implementation best
suited for current run-time circumstances.
Kudos
-----
NUT-Monitor and PyNUT (for Python 2 syntax) were originally authored
by David Goncalves <david@lestat.st>
NUT-Monitor was converted to Python 3 + QT5 by Luke Dashjr
PyNUT was extended, and two variants of NUT-Monitor converged and wrapped
for Python 2+3 dual support by Jim Klimov

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,490 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48"
height="48"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45"
version="1.0"
sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/devices"
sodipodi:docname="battery.svg"
inkscape:export-filename="/home/lapo/Desktop/per jimmac/scalable/devices/battery.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs4">
<linearGradient
id="linearGradient3367">
<stop
id="stop3369"
offset="0"
style="stop-color:#555753" />
<stop
style="stop-color:#8a8d85;stop-opacity:1;"
offset="0.32156199"
id="stop3371" />
<stop
style="stop-color:#babdb6;stop-opacity:1;"
offset="0.53021115"
id="stop3373" />
<stop
id="stop3375"
offset="0.85266888"
style="stop-color:#dcdeda;stop-opacity:1;" />
<stop
id="stop3377"
offset="1"
style="stop-color:#babdb6" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3351">
<stop
style="stop-color:#888a85"
offset="0"
id="stop3353" />
<stop
style="stop-color:#555753"
offset="1"
id="stop3355" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3290">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3292" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3294" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3280">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3282" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3284" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3265">
<stop
style="stop-color:#c4a000;stop-opacity:1;"
offset="0"
id="stop3267" />
<stop
style="stop-color:#c4a000;stop-opacity:0;"
offset="1"
id="stop3269" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3254">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3256" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3258" />
</linearGradient>
<linearGradient
id="linearGradient3236">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3238" />
<stop
style="stop-color:#fce94f"
offset="1"
id="stop3240" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3227">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3229" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3231" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3217">
<stop
style="stop-color:#c4a000;stop-opacity:1;"
offset="0"
id="stop3219" />
<stop
style="stop-color:#edd400"
offset="1"
id="stop3221" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3174">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3176" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3178" />
</linearGradient>
<linearGradient
id="linearGradient3146">
<stop
id="stop3148"
offset="0"
style="stop-color:#c4a000" />
<stop
style="stop-color:#d8ba00;stop-opacity:1;"
offset="0.35133624"
id="stop3160" />
<stop
style="stop-color:#edd400;stop-opacity:1;"
offset="0.50020754"
id="stop3152" />
<stop
id="stop3162"
offset="0.85000002"
style="stop-color:#fdf4a7;stop-opacity:1;" />
<stop
id="stop3158"
offset="1"
style="stop-color:#fce94f" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3280"
id="radialGradient3286"
cx="21.34375"
cy="14.125"
fx="21.34375"
fy="14.125"
r="11.96875"
gradientTransform="matrix(1,0,0,0.302872,8.341852e-16,9.846932)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3236"
id="radialGradient3337"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.690032,-4.583908e-18,1.406348e-18,0.228281,6.615871,10.90053)"
cx="19.717636"
cy="16.677069"
fx="19.717636"
fy="16.677069"
r="12.46875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3174"
id="radialGradient3339"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.253821,-0.396912,0.124986,0.425706,-7.949749,14.71501)"
cx="19.161945"
cy="24.691038"
fx="19.161945"
fy="24.691038"
r="12.46875" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3265"
id="linearGradient3341"
gradientUnits="userSpaceOnUse"
x1="31.18708"
y1="9.9904861"
x2="25.531752"
y2="18.613125" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3174"
id="radialGradient3343"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.253821,-0.396912,0.124986,0.425706,-7.949749,14.71501)"
cx="19.161945"
cy="24.691038"
fx="19.161945"
fy="24.691038"
r="12.46875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3227"
id="radialGradient3347"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.499279,-0.163895,3.603099e-2,0.557877,-10.01886,8.004429)"
cx="19.863604"
cy="11.205179"
fx="19.863604"
fy="11.205179"
r="4" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3217"
id="linearGradient3380"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(2,-4.760636e-13)"
x1="18.5625"
y1="11.1875"
x2="17.71875"
y2="12.534899" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3146"
id="linearGradient3384"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(2,-4.760636e-13)"
x1="25.500298"
y1="10.985043"
x2="17.499449"
y2="10.985043" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3351"
id="linearGradient3393"
gradientUnits="userSpaceOnUse"
x1="13.375"
y1="23.221346"
x2="13.375"
y2="32.383766"
gradientTransform="translate(-2,-4.760636e-13)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3290"
id="linearGradient3398"
gradientUnits="userSpaceOnUse"
x1="13.96536"
y1="10.495919"
x2="20.682875"
y2="31.382992"
gradientTransform="translate(2,0)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3254"
id="linearGradient3401"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(2,-4.760636e-13)"
x1="12.25"
y1="20.230709"
x2="17.125"
y2="34.173542" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3146"
id="linearGradient3404"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(2,-4.760636e-13)"
x1="33.5625"
y1="19.125"
x2="9.4987011"
y2="19.125" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3367"
id="linearGradient3407"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(2,-4.760636e-13)"
x1="33.50008"
y1="28.375"
x2="9.4992361"
y2="28.375" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="34.743513"
inkscape:cy="19.440609"
inkscape:document-units="px"
inkscape:current-layer="layer5"
showgrid="false"
gridempspacing="2"
gridspacingx="0.5px"
gridspacingy="0.5px"
inkscape:window-width="872"
inkscape:window-height="771"
inkscape:window-x="392"
inkscape:window-y="55"
stroke="#c4a000"
inkscape:grid-points="false"
inkscape:grid-bbox="true"
fill="#555753"
showborder="false"
inkscape:showpageshadow="false" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:creator>
<cc:Agent>
<dc:title>Lapo Calamandrei</dc:title>
</cc:Agent>
</dc:creator>
<dc:title>Battery</dc:title>
<dc:subject>
<rdf:Bag>
<rdf:li>battery</rdf:li>
<rdf:li>recharge</rdf:li>
<rdf:li>power</rdf:li>
<rdf:li>acpi</rdf:li>
<rdf:li>apm</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
<cc:requires
rdf:resource="http://web.resource.org/cc/SourceCode" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer6"
inkscape:label="Shadow"
style="display:inline">
<path
sodipodi:type="arc"
style="opacity:0.7254902;color:#000000;fill:url(#radialGradient3286);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
id="path3278"
sodipodi:cx="21.34375"
sodipodi:cy="14.125"
sodipodi:rx="11.96875"
sodipodi:ry="3.625"
d="M 33.3125 14.125 A 11.96875 3.625 0 1 1 9.375,14.125 A 11.96875 3.625 0 1 1 33.3125 14.125 z"
transform="matrix(1.389034,0,0,1.337644,-6.147196,18.98077)" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Battery"
style="display:inline" />
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="inner stroke"
style="display:inline" />
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="tip"
style="display:inline">
<path
style="color:#000000;fill:url(#linearGradient3407);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 22,10.5 C 16.084021,10.716519 11.5,12.21646 11.5,14 L 11.5,37 C 11.5,38.932002 16.876,40.500001 23.5,40.5 C 30.124,40.5 35.5,38.932003 35.5,37 L 35.5,14 C 35.5,12.067998 30.124001,10.5 23.5,10.5 C 23.13775,10.5 22.79161,10.490818 22.4375,10.5 C 22.294038,10.50372 22.141983,10.494804 22,10.5 z "
id="path2230"
sodipodi:nodetypes="csssssssc" />
<path
style="color:#000000;fill:url(#linearGradient3404);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 22.4375,10.5 C 16.316456,10.658717 11.5,12.173655 11.5,14 L 11.5,20.5 C 11.5,22.432002 16.875999,24.000001 23.5,24 C 30.124,24 35.5,22.432001 35.5,20.5 L 35.5,14 C 35.5,12.067998 30.124,10.5 23.5,10.5 C 23.13775,10.5 22.79161,10.490818 22.4375,10.5 z "
id="path2232"
sodipodi:nodetypes="cssssssc" />
<path
style="opacity:0.36862745;color:#000000;fill:url(#linearGradient3401);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 15,16 L 20,16 L 20,40.3125 L 15,39.5 L 15,16 z "
id="rect3244"
sodipodi:nodetypes="ccccc" />
<path
style="opacity:0.34509804;color:#000000;fill:url(#linearGradient3398);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 22,10.5 C 16.084021,10.716519 11.5,12.21646 11.5,14 L 11.5,37 C 11.5,38.932002 16.876,40.500001 23.5,40.5 C 30.124,40.5 35.5,38.932003 35.5,37 L 35.5,14 C 35.5,12.067998 30.124001,10.5 23.5,10.5 C 23.13775,10.5 22.79161,10.490818 22.4375,10.5 C 22.294038,10.50372 22.141983,10.494804 22,10.5 z "
id="path3288"
sodipodi:nodetypes="csssssssc" />
<path
sodipodi:type="arc"
style="color:#000000;fill:url(#radialGradient3337);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient3339);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
id="path3164"
sodipodi:cx="21.34375"
sodipodi:cy="14.125"
sodipodi:rx="11.96875"
sodipodi:ry="3.625"
d="M 33.3125 14.125 A 11.96875 3.625 0 1 1 9.375,14.125 A 11.96875 3.625 0 1 1 33.3125 14.125 z"
transform="matrix(1.002611,0,0,0.965518,2.100522,0.362061)" />
<path
sodipodi:type="arc"
style="opacity:0.63921569;color:#000000;fill:url(#linearGradient3341);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient3343);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
id="path3263"
sodipodi:cx="21.34375"
sodipodi:cy="14.125"
sodipodi:rx="11.96875"
sodipodi:ry="3.625"
d="M 33.3125 14.125 A 11.96875 3.625 0 1 1 9.375,14.125 A 11.96875 3.625 0 1 1 33.3125 14.125 z"
transform="matrix(1.002611,0,0,0.965518,2.100522,0.362061)" />
<path
style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3393);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 11.5,21.5 L 11.5,37 C 11.5,38.932002 16.876,40.500001 23.5,40.5 C 30.124,40.5 35.5,38.932003 35.5,37 L 35.5,21.5"
id="path2217"
sodipodi:nodetypes="ccscc" />
<path
style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#c4a000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 35.5,21.5 L 35.5,14 C 35.5,12.067998 30.124001,10.5 23.5,10.5 C 23.13775,10.5 22.79161,10.490818 22.4375,10.5 C 22.294038,10.50372 22.141983,10.494804 22,10.5 C 16.084021,10.716519 11.5,12.21646 11.5,14 L 11.5,21.5"
id="path2219"
sodipodi:nodetypes="cssscsc" />
<path
style="opacity:0.49019608;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 21.84375,11.5 C 16.548895,11.680925 12.5,12.74668 12.5,14 C 12.5,15.142813 12.5,35.855219 12.5,37 C 12.5,38.38 17.427994,39.5 23.5,39.5 C 29.572006,39.5 34.5,38.38 34.5,37 C 34.5,35.940784 34.499999,15.059216 34.5,14 C 34.5,12.62 29.572007,11.5 23.5,11.5 C 23.1205,11.5 22.744639,11.49146 22.375,11.5 C 22.201732,11.504003 22.014552,11.494164 21.84375,11.5 z "
id="path2206"
sodipodi:nodetypes="csssssssc" />
<path
style="color:#000000;fill:url(#linearGradient3384);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 23,9.5 C 21.315666,9.5803665 19.950192,10.074035 19.59375,10.6875 C 19.587086,10.699702 19.568368,10.737692 19.5625,10.75 C 19.559767,10.75618 19.533781,10.775045 19.53125,10.78125 C 19.528923,10.78748 19.533372,10.806246 19.53125,10.8125 C 19.521672,10.843887 19.504323,10.905557 19.5,10.9375 C 19.49935,10.943909 19.500435,10.96232 19.5,10.96875 C 19.499782,10.975199 19.5,12.993531 19.5,13 C 19.5,13.006469 19.499782,13.024801 19.5,13.03125 C 19.500435,13.03768 19.49935,13.056091 19.5,13.0625 C 19.504323,13.094443 19.521672,13.156113 19.53125,13.1875 C 19.533372,13.193754 19.528923,13.21252 19.53125,13.21875 C 19.533781,13.224955 19.559767,13.24382 19.5625,13.25 C 19.568368,13.262308 19.587086,13.300298 19.59375,13.3125 C 19.985483,13.986704 21.58525,14.5 23.5,14.5 C 25.41475,14.5 27.014517,13.986704 27.40625,13.3125 C 27.412914,13.300298 27.431632,13.262308 27.4375,13.25 C 27.440233,13.24382 27.466219,13.224955 27.46875,13.21875 C 27.471077,13.21252 27.466628,13.193754 27.46875,13.1875 C 27.478328,13.156113 27.495677,13.094443 27.5,13.0625 C 27.50065,13.056091 27.499565,13.03768 27.5,13.03125 C 27.500218,13.024801 27.5,13.006469 27.5,13 C 27.5,12.993531 27.500218,10.975199 27.5,10.96875 C 27.499565,10.96232 27.50065,10.943909 27.5,10.9375 C 27.495677,10.905557 27.478328,10.843887 27.46875,10.8125 C 27.466628,10.806246 27.471077,10.78748 27.46875,10.78125 C 27.466219,10.775045 27.440233,10.75618 27.4375,10.75 C 27.431632,10.737692 27.412914,10.699702 27.40625,10.6875 C 27.014517,10.013296 25.41475,9.5 23.5,9.5 C 23.3275,9.5 23.166766,9.4920429 23,9.5 z "
id="path3198"
sodipodi:nodetypes="cssssssssssssssssssssssssssssc" />
<path
sodipodi:type="arc"
style="color:#000000;fill:url(#radialGradient3347);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
id="path3225"
sodipodi:cx="21.5"
sodipodi:cy="11"
sodipodi:rx="4"
sodipodi:ry="1.5"
d="M 25.5 11 A 4 1.5 0 1 1 17.5,11 A 4 1.5 0 1 1 25.5 11 z"
transform="matrix(0.867417,0,0,0.666667,4.820203,3.666665)" />
<path
style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3380);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 23,9.5 C 21.315666,9.5803665 19.950192,10.074035 19.59375,10.6875 C 19.587086,10.699702 19.568368,10.737692 19.5625,10.75 C 19.559767,10.75618 19.533781,10.775045 19.53125,10.78125 C 19.528923,10.78748 19.533372,10.806246 19.53125,10.8125 C 19.521672,10.843887 19.504323,10.905557 19.5,10.9375 C 19.49935,10.943909 19.500435,10.96232 19.5,10.96875 C 19.499782,10.975199 19.5,12.993531 19.5,13 C 19.5,13.006469 19.499782,13.024801 19.5,13.03125 C 19.500435,13.03768 19.49935,13.056091 19.5,13.0625 C 19.504323,13.094443 19.521672,13.156113 19.53125,13.1875 C 19.533372,13.193754 19.528923,13.21252 19.53125,13.21875 C 19.533781,13.224955 19.559767,13.24382 19.5625,13.25 C 19.568368,13.262308 19.587086,13.300298 19.59375,13.3125 C 19.985483,13.986704 21.58525,14.5 23.5,14.5 C 25.41475,14.5 27.014517,13.986704 27.40625,13.3125 C 27.412914,13.300298 27.431632,13.262308 27.4375,13.25 C 27.440233,13.24382 27.466219,13.224955 27.46875,13.21875 C 27.471077,13.21252 27.466628,13.193754 27.46875,13.1875 C 27.478328,13.156113 27.495677,13.094443 27.5,13.0625 C 27.50065,13.056091 27.499565,13.03768 27.5,13.03125 C 27.500218,13.024801 27.5,13.006469 27.5,13 C 27.5,12.993531 27.500218,10.975199 27.5,10.96875 C 27.499565,10.96232 27.50065,10.943909 27.5,10.9375 C 27.495677,10.905557 27.478328,10.843887 27.46875,10.8125 C 27.466628,10.806246 27.471077,10.78748 27.46875,10.78125 C 27.466219,10.775045 27.440233,10.75618 27.4375,10.75 C 27.431632,10.737692 27.412914,10.699702 27.40625,10.6875 C 27.014517,10.013296 25.41475,9.5 23.5,9.5 C 23.3275,9.5 23.166766,9.4920429 23,9.5 z "
id="path3205"
sodipodi:nodetypes="cssssssssssssssssssssssssssssc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 23 KiB

View file

@ -0,0 +1,11 @@
[Desktop Entry]
Name=NUT Monitor
Name[fr]=Moniteur NUT
Comment=Network UPS Tools GUI client (Py2Gtk2)
Comment[fr]=Client graphique pour NUT (Network UPS Tools, Py2Gtk2)
Comment[it]=Client grafico per NUT (Network UPS Tools, Py2Gtk2)
Categories=System;Monitor;HardwareSettings;Settings;GTK
Exec=NUT-Monitor-py2gtk2
Icon=nut-monitor
Terminal=false
Type=Application

View file

@ -0,0 +1,11 @@
[Desktop Entry]
Name=NUT Monitor
Name[fr]=Moniteur NUT
Comment=Network UPS Tools GUI client (Py3Qt5)
Comment[fr]=Client graphique pour NUT (Network UPS Tools, Py3Qt5)
Comment[it]=Client grafico per NUT (Network UPS Tools, Py3Qt5)
Categories=System;Monitor;HardwareSettings;Settings;Qt
Exec=NUT-Monitor-py3qt5
Icon=nut-monitor
Terminal=false
Type=Application

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Arnaud Quette <arnaud.quette@free.fr> -->
<application>
<id type="desktop">nut-monitor.desktop</id>
<component type="desktop-application">
<id>nut-monitor.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>NUT Monitor</name>
@ -32,11 +32,17 @@
</p>
</description>
<screenshots>
<screenshot type="default" width="620" height="349">http://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-1.png</screenshot>
<screenshot width="620" height="349">http://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-2.png</screenshot>
<screenshot width="620" height="349">http://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-3.png</screenshot>
<screenshot type="default" width="620" height="349">
<image>https://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-1.png</image>
</screenshot>
<screenshot width="620" height="349">
<image>https://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-2.png</image>
</screenshot>
<screenshot width="620" height="349">
<image>https://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-3.png</image>
</screenshot>
</screenshots>
<url type="homepage">http://www.lestat.st/en/informatique/projets/nut-monitor</url>
<updatecontact>david@lestat.st</updatecontact>
<url type="homepage">https://www.lestat.st/en/informatique/projets/nut-monitor</url>
<update_contact>david@lestat.st</update_contact>
<!-- project_group>GNOME</project_group -->
</application>
</component>

View file

@ -1,12 +0,0 @@
[Desktop Entry]
Name=NUT Monitor
Name[fr]=Moniteur NUT
Comment=Network UPS Tools GUI client
Comment[fr]=Client graphique pour NUT (Network UPS Tools)
Comment[it]=Client grafico per NUT (Network UPS Tools)
Categories=Application;Network;
Encoding=UTF-8
Exec=NUT-Monitor
Icon=nut-monitor.png
Terminal=false
Type=Application

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>aboutdialog1</class>
<widget class="QDialog" name="aboutdialog1">
<property name="windowTitle">
<string>About NUT-Monitor</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="icon">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;h1&gt;NUT-Monitor 1.3.1&lt;/h1&gt;
&lt;p&gt;GUI to manage devices connected a NUT server.&lt;/p&gt;
&lt;p&gt;For more information about NUT (Network UPS Tools) please visit the author's website.&lt;/p&gt;
&lt;p style=&quot;margin-bottom: 1.5em&quot;&gt;http://www.networkupstools.org&lt;/p&gt;
&lt;p style=&quot; font-size:8pt;&quot;&gt;Copyright (c) 2010 David Goncalves&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.lestat.st/informatique/projets/nut-monitor-en&quot;&gt;http://www.lestat.st&lt;/a&gt;&lt;/p&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>aboutdialog1</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>aboutdialog1</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dialog1</class>
<widget class="QDialog" name="dialog1">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>297</width>
<height>133</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label5">
<property name="text">
<string>Enter a name for this favorite&lt;br&gt;&lt;br&gt;&lt;font color=&quot;#808080&quot;&gt;You cannot re-use a name from another entry&lt;/font&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="entry4"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>dialog1</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>dialog1</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dialog2</class>
<widget class="QDialog" name="dialog2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>229</width>
<height>116</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="vbox4">
<item>
<widget class="QLabel" name="label5">
<property name="text">
<string>Please select the favorite that you want to delete from list...</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combobox2">
<item>
<property name="text">
<string>None</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>dialog2</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>dialog2</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -0,0 +1,473 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>window1</class>
<widget class="QMainWindow" name="window1">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>560</width>
<height>465</height>
</rect>
</property>
<property name="windowTitle">
<string>NUT Monitor</string>
</property>
<property name="windowIcon">
<iconset theme="battery">
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox1">
<property name="title">
<string> NUT Server </string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QWidget" name="vbox6" native="true">
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="table1">
<item row="0" column="2">
<widget class="QSpinBox" name="spinbutton1">
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>3493</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="entry1"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label3">
<property name="text">
<string>Device : </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="combobox1">
<item>
<property name="text">
<string>None</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label2">
<property name="text">
<string>Host / Port : </string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="button1">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Refresh</string>
</property>
<property name="icon">
<iconset theme="view-refresh"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkbutton1">
<property name="text">
<string>Use authentication</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="hbox1" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label4">
<property name="text">
<string>Login / Password : </string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="entry2"/>
</item>
<item>
<widget class="QLineEdit" name="entry3">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="hseparator1">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hbox2">
<item>
<widget class="QPushButton" name="button2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>C&amp;onnect</string>
</property>
<property name="icon">
<iconset theme="network-connect"/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button7">
<property name="text">
<string>&amp;Disconnect</string>
</property>
<property name="icon">
<iconset theme="network-disconnect"/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTabWidget" name="notebook1">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="vbox7">
<attribute name="title">
<string>Device status</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="hbox3">
<item>
<widget class="QLabel" name="image1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label10">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>label</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label11">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>label</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="table2">
<item row="2" column="0">
<widget class="QLabel" name="label14">
<property name="text">
<string>Remaining time :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label12">
<property name="text">
<string>Battery charge :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QProgressBar" name="progressbar2">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label16">
<property name="text">
<string>Device commands :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QProgressBar" name="progressbar1">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label13">
<property name="text">
<string>Current load :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QFrame" name="frame5">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label15">
<property name="text">
<string>N/A</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="hbox5">
<item>
<widget class="QComboBox" name="ups_commands_combo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button8">
<property name="text">
<string>&amp;Execute</string>
</property>
<property name="icon">
<iconset theme="system-run"/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="vbox8">
<attribute name="title">
<string>Device vars</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QFrame" name="frame6">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QTreeView" name="treeview1"/>
</item>
<item>
<widget class="QPushButton" name="button9">
<property name="text">
<string>&amp;Refresh</string>
</property>
<property name="icon">
<iconset theme="view-refresh"/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar1">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>560</width>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menu1">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="imagemenuitem1"/>
<addaction name="separator"/>
<addaction name="imagemenuitem5"/>
</widget>
<widget class="QMenu" name="menu2">
<property name="title">
<string>F&amp;avorites</string>
</property>
<addaction name="menuitem4"/>
<addaction name="menuitem5"/>
<addaction name="separator"/>
</widget>
<addaction name="menu1"/>
<addaction name="menu2"/>
</widget>
<widget class="QStatusBar" name="statusbar2"/>
<action name="imagemenuitem1">
<property name="icon">
<iconset theme="help-about"/>
</property>
<property name="text">
<string>&amp;About</string>
</property>
</action>
<action name="imagemenuitem5">
<property name="icon">
<iconset theme="application-exit"/>
</property>
<property name="text">
<string>&amp;Quit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="menuitem4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset theme="bookmark-new"/>
</property>
<property name="text">
<string>&amp;Add</string>
</property>
</action>
<action name="menuitem5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset theme="bookmark-remove"/>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!@PYTHON@
# -*- coding: utf-8 -*-
# Copyright (C) 2008 David Goncalves <david@lestat.st>
@ -38,6 +38,11 @@
# 2014-06-03 george2 - Version 1.3.0
# Added custom exception class, fixed minor bug, added Python 3 support.
#
# 2021-09-27 Jim Klimov <jimklimov+nut@gmail.com> - Version 1.4.0
# Revise strings used to be byte sequences as required by telnetlib
# in Python 3.9, by spelling out b"STR" or str.encode('ascii');
# the change was also tested to work with Python 2.7, 3.4, 3.5 and
# 3.7 (to the extent of accompanying test_nutclient.py at least).
import telnetlib
@ -56,8 +61,8 @@ class PyNUTClient :
__timeout = None
__srv_handler = None
__version = "1.3.0"
__release = "2014-06-03"
__version = "1.4.0"
__release = "2021-09-27"
def __init__( self, host="127.0.0.1", port=3493, login=None, password=None, debug=False, timeout=5 ) :
@ -89,7 +94,7 @@ timeout : Timeout used to wait for network response
def __del__( self ) :
""" Class destructor method """
try :
self.__srv_handler.write( "LOGOUT\n" )
self.__srv_handler.write( b"LOGOUT\n" )
except :
pass
@ -105,16 +110,16 @@ if something goes wrong.
self.__srv_handler = telnetlib.Telnet( self.__host, self.__port )
if self.__login != None :
self.__srv_handler.write( "USERNAME %s\n" % self.__login )
result = self.__srv_handler.read_until( "\n", self.__timeout )
if result[:2] != "OK" :
raise PyNUTError( result.replace( "\n", "" ) )
self.__srv_handler.write( ("USERNAME %s\n" % self.__login).encode('ascii') )
result = self.__srv_handler.read_until( b"\n", self.__timeout )
if result[:2] != b"OK" :
raise PyNUTError( result.replace( b"\n", b"" ) )
if self.__password != None :
self.__srv_handler.write( "PASSWORD %s\n" % self.__password )
result = self.__srv_handler.read_until( "\n", self.__timeout )
if result[:2] != "OK" :
raise PyNUTError( result.replace( "\n", "" ) )
self.__srv_handler.write( ("PASSWORD %s\n" % self.__password).encode('ascii') )
result = self.__srv_handler.read_until( b"\n", self.__timeout )
if result[:2] != b"OK" :
raise PyNUTError( result.replace( b"\n", b"" ) )
def GetUPSList( self ) :
""" Returns the list of available UPS from the NUT server
@ -124,18 +129,18 @@ The result is a dictionary containing 'key->val' pairs of 'UPSName' and 'UPS Des
if self.__debug :
print( "[DEBUG] GetUPSList from server" )
self.__srv_handler.write( "LIST UPS\n" )
result = self.__srv_handler.read_until( "\n" )
if result != "BEGIN LIST UPS\n" :
raise PyNUTError( result.replace( "\n", "" ) )
self.__srv_handler.write( b"LIST UPS\n" )
result = self.__srv_handler.read_until( b"\n" )
if result != b"BEGIN LIST UPS\n" :
raise PyNUTError( result.replace( b"\n", b"" ) )
result = self.__srv_handler.read_until( "END LIST UPS\n" )
result = self.__srv_handler.read_until( b"END LIST UPS\n" )
ups_list = {}
for line in result.split( "\n" ) :
if line[:3] == "UPS" :
ups, desc = line[4:-1].split( '"' )
ups_list[ ups.replace( " ", "" ) ] = desc
for line in result.split( b"\n" ) :
if line[:3] == b"UPS" :
ups, desc = line[4:-1].split( b'"' )
ups_list[ ups.replace( b" ", b"" ) ] = desc
return( ups_list )
@ -148,19 +153,19 @@ available vars.
if self.__debug :
print( "[DEBUG] GetUPSVars called..." )
self.__srv_handler.write( "LIST VAR %s\n" % ups )
result = self.__srv_handler.read_until( "\n" )
if result != "BEGIN LIST VAR %s\n" % ups :
raise PyNUTError( result.replace( "\n", "" ) )
self.__srv_handler.write( ("LIST VAR %s\n" % ups).encode('ascii') )
result = self.__srv_handler.read_until( b"\n" )
if result != ("BEGIN LIST VAR %s\n" % ups).encode('ascii') :
raise PyNUTError( result.replace( b"\n", b"" ) )
ups_vars = {}
result = self.__srv_handler.read_until( "END LIST VAR %s\n" % ups )
offset = len( "VAR %s " % ups )
end_offset = 0 - ( len( "END LIST VAR %s\n" % ups ) + 1 )
result = self.__srv_handler.read_until( ("END LIST VAR %s\n" % ups).encode('ascii') )
offset = len( ("VAR %s " % ups ).encode('ascii') )
end_offset = 0 - ( len( ("END LIST VAR %s\n" % ups).encode('ascii') ) + 1 )
for current in result[:end_offset].split( "\n" ) :
var = current[ offset: ].split( '"' )[0].replace( " ", "" )
data = current[ offset: ].split( '"' )[1]
for current in result[:end_offset].split( b"\n" ) :
var = current[ offset: ].split( b'"' )[0].replace( b" ", b"" )
data = current[ offset: ].split( b'"' )[1]
ups_vars[ var ] = data
return( ups_vars )
@ -174,28 +179,28 @@ of the command as value
if self.__debug :
print( "[DEBUG] GetUPSCommands called..." )
self.__srv_handler.write( "LIST CMD %s\n" % ups )
result = self.__srv_handler.read_until( "\n" )
if result != "BEGIN LIST CMD %s\n" % ups :
raise PyNUTError( result.replace( "\n", "" ) )
self.__srv_handler.write( ("LIST CMD %s\n" % ups).encode('ascii') )
result = self.__srv_handler.read_until( b"\n" )
if result != ("BEGIN LIST CMD %s\n" % ups).encode('ascii') :
raise PyNUTError( result.replace( b"\n", b"" ) )
ups_cmds = {}
result = self.__srv_handler.read_until( "END LIST CMD %s\n" % ups )
offset = len( "CMD %s " % ups )
end_offset = 0 - ( len( "END LIST CMD %s\n" % ups ) + 1 )
result = self.__srv_handler.read_until( ("END LIST CMD %s\n" % ups).encode('ascii') )
offset = len( ("CMD %s " % ups).encode('ascii') )
end_offset = 0 - ( len( ("END LIST CMD %s\n" % ups).encode('ascii') ) + 1 )
for current in result[:end_offset].split( "\n" ) :
var = current[ offset: ].split( '"' )[0].replace( " ", "" )
for current in result[:end_offset].split( b"\n" ) :
var = current[ offset: ].split( b'"' )[0].replace( b" ", b"" )
# For each var we try to get the available description
try :
self.__srv_handler.write( "GET CMDDESC %s %s\n" % ( ups, var ) )
temp = self.__srv_handler.read_until( "\n" )
if temp[:7] != "CMDDESC" :
self.__srv_handler.write( ("GET CMDDESC %s %s\n" % ( ups, var )).encode('ascii') )
temp = self.__srv_handler.read_until( b"\n" )
if temp[:7] != b"CMDDESC" :
raise PyNUTError
else :
off = len( "CMDDESC %s %s " % ( ups, var ) )
desc = temp[off:-1].split('"')[1]
off = len( ("CMDDESC %s %s " % ( ups, var )).encode('ascii') )
desc = temp[off:-1].split(b'"')[1]
except :
desc = var
@ -211,20 +216,20 @@ The result is presented as a dictionary containing 'key->val' pairs
if self.__debug :
print( "[DEBUG] GetUPSVars from '%s'..." % ups )
self.__srv_handler.write( "LIST RW %s\n" % ups )
result = self.__srv_handler.read_until( "\n" )
if ( result != "BEGIN LIST RW %s\n" % ups ) :
raise PyNUTError( result.replace( "\n", "" ) )
self.__srv_handler.write( ("LIST RW %s\n" % ups).encode('ascii') )
result = self.__srv_handler.read_until( b"\n" )
if ( result != ("BEGIN LIST RW %s\n" % ups).encode('ascii') ) :
raise PyNUTError( result.replace( b"\n", b"" ) )
result = self.__srv_handler.read_until( "END LIST RW %s\n" % ups )
offset = len( "VAR %s" % ups )
end_offset = 0 - ( len( "END LIST RW %s\n" % ups ) + 1 )
result = self.__srv_handler.read_until( ("END LIST RW %s\n" % ups).encode('ascii') )
offset = len( ("VAR %s" % ups).encode('ascii') )
end_offset = 0 - ( len( ("END LIST RW %s\n" % ups).encode('ascii') ) + 1 )
rw_vars = {}
try :
for current in result[:end_offset].split( "\n" ) :
var = current[ offset: ].split( '"' )[0].replace( " ", "" )
data = current[ offset: ].split( '"' )[1]
for current in result[:end_offset].split( b"\n" ) :
var = current[ offset: ].split( b'"' )[0].replace( b" ", b"" )
data = current[ offset: ].split( b'"' )[1]
rw_vars[ var ] = data
except :
@ -239,9 +244,9 @@ The variable must be a writable value (cf GetRWVars) and you must have the prope
rights to set it (maybe login/password).
"""
self.__srv_handler.write( "SET VAR %s %s %s\n" % ( ups, var, value ) )
result = self.__srv_handler.read_until( "\n" )
if ( result == "OK\n" ) :
self.__srv_handler.write( ("SET VAR %s %s %s\n" % ( ups, var, value )).encode('ascii') )
result = self.__srv_handler.read_until( b"\n" )
if ( result == b"OK\n" ) :
return( "OK" )
else :
raise PyNUTError( result )
@ -255,35 +260,43 @@ Returns OK on success or raises an error
if self.__debug :
print( "[DEBUG] RunUPSCommand called..." )
self.__srv_handler.write( "INSTCMD %s %s\n" % ( ups, command ) )
result = self.__srv_handler.read_until( "\n" )
if ( result == "OK\n" ) :
self.__srv_handler.write( ("INSTCMD %s %s\n" % ( ups, command )).encode('ascii') )
result = self.__srv_handler.read_until( b"\n" )
if ( result == b"OK\n" ) :
return( "OK" )
else :
raise PyNUTError( result.replace( "\n", "" ) )
raise PyNUTError( result.replace( b"\n", b"" ) )
def FSD( self, ups="") :
""" Send FSD command
Returns OK on success or raises an error
NOTE: API changed since NUT 2.8.0 to replace MASTER with PRIMARY
(and backwards-compatible alias handling)
"""
if self.__debug :
print( "[DEBUG] MASTER called..." )
print( "[DEBUG] PRIMARY called..." )
self.__srv_handler.write( "MASTER %s\n" % ups )
result = self.__srv_handler.read_until( "\n" )
if ( result != "OK MASTER-GRANTED\n" ) :
raise PyNUTError( ( "Master level function are not available", "" ) )
self.__srv_handler.write( ("PRIMARY %s\n" % ups).encode('ascii') )
result = self.__srv_handler.read_until( b"\n" )
if ( result != b"OK PRIMARY-GRANTED\n" ) :
if self.__debug :
print( "[DEBUG] Retrying: MASTER called..." )
self.__srv_handler.write( ("MASTER %s\n" % ups).encode('ascii') )
result = self.__srv_handler.read_until( b"\n" )
if ( result != b"OK MASTER-GRANTED\n" ) :
raise PyNUTError( ( "Primary level functions are not available", "" ) )
if self.__debug :
print( "[DEBUG] FSD called..." )
self.__srv_handler.write( "FSD %s\n" % ups )
result = self.__srv_handler.read_until( "\n" )
if ( result == "OK FSD-SET\n" ) :
self.__srv_handler.write( ("FSD %s\n" % ups).encode('ascii') )
result = self.__srv_handler.read_until( b"\n" )
if ( result == b"OK FSD-SET\n" ) :
return( "OK" )
else :
raise PyNUTError( result.replace( "\n", "" ) )
raise PyNUTError( result.replace( b"\n", b"" ) )
def help(self) :
""" Send HELP command
@ -292,8 +305,8 @@ Returns OK on success or raises an error
if self.__debug :
print( "[DEBUG] HELP called..." )
self.__srv_handler.write( "HELP\n")
return self.__srv_handler.read_until( "\n" )
self.__srv_handler.write( b"HELP\n" )
return self.__srv_handler.read_until( b"\n" )
def ver(self) :
""" Send VER command
@ -302,8 +315,8 @@ Returns OK on success or raises an error
if self.__debug :
print( "[DEBUG] VER called..." )
self.__srv_handler.write( "VER\n")
return self.__srv_handler.read_until( "\n" )
self.__srv_handler.write( b"VER\n" )
return self.__srv_handler.read_until( b"\n" )
def ListClients( self, ups = None ) :
""" Returns the list of connected clients from the NUT server
@ -317,20 +330,20 @@ The result is a dictionary containing 'key->val' pairs of 'UPSName' and a list o
raise PyNUTError( "%s is not a valid UPS" % ups )
if ups:
self.__srv_handler.write( "LIST CLIENTS %s\n" % ups)
self.__srv_handler.write( ("LIST CLIENTS %s\n" % ups).encode('ascii') )
else:
self.__srv_handler.write( "LIST CLIENTS\n" )
result = self.__srv_handler.read_until( "\n" )
if result != "BEGIN LIST CLIENTS\n" :
raise PyNUTError( result.replace( "\n", "" ) )
self.__srv_handler.write( b"LIST CLIENTS\n" )
result = self.__srv_handler.read_until( b"\n" )
if result != b"BEGIN LIST CLIENTS\n" :
raise PyNUTError( result.replace( b"\n", b"" ) )
result = self.__srv_handler.read_until( "END LIST CLIENTS\n" )
result = self.__srv_handler.read_until( b"END LIST CLIENTS\n" )
ups_list = {}
for line in result.split( "\n" ):
if line[:6] == "CLIENT" :
host, ups = line[7:].split(' ')
ups.replace(' ', '')
for line in result.split( b"\n" ):
if line[:6] == b"CLIENT" :
host, ups = line[7:].split(b' ')
ups.replace(b' ', b'')
if not ups in ups_list:
ups_list[ups] = []
ups_list[ups].append(host)

View file

@ -1,22 +1,31 @@
#!/usr/bin/env python
#!@PYTHON@
# -*- coding: utf-8 -*-
# This source code is provided for testing/debuging purpose ;)
import PyNUT
import sys
import os
if __name__ == "__main__" :
NUT_PORT = int(os.getenv('NUT_PORT', '3493'))
NUT_USER = os.getenv('NUT_USER', None)
NUT_PASS = os.getenv('NUT_PASS', None)
print( "PyNUTClient test..." )
nut = PyNUT.PyNUTClient( debug=True )
#nut = PyNUT.PyNUTClient( login="upsadmin", password="upsadmin", debug=True )
#nut = PyNUT.PyNUTClient( debug=True, port=NUT_PORT )
nut = PyNUT.PyNUTClient( login=NUT_USER, password=NUT_PASS, debug=True, port=NUT_PORT )
#nut = PyNUT.PyNUTClient( login="upsadmin", password="upsadmin", debug=True, port=NUT_PORT )
print( 80*"-" + "\nTesting 'GetUPSList' :")
result = nut.GetUPSList( )
print( "\033[01;33m%s\033[0m\n" % result )
print( 80*"-" + "\nTesting 'GetUPSVars' :")
# [dummy]
# driver = dummy-ups
# desc = "Test device"
# port = /src/nut/data/evolution500.seq
print( 80*"-" + "\nTesting 'GetUPSVars' for 'dummy' (should be registered in upsd.conf) :")
result = nut.GetUPSVars( "dummy" )
print( "\033[01;33m%s\033[0m\n" % result )

View file

@ -3,13 +3,14 @@
# an auxiliary script to produce a "stub" snmp-ups subdriver from
# SNMP data from a real agent or from dump files
#
# Version: 0.6
# Version: 0.13
#
# See also: docs/snmp-subdrivers.txt
#
# Copyright (C)
# 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
# 2015 Arnaud Quette <ArnaudQuette@Eaton.com>
# 2015 - 2022 Eaton (author: Arnaud Quette <ArnaudQuette@Eaton.com>)
# 2011 Jim Klimov <jimklimov+nut@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -26,37 +27,53 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# TODO:
# - Prepend sysDescription (.1.3.6.1.2.1.1.1.0) to have some more visibility
# - extend to SNMP v3 (auth.)
usage() {
echo "Usage: $0 [options] [file]"
echo "Options:"
echo " -h, --help -- show this message and quit"
echo " -n name -- subdriver name (use natural capitalization)"
echo " -M DIRLIST -- colon separated list of directories to also search for MIBs"
echo " -k -- keep temporary files (for debugging)"
echo ""
echo "mode 1: get SNMP data from a real agent"
echo " -H host_address -- SNMP host IP address or name"
echo " -c community -- SNMP v1 community name (default: public)"
echo " -s XXXX -- override SNMP OID entry point (sysOID). Ex: '.1.3.6.1.4.1.534.10'"
echo ""
echo "mode 2: get data from files (snmpwalk dumps of 'sysOID' subtree)"
echo " -s XXXX -- SNMP OID entry point (sysOID). Ex: '.1.3.6.1.4.1.534.6.6.7'"
echo " file1 file2 -- read from files instead of an host (using Net SNMP)"
echo " file1: numeric SNMP walk (snmpwalk -On ... <sysOID>)"
echo " file2: string SNMP walk (snmpwalk -Os ... <sysOID>)"
echo ""
echo "Notes:"
echo " For both modes, prefer to copy the specific MIB file(s) for your device in the $0 script directory"
echo " In such case, for mode 2, also add \"-M.\" to allow the name resolution of OIDs"
echo ""
echo "Example:"
echo "mode 1: $0 -H 192.168.0.1 -n mibname -c mycommunity"
echo "mode 2: (using sysOID .1.3.6.1.4.1.534.6.6.7)"
echo " snmpwalk -On -v1 -c mycommunity 192.168.0.1 .1.3.6.1.4.1.534.6.6.7 2>/dev/null 1> numeric-walk-file"
echo " snmpwalk -Os -v1 -m ALL -M+. -c mycommunity 192.168.0.1 .1.3.6.1.4.1.534.6.6.7 2>/dev/null 1> string-walk-file"
echo " $0 -s .1.3.6.1.4.1.534.6.6.7 numeric-walk-file string-walk-file"
echo "Usage: $0 [options] [file]"
echo "Options:"
echo " -h, --help -- show this message and quit"
echo " -n name -- subdriver name (use natural capitalization)"
echo " -M DIRLIST -- colon separated list of directories to also search for MIBs"
echo " -k -- keep temporary files (for debugging)"
echo ""
echo "mode 1: get SNMP data from a real agent"
echo " -H host_address -- SNMP host IP address or name"
echo " -c community -- SNMP v1 community name (default: public)"
echo " -s XXXX -- override SNMP OID entry point (sysOID). Ex: '.1.3.6.1.4.1.534.10'"
echo ""
echo "mode 2: get data from files (snmpwalk dumps of 'sysOID' subtree)"
echo " -s XXXX -- SNMP OID entry point (sysOID). Ex: '.1.3.6.1.4.1.534.6.6.7'"
echo " file1 file2 -- read from files instead of an host (using Net SNMP)"
echo " file1: numeric SNMP walk (snmpwalk -On ... <sysOID>)"
echo " file2: string SNMP walk (snmpwalk -Os ... <sysOID>)"
echo ""
echo "mode 3: get data from 1 file (numeric snmpwalk dump of the whole SNMP tree)"
echo " The sysOID is extracted from the dump, and only the pointed subtree is used"
echo " A MIB file MUST be provided, and is used to produce the string SNMP walk"
echo " file1 -- read from file instead of an host (using Net SNMP)"
echo " file1: numeric SNMP walk (snmpwalk -On ... <sysOID>)"
echo ""
echo "Notes:"
echo " For both modes, prefer to copy the specific MIB file(s) for your device in the $0 script directory"
echo " So that it is automatically taken into account for the string name resolution of OIDs"
echo " Otherwise, use \"-M.\" option"
echo ""
echo "Example:"
echo "mode 1: $0 -H 192.168.0.1 -n mibname -c mycommunity"
echo "mode 2: (using sysOID .1.3.6.1.4.1.534.6.6.7)"
echo " snmpwalk -On -v1 -c mycommunity 192.168.0.1 .1.3.6.1.4.1.534.6.6.7 2>/dev/null 1> numeric-walk-file"
echo " snmpwalk -Os -v1 -m ALL -M+. -c mycommunity 192.168.0.1 .1.3.6.1.4.1.534.6.6.7 2>/dev/null 1> string-walk-file"
echo " $0 -s .1.3.6.1.4.1.534.6.6.7 numeric-walk-file string-walk-file"
echo "mode 3:"
echo " snmpwalk -On -v1 -c mycommunity 192.168.0.1 .1 2>/dev/null 1> numeric-walk-file"
echo " $0 numeric-walk-file"
echo ""
echo " You may alos need to install additional packages:"
echo " - 'snmp' package (on Debian) for the base commands (snmpget, snmpwalk, snmptranslate)"
echo " - 'snmp-mibs-downloader' package (on Debian) to get all standard MIBs"
}
# variables
@ -65,298 +82,388 @@ KEEP=""
HOSTNAME=""
MIBS_DIRLIST="+."
COMMUNITY="public"
DEVICE_SYSOID=""
SYSOID=""
MODE=0
# constants
NAME=gen-snmp-subdriver
TMPDIR="${TEMPDIR:-/tmp}"
DEBUG=`mktemp "$TMPDIR/$NAME-DEBUG.XXXXXX"`
DFL_NUMWALKFILE=`mktemp "$TMPDIR/$NAME-NUMWALK.XXXXXX"`
DFL_STRWALKFILE=`mktemp "$TMPDIR/$NAME-STRWALK.XXXXXX"`
TMP_NUMWALKFILE=`mktemp "$TMPDIR/$NAME-TMP-NUMWALK.XXXXXX"`
TMP_STRWALKFILE=`mktemp "$TMPDIR/$NAME-TMP-STRWALK.XXXXXX"`
SYSOID_NUMBER=".1.3.6.1.2.1.1.2.0"
DEBUG="`mktemp "$TMPDIR/$NAME-DEBUG.XXXXXX"`"
DFL_NUMWALKFILE="`mktemp "$TMPDIR/$NAME-NUMWALK.XXXXXX"`"
DFL_STRWALKFILE="`mktemp "$TMPDIR/$NAME-STRWALK.XXXXXX"`"
TMP_NUMWALKFILE="`mktemp "$TMPDIR/$NAME-TMP-NUMWALK.XXXXXX"`"
TMP_STRWALKFILE="`mktemp "$TMPDIR/$NAME-TMP-STRWALK.XXXXXX"`"
get_snmp_data() {
# 1) get the sysOID (points the mfr specif MIB), apart if there's an override
if [ -z "$SYSOID" ]
then
SYSOID=`snmpget -On -v1 -c $COMMUNITY -Ov $HOSTNAME .1.3.6.1.2.1.1.2.0 | cut -d' ' -f2`
# 1) get the sysOID (points the mfr specif MIB), apart if there's an override
if [ -z "$SYSOID" ]
then
SYSOID="`snmpget -On -v1 -c "$COMMUNITY" -Ov "$HOSTNAME" "$SYSOID_NUMBER" | cut -d' ' -f2`"
echo "sysOID retrieved: ${SYSOID}"
else
echo "Using the provided sysOID override ($SYSOID)"
fi
DEVICE_SYSOID="$SYSOID"
# 2) get the content of the mfr specif MIB
echo "Retrieving SNMP information. This may take some time"
snmpwalk -On -v1 -c $COMMUNITY $HOSTNAME $SYSOID 2>/dev/null 1> $DFL_NUMWALKFILE
snmpwalk -Os -v1 -m ALL -M $MIBS_DIRLIST -c $COMMUNITY $HOSTNAME $SYSOID 2>/dev/null 1> $DFL_STRWALKFILE
OID_COUNT=0
while (test "$OID_COUNT" -eq 0)
do
# 2) get the content of the mfr specif MIB
echo "Retrieving SNMP information. This may take some time"
snmpwalk -On -v1 -c "$COMMUNITY" "$HOSTNAME" "$SYSOID" 2>/dev/null 1> "$DFL_NUMWALKFILE"
snmpwalk -Os -v1 -m ALL -M"$MIBS_DIRLIST" -c "$COMMUNITY" "$HOSTNAME" "$SYSOID" 2>/dev/null 1> "$DFL_STRWALKFILE"
# 3) test return value of the walk, and possibly ramp-up the path to get something.
# The sysOID mechanism only works if we're pointed somehow in the right direction
# i.e. doesn't work if sysOID is .1.3.6.1.4.1.705.1 and data is at .1.3.6.1.4.1.534...
# Ex: sysOID = ".1.X.Y.Z"
# try with ".1.X.Y.Z", if fails try with .1.X.Y", if fails try with .1.X"...
OID_COUNT="`cat $NUMWALKFILE | wc -l`"
if [ $OID_COUNT -eq 0 ]; then
# ramp-up the provided sysOID by removing the last .x part
SYSOID=${SYSOID%.*}
echo "Warning: sysOID provided no data! Trying with a level up using $SYSOID"
fi
done
return $OID_COUNT
}
# process command line options
while [ $# -gt 0 ]; do
if [ $# -gt 1 -a "$1" = "-n" ]; then
DRIVER="$2"
shift 2
elif [ $# -gt 1 -a "$1" = "-M" ]; then
MIBS_DIRLIST="$MIBS_DIRLIST:$2"
shift 2
elif [ "$1" = "-k" ]; then
KEEP=yes
shift
elif [ $# -gt 1 -a "$1" = "-H" ]; then
HOSTNAME="$2"
shift 2
elif [ $# -gt 1 -a "$1" = "-c" ]; then
COMMUNITY="$2"
shift 2
elif [ $# -gt 1 -a "$1" = "-s" ]; then
SYSOID="$2"
shift 2
elif echo "$1" | grep -qv '^-'; then
if [ $# -gt 1 ]; then
NUMWALKFILE="$1"
shift
STRWALKFILE="$1"
shift
else
usage
exit 1
fi
elif [ "$1" = "--help" -o "$1" = "-h" ]; then
usage
exit 0
else
echo "Illegal option $1. Try --help for more info." >&2
exit 1
fi
done
generate_C() {
# create file names, lowercase
LDRIVER="`echo "$DRIVER" | tr A-Z a-z`"
UDRIVER="`echo "$DRIVER" | tr a-z A-Z`"
# keep dashes in name for files
CFILE="$LDRIVER-mib.c"
HFILE="$LDRIVER-mib.h"
# but replace with underscores for the structures and defines
LDRIVER="`echo "$LDRIVER" | tr - _`"
UDRIVER="`echo "$UDRIVER" | tr - _`"
# check that the needed parameters are provided, depending on the mode
if [ -z "$NUMWALKFILE" ]; then
# mode 1: directly get SNMP data from a real agent
MODE=1
NUMWALKFILE=$DFL_NUMWALKFILE
STRWALKFILE=$DFL_STRWALKFILE
# check if Net SNMP is available
if [ -z "`which snmpget`" -o -z "`which snmpwalk`" ]; then
echo "Net SNMP not found! snmpget and snmpwalk commands are required." >&2
exit 1
fi
# hostname is also mandatory
while [ -z "$HOSTNAME" ]; do
echo "
Please enter the SNMP host IP address or name."
read -p "SNMP host IP name or address: " HOSTNAME < /dev/tty
if echo $HOSTNAME | egrep -q '[^a-zA-Z0-9]'; then
echo "Please use only letters and digits"
HOSTNAME=""
fi
done
# get data from the agent
get_snmp_data
else
# mode 2: get data from files
MODE=2
# get sysOID value from command line, if needed
while [ -z "$SYSOID" ]; do
echo "
Please enter the value of sysOID, as displayed by snmp-ups. For example '.1.3.6.1.4.1.2254.2.4'.
You can get it using: snmpget -v1 -c XXX <host> .1.3.6.1.2.1.1.2.0"
read -p "Value of sysOID: " SYSOID < /dev/tty
if echo $SYSOID | egrep -q '[^0-9.]'; then
echo "Please use only the numeric form, with dots and digits"
SYSOID=""
fi
done
# check for actual files existence
if [ ! -f "$NUMWALKFILE" -o ! -f "$STRWALKFILE" ]; then
echo "SNMP walk dump files are missing on disk. Try --help for more info." >&2
exit 1
fi
fi
# delete temporary files: this is called just before exiting.
cleanup () {
rm -f "$DEBUG $DFL_NUMWALKFILE $TMP_NUMWALKFILE $DFL_STRWALKFILE $TMP_STRWALKFILE"
}
if [ -n "$KEEP" ]; then
trap cleanup EXIT
fi
# prompt use for name of driver
while [ -z "$DRIVER" ]; do
echo "
Please enter a name for this driver. Use only letters and numbers. Use
natural (upper- and lowercase) capitalization, e.g., 'Belkin', 'APC'."
read -p "Name of subdriver: " DRIVER < /dev/tty
if echo $DRIVER | egrep -q '[^a-zA-Z0-9]'; then
echo "Please use only letters and digits"
DRIVER=""
fi
done
# remove blank and "End of MIB" lines
egrep -e "^[[:space:]]?$" -e "End of MIB" -v ${NUMWALKFILE} > ${TMP_NUMWALKFILE}
egrep -e "^[[:space:]]?$" -e "End of MIB" -v ${STRWALKFILE} > ${TMP_STRWALKFILE}
NUMWALKFILE=${TMP_NUMWALKFILE}
STRWALKFILE=${TMP_STRWALKFILE}
# FIXME: sanity checks (! -z contents -a same `wc -l`)
NUM_OID_COUNT="`cat $NUMWALKFILE | wc -l`"
STR_OID_COUNT="`cat $STRWALKFILE | wc -l`"
echo "COUNT = $NUM_OID_COUNT / $NUM_OID_COUNT"
# create file names
LDRIVER=`echo $DRIVER | tr A-Z a-z`
UDRIVER=`echo $DRIVER | tr a-z A-Z`
CFILE="$LDRIVER-mib.c"
HFILE="$LDRIVER-mib.h"
# generate header file
echo "Creating $HFILE"
cat > "$HFILE" <<EOF
/* ${HFILE} - subdriver to monitor ${DRIVER} SNMP devices with NUT
*
* Copyright (C)
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ${UDRIVER}_MIB_H
#define ${UDRIVER}_MIB_H
#include "main.h"
#include "snmp-ups.h"
extern mib2nut_info_t ${LDRIVER};
#endif /* ${UDRIVER}_MIB_H */
EOF
# generate source file
# create header
echo "Creating $CFILE"
cat > "$CFILE" <<EOF
/* ${CFILE} - subdriver to monitor ${DRIVER} SNMP devices with NUT
*
* Copyright (C)
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
*
* Note: this subdriver was initially generated as a "stub" by the
* gen-snmp-subdriver script. It must be customized!
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "${HFILE}"
#define ${UDRIVER}_MIB_VERSION "0.1"
#define ${UDRIVER}_SYSOID "${SYSOID}"
/* To create a value lookup structure (as needed on the 2nd line of the example
* below), use the following kind of declaration, outside of the present snmp_info_t[]:
* static info_lkp_t onbatt_info[] = {
* { 1, "OB" },
* { 2, "OL" },
* { 0, NULL }
* };
*/
/* ${UDRIVER} Snmp2NUT lookup table */
static snmp_info_t ${LDRIVER}_mib[] = {
/* Data format:
* { info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar },
# generate header file
# NOTE: with <<-EOF leading TABs are all stripped
echo "Creating $HFILE"
cat > "$HFILE" <<-EOF
/* ${HFILE} - subdriver to monitor ${DRIVER} SNMP devices with NUT
*
* info_type: NUT INFO_ or CMD_ element name
* info_flags: flags to set in addinfo
* info_len: length of strings if STR
* cmd value if CMD, multiplier otherwise
* OID: SNMP OID or NULL
* dfl: default value
* flags: snmp-ups internal flags (FIXME: ...)
* oid2info: lookup table between OID and NUT values
* setvar: variable to set for SU_FLAG_SETINT
* Copyright (C)
* 2011 - 2016 Arnaud Quette <arnaud.quette@free.fr>
*
* Example:
* { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL },
* { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, onbatt_info },
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* To create a value lookup structure (as needed on the 2nd line), use the
* following kind of declaration, outside of the present snmp_info_t[]:
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ${UDRIVER}_MIB_H
#define ${UDRIVER}_MIB_H
#include "main.h"
#include "snmp-ups.h"
extern mib2nut_info_t ${LDRIVER};
#endif /* ${UDRIVER}_MIB_H */
EOF
# generate source file
# create heading boilerblate
# NOTE: with <<-EOF leading TABs are all stripped
echo "Creating $CFILE"
cat > "$CFILE" <<-EOF
/* ${CFILE} - subdriver to monitor ${DRIVER} SNMP devices with NUT
*
* Copyright (C)
* 2011 - 2016 Arnaud Quette <arnaud.quette@free.fr>
*
* Note: this subdriver was initially generated as a "stub" by the
* gen-snmp-subdriver script. It must be customized!
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "${HFILE}"
#define ${UDRIVER}_MIB_VERSION "0.1"
#define ${UDRIVER}_SYSOID "${DEVICE_SYSOID}"
/* To create a value lookup structure (as needed on the 2nd line of the example
* below), use the following kind of declaration, outside of the present snmp_info_t[]:
* static info_lkp_t onbatt_info[] = {
* { 1, "OB" },
* { 2, "OL" },
* { 0, NULL }
* };
*/
/* ${UDRIVER} Snmp2NUT lookup table */
static snmp_info_t ${LDRIVER}_mib[] = {
/* Data format:
* { info_type, info_flags, info_len, OID, dfl, flags, oid2info },
*
* info_type: NUT INFO_ or CMD_ element name
* info_flags: flags to set in addinfo
* info_len: length of strings if ST_FLAG_STRING, multiplier otherwise
* OID: SNMP OID or NULL
* dfl: default value
* flags: snmp-ups internal flags (FIXME: ...)
* oid2info: lookup table between OID and NUT values
*
* Example:
* { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL },
* { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, onbatt_info },
*
* To create a value lookup structure (as needed on the 2nd line), use the
* following kind of declaration, outside of the present snmp_info_t[]:
* static info_lkp_t onbatt_info[] = {
* { 1, "OB" },
* { 2, "OL" },
* { 0, NULL }
* };
*/
/* standard MIB items; if the vendor MIB contains better OIDs for
* this (e.g. with daisy-chain support), consider adding those here
*/
EOF
# Same file, indented text (TABs not stripped):
cat >> "$CFILE" <<EOF
{ "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL },
{ "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL },
{ "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL },
EOF
# extract OID string paths, one by one
LINENB="0"
while IFS= read -r line; do
LINENB="`expr $LINENB + 1`"
FULL_STR_OID="$line"
STR_OID="`echo "$line" | cut -d'.' -f1`"
echo "$line" | grep STRING > /dev/null
if [ $? -eq 0 ]; then
ST_FLAG_TYPE="ST_FLAG_STRING"
SU_INFOSIZE="SU_INFOSIZE"
else
ST_FLAG_TYPE="0"
SU_INFOSIZE="1"
fi
# get the matching numeric OID
NUM_OID="`sed -n "${LINENB}p" "${NUMWALKFILE}" | cut -d' ' -f1`"
printf "\t/* ${FULL_STR_OID} */\n\t{ \"unmapped.${STR_OID}\", ${ST_FLAG_TYPE}, ${SU_INFOSIZE}, \"${NUM_OID}\", NULL, SU_FLAG_OK, NULL },\n"
done < "${STRWALKFILE}" >> "${CFILE}"
# extract OID string paths, one by one
LINENB="0"
while IFS= read -r line; do
LINENB="`expr $LINENB + 1`"
FULL_STR_OID="$line"
STR_OID="`echo $line | cut -d'.' -f1`"
echo $line | grep STRING > /dev/null
if [ $? -eq 0 ]; then
ST_FLAG_TYPE="ST_FLAG_STRING"
SU_INFOSIZE="SU_INFOSIZE"
else
ST_FLAG_TYPE="0"
SU_INFOSIZE="1"
fi
# get the matching numeric OID
NUM_OID="`sed -n ${LINENB}p ${NUMWALKFILE} | cut -d' ' -f1`"
printf "\t/* ${FULL_STR_OID} */\n\t{ \"unmapped.${STR_OID}\", ${ST_FLAG_TYPE}, ${SU_INFOSIZE}, \"${NUM_OID}\", NULL, SU_FLAG_OK, NULL, NULL },\n"
done < ${STRWALKFILE} >> ${CFILE}
# append footer
cat >> "$CFILE" <<EOF
# append footer (TABs not stripped):
cat >> "$CFILE" <<EOF
/* end of structure. */
{ NULL, 0, 0, NULL, NULL, 0, NULL }
};
mib2nut_info_t ${LDRIVER} = { "${LDRIVER}", ${UDRIVER}_MIB_VERSION, NULL, NULL, ${LDRIVER}_mib, ${UDRIVER}_SYSOID };
mib2nut_info_t ${LDRIVER} = { "${LDRIVER}", ${UDRIVER}_MIB_VERSION, NULL, NULL, ${LDRIVER}_mib, ${UDRIVER}_DEVICE_SYSOID };
EOF
return
}
# process command line options
while [ $# -gt 0 ]; do
if [ $# -gt 1 -a "$1" = "-n" ]; then
DRIVER="$2"
shift 2
elif [ $# -gt 1 -a "$1" = "-M" ]; then
MIBS_DIRLIST="$MIBS_DIRLIST:$2"
shift 2
elif [ "$1" = "-k" ]; then
KEEP=yes
shift
elif [ $# -gt 1 -a "$1" = "-H" ]; then
HOSTNAME="$2"
shift 2
elif [ $# -gt 1 -a "$1" = "-c" ]; then
COMMUNITY="$2"
shift 2
elif [ $# -gt 1 -a "$1" = "-s" ]; then
SYSOID="$2"
shift 2
elif echo "$1" | grep -qv '^-'; then
if [ $# -gt 1 ]; then
NUMWALKFILE="$1"
shift
STRWALKFILE="$1"
shift
else
NUMWALKFILE="$1"
shift
#usage
#exit 1
fi
elif [ "$1" = "--help" -o "$1" = "-h" ]; then
usage
exit 0
else
echo "Illegal option $1. Try --help for more info." >&2
exit 1
fi
done
# check that the needed parameters are provided, depending on the mode
if [ -z "$NUMWALKFILE" ]; then
# mode 1: directly get SNMP data from a real agent
echo "Mode 1 selected"
MODE=1
NUMWALKFILE="$DFL_NUMWALKFILE"
STRWALKFILE="$DFL_STRWALKFILE"
# check if Net SNMP is available
if [ -z "`command -v snmpget`" -o -z "`command -v snmpwalk`" ] && \
[ -z "`which snmpget`" -o -z "`which snmpwalk`" ]; then
echo "Net SNMP not found! snmpget and snmpwalk commands are required." >&2
exit 1
fi
# hostname is also mandatory
while [ -z "$HOSTNAME" ]; do
printf "\n\tPlease enter the SNMP host IP address or name.\n"
read -p "SNMP host IP name or address: " HOSTNAME < /dev/tty
if echo "$HOSTNAME" | egrep -q '[^a-zA-Z0-9.-]'; then
echo "Please use only letters, digits, dash and period character"
HOSTNAME=""
fi
done
# get data from the agent
get_snmp_data
else
# no string walk provided, so mode 3
if [ -z "$STRWALKFILE" ]; then
# mode 3: get data from 1 file,
# Filter according to sysOID on the specific subtree
# Generate the numeric SNMP walk using this output
# then use snmptranslate to get the string OIDs and generated the string SNMP walk
echo "Mode 3 selected"
MODE=3
RAWWALKFILE="$NUMWALKFILE"
NUMWALKFILE="$DFL_NUMWALKFILE"
STRWALKFILE="$DFL_STRWALKFILE"
# check for actual file existence
if [ ! -f "$RAWWALKFILE" ]; then
echo "SNMP walk dump file is missing on disk. Try --help for more info." >&2
exit 1
fi
# Extract the sysOID
# Format is "1.3.6.1.2.1.1.2.0 = OID: 1.3.6.1.4.1.4555.1.1.1"
DEVICE_SYSOID="`grep 1.3.6.1.2.1.1.2.0 "$RAWWALKFILE" | cut -d' ' -f4`"
if [ -n "$DEVICE_SYSOID" ]; then
echo "Found sysOID $DEVICE_SYSOID"
else
echo "SNMP sysOID is missing in file. Try --help for more info." >&2
exit 1
fi
# Switch to the entry point, and extract the subtree
# Extract the numeric walk
echo -n "Extracting numeric SNMP walk..."
grep "$DEVICE_SYSOID" "$RAWWALKFILE" | egrep -v "1.3.6.1.2.1.1.2.0" 2>/dev/null 1> "$NUMWALKFILE"
echo " done"
# Create the string walk from a translation of the numeric one
echo -n "Converting string SNMP walk..."
while IFS=' = ' read NUM_OID OID_VALUE
do
STR_OID="`snmptranslate -Os -m ALL -M+. "$NUM_OID" 2>/dev/null`"
# Uncomment the below line to get debug logs
#echo "Got: $STR_OID = $OID_VALUE"
printf "."
echo "$STR_OID = $OID_VALUE" >> "$STRWALKFILE"
done < "$NUMWALKFILE"
echo " done"
else
# mode 2: get data from files
echo "Mode 2 selected"
MODE=2
# get sysOID value from command line, if needed
while [ -z "$SYSOID" ]; do
echo "
Please enter the value of sysOID, as displayed by snmp-ups. For example '.1.3.6.1.4.1.2254.2.4'.
You can get it using: snmpget -v1 -c XXX <host> $SYSOID_NUMBER"
read -p "Value of sysOID: " SYSOID < /dev/tty
if echo "$SYSOID" | egrep -q '[^0-9.]'; then
echo "Please use only the numeric form, with dots and digits"
SYSOID=""
fi
done
# check for actual files existence
if [ ! -f "$NUMWALKFILE" -o ! -f "$STRWALKFILE" ]; then
echo "SNMP walk dump files are missing on disk. Try --help for more info." >&2
exit 1
fi
fi
fi
# delete temporary files: this is called just before exiting.
cleanup () {
rm -f "$DEBUG $DFL_NUMWALKFILE $TMP_NUMWALKFILE $DFL_STRWALKFILE $TMP_STRWALKFILE"
}
if [ -n "$KEEP" ]; then
trap cleanup EXIT
fi
# prompt use for name of driver
while [ -z "$DRIVER" ]; do
echo "
Please enter a name for this driver. Use only letters and numbers. Use
natural (upper- and lowercase) capitalization, e.g., 'Belkin', 'APC'."
read -p "Name of subdriver: " DRIVER < /dev/tty
if echo "$DRIVER" | egrep -q '[^a-zA-Z0-9]'; then
echo "Please use only letters and digits"
DRIVER=""
fi
done
# remove blank and "End of MIB" lines
egrep -e "^[[:space:]]?$" -e "End of MIB" -v "${NUMWALKFILE}" > "${TMP_NUMWALKFILE}"
egrep -e "^[[:space:]]?$" -e "End of MIB" -v "${STRWALKFILE}" > "${TMP_STRWALKFILE}"
NUMWALKFILE="${TMP_NUMWALKFILE}"
STRWALKFILE="${TMP_STRWALKFILE}"
# FIXME: sanity checks (! -z contents -a same `wc -l`)
NUM_OID_COUNT="`cat "$NUMWALKFILE" | wc -l`"
STR_OID_COUNT="`cat "$STRWALKFILE" | wc -l`"
echo "SNMP OIDs extracted = $NUM_OID_COUNT / $NUM_OID_COUNT"
generate_C
# Display the remaining tasks
cat <<EOF
Done.
Do not forget to:
For C-style integration, do not forget to:
* bump DRIVER_VERSION in snmp-ups.c (add "0.01")
* copy "${HFILE}" and "${CFILE}" to "../../drivers"
* add #include "${HFILE}" to drivers/snmp-ups.c

View file

@ -168,6 +168,9 @@ cat > "$CFILE" <<EOF
* 2008 - 2009 Arjen de Korte <adkorte-guest@alioth.debian.org>
* 2013 Charles Lepple <clepple+nut@gmail.com>
*
* TODO: Add year and name for new subdriver author (contributor)
* Mention in docs/acknowledgements.txt if this is a vendor contribution
*
* Note: this subdriver was initially generated as a "stub" by the
* gen-usbhid-subdriver script. It must be customized.
*
@ -203,7 +206,7 @@ static usb_device_id_t ${LDRIVER}_usb_device_table[] = {
{ USB_DEVICE(${UDRIVER}_VENDORID, 0x${PRODUCTID}), NULL },
/* Terminating entry */
{ -1, -1, NULL }
{ 0, 0, NULL }
};
@ -218,7 +221,7 @@ EOF
cat "$SUBST" | sed 's/\(.*\) \(.*\)/\t{ "\2",\t0x\1 },/' >> "$CFILE"
cat >> "$CFILE" <<EOF
{ NULL, 0 }
{ NULL, 0 }
};
static usage_tables_t ${LDRIVER}_utab[] = {
@ -238,14 +241,14 @@ EOF
cat "$NEWUTABLE" | sort -u | while read U; do
UL=`echo $U | tr A-Z a-z`
cat >> "$CFILE" <<EOF
{ "unmapped.${UL}", 0, 0, "${U}", NULL, "%.0f", 0, NULL },
{ "unmapped.${UL}", 0, 0, "${U}", NULL, "%.0f", 0, NULL },
EOF
done
cat >> "$CFILE" <<EOF
/* end of structure. */
{ NULL, 0, 0, NULL, NULL, NULL, 0, NULL }
/* end of structure. */
{ NULL, 0, 0, NULL, NULL, NULL, 0, NULL }
};
static const char *${LDRIVER}_format_model(HIDDevice_t *hd) {
@ -293,6 +296,7 @@ subdriver_t ${LDRIVER}_subdriver = {
${LDRIVER}_format_model,
${LDRIVER}_format_mfr,
${LDRIVER}_format_serial,
fix_report_desc, /* may optionally be customized, see cps-hid.c for example */
};
EOF

View file

@ -3,14 +3,35 @@ EXTRA_DIST = README
if HAVE_SYSTEMD
systemdsystemunit_DATA = \
nut-driver.service \
nut-driver-enumerator.service \
nut-driver-enumerator.path \
nut-driver@.service \
nut-monitor.service \
nut-server.service
nut-server.service \
nut-driver.target \
nut.target
systemdsystemshutdown_SCRIPTS = nutshutdown
systemdtmpfiles_DATA = \
nut-common.tmpfiles
EXTRA_DIST += nut-driver.target nut.target
systemdshutdown_SCRIPTS = nutshutdown
libexec_SCRIPTS = ../upsdrvsvcctl/nut-driver-enumerator.sh
sbin_SCRIPTS = ../upsdrvsvcctl/upsdrvsvcctl
else
EXTRA_DIST += nut-driver.service.in nut-monitor.service.in \
nut-server.service.in nutshutdown.in
EXTRA_DIST += \
nut-driver@.service.in nut-monitor.service.in \
nut-server.service.in nutshutdown.in nut-driver.target nut.target \
nut-driver-enumerator.path.in nut-driver-enumerator.service.in
# NOTE: Do not EXTRA_DIST nut-common.tmpfiles.in - it is generated per build
endif
MAINTAINERCLEANFILES = Makefile.in .dirstamp
# Generated by autogen.sh and needed to run the configure script:
MAINTAINERCLEANFILES += nut-common.tmpfiles.in

View file

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,7 +16,17 @@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -80,26 +90,31 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@HAVE_SYSTEMD_FALSE@am__append_1 = nut-driver.service.in nut-monitor.service.in \
@HAVE_SYSTEMD_FALSE@ nut-server.service.in nutshutdown.in
@HAVE_SYSTEMD_TRUE@am__append_1 = nut-driver.target nut.target
@HAVE_SYSTEMD_FALSE@am__append_2 = \
@HAVE_SYSTEMD_FALSE@ nut-driver@.service.in nut-monitor.service.in \
@HAVE_SYSTEMD_FALSE@ nut-server.service.in nutshutdown.in nut-driver.target nut.target \
@HAVE_SYSTEMD_FALSE@ nut-driver-enumerator.path.in nut-driver-enumerator.service.in
subdir = scripts/systemd
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/nut-driver.service.in \
$(srcdir)/nut-monitor.service.in \
$(srcdir)/nut-server.service.in $(srcdir)/nutshutdown.in \
README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
@ -108,15 +123,23 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = nut-driver.service nut-monitor.service \
nut-server.service nutshutdown
CONFIG_CLEAN_FILES = nut-common.tmpfiles nut-driver@.service \
nut-monitor.service nut-server.service \
nut-driver-enumerator.service nut-driver-enumerator.path \
nutshutdown
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@ -145,9 +168,12 @@ am__uninstall_files_from_dir = { \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(systemdsystemshutdowndir)" \
"$(DESTDIR)$(systemdsystemunitdir)"
SCRIPTS = $(systemdsystemshutdown_SCRIPTS)
am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" \
"$(DESTDIR)$(systemdshutdowndir)" \
"$(DESTDIR)$(systemdsystemunitdir)" \
"$(DESTDIR)$(systemdtmpfilesdir)"
SCRIPTS = $(libexec_SCRIPTS) $(sbin_SCRIPTS) \
$(systemdshutdown_SCRIPTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@ -167,8 +193,16 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DATA = $(systemdsystemunit_DATA)
DATA = $(systemdsystemunit_DATA) $(systemdtmpfiles_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in \
$(srcdir)/nut-common.tmpfiles.in \
$(srcdir)/nut-driver-enumerator.path.in \
$(srcdir)/nut-driver-enumerator.service.in \
$(srcdir)/nut-driver@.service.in \
$(srcdir)/nut-monitor.service.in \
$(srcdir)/nut-server.service.in $(srcdir)/nutshutdown.in \
README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
@ -177,6 +211,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -187,6 +222,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
@ -200,6 +236,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
@ -212,6 +249,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -229,6 +267,8 @@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
@ -239,21 +279,29 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
@ -273,6 +321,9 @@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
@ -286,6 +337,7 @@ STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
@ -303,6 +355,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@ -316,6 +369,9 @@ datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@ -341,12 +397,14 @@ pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemshutdowndir = @systemdsystemshutdowndir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
@ -356,13 +414,27 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udevdir = @udevdir@
EXTRA_DIST = README $(am__append_1)
EXTRA_DIST = README $(am__append_1) $(am__append_2)
@HAVE_SYSTEMD_TRUE@systemdsystemunit_DATA = \
@HAVE_SYSTEMD_TRUE@ nut-driver.service \
@HAVE_SYSTEMD_TRUE@ nut-driver-enumerator.service \
@HAVE_SYSTEMD_TRUE@ nut-driver-enumerator.path \
@HAVE_SYSTEMD_TRUE@ nut-driver@.service \
@HAVE_SYSTEMD_TRUE@ nut-monitor.service \
@HAVE_SYSTEMD_TRUE@ nut-server.service
@HAVE_SYSTEMD_TRUE@ nut-server.service \
@HAVE_SYSTEMD_TRUE@ nut-driver.target \
@HAVE_SYSTEMD_TRUE@ nut.target
@HAVE_SYSTEMD_TRUE@systemdsystemshutdown_SCRIPTS = nutshutdown
@HAVE_SYSTEMD_TRUE@systemdtmpfiles_DATA = \
@HAVE_SYSTEMD_TRUE@ nut-common.tmpfiles
@HAVE_SYSTEMD_TRUE@systemdshutdown_SCRIPTS = nutshutdown
@HAVE_SYSTEMD_TRUE@libexec_SCRIPTS = ../upsdrvsvcctl/nut-driver-enumerator.sh
@HAVE_SYSTEMD_TRUE@sbin_SCRIPTS = ../upsdrvsvcctl/upsdrvsvcctl
# NOTE: Do not EXTRA_DIST nut-common.tmpfiles.in - it is generated per build
# Generated by autogen.sh and needed to run the configure script:
MAINTAINERCLEANFILES = Makefile.in .dirstamp nut-common.tmpfiles.in
all: all-am
.SUFFIXES:
@ -378,14 +450,13 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/systemd/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/systemd/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -396,20 +467,26 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
nut-driver.service: $(top_builddir)/config.status $(srcdir)/nut-driver.service.in
nut-common.tmpfiles: $(top_builddir)/config.status $(srcdir)/nut-common.tmpfiles.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut-driver@.service: $(top_builddir)/config.status $(srcdir)/nut-driver@.service.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut-monitor.service: $(top_builddir)/config.status $(srcdir)/nut-monitor.service.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut-server.service: $(top_builddir)/config.status $(srcdir)/nut-server.service.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut-driver-enumerator.service: $(top_builddir)/config.status $(srcdir)/nut-driver-enumerator.service.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut-driver-enumerator.path: $(top_builddir)/config.status $(srcdir)/nut-driver-enumerator.path.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nutshutdown: $(top_builddir)/config.status $(srcdir)/nutshutdown.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-systemdsystemshutdownSCRIPTS: $(systemdsystemshutdown_SCRIPTS)
install-libexecSCRIPTS: $(libexec_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(systemdsystemshutdown_SCRIPTS)'; test -n "$(systemdsystemshutdowndir)" || list=; \
@list='$(libexec_SCRIPTS)'; test -n "$(libexecdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(systemdsystemshutdowndir)'"; \
$(MKDIR_P) "$(DESTDIR)$(systemdsystemshutdowndir)" || exit 1; \
echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@ -428,17 +505,87 @@ install-systemdsystemshutdownSCRIPTS: $(systemdsystemshutdown_SCRIPTS)
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(systemdsystemshutdowndir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(systemdsystemshutdowndir)$$dir" || exit $$?; \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
} \
; done
uninstall-systemdsystemshutdownSCRIPTS:
uninstall-libexecSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(systemdsystemshutdown_SCRIPTS)'; test -n "$(systemdsystemshutdowndir)" || exit 0; \
@list='$(libexec_SCRIPTS)'; test -n "$(libexecdir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(systemdsystemshutdowndir)'; $(am__uninstall_files_from_dir)
dir='$(DESTDIR)$(libexecdir)'; $(am__uninstall_files_from_dir)
install-sbinSCRIPTS: $(sbin_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n' \
-e 'h;s|.*|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
if (++n[d] == $(am__install_max)) { \
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
else { print "f", d "/" $$4, $$1 } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
} \
; done
uninstall-sbinSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir)
install-systemdshutdownSCRIPTS: $(systemdshutdown_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(systemdshutdown_SCRIPTS)'; test -n "$(systemdshutdowndir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(systemdshutdowndir)'"; \
$(MKDIR_P) "$(DESTDIR)$(systemdshutdowndir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n' \
-e 'h;s|.*|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
if (++n[d] == $(am__install_max)) { \
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
else { print "f", d "/" $$4, $$1 } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(systemdshutdowndir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(systemdshutdowndir)$$dir" || exit $$?; \
} \
; done
uninstall-systemdshutdownSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(systemdshutdown_SCRIPTS)'; test -n "$(systemdshutdowndir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(systemdshutdowndir)'; $(am__uninstall_files_from_dir)
mostlyclean-libtool:
-rm -f *.lo
@ -466,6 +613,27 @@ uninstall-systemdsystemunitDATA:
@list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(systemdsystemunitdir)'; $(am__uninstall_files_from_dir)
install-systemdtmpfilesDATA: $(systemdtmpfiles_DATA)
@$(NORMAL_INSTALL)
@list='$(systemdtmpfiles_DATA)'; test -n "$(systemdtmpfilesdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(systemdtmpfilesdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(systemdtmpfilesdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemdtmpfilesdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(systemdtmpfilesdir)" || exit $$?; \
done
uninstall-systemdtmpfilesDATA:
@$(NORMAL_UNINSTALL)
@list='$(systemdtmpfiles_DATA)'; test -n "$(systemdtmpfilesdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(systemdtmpfilesdir)'; $(am__uninstall_files_from_dir)
tags TAGS:
ctags CTAGS:
@ -473,7 +641,10 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -507,7 +678,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(SCRIPTS) $(DATA)
installdirs:
for dir in "$(DESTDIR)$(systemdsystemshutdowndir)" "$(DESTDIR)$(systemdsystemunitdir)"; do \
for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(systemdshutdowndir)" "$(DESTDIR)$(systemdsystemunitdir)" "$(DESTDIR)$(systemdtmpfilesdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@ -540,6 +711,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
@ -560,14 +732,14 @@ info: info-am
info-am:
install-data-am: install-systemdsystemshutdownSCRIPTS \
install-systemdsystemunitDATA
install-data-am: install-systemdshutdownSCRIPTS \
install-systemdsystemunitDATA install-systemdtmpfilesDATA
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-exec-am: install-libexecSCRIPTS install-sbinSCRIPTS
install-html: install-html-am
@ -605,8 +777,9 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-systemdsystemshutdownSCRIPTS \
uninstall-systemdsystemunitDATA
uninstall-am: uninstall-libexecSCRIPTS uninstall-sbinSCRIPTS \
uninstall-systemdshutdownSCRIPTS \
uninstall-systemdsystemunitDATA uninstall-systemdtmpfilesDATA
.MAKE: install-am install-strip
@ -615,15 +788,19 @@ uninstall-am: uninstall-systemdsystemshutdownSCRIPTS \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip install-systemdsystemshutdownSCRIPTS \
install-systemdsystemunitDATA installcheck installcheck-am \
install-html-am install-info install-info-am \
install-libexecSCRIPTS install-man install-pdf install-pdf-am \
install-ps install-ps-am install-sbinSCRIPTS install-strip \
install-systemdshutdownSCRIPTS install-systemdsystemunitDATA \
install-systemdtmpfilesDATA installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags-am uninstall uninstall-am \
uninstall-systemdsystemshutdownSCRIPTS \
uninstall-systemdsystemunitDATA
uninstall-libexecSCRIPTS uninstall-sbinSCRIPTS \
uninstall-systemdshutdownSCRIPTS \
uninstall-systemdsystemunitDATA uninstall-systemdtmpfilesDATA
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View file

@ -4,5 +4,10 @@ Service Manager.
These files are automatically installed, upon detection (at configure time)
of a systemd enabled system.
Contributed by Michal Hlavinka <mhlavink@redhat.com>
This also uses the nut-driver-enumerator.sh (service and implementation
method) and upsdrvsvcctl (tool) to manage NUT drivers as service instances
located in ../upsdrvsvcctl/ source subdirectory.
Contributed by Michal Hlavinka <mhlavink@redhat.com>
Updated 2016-2018 by Michal Hrusecky and Jim Klimov <EvgenyKlimov@eaton.com>

View file

@ -0,0 +1,5 @@
# State file (e.g. upsd to driver) and pidfile location for NUT:
d @STATEPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
X @STATEPATH@/nut
d @PIDPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
X @PIDPATH@/nut

View file

@ -0,0 +1,7 @@
# Trigger restart of nut-driver-enumerator.service whenever ups.conf is edited
[Path]
PathModified=@CONFPATH@/ups.conf
[Install]
WantedBy=nut.target

View file

@ -0,0 +1,30 @@
[Unit]
# This unit starts early in system lifecycle to set up nut-driver instances.
# End-user may also restart this unit after editing ups.conf to automatically
# un-register or add new instances as appropriate.
Description=Network UPS Tools - enumeration of configure-file devices into systemd unit instances
After=local-fs.target
Before=nut-driver.target
PartOf=nut.target
[Service]
### Script needs privileges to restart units
#User=@RUN_AS_USER@
#Group=@RUN_AS_GROUP@
User=root
SyslogIdentifier=%N
# it is expected that the process has to exit before systemd starts follow-up
# units; it should not be a problem for those
Type=oneshot
# Currently systemd does not support restarting of oneshot services, and does
# not seem to guarantee that other services would only start after the script
# completes, for a non-oneshot case. The script itself handles restarting of
# nut-server which is the primary concerned dependency at the moment, so we
# don't want it to fail the unit (when it can't restart).
Environment=REPORT_RESTART_42=no
EnvironmentFile=-@CONFPATH@/nut.conf
ExecStart=@NUT_LIBEXECDIR@/nut-driver-enumerator.sh
ExecReload=@NUT_LIBEXECDIR@/nut-driver-enumerator.sh
[Install]
WantedBy=nut.target

View file

@ -1,10 +0,0 @@
[Unit]
Description=Network UPS Tools - power device driver controller
After=local-fs.target network.target
StopWhenUnneeded=yes
[Service]
ExecStart=@SBINDIR@/upsdrvctl start
ExecStop=@SBINDIR@/upsdrvctl stop
Type=forking

View file

@ -0,0 +1,8 @@
[Unit]
Description=Network UPS Tools - target for power device drivers on this system
After=local-fs.target
# network.target
PartOf=nut.target
[Install]
WantedBy=nut.target

View file

@ -0,0 +1,67 @@
[Unit]
Description=Network UPS Tools - device driver for %I
After=local-fs.target
# Note: If the "Before" line below is uncommented, the target unit
# would only become initialized after the driver units are all in
# a final state (active, failed, ...) and would allow nut-server
# (upsd) to start up and represent those devices on the network.
# With this constraint commented away, the nut-server should start
# earlier, but may initially report some devices as Not connected
# (they should appear when drivers complete their initialization -
# e.g. snmp walks of large MIBs can take a while):
#Before=nut-driver.target
# Propagate stopping of the target:
PartOf=nut-driver.target
# Note: The choice of "network.target" allows to schedule this unit
# roughly when the network stack of this OS is ready (e.g. that the
# subsequent `upsd` will have a `0.0.0.0` or a `localhost` to bind
# to); however this target does not ensure availability of a real
# connection or final IP addresses. Drivers that require network as
# a media for interaction with UPSes (snmp-ups, netxml-ups, ipmi etc.)
# may want to extend this unit with `Requires=network-online.target`
# instead. Also note that *generally* this should not be a problem,
# since the drivers have a few retries with timeouts during startup,
# and typically by the time the box gets an IP address, the driver
# is still retrying to start and will succeed.
# Extending the unit does not require *this* file to be edited, you
# can instead drop in an additional piece of configuration, e.g. add
# a `/etc/systemd/system/nut-driver@.service.d/network.conf` with:
# [Unit]
# Requires=network-online.target
# After=network-online.target
# If your `upsd` requires specific IP addresses to be available before
# starting, a `/etc/systemd/system/nut-driver.target.d/network.conf`
# can be used in a similar manner.
# Finally note that "nut-driver-enumerator.service" should take care of this.
[Service]
EnvironmentFile=-@CONFPATH@/nut.conf
SyslogIdentifier=%N
ExecStart=/bin/sh -c 'NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl start "$NUTDEV"'
ExecStop=/bin/sh -c 'NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl stop "$NUTDEV"'
# Restart really always, do not stop trying:
StartLimitInterval=0
Restart=always
# Protract the "hold-off" interval, so if the device connection is
# lost, the driver does not reapidly restart and fail too many times,
# and then systemd would keep the unit failed without further retries.
# Notably, this helps start "dummy-ups" drivers retranslating local
# devices (so getting a chicken-and-egg problem for driver-upsd-driver
# orderly series of initializations). More details in NUT issue #779.
RestartSec=15s
Type=forking
# Note: If you customize the "maxstartdelay" in ups.conf or in your
# NUT compilation defaults, so it exceeds the default systemd unit
# startup timeout (typically 90 sec), then make sure to set a slightly
# longer systemd timeout for the nut-driver unit instances. You can
# do this by populating a drop-in configuration, so it is not later
# overwritten by updates to your NUT package -- create a dir+file:
# /etc/systemd/system/nut-driver@.service.d/timeout.conf with lines:
# [Service]
# TimeoutStartSec=190s
[Install]
WantedBy=nut-driver.target

View file

@ -1,11 +1,26 @@
[Unit]
Description=Network UPS Tools - power device monitor and shutdown controller
After=local-fs.target network.target nut-server.service
# Note: We do not specify Requires nut-server.service because
# the `upsd` daemon(s) may be running on a different machine
# (connected to the UPSes) than the `upsmon` shutdown protector.
# The "Wants" directive would try to start the nut-server but
# would not abort if that attempt fails for whatever reason.
Wants=nut-server.service
# Extending the unit does not require *this* file to be edited, you
# can instead drop in an additional piece of configuration, e.g. add
# a `/etc/systemd/system/nut-monitor.service.d/network.conf` with:
# [Unit]
# Requires=network-online.target
# After=network-online.target
PartOf=nut.target
[Service]
ExecStart=@SBINDIR@/upsmon
EnvironmentFile=-@CONFPATH@/nut.conf
SyslogIdentifier=%N
ExecStart=@SBINDIR@/upsmon -F
ExecReload=@SBINDIR@/upsmon -c reload
PIDFile=@PIDPATH@/upsmon.pid
Type=forking
[Install]
WantedBy=multi-user.target
WantedBy=nut.target

View file

@ -1,15 +1,29 @@
[Unit]
Description=Network UPS Tools - power devices information server
After=local-fs.target network.target nut-driver.service
After=local-fs.target network.target nut-driver.target
# We don't Require drivers to be successfully started! This would be
# a change of behavior compared to init SysV, and could prevent from
# accessing successfully started, at least to audit a system.
Wants=nut-driver.service
Wants=nut-driver.target
# The `upsd` is a networked service (even if bound to a `localhost`)
# so it requires that the OS has some notion of networking already.
# Extending the unit does not require *this* file to be edited, you
# can instead drop in an additional piece of configuration, e.g. add
# a `/etc/systemd/system/nut-server.service.d/network.conf` with:
# [Unit]
# Requires=network-online.target
# After=network-online.target
Requires=network.target
Before=nut-monitor.service
PartOf=nut.target
[Service]
ExecStart=@SBINDIR@/upsd
Type=forking
EnvironmentFile=-@CONFPATH@/nut.conf
SyslogIdentifier=%N
# Note: foreground mode by default skips writing a PID file (and
# needs Type=simple); can use "-FF" here to create one anyway:
ExecStart=@SBINDIR@/upsd -F
ExecReload=@SBINDIR@/upsd -c reload -P $MAINPID
[Install]
WantedBy=multi-user.target
WantedBy=nut.target

View file

@ -0,0 +1,8 @@
[Unit]
Description=Network UPS Tools - target for power device drivers, data server and monitoring client (if enabled) on this system
After=local-fs.target nut-driver.target nut-server.service nut-monitor.service
Wants=local-fs.target nut-driver.target nut-server.service nut-monitor.service
# network.target
[Install]
WantedBy=multi-user.target

23
scripts/systemd/nutshutdown.in Normal file → Executable file
View file

@ -1,2 +1,23 @@
#!/bin/sh
@SBINDIR@/upsmon -K >/dev/null 2>&1 && @SBINDIR@/upsdrvctl shutdown
# This script requires both nut-server (drivers)
# and nut-client (upsmon) to be present locally
# and on mounted filesystems
[ -x "@SBINDIR@/upsmon" ] && [ -x "@SBINDIR@/upsdrvctl" ] || exit
if @SBINDIR@/upsmon -K >/dev/null 2>&1; then
# The argument may be anything compatible with sleep
# (not necessarily a non-negative integer)
wait_delay="`/bin/sed -ne 's#^ *POWEROFF_WAIT= *\(.*\)$#\1#p' @CONFPATH@/nut.conf`" || wait_delay=""
@SBINDIR@/upsdrvctl shutdown
if [ -n "$wait_delay" ] ; then
/bin/sleep $wait_delay
# We need to pass --force twice here to bypass systemd and execute the
# reboot directly ourself.
/bin/systemctl reboot --force --force
fi
fi
exit 0

View file

@ -18,7 +18,17 @@ EXTRA_DIST = README
52-nut-ipmipsu.rules: nut-ipmipsu.rules
cp nut-ipmipsu.rules $@
MAINTAINERCLEANFILES = Makefile.in .dirstamp
# Generated by configure script:
DISTCLEANFILES = nut-usbups.rules nut-ipmipsu.rules
CLEANFILES = 62-nut-usbups.rules 52-nut-ipmipsu.rules
# we should never remove this one, apart from a distclean-check
#MAINTAINERCLEANFILES = nut-usbups.rules.in
# Generated by autogen.sh and needed to run the configure script
# (technically, generated by tools/nut-usbinfo.pl script among
# GENERATED_USB_OS_FILES):
MAINTAINERCLEANFILES += nut-usbups.rules.in nut-usbups.rules.in.AUTOGEN_WITHOUT

View file

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -15,7 +15,17 @@
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -82,20 +92,24 @@ target_triplet = @target@
@WITH_UDEV_TRUE@@WITH_USB_TRUE@am__append_1 = 62-nut-usbups.rules
@WITH_IPMI_TRUE@@WITH_UDEV_TRUE@am__append_2 = 52-nut-ipmipsu.rules
subdir = scripts/udev
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/nut-ipmipsu.rules.in $(srcdir)/nut-usbups.rules.in \
README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
@ -104,11 +118,17 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = nut-ipmipsu.rules nut-usbups.rules
@ -162,6 +182,8 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(udevrulesdir)"
DATA = $(udevrules_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/nut-ipmipsu.rules.in \
$(srcdir)/nut-usbups.rules.in README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
@ -170,6 +192,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -180,6 +203,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
@ -193,6 +217,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
@ -205,6 +230,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -222,6 +248,8 @@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
@ -232,21 +260,29 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
@ -266,6 +302,9 @@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
@ -279,6 +318,7 @@ STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
@ -296,6 +336,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@ -309,6 +350,9 @@ datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@ -334,12 +378,14 @@ pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemshutdowndir = @systemdsystemshutdowndir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
@ -352,6 +398,17 @@ udevdir = @udevdir@
@WITH_UDEV_TRUE@udevrulesdir = $(udevdir)/rules.d
@WITH_UDEV_TRUE@udevrules_DATA = $(am__append_1) $(am__append_2)
EXTRA_DIST = README
# we should never remove this one, apart from a distclean-check
#MAINTAINERCLEANFILES = nut-usbups.rules.in
# Generated by autogen.sh and needed to run the configure script
# (technically, generated by tools/nut-usbinfo.pl script among
# GENERATED_USB_OS_FILES):
MAINTAINERCLEANFILES = Makefile.in .dirstamp nut-usbups.rules.in \
nut-usbups.rules.in.AUTOGEN_WITHOUT
# Generated by configure script:
DISTCLEANFILES = nut-usbups.rules nut-ipmipsu.rules
CLEANFILES = 62-nut-usbups.rules 52-nut-ipmipsu.rules
all: all-am
@ -369,14 +426,13 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/udev/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/udev/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -425,7 +481,10 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -494,6 +553,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
@ -575,14 +635,14 @@ uninstall-am: uninstall-udevrulesDATA
mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
uninstall-am uninstall-udevrulesDATA
.PRECIOUS: Makefile
62-nut-usbups.rules: nut-usbups.rules
cp nut-usbups.rules $@
52-nut-ipmipsu.rules: nut-ipmipsu.rules
cp nut-ipmipsu.rules $@
# we should never remove this one, apart from a distclean-check
#MAINTAINERCLEANFILES = nut-usbups.rules.in
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -1,12 +1,12 @@
# This file is generated and installed by the Network UPS Tools package.
ACTION!="add|change", GOTO="nut-usbups_rules_end"
ACTION=="remove", GOTO="nut-usbups_rules_end"
SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real"
SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real"
SUBSYSTEM!="usb", GOTO="nut-usbups_rules_end"
GOTO="nut-usbups_rules_end"
LABEL="nut-usbups_rules_real"
# ATCL FOR UPS - nutdrv_atcl_usb
# SNR-UPS-LID-XXXX UPSes - nutdrv_qx
ATTR{idVendor}=="0001", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@"
# Hewlett Packard
@ -50,8 +50,16 @@ ATTR{idVendor}=="0463", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROU
# Dell
# various models - usbhid-ups
ATTR{idVendor}=="047c", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@"
# TS Shara UPSes - nutdrv_qx
# ST Microelectronics
# TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs - nutdrv_qx
ATTR{idVendor}=="0483", ATTR{idProduct}=="0035", MODE="664", GROUP="@RUN_AS_GROUP@"
# USB IDs device table - usbhid-ups
ATTR{idVendor}=="0483", ATTR{idProduct}=="a113", MODE="664", GROUP="@RUN_AS_GROUP@"
# IBM
# 6000 VA LCD 4U Rack UPS; 5396-1Kx - usbhid-ups
ATTR{idVendor}=="04b3", ATTR{idProduct}=="0001", MODE="664", GROUP="@RUN_AS_GROUP@"
# Riello (Cypress Semiconductor Corp.)
# various models - riello_usb
@ -98,25 +106,31 @@ ATTR{idVendor}=="051d", ATTR{idProduct}=="0003", MODE="664", GROUP="@RUN_AS_GROU
ATTR{idVendor}=="0592", ATTR{idProduct}=="0002", MODE="664", GROUP="@RUN_AS_GROUP@"
# PW 9140 - usbhid-ups
ATTR{idVendor}=="0592", ATTR{idProduct}=="0004", MODE="664", GROUP="@RUN_AS_GROUP@"
# Agiler UPS - blazer_usb
# Agiler UPS - nutdrv_qx
ATTR{idVendor}=="05b8", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@"
# Belkin F6C1200-UNV - blazer_usb
# Delta UPS
# Delta UPS Amplon R Series, Single Phase UPS, 1/2/3 kVA - usbhid-ups
ATTR{idVendor}=="05dd", ATTR{idProduct}=="041b", MODE="664", GROUP="@RUN_AS_GROUP@"
# Delta/Minuteman Enterprise Plus E1500RM2U - usbhid-ups
ATTR{idVendor}=="05dd", ATTR{idProduct}=="a011", MODE="664", GROUP="@RUN_AS_GROUP@"
# Belkin F6C1200-UNV/Voltronic Power UPSes - nutdrv_qx
ATTR{idVendor}=="0665", ATTR{idProduct}=="5161", MODE="664", GROUP="@RUN_AS_GROUP@"
# Phoenixtec Power Co., Ltd
# various models - bcmxcp_usb
# Online Yunto YQ450 - nutdrv_qx
ATTR{idVendor}=="06da", ATTR{idProduct}=="0002", MODE="664", GROUP="@RUN_AS_GROUP@"
# Mustek Powermust - blazer_usb
# Mustek Powermust - nutdrv_qx
ATTR{idVendor}=="06da", ATTR{idProduct}=="0003", MODE="664", GROUP="@RUN_AS_GROUP@"
# Phoenixtec Innova 3/1 T - blazer_usb
# Phoenixtec Innova 3/1 T - nutdrv_qx
ATTR{idVendor}=="06da", ATTR{idProduct}=="0004", MODE="664", GROUP="@RUN_AS_GROUP@"
# Phoenixtec Innova RT - blazer_usb
# Phoenixtec Innova RT - nutdrv_qx
ATTR{idVendor}=="06da", ATTR{idProduct}=="0005", MODE="664", GROUP="@RUN_AS_GROUP@"
# Phoenixtec Innova T - blazer_usb
# Phoenixtec Innova T - nutdrv_qx
ATTR{idVendor}=="06da", ATTR{idProduct}=="0201", MODE="664", GROUP="@RUN_AS_GROUP@"
# Online Zinto A - blazer_usb
# Online Zinto A - nutdrv_qx
ATTR{idVendor}=="06da", ATTR{idProduct}=="0601", MODE="664", GROUP="@RUN_AS_GROUP@"
# various models - usbhid-ups
# PROTECT B / NAS - usbhid-ups
ATTR{idVendor}=="06da", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@"
# iDowell
@ -146,6 +160,8 @@ ATTR{idVendor}=="09ae", ATTR{idProduct}=="1008", MODE="664", GROUP="@RUN_AS_GROU
ATTR{idVendor}=="09ae", ATTR{idProduct}=="1009", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite ECO550UPS - usbhid-ups
ATTR{idVendor}=="09ae", ATTR{idProduct}=="1010", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite SU3000LCD2UHV - usbhid-ups
ATTR{idVendor}=="09ae", ATTR{idProduct}=="1330", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite OMNI1000LCD - usbhid-ups
ATTR{idVendor}=="09ae", ATTR{idProduct}=="2005", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite OMNI900LCD - usbhid-ups
@ -182,6 +198,8 @@ ATTR{idVendor}=="09ae", ATTR{idProduct}=="3014", MODE="664", GROUP="@RUN_AS_GROU
ATTR{idVendor}=="09ae", ATTR{idProduct}=="3015", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite Smart1500LCD (newer unit) - usbhid-ups
ATTR{idVendor}=="09ae", ATTR{idProduct}=="3016", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite AVR750U (newer unit) - usbhid-ups
ATTR{idVendor}=="09ae", ATTR{idProduct}=="3024", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) - usbhid-ups
ATTR{idVendor}=="09ae", ATTR{idProduct}=="4001", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite SmartOnline SU6000RT4U? - usbhid-ups
@ -214,7 +232,7 @@ ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a4", MODE="664", GROUP="@RUN_AS_GROU
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a5", MODE="664", GROUP="@RUN_AS_GROUP@"
# PowerCOM BNT - Black Knight Pro - usbhid-ups
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a6", MODE="664", GROUP="@RUN_AS_GROUP@"
# Unitek Alpha 1200Sx - blazer_usb
# Unitek Alpha 1200Sx - nutdrv_qx
ATTR{idVendor}=="0f03", ATTR{idProduct}=="0001", MODE="664", GROUP="@RUN_AS_GROUP@"
# Liebert
@ -224,13 +242,57 @@ ATTR{idVendor}=="10af", ATTR{idProduct}=="0001", MODE="664", GROUP="@RUN_AS_GROU
ATTR{idVendor}=="10af", ATTR{idProduct}=="0004", MODE="664", GROUP="@RUN_AS_GROUP@"
# Liebert GXT3 - usbhid-ups
ATTR{idVendor}=="10af", ATTR{idProduct}=="0008", MODE="664", GROUP="@RUN_AS_GROUP@"
# GE EP series - blazer_usb
# GE EP series - nutdrv_qx
ATTR{idVendor}=="14f0", ATTR{idProduct}=="00c9", MODE="664", GROUP="@RUN_AS_GROUP@"
# Legrand
# Legrand Keor SP - usbhid-ups
ATTR{idVendor}=="1cb0", ATTR{idProduct}=="0032", MODE="664", GROUP="@RUN_AS_GROUP@"
# Legrand Daker DK / DK Plus - nutdrv_qx
ATTR{idVendor}=="1cb0", ATTR{idProduct}=="0035", MODE="664", GROUP="@RUN_AS_GROUP@"
# Legrand Keor PDU - usbhid-ups
ATTR{idVendor}=="1cb0", ATTR{idProduct}=="0038", MODE="664", GROUP="@RUN_AS_GROUP@"
# Arduino
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
ATTR{idVendor}=="2341", ATTR{idProduct}=="0036", MODE="664", GROUP="@RUN_AS_GROUP@"
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
ATTR{idVendor}=="2341", ATTR{idProduct}=="8036", MODE="664", GROUP="@RUN_AS_GROUP@"
# Arduino
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
ATTR{idVendor}=="2A03", ATTR{idProduct}=="0036", MODE="664", GROUP="@RUN_AS_GROUP@"
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
ATTR{idVendor}=="2A03", ATTR{idProduct}=="0040", MODE="664", GROUP="@RUN_AS_GROUP@"
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
ATTR{idVendor}=="2A03", ATTR{idProduct}=="8036", MODE="664", GROUP="@RUN_AS_GROUP@"
# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups
ATTR{idVendor}=="2A03", ATTR{idProduct}=="8040", MODE="664", GROUP="@RUN_AS_GROUP@"
# AEG
# PROTECT B / NAS - usbhid-ups
ATTR{idVendor}=="2b2d", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@"
# Ablerex 625L USB - blazer_usb
# Ever
# USB IDs device table - usbhid-ups
ATTR{idVendor}=="2e51", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@"
# USB IDs device table - usbhid-ups
ATTR{idVendor}=="2e51", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@"
# Salicru
# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups
ATTR{idVendor}=="2e66", ATTR{idProduct}=="0201", MODE="664", GROUP="@RUN_AS_GROUP@"
# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups
ATTR{idVendor}=="2e66", ATTR{idProduct}=="0202", MODE="664", GROUP="@RUN_AS_GROUP@"
# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups
ATTR{idVendor}=="2e66", ATTR{idProduct}=="0203", MODE="664", GROUP="@RUN_AS_GROUP@"
# https://www.salicru.com/sps-home.html - usbhid-ups
ATTR{idVendor}=="2e66", ATTR{idProduct}=="0300", MODE="664", GROUP="@RUN_AS_GROUP@"
# Powervar
# Powervar - usbhid-ups
ATTR{idVendor}=="4234", ATTR{idProduct}=="0002", MODE="664", GROUP="@RUN_AS_GROUP@"
# Ablerex 625L USB (Note: earlier best-fit was "krauler_subdriver" before PR #1135) - nutdrv_qx
ATTR{idVendor}=="ffff", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@"
LABEL="nut-usbups_rules_end"

2
scripts/ufw/Makefile.am Normal file
View file

@ -0,0 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in .dirstamp
CLEANFILES = *-spellchecked

569
scripts/ufw/Makefile.in Normal file
View file

@ -0,0 +1,569 @@
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = scripts/ufw
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = nut.ufw.profile
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/nut.ufw.profile.in \
README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BINDIR = @BINDIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DBLATEX = @DBLATEX@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@
LIBAVAHI_LIBS = @LIBAVAHI_LIBS@
LIBDIR = @LIBDIR@
LIBGD_CFLAGS = @LIBGD_CFLAGS@
LIBGD_LDFLAGS = @LIBGD_LDFLAGS@
LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@
LIBOBJS = @LIBOBJS@
LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@
LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OS_NAME = @OS_NAME@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PIDPATH = @PIDPATH@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
SBINDIR = @SBINDIR@
SED = @SED@
SERLIBS = @SERLIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@
STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
cgiexecdir = @cgiexecdir@
datadir = @datadir@
datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
hotplugdir = @hotplugdir@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
now = @now@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udevdir = @udevdir@
MAINTAINERCLEANFILES = Makefile.in .dirstamp
CLEANFILES = *-spellchecked
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/ufw/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/ufw/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
nut.ufw.profile: $(top_builddir)/config.status $(srcdir)/nut.ufw.profile.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags TAGS:
ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -1,145 +1,2 @@
##############################################################################################################
# Uninterruptible Power Supplies with USB HID interfaces
#
# This file was automatically generated by NUT:
# https://github.com/networkupstools/nut/
#
# To keep up to date, monitor upstream NUT
# https://github.com/networkupstools/nut/commits/master/scripts/upower/95-upower-hid.rules
# or checkout the NUT repository and call 'tools/nut-usbinfo.pl'
# newer hiddev are part of the usbmisc class
SUBSYSTEM=="usbmisc", GOTO="up_hid_chkdev"
# only support USB, else ignore
SUBSYSTEM!="usb", GOTO="up_hid_end"
# if usbraw device, ignore
LABEL="up_hid_chkdev"
KERNEL!="hiddev*", GOTO="up_hid_end"
# if an interface, ignore
ENV{DEVTYPE}=="usb_interface", GOTO="up_hid_end"
ATTRS{idVendor}=="03f0", ENV{UPOWER_VENDOR}="Hewlett Packard"
ATTRS{idVendor}=="0463", ENV{UPOWER_VENDOR}="Eaton"
ATTRS{idVendor}=="047c", ENV{UPOWER_VENDOR}="Dell"
ATTRS{idVendor}=="04d8", ENV{UPOWER_VENDOR}="Minibox"
ATTRS{idVendor}=="050d", ENV{UPOWER_VENDOR}="Belkin"
ATTRS{idVendor}=="051d", ENV{UPOWER_VENDOR}="APC"
ATTRS{idVendor}=="0592", ENV{UPOWER_VENDOR}="Powerware"
ATTRS{idVendor}=="06da", ENV{UPOWER_VENDOR}="Phoenixtec Power Co., Ltd"
ATTRS{idVendor}=="075d", ENV{UPOWER_VENDOR}="iDowell"
ATTRS{idVendor}=="0764", ENV{UPOWER_VENDOR}="Cyber Power Systems"
ATTRS{idVendor}=="09ae", ENV{UPOWER_VENDOR}="TrippLite"
ATTRS{idVendor}=="0d9f", ENV{UPOWER_VENDOR}="PowerCOM"
ATTRS{idVendor}=="10af", ENV{UPOWER_VENDOR}="Liebert"
ATTRS{idVendor}=="2b2d", ENV{UPOWER_VENDOR}="AEG"
# Hewlett Packard
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f06", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f08", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f09", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f0a", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe0", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe1", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe2", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe3", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe5", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe6", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe7", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe8", ENV{UPOWER_BATTERY_TYPE}="ups"
# Eaton
ATTRS{idVendor}=="0463", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups"
# Dell
ATTRS{idVendor}=="047c", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups"
# Minibox
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="d004", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="d005", ENV{UPOWER_BATTERY_TYPE}="ups"
# Belkin
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0750", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0751", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0900", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0910", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0912", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0980", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0f51", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="1100", ENV{UPOWER_BATTERY_TYPE}="ups"
# APC
ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0000", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0002", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0003", ENV{UPOWER_BATTERY_TYPE}="ups"
# Powerware
ATTRS{idVendor}=="0592", ATTRS{idProduct}=="0004", ENV{UPOWER_BATTERY_TYPE}="ups"
# Phoenixtec Power Co., Ltd
ATTRS{idVendor}=="06da", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups"
# iDowell
ATTRS{idVendor}=="075d", ATTRS{idProduct}=="0300", ENV{UPOWER_BATTERY_TYPE}="ups"
# Cyber Power Systems
ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0005", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0501", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0601", ENV{UPOWER_BATTERY_TYPE}="ups"
# TrippLite
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1003", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1007", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1008", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1009", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1010", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2005", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2007", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2008", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2009", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2010", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2011", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2012", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2013", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2014", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3008", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3009", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3010", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3011", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3012", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3013", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3014", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3015", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3016", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4001", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4002", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4003", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4004", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4005", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4006", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4007", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4008", ENV{UPOWER_BATTERY_TYPE}="ups"
# PowerCOM
ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="0004", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a2", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a3", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a4", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a5", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a6", ENV{UPOWER_BATTERY_TYPE}="ups"
# Liebert
ATTRS{idVendor}=="10af", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="10af", ATTRS{idProduct}=="0004", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="10af", ATTRS{idProduct}=="0008", ENV{UPOWER_BATTERY_TYPE}="ups"
# AEG
ATTRS{idVendor}=="2b2d", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups"
LABEL="up_hid_end"
# Copy some attributes from the USB device to the hiddev device
SUBSYSTEM=="usbmisc", SUBSYSTEMS=="usb", KERNEL=="hiddev*", IMPORT{parent}="UPOWER_*", IMPORT{parent}="ID_VENDOR", IMPORT{parent}="ID_PRODUCT"

View file

@ -0,0 +1,13 @@
EXTRA_DIST = README
if HAVE_SYSTEMD
EXTRA_DIST += nut-driver-enumerator.sh upsdrvsvcctl
else
if WITH_SOLARIS_SMF
EXTRA_DIST += nut-driver-enumerator.sh upsdrvsvcctl
endif
endif
EXTRA_DIST += nut-driver-enumerator.sh.in upsdrvsvcctl.in
MAINTAINERCLEANFILES = Makefile.in .dirstamp

View file

@ -0,0 +1,574 @@
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@HAVE_SYSTEMD_TRUE@am__append_1 = nut-driver-enumerator.sh upsdrvsvcctl
@HAVE_SYSTEMD_FALSE@@WITH_SOLARIS_SMF_TRUE@am__append_2 = nut-driver-enumerator.sh upsdrvsvcctl
subdir = scripts/upsdrvsvcctl
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_c_pragmas.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nut_arg_with.m4 \
$(top_srcdir)/m4/nut_check_asciidoc.m4 \
$(top_srcdir)/m4/nut_check_cppcheck.m4 \
$(top_srcdir)/m4/nut_check_headers_windows.m4 \
$(top_srcdir)/m4/nut_check_libavahi.m4 \
$(top_srcdir)/m4/nut_check_libfreeipmi.m4 \
$(top_srcdir)/m4/nut_check_libgd.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libmodbus.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
$(top_srcdir)/m4/nut_check_pkgconfig.m4 \
$(top_srcdir)/m4/nut_check_python.m4 \
$(top_srcdir)/m4/nut_compiler_family.m4 \
$(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \
$(top_srcdir)/m4/nut_report_feature.m4 \
$(top_srcdir)/m4/nut_stash_warnings.m4 \
$(top_srcdir)/m4/nut_type_socklen_t.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = nut-driver-enumerator.sh upsdrvsvcctl
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in \
$(srcdir)/nut-driver-enumerator.sh.in \
$(srcdir)/upsdrvsvcctl.in README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUGPARSE = @AUGPARSE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BINDIR = @BINDIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFPATH = @CONFPATH@
CPP = @CPP@
CPPCHECK = @CPPCHECK@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DBLATEX = @DBLATEX@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOC_BUILD_LIST = @DOC_BUILD_LIST@
DOC_CHECK_LIST = @DOC_CHECK_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GDLIB_CONFIG = @GDLIB_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@
LIBAVAHI_LIBS = @LIBAVAHI_LIBS@
LIBDIR = @LIBDIR@
LIBGD_CFLAGS = @LIBGD_CFLAGS@
LIBGD_LDFLAGS = @LIBGD_LDFLAGS@
LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
LIBIPMI_LIBS = @LIBIPMI_LIBS@
LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@
LIBLTDL_LIBS = @LIBLTDL_LIBS@
LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@
LIBMODBUS_LIBS = @LIBMODBUS_LIBS@
LIBNEON_CFLAGS = @LIBNEON_CFLAGS@
LIBNEON_LIBS = @LIBNEON_LIBS@
LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@
LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@
LIBOBJS = @LIBOBJS@
LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@
LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@
LIBS = @LIBS@
LIBSSL_CFLAGS = @LIBSSL_CFLAGS@
LIBSSL_LIBS = @LIBSSL_LIBS@
LIBSSL_REQUIRES = @LIBSSL_REQUIRES@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_CONFIG = @LIBUSB_CONFIG@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@
LIBWRAP_LIBS = @LIBWRAP_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LN_S_R = @LN_S_R@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NETLIBS = @NETLIBS@
NET_SNMP_CONFIG = @NET_SNMP_CONFIG@
NM = @NM@
NMEDIT = @NMEDIT@
NUT_DATADIR = @NUT_DATADIR@
NUT_LIBEXECDIR = @NUT_LIBEXECDIR@
NUT_NETVERSION = @NUT_NETVERSION@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OS_NAME = @OS_NAME@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PIDPATH = @PIDPATH@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PORT = @PORT@
PYTHON = @PYTHON@
PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
RANLIB = @RANLIB@
RUN_AS_GROUP = @RUN_AS_GROUP@
RUN_AS_USER = @RUN_AS_USER@
SBINDIR = @SBINDIR@
SED = @SED@
SERLIBS = @SERLIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@
STATEPATH = @STATEPATH@
STRIP = @STRIP@
SUN_LIBUSB = @SUN_LIBUSB@
TREE_VERSION = @TREE_VERSION@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
auglensdir = @auglensdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
cgiexecdir = @cgiexecdir@
datadir = @datadir@
datarootdir = @datarootdir@
devddir = @devddir@
docdir = @docdir@
driverexecdir = @driverexecdir@
dummy_PKG_CONFIG = @dummy_PKG_CONFIG@
dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@
dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
hotplugdir = @hotplugdir@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
now = @now@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdshutdowndir = @systemdshutdowndir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udevdir = @udevdir@
EXTRA_DIST = README $(am__append_1) $(am__append_2) \
nut-driver-enumerator.sh.in upsdrvsvcctl.in
MAINTAINERCLEANFILES = Makefile.in .dirstamp
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/upsdrvsvcctl/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/upsdrvsvcctl/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
nut-driver-enumerator.sh: $(top_builddir)/config.status $(srcdir)/nut-driver-enumerator.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
upsdrvsvcctl: $(top_builddir)/config.status $(srcdir)/upsdrvsvcctl.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags TAGS:
ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,11 @@
This directory contains the shared NUT support files for Linux systemd (the
System and Service Manager) and Solaris SMF (Service Management Framework).
It includes the nut-driver-enumerator.sh (service and implementation method)
and upsdrvsvcctl (tool) to manage NUT drivers as service instances.
These files are automatically installed into SBINDIR/upsdrvsvcctl and
LIBEXECDIR/nut-driver-enumerator.sh, upon detection (at configure time)
of a systemd or SMF enabled system, with Makefiles of the ../systemd/ and
../Solaris/ source directories respectively.
Contributed 2016-2018 by Jim Klimov <EvgenyKlimov@eaton.com>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

196
scripts/upsdrvsvcctl/upsdrvsvcctl Executable file
View file

@ -0,0 +1,196 @@
#!/bin/sh
#
# Copyright (C) 2016-2018 Eaton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#! \file upsdrvsvcctl(.in)
# \author Jim Klimov <EvgenyKlimov@eaton.com>
# \brief Manage NUT devices registered as service-unit instances
#
if [ -z "${SERVICE_FRAMEWORK-}" ] ; then
[ -x /usr/sbin/svcadm ] && [ -x /usr/sbin/svccfg ] && [ -x /usr/bin/svcs ] && \
SERVICE_FRAMEWORK="smf"
[ -z "${SERVICE_FRAMEWORK-}" ] && \
[ -x /bin/systemctl ] && \
SERVICE_FRAMEWORK="systemd"
fi
VERB=""
CMD=""
CMDARG=""
ENUMERATOR=""
case "$SERVICE_FRAMEWORK" in
smf) CMD="/usr/sbin/svcadm"
ENUMERATOR="/usr/local/libexec/nut-driver-enumerator.sh"
;;
systemd) CMD="/bin/systemctl"
ENUMERATOR="/usr/local/libexec/nut-driver-enumerator.sh"
;;
*) echo "Unrecognized SERVICE_FRAMEWORK: $SERVICE_FRAMEWORK" >&2 ; exit ;;
esac
usage() {
# Note: version header differs from UPS_VERSION in binaries that
# might also have the git-version suffixed during build time
cat << EOF
Network UPS Tools - UPS driver controller ${PACKAGE_VERSION}
Starts and stops UPS drivers via system service instances, see
the $ENUMERATOR
script for more details.
usage: $0 [OPTIONS] (start | stop | shutdown) [<ups>]
Options:
-h display this help
-t testing mode - prints actions without doing them
-D raise debugging level
start start all UPS drivers in ups.conf
start <ups> only start driver for UPS <ups>
stop stop all UPS drivers in ups.conf
stop <ups> only stop driver for UPS <ups>
Note: the "shutdown" options from original upsdrvctl are not currently
directly supported by this service management framework wrapper; instead
they are passed to the native upsdrvctl binary (your current user account
should have sufficient permissions to do that all):
shutdown shutdown all UPS drivers in ups.conf
shutdown <ups> only shutdown UPS <ups>
usage: $0 [OPTIONS] resync
resync call $ENUMERATOR
to update the mapping of service instances for
NUT drivers to device sections in 'ups.conf'
usage: $0 [OPTIONS] reconfigure
reconfigure call $ENUMERATOR
to remove and re-create the mapping of all service
instances for NUT drivers to device sections in
'ups.conf' e.g. after a NUT package upgrade
usage: $0 [OPTIONS] list [<ups>]
list call $ENUMERATOR
to list the mapping of service instances to device sections
list <ups> (optionally return the service instance name for one device)
usage: $0 [OPTIONS] show-config [<ups>]
show-config <ups> output config section from ups.conf for device <ups>
show-config ...or all devices if no <ups> argument was passed
EOF
}
ACTION=""
SVCINST=""
DRYRUN=""
DEBUG=0
# Note: DEBUG is UNUSED_PARAM so far
while [ $# -gt 0 ]; do
case "$1" in
resync) eval $DRYRUN $ENUMERATOR ; exit $? ;;
reconf|reconfigure) eval $DRYRUN $ENUMERATOR --reconfigure ; exit $? ;;
list)
if [ -n "$2" ] ; then
eval $ENUMERATOR --get-service-for-device "$2" ; exit $?
else
eval $ENUMERATOR --list-services-for-devices ; exit $?
fi
;;
show-config)
if [ -n "$2" ] ; then
eval $ENUMERATOR --show-device-config "$2" ; exit $?
else
eval $ENUMERATOR --show-all-configs ; exit $?
fi
;;
start|stop)
ACTION="$1"
if [ -n "$2" ] ; then
SVCINST="`$ENUMERATOR --get-service-for-device "$2"`" || exit
shift
fi
;;
shutdown)
echo "NOTE: Action '$1' is not implemented via services currently, will call upsdrvctl" >&2
echo "Stopping the driver service instance(s) to release exclusive resources, if any..." >&2
RES=0
$0 stop $2
/usr/local/sbin/upsdrvctl shutdown $2 || RES=$?
echo "Starting the driver service instance(s) so they can reconnect when the UPS returns..." >&2
$0 start $2
exit $RES
;;
-t) DRYRUN="echo" ;;
-h) usage; exit 0 ;;
-D) DEBUG="`expr $DEBUG + 1`" ;;
-r|-u) echo "Option '$1 $2' is not implemented via services currently" >&2 ; shift;;
*) echo "Unrecognized argument: $1" >&2 ; exit ;;
esac
shift
done
if [ -z "$ENUMERATOR" ] || [ ! -s "$ENUMERATOR" ] || [ ! -x "$ENUMERATOR" ] ; then
echo "ENUMERATOR script (nut-driver-enumerator.sh) not found!" >&2
exit 1
fi
if [ -z "$ACTION" ]; then
echo "No action was requested!" >&2
exit 1
fi
if [ -z "$SVCINST" ]; then
SVCINST="`$ENUMERATOR --list-services`" || exit
fi
# TODO: Support shutdown of one or all UPSes by stopping its service
# and then calling the original upsdrvctl on it?
case "$ACTION" in
start)
VERB="Starting"
case "$SERVICE_FRAMEWORK" in
smf) CMDARG="enable -ts" ;;
systemd) CMDARG="start" ;;
esac
;;
stop)
VERB="Stopping"
case "$SERVICE_FRAMEWORK" in
smf) CMDARG="disable -ts" ;;
systemd) CMDARG="stop" ;;
esac
;;
*) echo "Unrecognized ACTION: $ACTION" >&2 ; exit ;;
esac
for INST in $SVCINST ; do
echo "$VERB $INST ..." >&2
$DRYRUN $CMD $CMDARG "$INST" &
done
wait
case "$SERVICE_FRAMEWORK" in
smf)
sleep 1
echo "Post-process clearing services that failed early..." >&2
for INST in $SVCINST ; do
echo "Clearing $INST (if it got broken) ..." >&2
$DRYRUN $CMD clear "$INST" &
done
;;
esac
wait

View file

@ -0,0 +1,196 @@
#!/bin/sh
#
# Copyright (C) 2016-2018 Eaton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#! \file upsdrvsvcctl(.in)
# \author Jim Klimov <EvgenyKlimov@eaton.com>
# \brief Manage NUT devices registered as service-unit instances
#
if [ -z "${SERVICE_FRAMEWORK-}" ] ; then
[ -x /usr/sbin/svcadm ] && [ -x /usr/sbin/svccfg ] && [ -x /usr/bin/svcs ] && \
SERVICE_FRAMEWORK="smf"
[ -z "${SERVICE_FRAMEWORK-}" ] && \
[ -x /bin/systemctl ] && \
SERVICE_FRAMEWORK="systemd"
fi
VERB=""
CMD=""
CMDARG=""
ENUMERATOR=""
case "$SERVICE_FRAMEWORK" in
smf) CMD="/usr/sbin/svcadm"
ENUMERATOR="@NUT_LIBEXECDIR@/nut-driver-enumerator.sh"
;;
systemd) CMD="/bin/systemctl"
ENUMERATOR="@NUT_LIBEXECDIR@/nut-driver-enumerator.sh"
;;
*) echo "Unrecognized SERVICE_FRAMEWORK: $SERVICE_FRAMEWORK" >&2 ; exit ;;
esac
usage() {
# Note: version header differs from UPS_VERSION in binaries that
# might also have the git-version suffixed during build time
cat << EOF
Network UPS Tools - UPS driver controller ${PACKAGE_VERSION}
Starts and stops UPS drivers via system service instances, see
the $ENUMERATOR
script for more details.
usage: $0 [OPTIONS] (start | stop | shutdown) [<ups>]
Options:
-h display this help
-t testing mode - prints actions without doing them
-D raise debugging level
start start all UPS drivers in ups.conf
start <ups> only start driver for UPS <ups>
stop stop all UPS drivers in ups.conf
stop <ups> only stop driver for UPS <ups>
Note: the "shutdown" options from original upsdrvctl are not currently
directly supported by this service management framework wrapper; instead
they are passed to the native upsdrvctl binary (your current user account
should have sufficient permissions to do that all):
shutdown shutdown all UPS drivers in ups.conf
shutdown <ups> only shutdown UPS <ups>
usage: $0 [OPTIONS] resync
resync call $ENUMERATOR
to update the mapping of service instances for
NUT drivers to device sections in 'ups.conf'
usage: $0 [OPTIONS] reconfigure
reconfigure call $ENUMERATOR
to remove and re-create the mapping of all service
instances for NUT drivers to device sections in
'ups.conf' e.g. after a NUT package upgrade
usage: $0 [OPTIONS] list [<ups>]
list call $ENUMERATOR
to list the mapping of service instances to device sections
list <ups> (optionally return the service instance name for one device)
usage: $0 [OPTIONS] show-config [<ups>]
show-config <ups> output config section from ups.conf for device <ups>
show-config ...or all devices if no <ups> argument was passed
EOF
}
ACTION=""
SVCINST=""
DRYRUN=""
DEBUG=0
# Note: DEBUG is UNUSED_PARAM so far
while [ $# -gt 0 ]; do
case "$1" in
resync) eval $DRYRUN $ENUMERATOR ; exit $? ;;
reconf|reconfigure) eval $DRYRUN $ENUMERATOR --reconfigure ; exit $? ;;
list)
if [ -n "$2" ] ; then
eval $ENUMERATOR --get-service-for-device "$2" ; exit $?
else
eval $ENUMERATOR --list-services-for-devices ; exit $?
fi
;;
show-config)
if [ -n "$2" ] ; then
eval $ENUMERATOR --show-device-config "$2" ; exit $?
else
eval $ENUMERATOR --show-all-configs ; exit $?
fi
;;
start|stop)
ACTION="$1"
if [ -n "$2" ] ; then
SVCINST="`$ENUMERATOR --get-service-for-device "$2"`" || exit
shift
fi
;;
shutdown)
echo "NOTE: Action '$1' is not implemented via services currently, will call upsdrvctl" >&2
echo "Stopping the driver service instance(s) to release exclusive resources, if any..." >&2
RES=0
$0 stop $2
@SBINDIR@/upsdrvctl shutdown $2 || RES=$?
echo "Starting the driver service instance(s) so they can reconnect when the UPS returns..." >&2
$0 start $2
exit $RES
;;
-t) DRYRUN="echo" ;;
-h) usage; exit 0 ;;
-D) DEBUG="`expr $DEBUG + 1`" ;;
-r|-u) echo "Option '$1 $2' is not implemented via services currently" >&2 ; shift;;
*) echo "Unrecognized argument: $1" >&2 ; exit ;;
esac
shift
done
if [ -z "$ENUMERATOR" ] || [ ! -s "$ENUMERATOR" ] || [ ! -x "$ENUMERATOR" ] ; then
echo "ENUMERATOR script (nut-driver-enumerator.sh) not found!" >&2
exit 1
fi
if [ -z "$ACTION" ]; then
echo "No action was requested!" >&2
exit 1
fi
if [ -z "$SVCINST" ]; then
SVCINST="`$ENUMERATOR --list-services`" || exit
fi
# TODO: Support shutdown of one or all UPSes by stopping its service
# and then calling the original upsdrvctl on it?
case "$ACTION" in
start)
VERB="Starting"
case "$SERVICE_FRAMEWORK" in
smf) CMDARG="enable -ts" ;;
systemd) CMDARG="start" ;;
esac
;;
stop)
VERB="Stopping"
case "$SERVICE_FRAMEWORK" in
smf) CMDARG="disable -ts" ;;
systemd) CMDARG="stop" ;;
esac
;;
*) echo "Unrecognized ACTION: $ACTION" >&2 ; exit ;;
esac
for INST in $SVCINST ; do
echo "$VERB $INST ..." >&2
$DRYRUN $CMD $CMDARG "$INST" &
done
wait
case "$SERVICE_FRAMEWORK" in
smf)
sleep 1
echo "Post-process clearing services that failed early..." >&2
for INST in $SVCINST ; do
echo "Clearing $INST (if it got broken) ..." >&2
$DRYRUN $CMD clear "$INST" &
done
;;
esac
wait