svn commit: r322524 - in head/net-mgmt/nfsen: . files
Mark Felder
feld at FreeBSD.org
Mon Jul 8 17:44:08 UTC 2013
Author: feld
Date: Mon Jul 8 17:44:07 2013
New Revision: 322524
URL: http://svnweb.freebsd.org/changeset/ports/322524
Log:
- Port can now be packaged
Approved by: swills (mentor)
Added:
head/net-mgmt/nfsen/files/pkg-install.in (contents, props changed)
Deleted:
head/net-mgmt/nfsen/files/patch-install.pl
Modified:
head/net-mgmt/nfsen/Makefile
head/net-mgmt/nfsen/files/nfsen.in
head/net-mgmt/nfsen/pkg-plist
Modified: head/net-mgmt/nfsen/Makefile
==============================================================================
--- head/net-mgmt/nfsen/Makefile Mon Jul 8 17:43:15 2013 (r322523)
+++ head/net-mgmt/nfsen/Makefile Mon Jul 8 17:44:07 2013 (r322524)
@@ -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,56 @@ LICENSE_FILE= ${WRKSRC}/BSD-license.txt
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
-
-.if defined(PACKAGE_BUILDING)
-IGNORE= needs running syslogd
-.endif
+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}"
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
+.for perlfile in ${SHEBANG_FILES}
+ @${REINPLACE_CMD} "s|perl -w$$|perl|" ${WRKSRC}/${perlfile}
+.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>
Modified: head/net-mgmt/nfsen/files/nfsen.in
==============================================================================
--- head/net-mgmt/nfsen/files/nfsen.in Mon Jul 8 17:43:15 2013 (r322523)
+++ head/net-mgmt/nfsen/files/nfsen.in Mon Jul 8 17:44:07 2013 (r322524)
@@ -1,25 +1,54 @@
-#! /bin/sh
-
+#!/bin/sh
+#
# $FreeBSD$
#
# PROVIDE: nfsen
-# REQUIRE: sshd
+# REQUIRE: LOGIN
# 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"
+start_precmd=nfsen_start_precmd
+
+extra_commands=reload
-extra_commands="reload"
+nfsen_start_precmd()
+{
+ # This replications functionality provided by
+ # the perl install script that we're bypassing.
+ # It also is better because you don't have to reinstall
+ # to get thise file back
+ if [ ! -e %%PREFIX%%/var/nfsen/profiles-stat/live/profile.dat ]; then
+ time=$(/bin/date +%s);
+ timeu=$(/bin/expr $time - 300);
+ /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" | /usr/bin/tr -d '\011' > %%PREFIX%%/var/nfsen/profiles-stat/live/profile.dat;
+ fi
+}
run_rc_command "$1"
Added: head/net-mgmt/nfsen/files/pkg-install.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net-mgmt/nfsen/files/pkg-install.in Mon Jul 8 17:44:07 2013 (r322524)
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Created by: Mark Felder <feld at feld.me>
+# $FreeBSD$
+
+if [ "$2" = "POST-INSTALL" ]; then
+
+# 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
Modified: head/net-mgmt/nfsen/pkg-plist
==============================================================================
--- head/net-mgmt/nfsen/pkg-plist Mon Jul 8 17:43:15 2013 (r322523)
+++ head/net-mgmt/nfsen/pkg-plist Mon Jul 8 17:44:07 2013 (r322524)
@@ -1,95 +1,95 @@
-bin/nfsen
+%%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/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
- at dirrm www/%%PORTNAME%%/css
- at dirrm www/%%PORTNAME%%/icons
- at dirrm www/%%PORTNAME%%/js
- at dirrm www/%%PORTNAME%%/plugins
- at dirrm www/%%PORTNAME%%
- at 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
- at exec mkdir -p %D/var/%%PORTNAME%%/run
- at exec mkdir -p %D/var/%%PORTNAME%%/filters
- at dirrm var/%%PORTNAME%%/run
- at dirrm var/%%PORTNAME%%/filters
+ at dirrmtry var/%%PORTNAME%%/run
@dirrmtry var/%%PORTNAME%%/profiles-stat/live
@dirrmtry var/%%PORTNAME%%/profiles-stat
+ at dirrmtry var/%%PORTNAME%%/profiles-data/live
@dirrmtry var/%%PORTNAME%%/profiles-data
+ at dirrmtry var/%%PORTNAME%%/profiles/live
+ at dirrmtry var/%%PORTNAME%%/profiles
+ at dirrmtry var/%%PORTNAME%%/filters
@dirrmtry var/%%PORTNAME%%
- at dirrm libexec/%%PORTNAME%%/plugins
- at dirrm libexec/%%PORTNAME%%
+ at dirrmtry var
+ at dirrmtry %%WWWDIR%%/plugins
+ at dirrm %%WWWDIR%%/js
+ at dirrm %%WWWDIR%%/icons
+ at dirrm %%WWWDIR%%/css
+ at dirrmtry %%WWWDIR%%
+ at dirrmtry libexec/%%PORTNAME%%/plugins
+ at dirrmtry libexec/%%PORTNAME%%
More information about the svn-ports-head
mailing list