summaryrefslogtreecommitdiff
path: root/package/nut
diff options
context:
space:
mode:
Diffstat (limited to 'package/nut')
-rw-r--r--package/nut/Config.in239
-rw-r--r--package/nut/Makefile117
-rw-r--r--package/nut/files/ups.conf104
-rw-r--r--package/nut/files/upsd.conf42
-rw-r--r--package/nut/files/upsd.init30
-rw-r--r--package/nut/ipkg/nut.conffiles2
-rw-r--r--package/nut/ipkg/nut.control4
-rw-r--r--package/nut/ipkg/nut.postinst4
8 files changed, 542 insertions, 0 deletions
diff --git a/package/nut/Config.in b/package/nut/Config.in
new file mode 100644
index 000000000..2da404567
--- /dev/null
+++ b/package/nut/Config.in
@@ -0,0 +1,239 @@
+config ADK_PACKAGE_NUT
+ prompt "nut............................... Network UPS Tools"
+ tristate
+ default n
+ help
+ Network UPS Tools is a collection of programs which provide a common
+ interface for monitoring and administering UPS hardware. It uses a
+ layered approach to connect all of the parts.
+
+ http://www.networkupstools.org
+
+config ADK_PACKAGE_NUT_SSL
+ prompt "nut-ssl........................... Build Nut with SSL support"
+ boolean
+ default n
+ depends on ADK_PACKAGE_NUT
+ select ADK_PACKAGE_LIBOPENSSL
+
+config ADK_PACKAGE_NUT_USB
+ prompt "nut-usb........................... Build Nut with USB drivers"
+ boolean
+ default n
+ depends on ADK_PACKAGE_NUT
+ select ADK_PACKAGE_LIBUSB
+ help
+ This option enables two drivers, namely hidups and energizerups.
+
+config ADK_PACKAGE_NUT_SNMP
+ prompt "nut-snmp.......................... Build Nut with SNMP UPS driver"
+ boolean
+ default n
+ depends on ADK_PACKAGE_NUT
+ select ADK_PACKAGE_LIBNETSNMP
+ help
+ This option enables the snmp-ups driver.
+
+config ADK_PACKAGE_NUT_VARDESC
+ prompt "command descriptions.............. Include variable and command descriptions"
+ boolean
+ default y
+ depends on ADK_PACKAGE_NUT
+ help
+ With this option enabled, an optional file will be added to the package
+ containing a description of the commands and variables to clients.
+ If you leave this out, clients will receive "Unavailable" for any description
+ requests.
+
+menu "UPS Drivers to include"
+depends on ADK_PACKAGE_NUT
+
+config ADK_PACKAGE_NUT_DRIVER_APCSMART
+ prompt "apcsmart.......................... Driver for APC smart protocol (newapc)"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_BELKIN
+ prompt "belkin............................ Driver for Belkin Smart-UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_BELKINUNV
+ prompt "belkinunv......................... Driver for Belkin Universal UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_BESTUPS
+ prompt "bestups........................... Driver for Best-UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_BESTFCOM
+ prompt "bestfcom.......................... Driver for Best Power F-Command UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_BESTUFERRUPS
+ prompt "bestuferrups...................... Driver for Best Power Micro-Ferrups"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_BLAZER
+ prompt "blazer............................ Driver for Blazer UPS models"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_CPSUPS
+ prompt "cpsups............................ Driver for CyberPower text protocol UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_CYBERPOWER
+ prompt "cyberpower........................ Driver for Cyber Power Systems"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_ESUPSSMART
+ prompt "esupssmart........................ Driver for ES UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_ETAPRO
+ prompt "etapro............................ Driver for ETA UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_EVERUPS
+ prompt "everups........................... Driver for Ever UPS models"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_FENTONUPS
+ prompt "fentonups......................... Driver for Fenton Technologies units"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_GAMATRONIC
+ prompt "gamatronic........................ Driver for Gamatronic UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_GENERICUPS
+ prompt "genericups........................ Driver for generic contact-closure UPS models"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_IPPON
+ prompt "ippon............................. Driver for Ippon UPS devices"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_ISBMEX
+ prompt "isbmex............................ Driver for SOLA/BASIC Mexico models"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_LIEBERT
+ prompt "liebert........................... Driver for Liebert UPS via MultiLink cable"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_MASTERGUARD
+ prompt "masterguard....................... Driver for Masterguard units"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_MEGATEC
+ prompt "megatec........................... Driver for Megatec protocol based UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_METASYS
+ prompt "metasys........................... Driver for Meta System UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_MGE_UTALK
+ prompt "mge-utalk......................... Driver for MGE UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_MUSTEK
+ prompt "mustek............................ Driver for Mustek UPS models"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_ONEAC
+ prompt "oneac............................. Driver for UPS using the Oneac Advanced Interface"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_POWERCOM
+ prompt "powercom.......................... Driver for Powercom units (see help)"
+ boolean
+ default n
+ help
+ This driver supports the following units:
+ * -Trust 425/625
+ * -Powercom
+ * -Advice Partner/King PR750
+ * See http://www.advice.co.il/product/inter/ups.html for its specifications.
+ * This model is based on PowerCom (www.powercom.com) models.
+ * -Socomec Sicon Egys 420
+
+config ADK_PACKAGE_NUT_DRIVER_POWERMUST
+ prompt "powermust......................... Driver for Powermust"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_RHINO
+ prompt "rhino............................. Driver for Microsol Rhino UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_SAFENET
+ prompt "safenet........................... Driver for SafeNet UPS (see help)"
+ boolean
+ default n
+ help
+ Supports the following units:
+ * - Fairstone L525/-625/-750
+ * - Fenton P400/-600/-800
+ * - Gemini UPS625/-1000
+ * - Powerwell PM525A/-625A/-800A/-1000A/-1250A
+ * - Repotec RPF525/-625/-800/-1000
+ * - Soltec Winmate 525/625/800/1000
+ * - Sweex 500/1000
+ * - others using SafeNet software and serial interface
+
+config ADK_PACKAGE_NUT_DRIVER_SMS
+ prompt "sms............................... Driver for SMS UPS hardware"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_SOLIS
+ prompt "solis............................. Driver for Microsol Solis UPS"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_TRIPPLITE
+ prompt "tripplite......................... Driver for Tripp Lite SmartUPS models"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_TRIPPLITESU
+ prompt "tripplitesu....................... Driver for Tripp Lite SmartOnline (SU*) models"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_UPSCODE2
+ prompt "upscode2.......................... Driver for UPS using UPScode II command set"
+ boolean
+ default n
+
+config ADK_PACKAGE_NUT_DRIVER_VICTRONUPS
+ prompt "victronups........................ Driver for GE/IMV/Victron units"
+ boolean
+ default n
+
+endmenu
diff --git a/package/nut/Makefile b/package/nut/Makefile
new file mode 100644
index 000000000..0d1837991
--- /dev/null
+++ b/package/nut/Makefile
@@ -0,0 +1,117 @@
+# $Id$
+#-
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include ${TOPDIR}/rules.mk
+
+PKG_NAME:= nut
+PKG_VERSION:= 2.0.5
+PKG_RELEASE:= 1
+PKG_MD5SUM:= b08fde86191154bbcfda860f95a5dca2
+MASTER_SITES:= http://www.networkupstools.org/source/2.0/
+
+include ${TOPDIR}/mk/package.mk
+
+$(eval $(call PKG_template,NUT,nut,${PKG_VERSION}-${PKG_RELEASE},${ARCH}))
+
+define DRIVER_template
+
+DRIVERS_$${ADK_PACKAGE_NUT_DRIVER_${1}}+=${2}
+
+endef
+
+DRIVERS_y:=
+$(eval $(call DRIVER_template,BESTUPS,bestups))
+$(eval $(call DRIVER_template,FENTONUPS,fentonups))
+$(eval $(call DRIVER_template,APCSMART,apcsmart))
+$(eval $(call DRIVER_template,EVERUPS,everups))
+$(eval $(call DRIVER_template,BELKIN,belkin))
+$(eval $(call DRIVER_template,MASTERGUARD,masterguard))
+$(eval $(call DRIVER_template,POWERCOM,powercom))
+$(eval $(call DRIVER_template,CYBERPOWER,cyberpower))
+$(eval $(call DRIVER_template,TRIPPLITE,tripplite))
+$(eval $(call DRIVER_template,VICTRONUPS,victronups))
+$(eval $(call DRIVER_template,GENERICUPS,genericups))
+$(eval $(call DRIVER_template,MGE_UTALK,mge-utalk))
+$(eval $(call DRIVER_template,BESTUFERRUPS,bestuferrups))
+$(eval $(call DRIVER_template,ISBMEX,isbmex))
+$(eval $(call DRIVER_template,ETAPRO,etapro))
+$(eval $(call DRIVER_template,LIEBERT,liebert))
+$(eval $(call DRIVER_template,SMS,sms))
+$(eval $(call DRIVER_template,ESUPSSMART,esupssmart))
+$(eval $(call DRIVER_template,TRIPPLITESU,tripplitesu))
+$(eval $(call DRIVER_template,BLAZER,blazer))
+$(eval $(call DRIVER_template,SAFENET,safenet))
+$(eval $(call DRIVER_template,BELKINUNV,belkinunv))
+$(eval $(call DRIVER_template,ONEAC,oneac))
+$(eval $(call DRIVER_template,IPPON,ippon))
+$(eval $(call DRIVER_template,CPSUPS,cpsups))
+$(eval $(call DRIVER_template,MUSTEK,mustek))
+$(eval $(call DRIVER_template,METASYS,metasys))
+$(eval $(call DRIVER_template,BESTFCOM,bestfcom))
+$(eval $(call DRIVER_template,UPSCODE2,upscode2))
+$(eval $(call DRIVER_template,SOLIS,solis))
+$(eval $(call DRIVER_template,GAMATRONIC,gamatronic))
+$(eval $(call DRIVER_template,MEGATEC,megatec))
+$(eval $(call DRIVER_template,RHINO,rhino))
+
+CONFIG_DRIVERS=$(shell echo ${DRIVERS_y} | tr ' ' ',')
+
+INSTALL_DRIVERS_tmp=${DRIVERS_y}
+ifneq (${ADK_PACKAGE_NUT_USB},)
+INSTALL_DRIVERS_tmp+= hidups energizerups newhidups tripplite_usb
+endif
+ifneq (${ADK_PACKAGE_NUT_SNMP},)
+INSTALL_DRIVERS_tmp+= snmp-ups
+endif
+INSTALL_DRIVERS=$(shell echo ${INSTALL_DRIVERS_tmp} | tr ' ' ',')
+
+CONFIGURE_STYLE:= gnu
+CONFIGURE_ARGS+= --with-linux-hiddev=${LINUX_DIR}/include/linux/hiddev.h \
+ --without-cgi \
+ --with-drivers=${INSTALL_DRIVERS} \
+ --with-user=root
+IPKG_DEPEND_tmp:=
+ifneq (${ADK_PACKAGE_NUT_SSL},)
+CONFIGURE_ARGS+= --with-ssl
+CONFIGURE_ENV+= CPPFLAGS="${TCPPFLAGS} ${TLDFLAGS}"
+MAKE_FLAGS+= SSL_CFLAGS="${TCPPFLAGS}" SSL_LDFLAGS="${TLDFLAGS} -lssl -lcrypto"
+IPKG_DEPEND_tmp+= libopenssl
+endif
+BUILD_STYLE:= auto
+ALL_TARGET:= all
+INSTALL_STYLE:= auto
+INSTALL_TARGET:= install
+ifneq (${ADK_PACKAGE_NUT_USB},)
+ALL_TARGET+= usb
+INSTALL_TARGET+= install-usb
+IPKG_DEPEND_tmp+= libusb
+endif
+ifneq (${ADK_PACKAGE_NUT_SNMP},)
+ALL_TARGET+= snmp
+INSTALL_TARGET+= install-snmp
+IPKG_DEPEND_tmp+= libnetsnmp
+endif
+IPKG_DEPEND=$(shell echo ${IPKG_DEPEND_tmp} | tr ' ' ',')
+
+post-install:
+ ${INSTALL_DIR} ${IDIR_NUT}/usr/{s,}bin
+ ${INSTALL_DIR} ${IDIR_NUT}/etc/init.d
+ ${INSTALL_BIN} ./files/upsd.init \
+ ${IDIR_NUT}/etc/init.d/upsd
+ ${INSTALL_BIN} ${WRKINST}/usr/sbin/ups{d,mon,sched} \
+ ${IDIR_NUT}/usr/sbin/
+ ${INSTALL_BIN} ${WRKINST}/usr/bin/{${INSTALL_DRIVERS}} \
+ ${IDIR_NUT}/usr/bin/
+ ${INSTALL_BIN} ${WRKINST}/usr/bin/ups{c,cmd,drvctl,log,rw} \
+ ${IDIR_NUT}/usr/bin/
+ ${INSTALL_DATA} ./files/ups{d,}.conf ${IDIR_NUT}/etc/
+ echo "Depends: ${IPKG_DEPEND}" >> ${IDIR_NUT}/CONTROL/control
+ifneq (${ADK_PACKAGE_NUT_VARDESC},)
+ ${INSTALL_DIR} ${IDIR_NUT}/usr/share
+ ${INSTALL_DATA} ${WRKINST}/usr/share/cmdvartab \
+ ${IDIR_NUT}/usr/share/
+endif
+
+include ${TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/nut/files/ups.conf b/package/nut/files/ups.conf
new file mode 100644
index 000000000..113394d5d
--- /dev/null
+++ b/package/nut/files/ups.conf
@@ -0,0 +1,104 @@
+# Network UPS Tools: example ups.conf
+#
+# --- SECURITY NOTE ---
+#
+# If you use snmp-ups and set a community string in here, you
+# will have to secure this file to keep other users from obtaining
+# that string. It needs to be readable by upsdrvctl and any drivers,
+# and by upsd.
+#
+# ---
+#
+# This is where you configure all the UPSes that this system will be
+# monitoring directly. These are usually attached to serial ports, but
+# USB devices and SNMP devices are also supported.
+#
+# This file is used by upsdrvctl to start and stop your driver(s), and
+# is also used by upsd to determine which drivers to monitor. The
+# drivers themselves also read this file for configuration directives.
+#
+# The general form is:
+#
+# [upsname]
+# driver = <drivername>
+# port = <portname>
+# < any other directives here >
+#
+# The section header ([upsname]) can be just about anything as long as
+# it is a single word inside brackets. upsd uses this to uniquely
+# identify a UPS on this system.
+#
+# If you have a UPS called snoopy, your section header would be "[snoopy]".
+# On a system called "doghouse", the line in your upsmon.conf to monitor
+# it would look something like this:
+#
+# MONITOR snoopy@doghouse 1 upsmonuser mypassword master
+#
+# It might look like this if monitoring in slave mode:
+#
+# MONITOR snoopy@doghouse 1 upsmonuser mypassword slave
+#
+# Configuration directives
+# ------------------------
+#
+# These directives are common to all drivers that support ups.conf:
+#
+# driver: REQUIRED. Specify the program to run to talk to this UPS.
+# apcsmart, fentonups, bestups, and sec are some examples.
+#
+# port: REQUIRED. The serial port where your UPS is connected.
+# /dev/ttyS0 is usually the first port on Linux boxes, for example.
+#
+# sdorder: optional. When you have multiple UPSes on your system, you
+# usually need to turn them off in a certain order. upsdrvctl
+# shuts down all the 0s, then the 1s, 2s, and so on. To exclude
+# a UPS from the shutdown sequence, set this to -1.
+#
+# The default value for this parameter is 0.
+#
+# nolock: optional, and not recommended for use in this file.
+#
+# If you put nolock in here, the driver will not lock the
+# serial port every time it starts. This may allow other
+# processes to seize the port if you start more than one by
+# mistake.
+#
+# This is only intended to be used on systems where locking
+# absolutely must be disabled for the software to work.
+#
+# maxstartdelay: optional. This can be set as a global variable
+# above your first UPS definition and it can also be
+# set in a UPS section. This value controls how long
+# upsdrvctl will wait for the driver to finish starting.
+# This keeps your system from getting stuck due to a
+# broken driver or UPS.
+#
+# The default is 45 seconds.
+#
+#
+# Anything else is passed through to the hardware-specific part of
+# the driver.
+#
+# Examples
+# --------
+#
+# A simple example for a UPS called "powerpal" that uses the fentonups
+# driver on /dev/ttyS0 is:
+#
+# [powerpal]
+# driver = fentonups
+# port = /dev/ttyS0
+# desc = "Web server"
+#
+# If your UPS driver requires additional settings, you can specify them
+# here. For example, if it supports a setting of "1234" for the
+# variable "cable", it would look like this:
+#
+# [myups]
+# driver = mydriver
+# port = /dev/ttyS1
+# cable = 1234
+# desc = "Something descriptive"
+#
+# To find out if your driver supports any extra settings, start it with
+# the -h option and/or read the driver's documentation.
diff --git a/package/nut/files/upsd.conf b/package/nut/files/upsd.conf
new file mode 100644
index 000000000..c165cfcf5
--- /dev/null
+++ b/package/nut/files/upsd.conf
@@ -0,0 +1,42 @@
+# Network UPS Tools: example upsd configuration file
+#
+# This file contains access control data, you should keep it secure.
+#
+# It should only be readable by the user that upsd becomes. See the FAQ.
+
+# =======================================================================
+# Access Control Lists (ACLs)
+#
+# ACL <name> <ipblock>
+# ACL myhost 10.0.0.1/32
+#
+# ACCEPT <aclname> [<aclname>...]
+# REJECT <aclname> [<aclname>...]
+#
+# Define lists of hosts or networks with ACL definitions.
+#
+# ACCEPT and REJECT use ACL definitions to control whether a host is
+# allowed to connect to upsd.
+#
+# This default configuration only gives access to localhost. To allow
+# other hosts or networks to connect, see the documentation and change
+# these lines.
+
+ACL all 0.0.0.0/0
+ACL localhost 127.0.0.1/32
+
+ACCEPT localhost
+REJECT all
+
+# =======================================================================
+# MAXAGE <seconds>
+# MAXAGE 15
+#
+# This defaults to 15 seconds. After a UPS driver has stopped updating
+# the data for this many seconds, upsd marks it stale and stops making
+# that information available to clients. After all, the only thing worse
+# than no data is bad data.
+#
+# You should only use this if your driver has difficulties keeping
+# the data fresh within the normal 15 second interval. Watch the syslog
+# for notifications from upsd about staleness.
diff --git a/package/nut/files/upsd.init b/package/nut/files/upsd.init
new file mode 100644
index 000000000..e3afadbba
--- /dev/null
+++ b/package/nut/files/upsd.init
@@ -0,0 +1,30 @@
+#!/bin/sh
+#FWINIT 60
+. /etc/rc.conf
+
+case $1 in
+autostop) ;;
+autostart)
+ test x"${upsd:-NO}" = x"NO" && exit 0
+ exec sh $0 start
+ ;;
+start)
+ [ -d /var/state/ups ] || mkdir -p /var/state/ups
+ /usr/bin/upsdrvctl start || exit 1
+ /usr/sbin/upsd || exit 2
+ ;;
+stop)
+ /usr/sbin/upsd -c stop || killall upsd
+ /usr/bin/upsdrvctl stop
+ ;;
+restart)
+ sh $0 stop
+ sleep 1
+ sh $0 start
+ ;;
+*)
+ echo "Usage: $0 {start | stop | restart}"
+ exit 1
+ ;;
+esac
+exit $?
diff --git a/package/nut/ipkg/nut.conffiles b/package/nut/ipkg/nut.conffiles
new file mode 100644
index 000000000..df6dd3071
--- /dev/null
+++ b/package/nut/ipkg/nut.conffiles
@@ -0,0 +1,2 @@
+/etc/ups.conf
+/etc/upsd.conf
diff --git a/package/nut/ipkg/nut.control b/package/nut/ipkg/nut.control
new file mode 100644
index 000000000..a896bfd60
--- /dev/null
+++ b/package/nut/ipkg/nut.control
@@ -0,0 +1,4 @@
+Package: nut
+Priority: optional
+Section: sys
+Description: Network UPS Tools
diff --git a/package/nut/ipkg/nut.postinst b/package/nut/ipkg/nut.postinst
new file mode 100644
index 000000000..cd5faf1af
--- /dev/null
+++ b/package/nut/ipkg/nut.postinst
@@ -0,0 +1,4 @@
+#!/bin/sh
+. $IPKG_INSTROOT/etc/functions.sh
+add_rcconf upsd upsd NO
+