Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Dec 2010 17:00:12 GMT
From:      John Bayly <freebsd.ports@tipstrade.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/152866: Take over ownership of the sysutils/nut port
Message-ID:  <201012061700.oB6H0Cvo099111@red.freebsd.org>
Resent-Message-ID: <201012061700.oB6H0O70034721@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         152866
>Category:       ports
>Synopsis:       Take over ownership of the sysutils/nut port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 06 17:00:23 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     John Bayly
>Release:        7.3-RELEASE-p2
>Organization:
>Environment:
FreeBSD rack 7.3-RELEASE-p2 FreeBSD 7.3-RELEASE-p2 #6: Thu Oct 14 15:19:25 GMT 2010     <...>:/usr/obj/usr/src/sys/S5500BC  amd64

>Description:
Updated the sysutils/nut port to v.2.4.3
Also updated the maintainer to myself following email conversation with current maintainer (Tetcu Ion-Mihai).

Have also included some updates to the Belkin driver not yet in v.2.4.3
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	./nut
#	./nut/files
#	./nut/files/patch-drivers-belkin.h
#	./nut/files/nut.sh.in
#	./nut/files/nut_upslog.sh.in
#	./nut/files/nut_upsmon.sh.in
#	./nut/files/patch-drivers-belkin.c
#	./nut/files/patch-man-upsd.users.5
#	./nut/files/patch-conf-upsd.users.sample
#	./nut/Makefile
#	./nut/pkg-descr
#	./nut/pkg-plist
#	./nut/distinfo
#
echo c - ./nut
mkdir -p ./nut > /dev/null 2>&1
echo c - ./nut/files
mkdir -p ./nut/files > /dev/null 2>&1
echo x - ./nut/files/patch-drivers-belkin.h
sed 's/^X//' >./nut/files/patch-drivers-belkin.h << 'd257eca6545a284c7406365c03ccdcd8'
X--- drivers/belkin.h.orig	2010-12-02 11:38:46.000000000 +0000
X+++ drivers/belkin.h	2010-12-06 15:06:55.000000000 +0000
X@@ -15,6 +15,12 @@
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
X+
X+   Author           : Marcus Müller
X+   Created On       :
X+   Last Modified By : John Bayly
X+   Last Modified On : Monday December 06, 2010, 15:05 GMT
X+
X */
X 
X #include <sys/ioctl.h>
X@@ -32,16 +38,28 @@
X #define STAT_OUTPUT	"STO"
X #define STAT_BATTERY	"STB"
X #define STAT_STATUS	"STA"
X+#define TEST_RESULT	"TSR"
X #define POWER_ON	"RON"
X #define POWER_OFF	"ROF"
X #define POWER_SDTYPE	"SDT"	/* shutdown type? */
X #define POWER_CYCLE	"SDA"	/* shutdown, then restore */
X+#define BUZZER "BUZ"
X+#define BUZZER_ON "1"
X+#define BUZZER_OFF0 "0"	/* Switching the buzzer off can be either 0 or 2 */
X+#define BUZZER_OFF2 "2"	/* Seems to be used for F6c1400 */
X+#define TEST "TST"
X+#define TEST_10SEC "3"
X+#define TEST_DEEP "4"
X+#define TEST_CANCEL "0"
X 
X /* The UPS Status "low battery" comes up 10s before the UPS actually stops.
X    Therefore a shutdown is done at this battery % */
X 
X #define LOW_BAT		20
X 
X+/* the maximum allowed number of missed replies */
X+#define MAXTRIES	3
X+
X /* dangerous instant commands must be reconfirmed within a 12 second window */
X #define CONFIRM_DANGEROUS_COMMANDS 1
X #define MINCMDTIME	3
d257eca6545a284c7406365c03ccdcd8
echo x - ./nut/files/nut.sh.in
sed 's/^X//' >./nut/files/nut.sh.in << 'c7ce638f0c332d19691ae0c735b673fe'
X#!/bin/sh
X#
X# $FreeBSD: ports/sysutils/nut/files/nut.sh.in,v 1.2 2010/03/27 00:14:59 dougb Exp $
X#
X
X# PROVIDE: nut
X# REQUIRE: NETWORKING
X# BEFORE: LOGIN
X# KEYWORD: shutdown
X
X# Define these nut_* variables in one of these files:
X#       /etc/rc.conf
X#       /etc/rc.conf.local
X#       /etc/rc.conf.d/nut
X#
X# DO NOT CHANGE THESE DEFAULT VALUES HERE
X#
Xnut_enable=${nut_enable-"NO"}
Xnut_prefix=${nut_prefix-"%%PREFIX%%"}
X
X. /etc/rc.subr
X
Xname="nut"
Xrcvar=`set_rcvar`
X
Xload_rc_config $name
X
Xrequired_dirs="%%STATEDIR%%"
Xrequired_files="${nut_prefix}/etc/nut/ups.conf ${nut_prefix}/etc/nut/upsd.conf ${nut_prefix}/etc/nut/upsd.users"
Xcommand="${nut_prefix}/sbin/upsd"
Xpidfile="%%STATEDIR%%/upsd.pid"
X
Xstart_precmd="nut_prestart"
Xstop_postcmd="nut_poststop"
X
Xnut_prestart() {
X	${nut_prefix}/libexec/nut/upsdrvctl start
X}
X
Xnut_poststop() {
X	${nut_prefix}/libexec/nut/upsdrvctl stop
X}
X
Xrun_rc_command "$1"
c7ce638f0c332d19691ae0c735b673fe
echo x - ./nut/files/nut_upslog.sh.in
sed 's/^X//' >./nut/files/nut_upslog.sh.in << '830f3291cb8368e3b429a014ceca756f'
X#!/bin/sh
X#
X# $FreeBSD: ports/sysutils/nut/files/nut_upslog.sh.in,v 1.2 2010/03/27 00:15:00 dougb Exp $
X#
X
X# PROVIDE: nut_upslog
X# REQUIRE: NETWORKING nut
X# BEFORE: LOGIN
X# KEYWORD: shutdown
X
X# Define these nut_upslog* variables in one of these files:
X#       /etc/rc.conf
X#       /etc/rc.conf.local
X#       /etc/rc.conf.d/nut_upslog
X#
X# DO NOT CHANGE THESE DEFAULT VALUES HERE
X#
Xnut_upslog_enable=${nut_upslog_enable-"NO"}
Xnut_upslog_prefix=${nut_upslog_prefix-"%%PREFIX%%"}
Xnut_upslog_logfile=${nut_upslog_logfile-"/var/log/ups.log"}
Xnut_upslog_interval=${nut_upslog_interval-"300"}
Xnut_upslog_ups=${nut_upslog_ups-"myups@localhost"}
X
X. /etc/rc.subr
X
Xname="nut_upslog"
Xrcvar=`set_rcvar`
X
Xload_rc_config $name
X
Xrequired_dirs="%%STATEDIR%%"
Xcommand="${nut_upslog_prefix}/bin/upslog"
Xpidfile="%%STATEDIR%%/upslog.pid"
Xnut_upslog_flags=${nut_upslog_flags-"-s ${nut_upslog_ups} -l ${nut_upslog_logfile} -i ${nut_upslog_interval}"}
X
Xrun_rc_command "$1"
830f3291cb8368e3b429a014ceca756f
echo x - ./nut/files/nut_upsmon.sh.in
sed 's/^X//' >./nut/files/nut_upsmon.sh.in << '4f106c81f19244acf267d98ed7b39d2b'
X#!/bin/sh
X#
X# $FreeBSD: ports/sysutils/nut/files/nut_upsmon.sh.in,v 1.2 2010/03/27 00:15:00 dougb Exp $
X#
X
X# PROVIDE: nut_upsmon
X# REQUIRE: NETWORKING nut
X# BEFORE: LOGIN
X# KEYWORD: shutdown
X
X# Define these nut_upsmon* variables in one of these files:
X#       /etc/rc.conf
X#       /etc/rc.conf.local
X#       /etc/rc.conf.d/nut_upsmon
X#
X# DO NOT CHANGE THESE DEFAULT VALUES HERE
X#
Xnut_upsmon_enable=${nut_upsmon_enable-"NO"}
Xnut_upsmon_prefix=${nut_upsmon_prefix-"%%PREFIX%%"}
X
X. /etc/rc.subr
X
Xname="nut_upsmon"
Xrcvar=`set_rcvar`
X
Xload_rc_config $name
X
Xrequired_dirs="%%STATEDIR%%"
Xrequired_files="${nut_upsmon_prefix}/etc/nut/upsmon.conf"
Xcommand="${nut_upsmon_prefix}/sbin/upsmon"
Xpidfile="%%STATEDIR%%/upsmon.pid"
Xnut_upsmon_flags=${nut_upsmon_flags-"localhost"}
X
Xrun_rc_command "$1"
4f106c81f19244acf267d98ed7b39d2b
echo x - ./nut/files/patch-drivers-belkin.c
sed 's/^X//' >./nut/files/patch-drivers-belkin.c << '431b308a41b3325475a7f967cf1f9935'
X--- drivers/belkin.c.orig	2010-02-11 21:43:23.000000000 +0000
X+++ drivers/belkin.c	2010-12-06 15:06:58.000000000 +0000
X@@ -21,6 +21,11 @@
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
X+
X+   Author           : Marcus Müller
X+   Created On       :
X+   Last Modified By : John Bayly
X+   Last Modified On : Monday December 06, 2010, 15:05 GMT
X */
X 
X #include "main.h"
X@@ -28,7 +33,7 @@
X #include "belkin.h"
X 
X #define DRIVER_NAME	"Belkin Smart protocol driver"
X-#define DRIVER_VERSION	"0.22"
X+#define DRIVER_VERSION	"0.24"
X 
X /* driver description structure */
X upsdrv_info_t upsdrv_info = {
X@@ -39,8 +44,13 @@
X 	{ NULL }
X };
X 
X+/** the number of replies that have been missed */
X+static int retry = 0;
X+
X static void send_belkin_command(char cmd, const char *subcmd, const char *data)
X {
X+	upsdebugx(6, "Send Command: %s, %s", subcmd, data);
X+	ser_flush_io(upsfd);
X 	ser_send(upsfd, "~00%c%03d%s%s", cmd, (int)strlen(data) + 3, subcmd, data);
X }
X 
X@@ -96,53 +106,76 @@
X 	return NULL;
X }
X 
X-static int do_status(void)
X+static char *get_status()
X {
X 	char	temp[SMALLBUF], st[SMALLBUF];
X 	int	res;
X+	const char	*status = NULL;
X 
X 	send_belkin_command(STATUS,STAT_STATUS,"");
X 	res = get_belkin_reply(temp);
X-	if (res == -1) {
X-		dstate_datastale();
X-		return 0;
X-	}
X-
X-	status_init();
X-
X+	if (res < 1)
X+		return NULL;
X+	
X 	get_belkin_field(temp, st, sizeof(st), 6);
X 	if (*st == '1') {
X-		status_set("OFF");
X-
X-	} else {	/* (OFF) and (OB | OL) are mutually exclusive */
X+		status = "OFF";
X 
X+	} else if (*st == '0') {	/* (OFF) and (OB | OL) are mutually exclusive */
X 		get_belkin_field(temp, st, sizeof(st), 2);
X 		if (*st == '1') {
X-			status_set("OB");
X+			status = "OB";	/* on battery */
X 
X 			send_belkin_command(STATUS,STAT_BATTERY,"");
X 			res = get_belkin_reply(temp);
X 
X-			if (res == -1) {
X-				dstate_datastale();
X-				return 0;
X+			if (res < 1) {	/* no battery info, so no reliable status */
X+				status = NULL;
X+
X+			} else {
X+				get_belkin_field(temp, st, sizeof(st), 10);
X+				res = atoi(st);
X+				get_belkin_field(temp, st, sizeof(st), 2);
X+
X+				if (*st == '1' || res < LOW_BAT) 
X+					status = "LB";	/* low battery */
X 			}
X 
X-			get_belkin_field(temp, st, sizeof(st), 10);
X-			res = atoi(st);
X-			get_belkin_field(temp, st, sizeof(st), 2);
X+		} else if (*st == '0') {
X+			status = "OL";	/* on line */
X 
X-			if (*st == '1' || res < LOW_BAT) 
X-				status_set("LB");	/* low battery */
X 		}
X-		else
X-			status_set("OL");	/* on line */
X 	}
X 
X-	status_commit();
X-	dstate_dataok();
X+	return status;
X+}
X+
X+static int do_status(void)
X+{
X+	/* fetch the UPS status, or null if unavailable */
X+	const char	*status = get_status();
X+	
X+	if (status) {
X+		if (retry)	/* previous attempt had failed */
X+			upslogx(LOG_WARNING, "Communications with UPS re-established");
X+
X+		status_init();
X+		status_set(status);
X+		status_commit();
X+		dstate_dataok();
X+		retry = 0;
X+		return 1;
X+
X+	} else {
X+		if (retry < MAXTRIES) {
X+			upslogx(LOG_WARNING, "Communications with UPS lost: status read failed!");
X+			retry++;
X 
X-	return 1;
X+		} else {	/* too many retries */
X+			dstate_datastale();
X+		}
X+		return 0;
X+	}
X }
X 
X static int do_broken_rat(char *buf)
X@@ -217,8 +250,13 @@
X 
X 	ser_flush_io(upsfd);
X 
X+	dstate_addcmd("beeper.disable");
X+	dstate_addcmd("beeper.enable");
X 	dstate_addcmd("load.off");
X 	dstate_addcmd("load.on");
X+	dstate_addcmd("test.battery.start.quick");
X+	dstate_addcmd("test.battery.start.deep");
X+	dstate_addcmd("test.battery.stop");
X 	upsdrv_updateinfo();
X 	return 0;
X }
X@@ -283,6 +321,52 @@
X 	get_belkin_field(temp, st, sizeof(st), 7);
X 	val = atof(st);
X 	dstate_setinfo("ups.load", "%03.0f", val);
X+
X+	send_belkin_command(STATUS, TEST_RESULT, "");
X+	res = get_belkin_reply(temp);
X+	if (res == -1)
X+		return;
X+
X+	get_belkin_field(temp, st, sizeof(st), 1);
X+	val = atof(st);
X+	switch ((int)val) {
X+		case 0:
X+			dstate_setinfo("ups.test.result", "%s", "No test performed");
X+			break;
X+
X+		case 1:
X+			dstate_setinfo("ups.test.result", "%s", "Passed");
X+			break;
X+
X+		case 2:
X+			dstate_setinfo("ups.test.result", "%s", "In progress");
X+			break;
X+
X+		case 3:
X+		case 4:
X+			dstate_setinfo("ups.test.result", "%s", "10s test failed");
X+			break;
X+
X+		case 5:
X+			dstate_setinfo("ups.test.result", "%s", "deep test failed");
X+			break;
X+
X+		case 6:
X+			dstate_setinfo("ups.test.result", "%s", "Aborted");
X+			break;
X+
X+		default:
X+			break;
X+
X+	}
X+
X+	send_belkin_command(STATUS,STAT_STATUS, "");
X+	res = get_belkin_reply(temp);
X+	if (res == -1)
X+		return;
X+
X+	get_belkin_field(temp, st, sizeof(st), 16);
X+	dstate_setinfo("ups.beeper.status", "%s", (*st == '0' ? "disabled" : "enabled"));
X }
X 
X static int get_belkin_reply(char *buf)
X@@ -292,7 +376,7 @@
X 
X 	usleep(25000);
X 
X-	/* pull first 7 bytes to get data length - like ~00S004 */
X+	/* pull first 7 bytes to get data length - like ~00D004 */
X 	ret = ser_get_buf_len(upsfd, (unsigned char *)tmp, 7, 3, 0);
X 
X 	if (ret != 7) {
X@@ -302,8 +386,13 @@
X 
X 	tmp[7] = 0;
X 	cnt = atoi(tmp + 4);
X+	upsdebugx(6, "Received: %s", tmp);
X 
X-	if ((cnt < 1) || (cnt > 255))
X+	if (cnt == 0) {	/* possible to have ~00R000, return empty response */
X+		buf[0] = 0;
X+		return 0;
X+
X+	} else if ((cnt < 1) || (cnt > 255))
X 		return -1;
X 
X 	/* give it time to respond to us */
X@@ -312,6 +401,7 @@
X 	ret = ser_get_buf_len(upsfd, (unsigned char *)buf, cnt, 3, 0);
X 
X 	buf[cnt] = 0;
X+	upsdebugx(6, "Received: %s", buf);
X 
X 	if (ret != cnt) {
X 		ser_comm_fail("Second read returned %d bytes, expected %d",
X@@ -347,6 +437,28 @@
X 	send_belkin_command(CONTROL, "SDA", "5");
X }
X 
X+/* handle "beeper.disable" */
X+static void do_beeper_off(void) {
X+	int	res;
X+	char	temp[SMALLBUF];
X+	const char	*arg;
X+
X+	/* Compare the model name, as the BUZZER_OFF argument depends on it */
X+	send_belkin_command(STATUS, MODEL, "");
X+	res = get_belkin_reply(temp);
X+	if (res == -1)
X+		return;
X+
X+	if (!strcmp(temp, "F6C1400-EUR")) {
X+		arg = BUZZER_OFF2;
X+
X+	} else {
X+		arg = BUZZER_OFF0;
X+
X+	}
X+	send_belkin_command(CONTROL,BUZZER,arg);
X+}
X+
X /* handle the "load.off" with some paranoia */
X static void do_off(void)
X {
X@@ -375,6 +487,16 @@
X 
X static int instcmd(const char *cmdname, const char *extra)
X {
X+	if (!strcasecmp(cmdname, "beeper.disable")) {
X+		do_beeper_off();
X+		return STAT_INSTCMD_HANDLED;
X+	}
X+
X+	if (!strcasecmp(cmdname, "beeper.enable")) {
X+		send_belkin_command(CONTROL,BUZZER,BUZZER_ON);
X+		return STAT_INSTCMD_HANDLED;
X+	}
X+
X 	if (!strcasecmp(cmdname, "load.off")) {
X 		do_off();
X 		return STAT_INSTCMD_HANDLED;
X@@ -385,6 +507,21 @@
X 		return STAT_INSTCMD_HANDLED;
X 	}
X 
X+	if (!strcasecmp(cmdname, "test.battery.start.quick")) {
X+		send_belkin_command(CONTROL,TEST,TEST_10SEC);
X+		return STAT_INSTCMD_HANDLED;
X+	}
X+
X+	if (!strcasecmp(cmdname, "test.battery.start.deep")) {
X+		send_belkin_command(CONTROL,TEST,TEST_DEEP);
X+		return STAT_INSTCMD_HANDLED;
X+	}
X+
X+	if (!strcasecmp(cmdname, "test.battery.stop")) {
X+		send_belkin_command(CONTROL,TEST,TEST_CANCEL);
X+		return STAT_INSTCMD_HANDLED;
X+	}
X+
X 	upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname);
X 	return STAT_INSTCMD_UNKNOWN;
X }
431b308a41b3325475a7f967cf1f9935
echo x - ./nut/files/patch-man-upsd.users.5
sed 's/^X//' >./nut/files/patch-man-upsd.users.5 << 'f484592494059bfa2b75a50a71fa9be2'
X--- man/upsd.users.5.orig	2010-10-12 11:55:18.000000000 +0000
X+++ man/upsd.users.5	2010-10-12 11:49:46.000000000 +0000
X@@ -25,6 +25,7 @@
X 	[pfy]
X 		password = duh
X 		instcmds = test.panel.start
X+		instcmds = test.panel.stop
X 
X 	[monmaster]
X 		password = blah
X@@ -59,7 +60,10 @@
X 
X Let a user initiate specific instant commands.  Use "ALL" to grant all
X commands automatically.  For the full list of what your UPS supports,
X-use "upscmd \-l".  
X+use "upscmd \-l".
X+
X+To specify multiple commands, use multiple instances of the instcmds
X+field.
X 
X The \fBcmdvartab\fR file supplied with the distribution contains a list
X of most of the known command names.
f484592494059bfa2b75a50a71fa9be2
echo x - ./nut/files/patch-conf-upsd.users.sample
sed 's/^X//' >./nut/files/patch-conf-upsd.users.sample << '1aa106089e3792bdebcb5d66a9e4657a'
X--- conf/upsd.users.sample.orig	2009-02-17 09:20:40.000000000 +0000
X+++ conf/upsd.users.sample	2010-10-12 11:53:47.000000000 +0000
X@@ -49,6 +49,14 @@
X #
X 
X #
X+# --- Configuring for a user who can execute tests only
X+#
X+#	[testuser]
X+#		password  = pass
X+#		instcmds  = test.battery.start
X+#		instcmds  = test.battery.stop
X+
X+#
X # --- Configuring for upsmon
X #
X # To add a user for your upsmon, use this example:
1aa106089e3792bdebcb5d66a9e4657a
echo x - ./nut/Makefile
sed 's/^X//' >./nut/Makefile << 'df45a3b74ee0173ca013110ce45e00d6'
X# New ports collection makefile for:    nut
X# Date created:         08 Jan 2000
X# Whom:                 Boris Popov <bp@freebsd.org>
X# Date modified:	06 Dec 2010
X# Whom:			John Bayly <freebsd.ports@tipstrade.net>
X#
X# $FreeBSD: ports/sysutils/nut/Makefile,v 1.58 2010/09/16 15:00:00 itetcu Exp $
X#
X
XPORTNAME=	nut
XPORTVERSION=	2.4.3
XPORTREVISION=	0
XCATEGORIES=	sysutils
XMASTER_SITES=	http://www.networkupstools.org/source/${PORTVERSION:R}/
XDISTFILES=	${DISTNAME}${EXTRACT_SUFX} ${DISTNAME}${EXTRACT_SUFX}.sig
XEXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
X
XMAINTAINER=	freebsd.ports@tipstrade.net
XCOMMENT=	Network UPS Tools
X
XUSE_AUTOTOOLS=	autoconf
XGNU_CONFIGURE=	yes
XUSE_GMAKE=	yes
XUSE_LDCONFIG=	yes
XUSE_GNOME=	pkgconfig
X
XNUT_USER?=	uucp
XNUT_GROUP?=	uucp
XSTATEDIR?=	/var/db/nut
X
XOPTIONS=	SERIAL		"SERIAL support"	on \
X		USB		"USB support"	on \
X		SNMP		"SNMP support"	on \
X		NEON		"NEON XML/HTTP support"	on \
X		PDU		"Powerman PDU support"	off \
X		HAL		"HAL support"	off \
X		IPV6		"IPV6 support"  on \
X		CGI		"Web CGI interface"	off \
X		BASH		"Bash Completion support" off
X
XUSE_RC_SUBR=	nut.sh nut_upsmon.sh nut_upslog.sh
XSUB_LIST+=	STATEDIR=${STATEDIR}
XPLIST_SUB+=	STATEDIR=${STATEDIR}
X
XMAN3=		upscli_connect.3 upscli_disconnect.3 upscli_fd.3 \
X		upscli_get.3 upscli_list_next.3 upscli_list_start.3 \
X		upscli_readline.3 upscli_sendline.3 upscli_splitaddr.3 \
X		upscli_splitname.3 upscli_ssl.3 upscli_strerror.3 \
X		upscli_upserror.3 upsclient.3
X
XMAN5=		nut.conf.5 ups.conf.5 upsd.conf.5 upsd.users.5 \
X		upsmon.conf.5 upssched.conf.5
X
XMAN8=		nutupsdrv.8 upsc.8 upscmd.8 upsd.8 upsdrvctl.8 \
X		upslog.8 upsmon.8 upsrw.8 upssched.8
X
XPORTDOCS=	*
X
X.include <bsd.port.pre.mk>
X
XCONFIGURE_ARGS=	--sysconfdir=${PREFIX}/etc/nut \
X		--program-transform-name="" \
X		--localstatedir=${STATEDIR} \
X		--datadir=${PREFIX}/etc/nut \
X		--with-drvpath=${PREFIX}/libexec/nut \
X		--with-statepath=${STATEDIR} \
X		--with-altpidpath=${STATEDIR} \
X		--with-pidpath=${STATEDIR} \
X		--with-pkgconfig-dir=${PREFIX}/libdata/pkgconfig \
X		--with-user=${NUT_USER} \
X		--with-group=${NUT_GROUP} \
X		--with-dev
X
X.if defined(WITH_CGI)
XLIB_DEPENDS+=	gd.4:${PORTSDIR}/graphics/gd
XMAN5+=		hosts.conf.5 upsset.conf.5 upsstats.html.5
XMAN8+=		upsset.cgi.8 upsstats.cgi.8 upsimage.cgi.8
XCGIDIR?=	${PREFIX}/www/cgi-bin/${PORTNAME}
XCGIDIR_REL?=	${CGIDIR:S,^${PREFIX}/,,}
XCONFIGURE_ARGS+=	--with-cgi --with-cgipath=${CGIDIR} \
X			--with-htmlpath=${WWWDIR} \
X			--with-gd-includes=-I${PREFIX}/include \
X			--with-gd-libs="-L${PREFIX}/lib -lgd"
XPLIST_SUB+=	NUT_CGI=""
XPLIST_SUB+=	CGIDIR="${CGIDIR_REL}"
XPLIST_SUB+=	CGIETCDIR="etc/nut/"
X.else
XCONFIGURE_ARGS+=	--without-cgi
XPLIST_SUB+=	NUT_CGI="@comment "
X.endif
X
X.if !defined(WITHOUT_SERIAL)
XCONFIGURE_ARGS+=	--with-serial
XMAN8+=		apcsmart.8 bcmxcp.8 belkin.8 belkinunv.8 bestfortress.8 \
X		bestuferrups.8 bestups.8 bestfcom.8 blazer.8 \
X		dummy-ups.8 etapro.8 everups.8 gamatronic.8 genericups.8 \
X		isbmex.8 ivtscd.8 liebert.8 liebertgxt2.8 masterguard.8 \
X		megatec.8 metasys.8 mge-shut.8 mge-utalk.8 microdowell.8 \
X		oneac.8 optiups.8 powercom.8 powerpanel.8 rhino.8 safenet.8 \
X		solis.8 tripplite.8 tripplitesu.8 upscode2.8 victronups.8
XPLIST_SUB+=	NUT_SERIAL=""
X.else
XCONFIGURE_ARGS+=	--without-serial
XPLIST_SUB+=	NUT_SERIAL="@comment "
X.endif
X
X.if !defined(WITHOUT_USB)
X. if ${OSVERSION} < 800069
XLIB_DEPENDS+=	usb-0.1.8:${PORTSDIR}/devel/libusb
X. else
XEXTRA_PATCHES=	${FILESDIR}/extra-patch-m4_nut_check_libusb.m4
X. endif
XCONFIGURE_ARGS+=	--with-usb=auto
XMAN8+=		bcmxcp_usb.8 megatec_usb.8 richcomm_usb.8 tripplite_usb.8 \
X		usbhid-ups.8
XPLIST_SUB+=	NUT_USB=""
X.else
XCONFIGURE_ARGS+=	--without-usb
XPLIST_SUB+=	NUT_USB="@comment "
X.endif
X
X.if !defined(WITHOUT_SNMP)
XLIB_DEPENDS+=	netsnmp.20:${PORTSDIR}/net-mgmt/net-snmp
XCONFIGURE_ARGS+=	--with-snmp
XMAN8+=		snmp-ups.8
XPLIST_SUB+=	NUT_SNMP=""
X.else
XCONFIGURE_ARGS+=	--without-snmp
XPLIST_SUB+=	NUT_SNMP="@comment "
X.endif
X
X.if !defined(WITHOUT_NEON)
XLIB_DEPENDS+=	neon.27:${PORTSDIR}/www/neon29
XCONFIGURE_ARGS+=	--with-neonxml
XMAN8+=		netxml-ups.8
XPLIST_SUB+=	NUT_NEON=""
X.else
XCONFIGURE_ARGS+=	--without-neonxml
XPLIST_SUB+=	NUT_NEON="@comment "
X.endif
X
X.if defined(WITH_PDU)
XLIB_DEPENDS+=	powerman.0:${PORTSDIR}/sysutils/powerman
XCONFIGURE_ARGS+=	--with-powerman
XMAN8+=		powerman-pdu.8
XPLIST_SUB+=	NUT_PDU=""
X.else
XCONFIGURE_ARGS+=	--without-powerman
XPLIST_SUB+=	NUT_PDU="@comment "
X.endif
X
X.if defined(WITH_HAL)
X. if defined(WITHOUT_USB)
XBROKEN=		HAL is only usable with USB support enabled. Run 'make config' again!
X. endif
XLIB_DEPENDS+=	hal.1:${PORTSDIR}/sysutils/hal
XCONFIGURE_ARGS+=	--with-hal
X#MAN8+=
XPLIST_SUB+=	NUT_HAL=""
X.else
XCONFIGURE_ARGS+=	--without-hal
XPLIST_SUB+=	NUT_HAL="@comment "
X.endif
X
X.if !defined(WITHOUT_IPV6)
XCONFIGURE_ARGS+=	--with-ipv6
X.else
XCONFIGURE_ARGS+=	--without-ipv6
X.endif
X
X.if defined(WITH_BASH)
XRUN_DEPENDS+=	${LOCALBASE}/bin/bash_completion.sh:${PORTSDIR}/shells/bash-completion
XPLIST_SUB+=	BASH=""
X.else
XPLIST_SUB+=	BASH="@comment "
X.endif
X
Xpost-patch:
X	@${REINPLACE_CMD} -e 's|<hal/|<|' ${WRKSRC}/drivers/main-hal.c ${WRKSRC}/drivers/dstate-hal.c ${WRKSRC}/drivers/dstate-hal.h
X	@${REINPLACE_CMD} -e 's|/usr/share|${LOCALBASE}/share| ; s|$${datarootdir}|${PREFIX}/share|' ${WRKSRC}/m4/nut_check_libhal.m4
X
Xpre-install:
X	@${MKDIR} ${PREFIX}/libexec/nut
X	@${MKDIR} ${STATEDIR}
X	@${CHOWN} ${NUT_USER}:${NUT_GROUP} ${STATEDIR}
X	@${CHMOD} 0750 ${STATEDIR}
X
Xpost-install:
X.if defined(WITH_BASH)
X	${INSTALL_DATA} ${WRKSRC}/scripts/misc/nut.bash_completion ${PREFIX}/etc/bash_completion.d
X.endif
X.if !defined(NOPORTDOCS)
X	@${MKDIR} ${DOCSDIR}/cables
X	${INSTALL_DATA} ${WRKSRC}/docs/cables/*.txt ${DOCSDIR}/cables
X	${INSTALL_DATA} ${WRKSRC}/docs/*.txt ${DOCSDIR}
X	${INSTALL_DATA} ${WRKSRC}/docs/FAQ ${DOCSDIR}
X.for file in AUTHORS COPYING ChangeLog INSTALL MAINTAINERS NEWS README UPGRADING
X	${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
X.endfor
X.endif
X
X.include <bsd.port.post.mk>
df45a3b74ee0173ca013110ce45e00d6
echo x - ./nut/pkg-descr
sed 's/^X//' >./nut/pkg-descr << '1d1613336a1cd898fdbf55bb7130c479'
XThis is a developing project to monitor a large assortment of UPS hardware.
XNetwork communications are used so that multiple systems can monitor a
Xsingle physical UPS and shut down together if necessary without any
Xspecial "sharing hardware" on the UPS itself. CGI scripts are provided
Xto monitor UPS status via a WEB browser.
X
XWWW: http://www.networkupstools.org/
1d1613336a1cd898fdbf55bb7130c479
echo x - ./nut/pkg-plist
sed 's/^X//' >./nut/pkg-plist << '89a1f66f8e58ff228ec772fe5c8392dd'
X@stopdaemon nut_upsmon
X@stopdaemon nut_upslog
X@stopdaemon nut
Xbin/upsc
Xbin/upscmd
Xbin/upslog
Xbin/upsrw
Xbin/upssched-cmd
X%%BASH%%etc/bash_completion.d/nut.bash_completion
Xetc/nut/cmdvartab
Xetc/nut/driver.list
Xetc/nut/nut.conf.sample
Xetc/nut/ups.conf.sample
Xetc/nut/upsd.conf.sample
Xetc/nut/upsd.users.sample
Xetc/nut/upsmon.conf.sample
Xetc/nut/upssched.conf.sample
Xinclude/parseconf.h
Xinclude/upsclient.h
Xlib/libupsclient.so.1
Xlib/libupsclient.so
Xlib/libupsclient.la
X%%NUT_HAL%%libexec/hald-addon-bcmxcp_usb
X%%NUT_HAL%%libexec/hald-addon-megatec_usb
X%%NUT_HAL%%libexec/hald-addon-tripplite_usb
X%%NUT_HAL%%libexec/hald-addon-usbhid-ups
X%%NUT_SERIAL%%libexec/nut/apcsmart
X%%NUT_SERIAL%%libexec/nut/bcmxcp
X%%NUT_USB%%libexec/nut/bcmxcp_usb
X%%NUT_SERIAL%%libexec/nut/belkin
X%%NUT_SERIAL%%libexec/nut/belkinunv
X%%NUT_SERIAL%%libexec/nut/bestfcom
X%%NUT_SERIAL%%libexec/nut/bestfortress
X%%NUT_SERIAL%%libexec/nut/bestuferrups
X%%NUT_SERIAL%%libexec/nut/bestups
X%%NUT_SERIAL%%libexec/nut/blazer_ser
X%%NUT_USB%%libexec/nut/blazer_usb
X%%NUT_SERIAL%%libexec/nut/clone
X%%NUT_SERIAL%%libexec/nut/clone-outlet
X%%NUT_SERIAL%%libexec/nut/dummy-ups
X%%NUT_SERIAL%%libexec/nut/etapro
X%%NUT_SERIAL%%libexec/nut/everups
X%%NUT_SERIAL%%libexec/nut/gamatronic
X%%NUT_SERIAL%%libexec/nut/genericups
X%%NUT_SERIAL%%libexec/nut/isbmex
X%%NUT_SERIAL%%libexec/nut/ivtscd
X%%NUT_SERIAL%%libexec/nut/liebert
X%%NUT_SERIAL%%libexec/nut/liebertgxt2
X%%NUT_SERIAL%%libexec/nut/masterguard
X%%NUT_SERIAL%%libexec/nut/megatec
X%%NUT_USB%%libexec/nut/megatec_usb
X%%NUT_SERIAL%%libexec/nut/metasys
X%%NUT_SERIAL%%libexec/nut/mge-shut
X%%NUT_SERIAL%%libexec/nut/mge-utalk
X%%NUT_SERIAL%%libexec/nut/microdowell
X%%NUT_NEON%%libexec/nut/netxml-ups
X%%NUT_SERIAL%%libexec/nut/newmge-shut
X%%NUT_SERIAL%%libexec/nut/oneac
X%%NUT_SERIAL%%libexec/nut/optiups
X%%NUT_SERIAL%%libexec/nut/powercom
X%%NUT_PDU%%libexec/nut/powerman-pdu
X%%NUT_SERIAL%%libexec/nut/powerpanel
X%%NUT_SERIAL%%libexec/nut/rhino
X%%NUT_USB%%libexec/nut/richcomm_usb
X%%NUT_SERIAL%%libexec/nut/safenet
X%%NUT_SERIAL%%libexec/nut/skel
X%%NUT_SNMP%%libexec/nut/snmp-ups
X%%NUT_SERIAL%%libexec/nut/solis
X%%NUT_SERIAL%%libexec/nut/tripplite
X%%NUT_USB%%libexec/nut/tripplite_usb
X%%NUT_SERIAL%%libexec/nut/tripplitesu
X%%NUT_SERIAL%%libexec/nut/upscode2
Xlibexec/nut/upsdrvctl
X%%NUT_USB%%libexec/nut/usbhid-ups
X%%NUT_SERIAL%%libexec/nut/victronups
Xlibdata/pkgconfig/libupsclient.pc
Xsbin/upsd
Xsbin/upsmon
Xsbin/upssched
X%%NUT_HAL%%share/hal/fdi/information/20thirdparty/20-ups-nut-device.fdi
X%%NUT_CGI%%%%CGIDIR%%/upsimage.cgi
X%%NUT_CGI%%%%CGIDIR%%/upsset.cgi
X%%NUT_CGI%%%%CGIDIR%%/upsstats.cgi
X%%NUT_CGI%%%%CGIETCDIR%%/hosts.conf.sample
X%%NUT_CGI%%%%CGIETCDIR%%/upsset.conf.sample
X%%NUT_CGI%%%%CGIETCDIR%%/upsstats.html.sample
X%%NUT_CGI%%%%CGIETCDIR%%/upsstats-single.html.sample
X%%NUT_CGI%%%%WWWDIR%%/bottom.html
X%%NUT_CGI%%%%WWWDIR%%/header.html
X%%NUT_CGI%%%%WWWDIR%%/index.html
X%%NUT_CGI%%%%WWWDIR%%/nut-banner.png
X@dirrmtry etc/nut
X@dirrmtry libdata/pkgconfig
X@dirrmtry libexec/nut
X@dirrmtry %%STATEDIR%%
X%%NUT_CGI%%@dirrm %%CGIDIR%%
X%%NUT_CGI%%@dirrmtry www/cgi-bin
X%%NUT_CGI%%@dirrm %%WWWDIR%%
89a1f66f8e58ff228ec772fe5c8392dd
echo x - ./nut/distinfo
sed 's/^X//' >./nut/distinfo << 'c77e2c5167860c8c437f20b97d5db568'
XSHA256 (nut-2.4.3.tar.gz) = d3b701f21f1e049abb5df94ee9805fce86fe57a876c3bb41217558a846a49335
XSIZE (nut-2.4.3.tar.gz) = 1154503
XSHA256 (nut-2.4.3.tar.gz.sig) = b9703edf0999d4335f1a948987144fba41d6d10db0eb580e95cb4438bc877aa8
XSIZE (nut-2.4.3.tar.gz.sig) = 72
c77e2c5167860c8c437f20b97d5db568
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012061700.oB6H0Cvo099111>