Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
This is a developing project to monitor a large assortment of UPS hardware.
Network communications are used so that multiple systems can monitor a
single physical UPS and shut down together if necessary without any
special "sharing hardware" on the UPS itself. CGI scripts are in the
ups-nut-cgi package.
+8
View File
@@ -0,0 +1,8 @@
===========================================================================
$NetBSD: MESSAGE,v 1.6 2004/02/15 13:14:25 lukem Exp $
Various changes occurred in version 1.4.
If upgrading from a prior version, refer to
${NUT_DOCDIR}/UPGRADING for more information.
===========================================================================
+64
View File
@@ -0,0 +1,64 @@
# $NetBSD: Makefile,v 1.53 2012/10/23 19:51:28 asau Exp $
.include "Makefile.common"
PKGNAME= ups-${DISTNAME}
COMMENT= Network UPS Tools
CONFIGURE_ARGS+= --with-drvpath=${NUT_DRVDIR:Q}
CONFIGURE_ARGS+= --with-altpidpath=${NUT_STATEDIR:Q}
CONFIGURE_ARGS+= --with-pidpath=${NUT_STATEDIR:Q}
PKG_GROUPS_VARS+= NUT_GROUP
PKG_USERS_VARS+= NUT_USER
BUILD_DEFS+= NUT_STATEDIR VARBASE
FILES_SUBST+= NUT_CONFDIR=${NUT_CONFDIR:Q}
FILES_SUBST+= NUT_STATEDIR=${NUT_STATEDIR:Q}
MESSAGE_SUBST+= NUT_CONFDIR=${NUT_CONFDIR}
MESSAGE_SUBST+= NUT_EGDIR=${NUT_EGDIR}
MESSAGE_SUBST+= NUT_DOCDIR=${NUT_DOCDIR}
PKG_GROUPS= ${NUT_GROUP}
PKG_USERS= ${NUT_USER}:${NUT_GROUP}
PKG_GECOS.${NUT_USER}= Network UPS Tools
PKG_HOME.${NUT_USER}= ${NUT_STATEDIR}
PKG_SHELL.${NUT_USER}= ${SH}
CONF_FILES= ${NUT_EGDIR}/nut.conf.sample ${NUT_CONFDIR}/nut.conf
CONF_FILES+= ${NUT_EGDIR}/ups.conf.sample ${NUT_CONFDIR}/ups.conf
CONF_FILES+= ${NUT_EGDIR}/upssched.conf.sample \
${NUT_CONFDIR}/upssched.conf
CONF_FILES_PERMS= ${NUT_EGDIR}/upsd.conf.sample \
${NUT_CONFDIR}/upsd.conf \
${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0600
CONF_FILES_PERMS+= ${NUT_EGDIR}/upsd.users.sample \
${NUT_CONFDIR}/upsd.users \
${NUT_USER} ${NUT_GROUP} 0600
CONF_FILES_PERMS+= ${NUT_EGDIR}/upsmon.conf.sample \
${NUT_CONFDIR}/upsmon.conf \
${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0600
RCD_SCRIPTS= ups upsd upsdriver upslog upsmon
OWN_DIRS= ${NUT_CONFDIR}
OWN_DIRS_PERMS= ${NUT_STATEDIR} ${NUT_USER} ${NUT_GROUP} 0770
INSTALLATION_DIRS+= ${NUT_EGDIR} ${NUT_DOCDIR}/cables ${NUT_DOCDIR}/drivers
post-install:
${INSTALL_DATA_DIR} ${DESTDIR}${NUT_EGDIR}
${MV} ${DESTDIR}${NUT_CONFDIR}/*.sample ${DESTDIR}${NUT_EGDIR}
${INSTALL_DATA_DIR} ${DESTDIR}${NUT_DOCDIR}
for f in COPYING CREDITS ChangeLog NEWS README INSTALL UPGRADING; do \
${INSTALL_DATA} ${WRKSRC}/$$f ${DESTDIR}${NUT_DOCDIR}; \
done
for f in ${WRKSRC}/docs/*.txt; do \
${INSTALL_DATA} $$f ${DESTDIR}${NUT_DOCDIR}; \
done
for f in ${WRKSRC}/docs/cables/*.txt; do \
${INSTALL_DATA} $$f ${DESTDIR}${NUT_DOCDIR}/cables/; \
done
.include "../../mk/bsd.pkg.mk"
+44
View File
@@ -0,0 +1,44 @@
# $NetBSD: Makefile.common,v 1.5 2013/02/16 17:34:58 jdf Exp $
# used by sysutils/ups-nut/Makefile
# used by sysutils/ups-nut-cgi/Makefile
# used by sysutils/ups-nut-snmp/Makefile
# used by sysutils/ups-nut-usb/Makefile
# used by sysutils/p5-UPS-Nut/Makefile
DISTNAME= nut-2.6.5
CATEGORIES= sysutils
MASTER_SITES= http://www.networkupstools.org/source/2.6/
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.networkupstools.org/
LICENSE= gnu-gpl-v2
NUT_USER?= nut
NUT_GROUP?= nut
DISTINFO_FILE= ${.CURDIR}/../../sysutils/ups-nut/distinfo
PATCHDIR= ${.CURDIR}/../../sysutils/ups-nut/patches
USE_LIBTOOL= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --sysconfdir=${NUT_CONFDIR:Q}
CONFIGURE_ARGS+= --datadir=${NUT_DATADIR:Q}
CONFIGURE_ARGS+= --localstatedir=${NUT_STATEDIR:Q}
CONFIGURE_ARGS+= --with-statepath=${NUT_STATEDIR:Q}
CONFIGURE_ARGS+= --with-htmlpath=${PREFIX:Q}/share/nut/html
CONFIGURE_ARGS+= --with-user=${NUT_USER}
CONFIGURE_ARGS+= --with-group=${NUT_GROUP}
CHECK_PORTABILITY_SKIP= packaging/*
.include "../../mk/bsd.prefs.mk"
PKG_SYSCONFSUBDIR?= nut
NUT_CONFDIR= ${PKG_SYSCONFDIR}
NUT_DATADIR= ${PREFIX}/share/nut
NUT_DOCDIR= ${PREFIX}/share/doc/nut
NUT_DRVDIR= ${PREFIX}/libexec/nut
NUT_EGDIR= ${PREFIX}/share/examples/nut
NUT_STATEDIR?= ${VARBASE}/db/nut
NUT_CGIDIR= ${PREFIX}/libexec/cgi-bin
+164
View File
@@ -0,0 +1,164 @@
@comment $NetBSD: PLIST,v 1.25 2013/02/16 17:34:58 jdf Exp $
bin/upsc
bin/upscmd
bin/upslog
bin/upsrw
bin/upssched-cmd
lib/libupsclient.la
libexec/nut/apcsmart
libexec/nut/apcsmart-old
libexec/nut/bcmxcp
libexec/nut/belkin
libexec/nut/belkinunv
libexec/nut/bestfcom
libexec/nut/bestfortress
libexec/nut/bestuferrups
libexec/nut/bestups
libexec/nut/blazer_ser
libexec/nut/clone
libexec/nut/clone-outlet
libexec/nut/dummy-ups
libexec/nut/etapro
libexec/nut/everups
libexec/nut/gamatronic
libexec/nut/genericups
libexec/nut/isbmex
libexec/nut/ivtscd
libexec/nut/liebert
libexec/nut/liebert-esp2
libexec/nut/masterguard
libexec/nut/metasys
libexec/nut/mge-shut
libexec/nut/mge-utalk
libexec/nut/microdowell
libexec/nut/oldmge-shut
libexec/nut/oneac
libexec/nut/optiups
libexec/nut/powercom
libexec/nut/powerpanel
libexec/nut/rhino
libexec/nut/safenet
libexec/nut/skel
libexec/nut/solis
libexec/nut/tripplite
libexec/nut/tripplitesu
libexec/nut/upscode2
libexec/nut/upsdrvctl
libexec/nut/victronups
man/man5/nut.conf.5
man/man5/ups.conf.5
man/man5/upsd.conf.5
man/man5/upsd.users.5
man/man5/upsmon.conf.5
man/man5/upssched.conf.5
man/man8/apcsmart-old.8
man/man8/apcsmart.8
man/man8/bcmxcp.8
man/man8/belkin.8
man/man8/belkinunv.8
man/man8/bestfcom.8
man/man8/bestfortress.8
man/man8/bestuferrups.8
man/man8/bestups.8
man/man8/blazer.8
man/man8/clone.8
man/man8/dummy-ups.8
man/man8/etapro.8
man/man8/everups.8
man/man8/gamatronic.8
man/man8/genericups.8
man/man8/isbmex.8
man/man8/ivtscd.8
man/man8/liebert-esp2.8
man/man8/liebert.8
man/man8/masterguard.8
man/man8/metasys.8
man/man8/mge-shut.8
man/man8/mge-utalk.8
man/man8/microdowell.8
man/man8/nut-recorder.8
man/man8/nut-scanner.8
man/man8/nutupsdrv.8
man/man8/oneac.8
man/man8/optiups.8
man/man8/powercom.8
man/man8/powerpanel.8
man/man8/rhino.8
man/man8/safenet.8
man/man8/solis.8
man/man8/tripplite.8
man/man8/tripplitesu.8
man/man8/upsc.8
man/man8/upscmd.8
man/man8/upscode2.8
man/man8/upsd.8
man/man8/upsdrvctl.8
man/man8/upslog.8
man/man8/upsmon.8
man/man8/upsrw.8
man/man8/upssched.8
man/man8/victronups.8
sbin/upsd
sbin/upsmon
sbin/upssched
share/doc/nut/COPYING
share/doc/nut/ChangeLog
share/doc/nut/FAQ.txt
share/doc/nut/INSTALL
share/doc/nut/NEWS
share/doc/nut/README
share/doc/nut/UPGRADING
share/doc/nut/acknowledgements.txt
share/doc/nut/cables.txt
share/doc/nut/cables/apc-rs500-serial.txt
share/doc/nut/cables/apc.txt
share/doc/nut/cables/ge-imv-victron.txt
share/doc/nut/cables/imv.txt
share/doc/nut/cables/mgeups.txt
share/doc/nut/cables/powerware.txt
share/doc/nut/cables/repotec.txt
share/doc/nut/cables/sms.txt
share/doc/nut/config-notes.txt
share/doc/nut/configure.txt
share/doc/nut/contact-closure.txt
share/doc/nut/design.txt
share/doc/nut/developer-guide.txt
share/doc/nut/developers.txt
share/doc/nut/documentation.txt
share/doc/nut/download.txt
share/doc/nut/features.txt
share/doc/nut/hid-subdrivers.txt
share/doc/nut/history.txt
share/doc/nut/macros.txt
share/doc/nut/net-protocol.txt
share/doc/nut/new-clients.txt
share/doc/nut/new-drivers.txt
share/doc/nut/nut-hal.txt
share/doc/nut/nut-names.txt
share/doc/nut/nut-qa.txt
share/doc/nut/outlets.txt
share/doc/nut/packager-guide.txt
share/doc/nut/scheduling.txt
share/doc/nut/security.txt
share/doc/nut/snmp.txt
share/doc/nut/sock-protocol.txt
share/doc/nut/stable-hcl.txt
share/doc/nut/support.txt
share/doc/nut/user-manual.txt
share/examples/nut/nut.conf.sample
share/examples/nut/ups.conf.sample
share/examples/nut/upsd.conf.sample
share/examples/nut/upsd.users.sample
share/examples/nut/upsmon.conf.sample
share/examples/nut/upssched.conf.sample
share/examples/rc.d/ups
share/examples/rc.d/upsd
share/examples/rc.d/upsdriver
share/examples/rc.d/upslog
share/examples/rc.d/upsmon
share/nut/cmdvartab
share/nut/driver.list
@pkgdir share/nut/html
@pkgdir share/doc/nut/drivers
@pkgdir etc/nut
@pkgdir cgi-bin
+7
View File
@@ -0,0 +1,7 @@
$NetBSD: distinfo,v 1.28 2013/02/16 17:34:58 jdf Exp $
SHA1 (nut-2.6.5.tar.gz) = 320debe11df91f04e32824694d0c89a020677f71
RMD160 (nut-2.6.5.tar.gz) = d6e6acd4696e3c3f8c0ecd998f8676a8625decb9
Size (nut-2.6.5.tar.gz) = 2038832 bytes
SHA1 (patch-aa) = 48110f378518edb43a653753eb4ef6ea28344c62
SHA1 (patch-ab) = 44988118570714ab2c3fffdd75909c2255b94fa6
+55
View File
@@ -0,0 +1,55 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: ups.sh,v 1.10 2002/09/20 02:02:01 grant Exp $
#
# KEYWORD: nostart
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
rcd_dir=`@DIRNAME@ $0`
# NOTE: run_rc_command sets $rc_arg
#
forward_commands()
{
# Backward compat with NetBSD <1.6:
[ -z "$rc_arg" ] && rc_arg=$_arg
for file in $COMMAND_LIST; do
$rcd_dir/$file $rc_arg
done
}
reverse_commands()
{
# Backward compat with NetBSD <1.6:
[ -z "$rc_arg" ] && rc_arg=$_arg
REVCOMMAND_LIST=
for file in $COMMAND_LIST; do
REVCOMMAND_LIST="$file $REVCOMMAND_LIST"
done
for file in $REVCOMMAND_LIST; do
$rcd_dir/$file $rc_arg
done
}
COMMAND_LIST="upsdriver upsd upsmon upslog"
name="ups"
start_cmd="forward_commands"
stop_cmd="reverse_commands"
status_cmd="forward_commands"
extra_commands="status"
if [ -f /etc/rc.subr ]
then
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
_arg="$1"
${start_cmd}
fi
+28
View File
@@ -0,0 +1,28 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: upsd.sh,v 1.7 2006/08/15 12:07:15 ghen Exp $
#
# PROVIDE: upsd
# REQUIRE: upsdriver
# BEFORE: upsmon
# KEYWORD: shutdown
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="upsd"
rcvar=$name
command="@PREFIX@/sbin/${name}"
required_files="@NUT_CONFDIR@/${name}.conf"
pidfile="@NUT_STATEDIR@/${name}.pid"
if [ -f /etc/rc.subr ]
then
load_rc_config $name
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
${command} ${upsd_flags} ${command_args}
fi
+58
View File
@@ -0,0 +1,58 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: upsdriver.sh,v 1.8 2004/02/15 13:14:25 lukem Exp $
#
# PROVIDE: upsdriver
# REQUIRE: NETWORK syslogd mountcritremote
#
# You will need to set some variables in /etc/rc.conf to start the UPS
# driver(s) properly, e.g.
#
# upsdriver=YES
# upsdriver_type="newapc"
# upsdriver_flags="-a smartups"
#
# If "upsdriver_type" is unset, then use "upsdrvctl" to control the UPS
# drivers. Please refer to nutupsdrv(8) for more information about the
# arguments to pass to the UPS drivers.
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="upsdriver"
rcvar=$name
if [ -f /etc/rc.subr ]
then
load_rc_config $name
fi
if [ "${upsdriver_type:-upsdrvctl}" = "upsdrvctl" ]
then
ctl_command="@PREFIX@/libexec/nut/upsdrvctl"
required_files="@NUT_CONFDIR@/ups.conf"
start_cmd="${ctl_command} start"
stop_cmd="${ctl_command} stop"
else
command="@PREFIX@/libexec/nut/${upsdriver_type}"
#
# XXX - We need a way to easily determine the pidfile, which is of
# XXX - the form @NUT_STATEDIR@/${updriver_type}-${tty}.pid
#
#pidfile="@NUT_STATEDIR@/${upsdriver_type}-${tty}.pid"
fi
if [ -f /etc/rc.subr ]
then
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
if [ -n "${start_cmd}" ]
then
${start_cmd}
else
${command} ${upsdriver_flags} ${command_args}
fi
fi
+34
View File
@@ -0,0 +1,34 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: upslog.sh,v 1.6 2004/02/15 13:14:25 lukem Exp $
#
# PROVIDE: upslog
# REQUIRE: upsd
#
# You will need to set some variables in /etc/rc.conf to start upslog
# properly, e.g.
#
# upslog=YES
# upslog_flags="smartups@localhost /var/log/ups 60"
#
# Please refer to upslog(8) for more information about the arguments to pass
# to upslog.
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="upslog"
rcvar="${name}"
command="@PREFIX@/bin/${name}"
pidfile="@NUT_STATEDIR@/${name}.pid"
if [ -f /etc/rc.subr ]
then
load_rc_config $name
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
${command} ${upslog_flags} ${command_args}
fi
+26
View File
@@ -0,0 +1,26 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: upsmon.sh,v 1.7 2006/08/15 12:07:15 ghen Exp $
#
# PROVIDE: upsmon
# KEYWORD: shutdown
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="upsmon"
rcvar="${name}"
command="@PREFIX@/sbin/${name}"
pidfile="@NUT_STATEDIR@/${name}.pid"
required_files="@NUT_CONFDIR@/${name}.conf"
if [ -f /etc/rc.subr ]
then
load_rc_config $name
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
${command} ${upsmon_flags} ${command_args}
fi
+13
View File
@@ -0,0 +1,13 @@
$NetBSD: patch-aa,v 1.11 2013/02/16 17:34:58 jdf Exp $
--- conf/Makefile.in.orig 2013-02-08 15:36:48.000000000 +0100
+++ conf/Makefile.in 2013-02-08 15:37:02.000000000 +0100
@@ -112,7 +112,7 @@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
-CONFPATH = @CONFPATH@
+CONFPATH = $(DESTDIR)@prefix@/share/examples/nut
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
+105
View File
@@ -0,0 +1,105 @@
$NetBSD: patch-ab,v 1.12 2013/02/16 17:34:58 jdf Exp $
Keep trying initialisation if we get a timeout or network error while
probing the device.
Submitted upstream as tracker #313195
--- drivers/snmp-ups.c.orig 2013-02-08 15:39:09.000000000 +0100
+++ drivers/snmp-ups.c 2013-02-08 15:39:13.000000000 +0100
@@ -90,6 +90,9 @@
const char *mibname;
const char *mibvers;
+int nut_snmp_err; /* saved snmp error from nut_snmp_get */
+int nut_sys_err; /* saved system errno from nut_snmp_get */
+
static void disable_transfer_oids(void);
#define DRIVER_NAME "Generic SNMP UPS driver"
@@ -266,15 +269,15 @@
/* FIXME: first test if the device is reachable to avoid timeouts! */
- /* Load the SNMP to NUT translation data */
- load_mib2nut(mibs);
-
/* init polling frequency */
if (getval(SU_VAR_POLLFREQ))
pollfreq = atoi(getval(SU_VAR_POLLFREQ));
else
pollfreq = DEFAULT_POLLFREQ;
+ /* Load the SNMP to NUT translation data */
+ load_mib2nut(mibs);
+
/* Get UPS Model node to see if there's a MIB */
su_info_p = su_find_info("ups.model");
status = nut_snmp_get_str(su_info_p->OID, model, sizeof(model), NULL);
@@ -477,6 +480,9 @@
size_t name_len = MAX_OID_LEN;
static unsigned int numerr = 0;
+ nut_sys_err = 0;
+ nut_snmp_err = 0;
+
upsdebugx(3, "nut_snmp_get(%s)", OID);
/* create and send request. */
@@ -495,8 +501,10 @@
status = snmp_synch_response(g_snmp_sess_p, pdu, &response);
- if (!response)
+ if (!response) {
+ snmp_error(g_snmp_sess_p, &nut_sys_err, &nut_snmp_err, NULL);
return NULL;
+ }
if (!((status == STAT_SUCCESS) && (response->errstat == SNMP_ERR_NOERROR)))
{
@@ -876,6 +884,7 @@
bool_t load_mib2nut(const char *mib)
{
int i;
+ int snmp_timeout = 0;
char buf[LARGEBUF];
mib2nut_info_t *m2n = NULL;
@@ -893,6 +902,7 @@
/* Otherwise, revert to the classic method */
if (m2n == NULL)
{
+again:
for (i = 0; mib2nut[i] != NULL; i++) {
/* Is there already a MIB name provided? */
if (strcmp(mib, "auto") && strcmp(mib, mib2nut[i]->mib_name)) {
@@ -902,6 +912,9 @@
/* Classic method: test an OID specific to this MIB */
if (!nut_snmp_get_str(mib2nut[i]->oid_auto_check, buf, sizeof(buf), NULL)) {
+ if (nut_snmp_err == SNMPERR_BAD_SENDTO ||
+ nut_snmp_err == SNMPERR_TIMEOUT)
+ snmp_timeout++;
continue;
}
/* MIB found */
@@ -920,6 +933,19 @@
upsdebugx(1, "load_mib2nut: using %s mib", mibname);
return TRUE;
}
+ if (snmp_timeout > 0) {
+ upslogx(LOG_WARNING, "timeout while probing %s",
+ upsname?upsname:device_name);
+ snmp_timeout = 0;
+ if (sleep(pollfreq) == 0) {
+ /*
+ * we're likely to end up in background if started
+ * from upsdrvctl so enable syslog now
+ */
+ syslogbit_set();
+ goto again;
+ }
+ }
/* Did we find something or is it really an unknown mib */
if (strcmp(mib, "auto") != 0) {