- Port can now be packaged
Approved by: swills (mentor)
This commit is contained in:
parent
4c3c70b590
commit
90f252fa41
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=322524
5 changed files with 183 additions and 159 deletions
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
20
net-mgmt/nfsen/files/pkg-install.in
Normal file
20
net-mgmt/nfsen/files/pkg-install.in
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# Created by: Mark Felder <feld@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
|
|
@ -1,95 +1,95 @@
|
|||
bin/nfsen
|
||||
bin/nfsend
|
||||
bin/RebuildHierarchy.pl
|
||||
%%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
|
||||
@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%%
|
||||
|
|
Loading…
Reference in a new issue