Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2005 12:08:26 +0200 (CEST)
From:      Joerg Pulz <Joerg.Pulz@frm2.tum.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        Maintainer <dougb@FreeBSD.org>
Subject:   ports/83318: [update] bring sysutils/nut to v2.0.2 and more
Message-ID:  <200507121008.j6CA8QA0097561@hades.admin.frm2>
Resent-Message-ID: <200507121010.j6CAAKVT010608@freefall.freebsd.org>

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

>Number:         83318
>Category:       ports
>Synopsis:       [update] bring sysutils/nut to v2.0.2 and more
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 12 10:10:19 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Joerg Pulz
>Release:        FreeBSD 5.4-RELEASE-p4 i386
>Organization:
TU-Munich / ZWE FRM-II
>Environment:
System: FreeBSD hades.admin.frm2 5.4-RELEASE-p4 FreeBSD 5.4-RELEASE-p4 #5: Fri Jul 8 01:37:16 CEST 2005 jpulz@hades.admin.frm2:/usr/obj/usr/src/sys/HADES i386


	
>Description:
	- update sysutils/nut to v2.0.2 and turn it into a MASTER port

sysutils/nut part:
	  - prepared Makefile to accept SLAVE ports
	  - updated pkg-plist and MAN sections for new ups drivers
	  - reordered MASTER_SITES as the eu1 server is more up to date
	  - make portlint(1) happier about the localstatedir
	  - removed creation of the localstatedir from pkg-plist,
	    this is already done in the Makefile
	  - added a line to forcestop nut when deinstalling this port
	    to pkg-plist
	  - modified the rcNG script
	    - added required_dirs and required_files
	    - turned start_cmd into start_postcmd to let the rc.subr test for
	      required_dirs and required_files actually happen
	  - removed files/patch-man_Makefile.in, as the SNMPPAGES are installed
	    by a SLAVE port now (installing this manpage was wrong anyway)
	  - added files/patch-Makefile.in, add and modify build and install
	    targets for the SLAVE ports
	The sysutils/nut port has not changes its behavior

SLAVE ports
 sysutils/nut-libupsclient
	  - added new port to build and install the libupsclient archive and
	    some headers
	  - this allows other/future ports to depend on this SLAVE port and
	    provides statically linking to the libupsclient archive
	  - this SLAVE port depends on devel/pkgconfig

 sysutils/nut-snmp
	  - added new port to build and install the SNMP ups driver and
	    manpages
	  - the snmp driver is marked as experimental but we are using it here
	    without any flaws
	  - this SLAVE port depends on sysutils/nut (without it the driver is
	    useless) and net-mgmt/net-snmp

 sysutils/nut-usb
	  - added new port to build and install the USB ups driver and
	    manpages
	  - this driver allows to communicate with ups systems connected via
	    the USBus (some MGE ups systems provide this interface)
	  - this SLAVE port depends on sysutils/nut (without it the driver is
	    useless) and devel/libusb

>How-To-Repeat:
	
>Fix:

	- apply the sysutils_nut.diff patch to sysutils/nut
	- remove sysutils/nut/files/patch-man_Makefile.in from CVS
	- add sysutils/nut/files/patch-Makefile.in to CVS

	- extract the three shar(1) archives in sysutils/ and add the newly
	  created nut-libupsclient, nut-snmp and nut-usb directories and their
	  files to CVS


--- sysutils_nut.diff begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/sysutils/nut/Makefile,v
retrieving revision 1.28
diff -u -r1.28 Makefile
--- Makefile	25 Jun 2005 20:28:01 -0000	1.28
+++ Makefile	12 Jul 2005 09:24:40 -0000
@@ -6,36 +6,46 @@
 #
 
 PORTNAME=	nut
-PORTVERSION=	2.0.1
+PORTVERSION=	2.0.2
 CATEGORIES=	sysutils
-MASTER_SITES=	http://us1.networkupstools.org/source/${PORTVERSION:R}/ \
-		http://eu1.networkupstools.org/source/${PORTVERSION:R}/
+MASTER_SITES=	http://eu1.networkupstools.org/source/${PORTVERSION:R}/ \
+		http://us1.networkupstools.org/source/${PORTVERSION:R}/
 DISTFILES=	${DISTNAME}${EXTRACT_SUFX} ${DISTNAME}${EXTRACT_SUFX}.sig
 EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
 
-
 MAINTAINER=	DougB@FreeBSD.org
-COMMENT=	Network UPS Tools
+COMMENT?=	Network UPS Tools
+
+SUBSYS?=	base
+.if ${SUBSYS} != base
+PKGNAMESUFFIX=	-${SUBSYS}
+.endif
 
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--sysconfdir=${PREFIX}/etc/nut \
-		--localstatedir=/var/db/nut \
+		--localstatedir=${STATEDIR} \
 		--datadir=${PREFIX}/etc/nut \
 		--with-drvpath=${PREFIX}/libexec/nut \
-		--with-statepath=/var/db/nut \
-		--with-altpidpath=/var/db/nut \
-		--with-pidpath=/var/db/nut
+		--with-statepath=${STATEDIR} \
+		--with-altpidpath=${STATEDIR} \
+		--with-pidpath=${STATEDIR} \
+		--with-linux-hiddev=no
 USE_RC_SUBR=	yes
+STATEDIR=	${DESTDIR}/var/db/nut
+
+.include <bsd.port.pre.mk>
 
+.if ${SUBSYS} == base
 MAN5=		ups.conf.5 upsd.conf.5 upsd.users.5 upsmon.conf.5 \
 		upssched.conf.5
-MAN8=		apcsmart.8 belkin.8 belkinunv.8 bestuferrups.8 bestups.8 \
-		bestfcom.8 cpsups.8 cyberpower.8 etapro.8 everups.8 \
+MAN8=		apcsmart.8 bcmxcp.8 belkin.8 belkinunv.8 bestuferrups.8 \
+		bestups.8 bestfcom.8 cpsups.8 cyberpower.8 etapro.8 everups.8 \
 		fentonups.8 genericups.8 ippon.8 isbmex.8 liebert.8 \
 		masterguard.8 metasys.8 mge-shut.8 mge-utalk.8 mustek.8 \
 		nutupsdrv.8 oneac.8 powercom.8 powermust.8 safenet.8 sms.8 \
-		snmp-ups.8 tripplite.8 tripplitesu.8 upsc.8 upscmd.8 upsd.8 \
-		upsdrvctl.8 upslog.8 upsmon.8 upsrw.8 upssched.8 victronups.8 
+		solis.8 tripplite.8 tripplitesu.8 upsc.8 upscmd.8 upscode2.8 \
+		upsd.8 upsdrvctl.8 upslog.8 upsmon.8 upsrw.8 upssched.8 \
+		victronups.8
 
 ALL_TARGET=	all
 INSTALL_TARGET=	install install-conf
@@ -62,19 +72,52 @@
 PLIST_SUB+=	CGIDIRRM="@comment "
 PLIST_SUB+=	CGIETC="@comment "
 .endif
+.endif
+
+.if ${SUBSYS} == usb
+LIB_DEPENDS=	usb-0.1.8:${PORTSDIR}/devel/libusb
+ALL_TARGET=	usb
+INSTALL_TARGET=	install-usb
+
+MAN8=		newhidups.8
+.endif
 
+.if ${SUBSYS} == snmp
+LIB_DEPENDS=	netsnmp.7:${PORTSDIR}/net-mgmt/net-snmp
+ALL_TARGET=	snmp
+INSTALL_TARGET=	install-snmp
+
+MAN8=		snmp-ups.8
+.endif
+
+.if ${SUBSYS} == libupsclient
+CONFIGURE_ARGS+=	--enable-pkg-config \
+			--with-pkgconfig-dir=${PREFIX}/libdata/pkgconfig
+ALL_TARGET=	lib
+INSTALL_TARGET=	install-lib
+
+MAN3=		upscli_connect.3 upscli_disconnect.3 upscli_readline.3 \
+		upscli_sendline.3 upscli_splitname.3 upscli_strerror.3
+
+post-patch:
+	@${REINPLACE_CMD} -e "s#@PKG_CFG_DIR@#${PREFIX}/libdata/pkgconfig#g" \
+		${WRKSRC}/lib/Makefile.in
+.endif
+
+.if ${SUBSYS} == base
 pre-install:
 .if !defined(WITH_NUT_CGI) && !defined(BATCH) && !defined(PACKAGE_BUILDING)
 	@${ECHO_MSG} "Type \"make -DWITH_NUT_CGI\" if you want to build CGI scripts."
 .endif
 	@${MKDIR} ${PREFIX}/libexec/nut
-	@${MKDIR} /var/db/nut
-	@${CHOWN} uucp:wheel /var/db/nut
-	@${CHMOD} 0750 /var/db/nut
+	@${MKDIR} ${STATEDIR}
+	@${CHOWN} uucp:wheel ${STATEDIR}
+	@${CHMOD} 0750 ${STATEDIR}
 
 post-install:
 	@${SED} -e "s#%%PREFIX%%#${PREFIX}#g" \
 		-e "s#%%RC_SUBR%%#${RC_SUBR}#g" \
+		-e "s#%%STATEDIR%%#${STATEDIR}#g" \
 		<${FILESDIR}/nut.sh.sample >${WRKSRC}/nut.sh
 	${INSTALL_SCRIPT} ${WRKSRC}/nut.sh ${PREFIX}/etc/rc.d/nut.sh
 .if !defined(NOPORTDOCS)
@@ -88,4 +131,6 @@
 .endfor
 .endif
 
-.include <bsd.port.mk>
+.endif
+
+.include <bsd.port.post.mk>
Index: distinfo
===================================================================
RCS file: /home/ncvs/ports/sysutils/nut/distinfo,v
retrieving revision 1.16
diff -u -r1.16 distinfo
--- distinfo	25 Jun 2005 20:28:01 -0000	1.16
+++ distinfo	12 Jul 2005 09:24:40 -0000
@@ -1,4 +1,4 @@
-MD5 (nut-2.0.1.tar.gz) = fe28e182ab31015cfcfad5870a2322a2
-SIZE (nut-2.0.1.tar.gz) = 564545
-MD5 (nut-2.0.1.tar.gz.sig) = 5a44399917dbb14cb939266aeafcaf61
-SIZE (nut-2.0.1.tar.gz.sig) = 65
+MD5 (nut-2.0.2.tar.gz) = 6560df8d0a42f0f585d34ed1ae8c6f67
+SIZE (nut-2.0.2.tar.gz) = 609977
+MD5 (nut-2.0.2.tar.gz.sig) = 65bfaa136df1b0a1b73f983f51d706b3
+SIZE (nut-2.0.2.tar.gz.sig) = 65
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/sysutils/nut/pkg-plist,v
retrieving revision 1.17
diff -u -r1.17 pkg-plist
--- pkg-plist	25 Jun 2005 20:28:01 -0000	1.17
+++ pkg-plist	12 Jul 2005 09:24:40 -0000
@@ -1,3 +1,4 @@
+@unexec %D/etc/rc.d/nut.sh forcestop 2>/dev/null || true
 bin/upsc
 bin/upscmd
 bin/upslog
@@ -12,6 +13,7 @@
 @unexec rmdir %D/etc/nut 2>/dev/null || true
 etc/rc.d/nut.sh
 libexec/nut/apcsmart
+libexec/nut/bcmxcp
 libexec/nut/belkin
 libexec/nut/belkinunv
 libexec/nut/bestfcom
@@ -38,8 +40,10 @@
 libexec/nut/powermust
 libexec/nut/safenet
 libexec/nut/sms
+libexec/nut/solis
 libexec/nut/tripplite
 libexec/nut/tripplitesu
+libexec/nut/upscode2
 libexec/nut/upsdrvctl
 libexec/nut/victronups
 sbin/upsd
@@ -94,7 +98,6 @@
 %%PORTDOCS%%@dirrm %%DOCSDIR%%/cables
 %%PORTDOCS%%@dirrm %%DOCSDIR%%/drivers
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
-@dirrm libexec/nut
-@exec if [ ! -d /var/db/nut ]; then mkdir /var/db/nut; chown uucp:wheel /var/db/nut; chmod 0755 /var/db/nut; fi
+@unexec rmdir %D/libexec/nut 2>/dev/null || true
 @unexec rmdir /var/db/nut 2>/dev/null || true
 %%CGIDIRRM%%
Index: files/nut.sh.sample
===================================================================
RCS file: /home/ncvs/ports/sysutils/nut/files/nut.sh.sample,v
retrieving revision 1.4
diff -u -r1.4 nut.sh.sample
--- files/nut.sh.sample	25 Jun 2005 20:28:01 -0000	1.4
+++ files/nut.sh.sample	12 Jul 2005 09:24:41 -0000
@@ -17,7 +17,7 @@
 #
 nut_enable=${nut_enable-"NO"}
 nut_prefix=${nut_prefix-"%%PREFIX%%"}
-nut_pidfile=${nut_pidfile-"/var/db/nut/nut.pid"}
+nut_pidfile=${nut_pidfile-"%%STATEDIR%%/nut.pid"}
 nut_upslog=${nut_upslog-"/var/log/ups.log"}
 nut_upsloginterval=${nut_upsloginterval-"300"}
 nut_upslogmail=${nut_upslogmail-"backups@localhost"}
@@ -27,7 +27,10 @@
 name="nut"
 rcvar=`set_rcvar`
 
-start_cmd="nut_start"
+required_dirs="%%STATEDIR%%"
+required_files="${nut_prefix}/etc/nut/ups.conf ${nut_prefix}/etc/nut/upsd.conf ${nut_prefix}/etc/nut/upsd.users ${nut_prefix}/etc/nut/upsmon.conf"
+
+start_postcmd="nut_start"
 stop_cmd="nut_stop"
 
 nut_start() {
Index: files/patch-Makefile.in
===================================================================
RCS file: files/patch-Makefile.in
diff -N files/patch-Makefile.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-Makefile.in	12 Jul 2005 09:24:41 -0000
@@ -0,0 +1,37 @@
+--- Makefile.in.orig	Thu Jan 27 15:33:15 2005
++++ Makefile.in	Fri Jul  8 21:45:32 2005
+@@ -90,6 +90,12 @@
+ install-cgi-conf:
+ 	@cd conf; $(MAKE) install-cgi-conf; cd ..;
+ 
++lib: build-lib
++
++build-lib:
++	@cd common ; $(MAKE) || exit 1; cd ..;
++	@cd clients; $(MAKE) libupsclient.a || exit 1; cd ..;
++
+ install-lib:
+ 	@cd clients; $(MAKE) install-lib; cd ..;
+ 	@cd man; $(MAKE) install-lib-man; cd ..;
+@@ -98,9 +104,8 @@
+ usb: build-usb
+ 
+ build-usb:
+-	@cd drivers; $(MAKE) hidups; cd ..;
+-	@cd drivers; $(MAKE) newhidups; cd ..;
+-	@cd drivers; $(MAKE) energizerups; cd ..;
++	@cd common ; $(MAKE) || exit 1; cd ..;
++	@cd drivers; $(MAKE) newhidups || exit 1; cd ..;
+ 
+ install-usb:
+ 	@cd drivers; $(MAKE) install-usb; cd ..;
+@@ -109,7 +114,8 @@
+ snmp: build-snmp
+ 
+ build-snmp:
+-	@cd drivers; $(MAKE) snmp-ups; cd ..;
++	@cd common ; $(MAKE) || exit 1; cd ..;
++	@cd drivers; $(MAKE) snmp-ups || exit 1; cd ..;
+ 
+ install-snmp: snmp install-snmp-man install-snmp-mgr
+ 
Index: files/patch-man_Makefile.in
===================================================================
RCS file: files/patch-man_Makefile.in
diff -N files/patch-man_Makefile.in
--- files/patch-man_Makefile.in	29 Aug 2004 01:55:45 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
---- man/Makefile.in.orig	Thu Nov 27 15:35:19 2003
-+++ man/Makefile.in	Sat Feb  7 23:09:21 2004
-@@ -47,7 +47,7 @@
- 		echo $(INSTALLCMD) -m $(INSTALLMODE) $$f $(MANDIR)/man5; \
- 		$(INSTALLCMD) -m $(INSTALLMODE) $$f $(MANDIR)/man5; \
- 	done
--	@for f in $(MAN8_PAGES) ; do \
-+	@for f in $(MAN8_PAGES) $(SNMPPAGES) ; do \
- 		echo $(INSTALLCMD) -m $(INSTALLMODE) $$f $(MANDIR)/man8; \
- 		$(INSTALLCMD) -m $(INSTALLMODE) $$f $(MANDIR)/man8; \
- 	done
--- sysutils_nut.diff ends here ---

--- sysutils_nut-libupsclient.shar begins here ---
# 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-libupsclient
#	nut-libupsclient/Makefile
#	nut-libupsclient/pkg-plist
#
echo c - nut-libupsclient
mkdir -p nut-libupsclient > /dev/null 2>&1
echo x - nut-libupsclient/Makefile
sed 's/^X//' >nut-libupsclient/Makefile << 'END-of-nut-libupsclient/Makefile'
X# New ports collection makefile for:    nut-libupsclient
X# Date created:         08 Jul 2005
X# Whom:                 Joerg Pulz <Joerg.Pulz@frm2.tum.de>
X#
X# $FreeBSD$
X#
X
XCOMMENT=	Network UPS Tools - upsclient library
X
X# Local variables
X#
X
XUSE_GNOME=	pkgconfig
XUSE_REINPLACE=	yes
X
XPLIST=		${.CURDIR}/pkg-plist
XSUBSYS=		libupsclient
X
X# Local overrides
X#
X
XMASTERDIR=	${.CURDIR}/../nut
X
X.include "${MASTERDIR}/Makefile"
END-of-nut-libupsclient/Makefile
echo x - nut-libupsclient/pkg-plist
sed 's/^X//' >nut-libupsclient/pkg-plist << 'END-of-nut-libupsclient/pkg-plist'
Xbin/libupsclient-config
Xinclude/parseconf.h
Xinclude/upsclient.h
Xlib/libupsclient.a
Xlibdata/pkgconfig/libupsclient.pc
END-of-nut-libupsclient/pkg-plist
exit
--- sysutils_nut-libupsclient.shar ends here ---

--- sysutils_nut-snmp.shar begins here ---
# 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-snmp
#	nut-snmp/Makefile
#	nut-snmp/pkg-plist
#
echo c - nut-snmp
mkdir -p nut-snmp > /dev/null 2>&1
echo x - nut-snmp/Makefile
sed 's/^X//' >nut-snmp/Makefile << 'END-of-nut-snmp/Makefile'
X# New ports collection makefile for:    nut-snmp
X# Date created:         08 Jul 2005
X# Whom:                 Joerg Pulz <Joerg.Pulz@frm2.tum.de>
X#
X# $FreeBSD$
X#
X
XCOMMENT=	Network UPS Tools - SNMP driver
X
X# Local variables
X#
X
XRUN_DEPENDS=	upsd:${PORTSDIR}/sysutils/nut
X
XPLIST=		${.CURDIR}/pkg-plist
XSUBSYS=		snmp
X
X# Local overrides
X#
X
XMASTERDIR=	${.CURDIR}/../nut
X
X.include "${MASTERDIR}/Makefile"
END-of-nut-snmp/Makefile
echo x - nut-snmp/pkg-plist
sed 's/^X//' >nut-snmp/pkg-plist << 'END-of-nut-snmp/pkg-plist'
Xlibexec/nut/snmp-ups
END-of-nut-snmp/pkg-plist
exit
--- sysutils_nut-snmp.shar ends here ---

--- sysutils_nut-libupsclient.shar begins here ---
# 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-libupsclient
#	nut-libupsclient/Makefile
#	nut-libupsclient/pkg-plist
#
echo c - nut-libupsclient
mkdir -p nut-libupsclient > /dev/null 2>&1
echo x - nut-libupsclient/Makefile
sed 's/^X//' >nut-libupsclient/Makefile << 'END-of-nut-libupsclient/Makefile'
X# New ports collection makefile for:    nut-libupsclient
X# Date created:         08 Jul 2005
X# Whom:                 Joerg Pulz <Joerg.Pulz@frm2.tum.de>
X#
X# $FreeBSD$
X#
X
XCOMMENT=	Network UPS Tools - upsclient library
X
X# Local variables
X#
X
XUSE_GNOME=	pkgconfig
XUSE_REINPLACE=	yes
X
XPLIST=		${.CURDIR}/pkg-plist
XSUBSYS=		libupsclient
X
X# Local overrides
X#
X
XMASTERDIR=	${.CURDIR}/../nut
X
X.include "${MASTERDIR}/Makefile"
END-of-nut-libupsclient/Makefile
echo x - nut-libupsclient/pkg-plist
sed 's/^X//' >nut-libupsclient/pkg-plist << 'END-of-nut-libupsclient/pkg-plist'
Xbin/libupsclient-config
Xinclude/parseconf.h
Xinclude/upsclient.h
Xlib/libupsclient.a
Xlibdata/pkgconfig/libupsclient.pc
END-of-nut-libupsclient/pkg-plist
exit
--- sysutils_nut-libupsclient.shar ends here ---


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



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