Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jun 2013 22:50:25 GMT
From:      Mark Felder <feld@feld.me>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/179659: [UPDATE] net-mgmt/nfsen: re-port; allow package building
Message-ID:  <201306172250.r5HMoPNM055846@oldred.freebsd.org>
Resent-Message-ID: <201306172300.r5HN00cn063135@freefall.freebsd.org>

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

>Number:         179659
>Category:       misc
>Synopsis:       [UPDATE] net-mgmt/nfsen: re-port; allow package building
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 17 23:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Mark Felder
>Release:        
>Organization:
>Environment:
>Description:
I've basically re-ported nfsen so we can build packages out of it. The previous port relied on the upstream supplied perl-installer script that wouldn't run unless there was a running syslog daemon. This prevented it from being built in tinderbox, poudriere, etc.

Notes:

-passes portlint
-passes rclint
-pkg-install script replaces some functionality the perl installer previously provided
-plist is complete; previous port revision had leftovers
-runs in production!

I've actually installed this port, edited config, run "nfsen reconfig", started daemon, and I'm watching it collect data. The only bit of functionality I'm worried about is the Perl warnings. My old nfsen install on an old server (perl 5.12) doesn't throw these warnings with these exact same scripts. Removing -w from the shebang line would fix it. I'm not sure what policy is on that, so I left it.

BUGS:
For some reason when you run "service nfsen status" (beyond the perl warnings) the output isn't showing the right version of the software.

NfSen version: -1
NfSen status:
Collector for (sw1_excelsior) port 9995 is running [66884].
nfsen daemon:  pid: [66886] is running.


I'm not sure how to fix that or where it gets its value from as I haven't dug into the perl scripts themselves. I don't feel it's very important, so I left it as-is.

https://redports.org/buildarchive/20130617224912-54078/

Maintainer, fyi this is an svn patch.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: Makefile
===================================================================
--- Makefile	(revision 321137)
+++ Makefile	(working copy)
@@ -3,7 +3,7 @@
 
 PORTNAME=	nfsen
 PORTVERSION=	1.3.6p1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net-mgmt
 MASTER_SITES=	SF/${PORTNAME}/stable/${PORTNAME}-${PORTVERSION} \
 		http://nfsen.sourceforge.net/
@@ -17,38 +17,53 @@
 RUN_DEPENDS=	rrdtool>=0:${PORTSDIR}/databases/rrdtool \
 		p5-Mail-Tools>=0:${PORTSDIR}/mail/p5-Mail-Tools \
 		p5-Socket6>=0:${PORTSDIR}/net/p5-Socket6 \
-		nfdump:${PORTSDIR}/net-mgmt/nfdump
+		nfdump>=0:${PORTSDIR}/net-mgmt/nfdump
 
-USES=		iconv
+USES=		iconv shebangfix
 USE_PERL5=	yes
 USE_PHP=	session pcre sockets
 NO_BUILD=	yes
 PLIST_SUB+=	PORTNAME=${PORTNAME}
+SUB_FILES=	pkg-install
 USE_RC_SUBR=	nfsen
+perl_OLD_CMD=	%%PERL%%
+SHEBANG_FILES=	bin/testPlugin bin/RebuildHierarchy.pl bin/nfsen bin/nfsend libexec/NfSenRRD.pm \
+		libexec/NfAlert.pm libexec/NfProfile.pm libexec/Notification.pm libexec/NfSen.pm \
+		libexec/NfConf.pm libexec/Lookup.pm libexec/AbuseWhois.pm libexec/NfSenRC.pm \
+		libexec/Nfsources.pm
+REINPLACE_ARGS=	-i ""
+REINPLACE_LIST=	bin/testPlugin bin/RebuildHierarchy.pl bin/nfsen bin/nfsend etc/nfsen-dist.conf libexec/NfConf.pm
+SUB_LIST+=	"CONFDIR=${PREFIX}/etc"
+SUB_LIST+=	"LIBEXECDIR=${PREFIX}/libexec/${PORTNAME}"
+SUB_LIST+=	"PORTVERSION=${PORTVERSION}"
+SUB_LIST+=	"PREFIX=${PREFIX}"
+SUB_LIST+=	"WWWDIR=${WWWDIR}"
 
-.if defined(PACKAGE_BUILDING)
-IGNORE=		needs running syslogd
-.endif
-
 post-patch:
-	@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' -e 's,%%PORTNAME%%,${PORTNAME},' \
-		${WRKSRC}/etc/nfsen-dist.conf
-	@${RM} ${WRKSRC}/etc/nfsen-dist.conf.*
-	@${REINPLACE_CMD} -e 's,%%PERL%%,${PERL},' -e 's,%%PREFIX%%,${PREFIX},' ${WRKSRC}/install.pl
+.for nfsenfile in ${REINPLACE_LIST}
+	${REINPLACE_CMD} ${_SUB_LIST_TEMP} ${WRKSRC}/${nfsenfile}
+.endfor
 
 do-install:
-	@${MKDIR} ${PREFIX}/var/${PORTNAME}/profiles/live
-	@${MKDIR} ${PREFIX}/libexec/${PORTNAME}
+	@${INSTALL} -d ${PREFIX}/var/${PORTNAME}/profiles-data/live
+	@${INSTALL} -d ${PREFIX}/var/${PORTNAME}/profiles-stat/live
+	@${INSTALL} -d ${PREFIX}/var/${PORTNAME}/profiles/live
+	@${INSTALL} -d ${PREFIX}/var/${PORTNAME}/filters
+	@${INSTALL} -d ${PREFIX}/var/${PORTNAME}/run
+	@${INSTALL} -d ${PREFIX}/libexec/${PORTNAME}/plugins
+	@${INSTALL} -d ${WWWDIR}/plugins
+	@(cd ${WRKSRC}/bin && ${INSTALL_SCRIPT} * ${PREFIX}/bin/)
+	${INSTALL_DATA} ${WRKSRC}/etc/nfsen-dist.conf ${PREFIX}/etc/
+	@(cd ${WRKSRC}/html && ${COPYTREE_SHARE} . ${WWWDIR}/)
+	@(cd ${WRKSRC}/plugins/frontend/ && ${COPYTREE_SHARE} . ${WWWDIR}/plugins/)
+	@(cd ${WRKSRC}/libexec && ${INSTALL_SCRIPT} * ${PREFIX}/libexec/${PORTNAME}/)
+	@(cd ${WRKSRC}/plugins/backend && ${COPYTREE_SHARE} . ${PREFIX}/libexec/${PORTNAME}/plugins/)
 	${INSTALL_DATA} ${WRKSRC}/installer-items/CopyRecursive.pm ${PREFIX}/libexec/${PORTNAME}/
 	${INSTALL_DATA} ${WRKSRC}/installer-items/RRDconvertv1.pm ${PREFIX}/libexec/${PORTNAME}/
-	@ if [ -f ${PREFIX}/etc/nfsen.conf ] ; then \
-	${ECHO_MSG} "installing with existing nfsen.conf"; \
-	cd ${WRKSRC} ;${PERL} ${WRKSRC}/install.pl ${PREFIX}/etc/nfsen.conf; \
-	else \
-	${ECHO_MSG} "installing with sample nfsen.conf"; \
-	cd ${WRKSRC} ;${PERL} ${WRKSRC}/install.pl ${WRKSRC}/etc/nfsen-dist.conf; \
-	fi
 	@${ECHO_MSG} "Configure your ${LOCALBASE}/etc/nfsen.conf to have necessary sources ";
-	@${ECHO_MSG} "Then run 'nfsen -R ${LOCALBASE}/etc/nfsen.conf' to correctly setup source, RRD, and profile files";
+	@${ECHO_MSG} "Then run 'nfsen reconfig' to correctly setup source, RRD, and profile files";
 
+post-install:
+	PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+
 .include <bsd.port.mk>
Index: files/nfsen.in
===================================================================
--- files/nfsen.in	(revision 321137)
+++ files/nfsen.in	(working copy)
@@ -1,25 +1,27 @@
-#! /bin/sh
-
+#!/bin/sh
+#
 # $FreeBSD$
 #
 # PROVIDE: nfsen
 # REQUIRE: sshd
 # KEYWORD: shutdown
 #
-nfsen_enable=${nfsen_enable-"NO"}
-#nfsen_flags=${nfsen_flags-""}
 
 . /etc/rc.subr
 
-name="nfsen"
+name=nfsen
 rcvar=nfsen_enable
 load_rc_config $name
+
+nfsen_enable=${nfsen_enable-"NO"}
+#nfsen_flags=${nfsen_flags-""}
+
 command="%%PREFIX%%/bin/nfsen"
 start_cmd="%%PREFIX%%/bin/nfsen start"
 stop_cmd="%%PREFIX%%/bin/nfsen stop"
 reload_cmd="%%PREFIX%%/bin/nfsen reconfig"
 status_cmd="%%PREFIX%%/bin/nfsen status"
 
-extra_commands="reload"
+extra_commands=reload
 
 run_rc_command "$1"
Index: files/patch-install.pl
===================================================================
--- files/patch-install.pl	(revision 321137)
+++ files/patch-install.pl	(working copy)
@@ -1,43 +0,0 @@
---- install.pl.orig	2012-01-23 20:36:02.000000000 +0400
-+++ install.pl	2012-11-12 15:52:05.000000000 +0400
-@@ -1,4 +1,4 @@
--#!/usr/bin/perl
-+#!%%PERL%% -I %%PREFIX%%/libexec/nfsen
- #
- #
- #  Copyright (c) 2004, SWITCH - Teleinformatikdienste fuer Lehre und Forschung
-@@ -88,33 +88,7 @@
- # Get Perl
- sub GetPerl {
- 
--	my $whichperl;
--	my $ans;
--	$whichperl = FindCommand("perl");
--	if ( defined $whichperl ) {
--		print "Perl to use: [$whichperl] ";
--		chomp($ans = <STDIN>);
--		if ( length $ans ) {
--			$whichperl = $ans;
--		}
--	} else {
--		print "No Perl found in your PATH. Please specify where to find perl [] ";
--		chomp($whichperl = <STDIN>);
--	}
--
--	while (1) {
--		if ( -x $whichperl ) {
--			my $err = system("$whichperl -e 'require 5.6.0;'") >> 8;
--			last if $err == 0;
--			print "Found errors while testing Perl\n";
--		} else {
--			print "No executable: '$whichperl'\n";
--		}
--		print "Perl to use: [] ";
--		chomp($whichperl = <STDIN>);
--	}
--
--	return $whichperl;
-+	return "%%PERL%%";
- 
- } # End of GetPerl
- 
Index: files/pkg-install.in
===================================================================
--- files/pkg-install.in	(revision 0)
+++ files/pkg-install.in	(working copy)
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Created by: Mark Felder <feld@feld.me>
+# $FreeBSD$
+
+# this replications functionality provided by
+# the perl install script that we're bypassing.
+# this is bad, bad, bad but it works...
+
+time=$(/bin/date +%s)
+timeu=$(/bin/expr $time - 300)
+
+if [ "$2" = "POST-INSTALL" ]; then
+
+# generate profile.dat
+/usr/bin/printf "name = live
+group = .
+tbegin = $time
+tcreate = $time
+tstart = $time
+tend = $time
+updated = $timeu
+expire = 0
+maxsize = 0
+size = 0
+type = 0
+locked = 0
+status = OK
+version = 130" > %%PREFIX%%/var/nfsen/profiles-stat/live/profile.dat
+
+# generate conf.php
+/usr/bin/printf "<?php
+/* This file was automatically created by the NfSen %%PORTVERSION%% install.pl script */
+
+\$COMMSOCKET = "%%PREFIX%%/var/nfsen/run/nfsen.comm";
+
+\$DEBUG=0;
+
+?>" > %%WWWDIR%%/conf.php
+
+# chown some files
+/usr/sbin/chown -R www:www %%PREFIX%%/var/nfsen
+
+fi
Index: pkg-plist
===================================================================
--- pkg-plist	(revision 321137)
+++ pkg-plist	(working copy)
@@ -1,95 +1,95 @@
+%%WWWDIR%%/rrdgraph.php
+%%WWWDIR%%/profileadmin.php
+%%WWWDIR%%/process.php
+%%WWWDIR%%/plugins/demoplugin.php
+%%WWWDIR%%/pic.php
+%%WWWDIR%%/overview.php
+%%WWWDIR%%/nfsenutil.php
+%%WWWDIR%%/nfsen.php
+%%WWWDIR%%/navigator.php
+%%WWWDIR%%/lookup.php
+%%WWWDIR%%/js/profileadmin.js
+%%WWWDIR%%/js/menu.js
+%%WWWDIR%%/js/global.js
+%%WWWDIR%%/js/detail.js
+%%WWWDIR%%/js/alerting.js
+%%WWWDIR%%/js/ColorPicker2.js
+%%WWWDIR%%/icons/trigger.png
+%%WWWDIR%%/icons/trash.png
+%%WWWDIR%%/icons/spyglas.png
+%%WWWDIR%%/icons/space.png
+%%WWWDIR%%/icons/shadeactive.png
+%%WWWDIR%%/icons/shade.png
+%%WWWDIR%%/icons/shade.gif
+%%WWWDIR%%/icons/save.png
+%%WWWDIR%%/icons/progress.png
+%%WWWDIR%%/icons/plus.png
+%%WWWDIR%%/icons/ok.png
+%%WWWDIR%%/icons/minus.png
+%%WWWDIR%%/icons/invisible.png
+%%WWWDIR%%/icons/help.png
+%%WWWDIR%%/icons/edit.png
+%%WWWDIR%%/icons/cursor-stop.png
+%%WWWDIR%%/icons/cursor-start.png
+%%WWWDIR%%/icons/cursor-line.png
+%%WWWDIR%%/icons/close.png
+%%WWWDIR%%/icons/cancel.png
+%%WWWDIR%%/icons/arrow.yellow.right.png
+%%WWWDIR%%/icons/arrow.yellow.down.png
+%%WWWDIR%%/icons/arrow.blue.right.png
+%%WWWDIR%%/icons/arrow.blue.down.png
+%%WWWDIR%%/icons/ErrorGraph.png
+%%WWWDIR%%/icons/Error.png
+%%WWWDIR%%/icons/EmptyGraph.png
+%%WWWDIR%%/details.php
+%%WWWDIR%%/css/profileadmin.css
+%%WWWDIR%%/css/nfsen.css
+%%WWWDIR%%/css/lookup.css
+%%WWWDIR%%/css/detail.css
+%%WWWDIR%%/css/alerting.css
+%%WWWDIR%%/conf.php
+%%WWWDIR%%/colour_picker.html
+%%WWWDIR%%/colour_palette.html
+%%WWWDIR%%/alerting.php
+libexec/%%PORTNAME%%/plugins/smily.jpg
+libexec/%%PORTNAME%%/plugins/demoplugin.pm
+libexec/%%PORTNAME%%/RRDconvertv1.pm
+libexec/%%PORTNAME%%/Notification.pm
+libexec/%%PORTNAME%%/Nfsync.pm
+libexec/%%PORTNAME%%/Nfsources.pm
+libexec/%%PORTNAME%%/Nfcomm.pm
+libexec/%%PORTNAME%%/NfSenSim.pm
+libexec/%%PORTNAME%%/NfSenRRD.pm
+libexec/%%PORTNAME%%/NfSenRC.pm
+libexec/%%PORTNAME%%/NfSen.pm
+libexec/%%PORTNAME%%/NfProfile.pm
+libexec/%%PORTNAME%%/NfConf.pm
+libexec/%%PORTNAME%%/NfAlert.pm
+libexec/%%PORTNAME%%/Lookup.pm
+libexec/%%PORTNAME%%/Log.pm
+libexec/%%PORTNAME%%/CopyRecursive.pm
+libexec/%%PORTNAME%%/AbuseWhois.pm
+etc/nfsen-dist.conf
+bin/testPlugin
+bin/nfsend
 bin/nfsen
-bin/nfsend
 bin/RebuildHierarchy.pl
-bin/testPlugin
 @unexec if cmp -s %D/etc/nfsen.conf %D/etc/nfsen-dist.conf; then rm -f %D/etc/nfsen.conf; fi
 @exec [ -f %D/etc/nfsen.conf ] || cp %D/etc/nfsen-dist.conf %D/etc/nfsen.conf
-etc/nfsen-dist.conf
-libexec/%%PORTNAME%%/CopyRecursive.pm
-libexec/%%PORTNAME%%/Log.pm
-libexec/%%PORTNAME%%/Lookup.pm
-libexec/%%PORTNAME%%/NfAlert.pm
-libexec/%%PORTNAME%%/NfConf.pm
-libexec/%%PORTNAME%%/NfProfile.pm
-libexec/%%PORTNAME%%/NfSen.pm
-libexec/%%PORTNAME%%/NfSenRC.pm
-libexec/%%PORTNAME%%/NfSenRRD.pm
-libexec/%%PORTNAME%%/NfSenSim.pm
-libexec/%%PORTNAME%%/Nfcomm.pm
-libexec/%%PORTNAME%%/Nfsources.pm
-libexec/%%PORTNAME%%/Notification.pm
-libexec/%%PORTNAME%%/RRDconvertv1.pm
-libexec/%%PORTNAME%%/plugins/demoplugin.pm
-libexec/%%PORTNAME%%/plugins/smily.jpg
-www/%%PORTNAME%%/alerting.php
-www/%%PORTNAME%%/colour_palette.html
-www/%%PORTNAME%%/colour_picker.html
-www/%%PORTNAME%%/css/alerting.css
-www/%%PORTNAME%%/css/detail.css
-www/%%PORTNAME%%/css/lookup.css
-www/%%PORTNAME%%/css/nfsen.css
-www/%%PORTNAME%%/css/profileadmin.css
-www/%%PORTNAME%%/details.php
-www/%%PORTNAME%%/icons/arrow.blue.down.png
-www/%%PORTNAME%%/icons/arrow.blue.right.png
-www/%%PORTNAME%%/icons/arrow.yellow.down.png
-www/%%PORTNAME%%/icons/arrow.yellow.right.png
-www/%%PORTNAME%%/icons/cancel.png
-www/%%PORTNAME%%/icons/close.png
-www/%%PORTNAME%%/icons/cursor-line.png
-www/%%PORTNAME%%/icons/cursor-start.png
-www/%%PORTNAME%%/icons/cursor-stop.png
-www/%%PORTNAME%%/icons/edit.png
-www/%%PORTNAME%%/icons/EmptyGraph.png
-www/%%PORTNAME%%/icons/Error.png
-www/%%PORTNAME%%/icons/ErrorGraph.png
-www/%%PORTNAME%%/icons/help.png
-www/%%PORTNAME%%/icons/invisible.png
-www/%%PORTNAME%%/icons/minus.png
-www/%%PORTNAME%%/icons/ok.png
-www/%%PORTNAME%%/icons/plus.png
-www/%%PORTNAME%%/icons/progress.png
-www/%%PORTNAME%%/icons/save.png
-www/%%PORTNAME%%/icons/shade.gif
-www/%%PORTNAME%%/icons/shade.png
-www/%%PORTNAME%%/icons/shadeactive.png
-www/%%PORTNAME%%/icons/space.png
-www/%%PORTNAME%%/icons/spyglas.png
-www/%%PORTNAME%%/icons/trash.png
-www/%%PORTNAME%%/icons/trigger.png
-www/%%PORTNAME%%/js/alerting.js
-www/%%PORTNAME%%/js/ColorPicker2.js
-www/%%PORTNAME%%/js/detail.js
-www/%%PORTNAME%%/js/global.js
-www/%%PORTNAME%%/js/menu.js
-www/%%PORTNAME%%/js/profileadmin.js
-www/%%PORTNAME%%/lookup.php
-www/%%PORTNAME%%/navigator.php
-www/%%PORTNAME%%/nfsen.php
-www/%%PORTNAME%%/nfsenutil.php
-www/%%PORTNAME%%/overview.php
-www/%%PORTNAME%%/pic.php
-www/%%PORTNAME%%/process.php
-www/%%PORTNAME%%/profileadmin.php
-www/%%PORTNAME%%/rrdgraph.php
-www/%%PORTNAME%%/conf.php
-www/%%PORTNAME%%/plugins/demoplugin.php
-@dirrm www/%%PORTNAME%%/css
-@dirrm www/%%PORTNAME%%/icons
-@dirrm www/%%PORTNAME%%/js
-@dirrm www/%%PORTNAME%%/plugins
-@dirrm www/%%PORTNAME%%
-@exec mkdir -p %D/var/%%PORTNAME%%/profiles-stat/live/
-var/%%PORTNAME%%/profiles-stat/hints
-var/%%PORTNAME%%/profiles-stat/live/upstream1.rrd
-var/%%PORTNAME%%/profiles-stat/live/profile.dat
-@exec mkdir -p %D/var/%%PORTNAME%%/run
-@exec mkdir -p %D/var/%%PORTNAME%%/filters
-@dirrm var/%%PORTNAME%%/run
-@dirrm var/%%PORTNAME%%/filters
+@dirrmtry var/%%PORTNAME%%/run
 @dirrmtry var/%%PORTNAME%%/profiles-stat/live
 @dirrmtry var/%%PORTNAME%%/profiles-stat
+@dirrmtry var/%%PORTNAME%%/profiles-data/live
 @dirrmtry var/%%PORTNAME%%/profiles-data
+@dirrmtry var/%%PORTNAME%%/profiles/live
+@dirrmtry var/%%PORTNAME%%/profiles
+@dirrmtry var/%%PORTNAME%%/filters
 @dirrmtry var/%%PORTNAME%%
-@dirrm libexec/%%PORTNAME%%/plugins
-@dirrm libexec/%%PORTNAME%%
+@dirrmtry var
+@dirrmtry %%WWWDIR%%/plugins
+@dirrm %%WWWDIR%%/js
+@dirrm %%WWWDIR%%/icons
+@dirrm %%WWWDIR%%/css
+@dirrmtry %%WWWDIR%%
+@dirrmtry libexec/%%PORTNAME%%/plugins
+@dirrmtry libexec/%%PORTNAME%%


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



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