diff options
author | wen <wen@FreeBSD.org> | 2011-03-28 10:45:01 +0800 |
---|---|---|
committer | wen <wen@FreeBSD.org> | 2011-03-28 10:45:01 +0800 |
commit | def1512720aa5b5c1e780c4aed67d8b2a9e07f17 (patch) | |
tree | 6bbe6ab359c8057351c6a393e00ba89dcdbfe1c1 /sysutils | |
parent | 6f5421db79ea684c1e89cc0b27779636a9b50f0d (diff) | |
download | freebsd-ports-gnome-def1512720aa5b5c1e780c4aed67d8b2a9e07f17.tar.gz freebsd-ports-gnome-def1512720aa5b5c1e780c4aed67d8b2a9e07f17.tar.zst freebsd-ports-gnome-def1512720aa5b5c1e780c4aed67d8b2a9e07f17.zip |
- Update to 2.1.0
- Pass maintainership to submitter
- Rewrite rc script
PR: ports/155976
Submitted by: Chris Rees <utisoft@gmail.com>
Approved by: admin@mjbrune.org (previous maintainer)
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/monitorix/Makefile | 90 | ||||
-rw-r--r-- | sysutils/monitorix/distinfo | 4 | ||||
-rw-r--r-- | sysutils/monitorix/files/monitorix.in | 33 | ||||
-rw-r--r-- | sysutils/monitorix/files/patch-monitorix | 96 | ||||
-rw-r--r-- | sysutils/monitorix/files/patch-monitorix.pl | 65 | ||||
-rw-r--r-- | sysutils/monitorix/files/pkg-message.in | 10 | ||||
-rw-r--r-- | sysutils/monitorix/pkg-plist | 52 |
7 files changed, 165 insertions, 185 deletions
diff --git a/sysutils/monitorix/Makefile b/sysutils/monitorix/Makefile index 7d6efdfca7ff..b7b374742f4b 100644 --- a/sysutils/monitorix/Makefile +++ b/sysutils/monitorix/Makefile @@ -6,15 +6,19 @@ # PORTNAME= monitorix -PORTVERSION= 1.5.1 +PORTVERSION= 2.1.0 CATEGORIES= sysutils -MASTER_SITES= http://www.monitorix.org/ +MASTER_SITES= http://www.monitorix.org/ \ + http://www.bayofrum.net/dist/${PORTNAME}/ -MAINTAINER= admin@mjbrune.org +MAINTAINER= utisoft@gmail.com COMMENT= A web based monitoring system LIB_DEPENDS= rrd:${PORTSDIR}/databases/rrdtool -BUILD_DEPENDS= ${SITE_PERL}/LWP/Parallel.pm:${PORTSDIR}/www/p5-ParallelUA +RUN_DEPENDS= ${SITE_PERL}/LWP/Parallel.pm:${PORTSDIR}/www/p5-ParallelUA \ + ${SITE_PERL}/CGI.pm:${PORTSDIR}/www/p5-CGI.pm \ + ${SITE_PERL}/LWP.pm:${PORTSDIR}/www/p5-libwww \ + ${SITE_PERL}/MIME/Lite.pm:${PORTSDIR}/mail/p5-MIME-Lite LICENSE= GPLv2 @@ -22,30 +26,34 @@ OPTIONS= REPORTS "Mail HTML reports to a given address" off .include <bsd.port.options.mk> +USE_PERL= 5.8+ MAN5= monitorix.conf.5 MANCOMPRESSED= no NO_BUILD= yes +USE_RC_SUBR= ${PORTNAME} CGIDIR?= ${PREFIX}/www/cgi-bin -#REPORTS?= true -# owner of $WWWROOT/imgs +CGIPATH?= ${CGIDIR:C,^.*/,/,} WWW_OWNER?= ${WWWOWN} WWW_GROUP?= ${WWWGRP} -DATADIR= ${INSTDIR} REPORT_LANG= ca de en it -INSTDIR= ${PREFIX}/${PORTNAME} -# WWWROOT: (WWWDIR - portname), we need the resulting path for a variable in monitorix.conf -WWWROOT= ${WWWDIR:S,${PORTNAME},,} +WWWROOT= ${WWWDIR:S,/${PORTNAME}$,,} SUB_FILES= pkg-message -SUB_LIST= PERL=${PERL} INSTDIR=${INSTDIR} -PLIST_SUB+= CGIDIR=${CGIDIR:S,${PREFIX}/,,} WWW_OWNER=${WWW_OWNER} WWW_GROUP=${WWW_GROUP} +SUB_LIST= PERL=${PERL} -WWW_FILES= logo_top.png logo_bot.png monitorixico.png -DOCS= COPYING Changes README README.FreeBSD README.nginx TODO \ - monitorix-alert.sh monitorix-apache.conf -REPORT_FILES= imgs_email/blank.png imgs_email/logo.jpg imgs_email/signature.png \ - imgs_email/title.jpg traffic_report.html traffic_report.sh +PLIST_SUB+= CGIDIR=${CGIDIR:C,^${PREFIX}/,,} + +WWW_FILES= logo_top.png \ + logo_bot.png \ + monitorixico.png + +PORTDOCS= COPYING \ + Changes \ + README \ + README.FreeBSD \ + monitorix-alert.sh \ + monitorix-apache.conf .if defined(WITH_REPORTS) RUN_DEPENDS+= metamail>=2.7:${PORTSDIR}/mail/metamail @@ -60,33 +68,26 @@ pre-everything:: @${ECHO_MSG} "" @${ECHO_MSG} "DATADIR=${DATADIR} Where do you put RRD databases?" @${ECHO_MSG} "CGIDIR=${CGIDIR} Where do you put cgi?" + @${ECHO_MSG} "CGIPATH=${CGIPATH} What is the relative URL for cgi files?" @${ECHO_MSG} "WWWDIR=${WWWDIR} Where do you put httpd's document root?" @${ECHO_MSG} "" post-patch: -.for f in cgi conf pl - @${REINPLACE_CMD} -e "s|/usr/bin/perl|${PERL}|" ${WRKSRC}/monitorix.${f} -.endfor -# Notes about the adjustments for default configuration: -# - set FreeBSD as OSTYPE -# - set a generic WWWROOT, since we can include it in the webserver config -# - milter-greylist use a new database path on FreeBSD -# - FreeBSD's interface name came from the NIC, the lo0 interface is almost everytime present -# - file/directory handling outside ${PREFIX} with ports is silly. We don't want to rewrite -# monitorix.pl therefore we use ${PREFIX} instead /var/db/! - @${REINPLACE_CMD} -e 's|our \$$OSTYPE = \"Linux-RHFC\"|our \$$OSTYPE = \"FreeBSD\"|' \ - -e "s|/usr/local/www/apache22/data|${WWWROOT}|" \ - -e "s|/var/lib/milter-greylist/db/greylist.db|/var/milter-greylist/greylist.db|" \ - -e "s|eth0|lo0|g" -e "s|/var/db/monitorix/|${INSTDIR}/|" \ - -e "s|%%INSTDIR%%|${INSTDIR}|g" ${WRKSRC}/monitorix.conf -.for d in ${REPORT_LANG} - @${REINPLACE_CMD} -e "s|^rm|${RM}|g" -e "s|/bin/sed|${SED}|g" \ - -e "s|/usr/bin/metasend|${PREFIX}/bin/metasend|g" \ - -e "s|\"tmp|\"/tmp/${PORTNAME}_report|g" ${WRKSRC}/reports/${d}/traffic_report.sh +# Set FreeBSD path for perl in shebang +.for f in monitorix.cgi monitorix.conf monitorix reports/send_reports + @${REINPLACE_CMD} -e "1s|^\(#!\).*|\1${PERL}|" ${WRKSRC}/${f} .endfor +# eth0 doesn't exist in FreeBSD! Also let's set our own paths. + @${REINPLACE_CMD} \ + -e 's|\($$BASE_DIR = "\)[^"]*|\1${WWWDIR}|' \ + -e 's|\($$BASE_LIB = "\)[^"]*|\1${DATADIR}|' \ + -e 's|\($$BASE_CGI = "\)[^"]*|\1${CGIPATH}|' \ + -e "s|/var/lib/milter-greylist/db/|/var/milter-greylist/|" \ + -e "s|eth0|lo0|g" \ + ${WRKSRC}/monitorix.conf do-install: - @${INSTALL_SCRIPT} ${WRKSRC}/monitorix.pl ${PREFIX}/sbin/ + @${INSTALL_SCRIPT} ${WRKSRC}/monitorix ${PREFIX}/sbin/ @${MKDIR} ${WWWDIR}/imgs @${CHOWN} ${WWW_OWNER}:${WWW_GROUP} ${WWWDIR}/imgs @for f in ${WWW_FILES}; do \ @@ -95,19 +96,18 @@ do-install: @${MKDIR} ${CGIDIR} @${INSTALL_SCRIPT} ${WRKSRC}/monitorix.cgi ${CGIDIR}/ .for m in ${MAN5} - @${INSTALL_MAN} ${WRKSRC}/man/man5/$m ${PREFIX}/man/man5/ + @${INSTALL_MAN} ${WRKSRC}/man/man5/$m ${MAN5PREFIX}/man/man5/ .endfor .if defined(WITH_REPORTS) + @${MKDIR} ${WWWDIR}/reports . for l in ${REPORT_LANG} - @${MKDIR} ${PREFIX}/${PORTNAME}/reports/${l}/imgs_email -. for f in ${REPORT_FILES} - @${INSTALL_DATA} ${WRKSRC}/reports/${l}/${f} ${PREFIX}/${PORTNAME}/reports/${l}/${f} -. endfor + @${INSTALL_DATA} ${WRKSRC}/reports/${l}.html \ + ${WWWDIR}/reports/ . endfor .endif .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} - @for doc in ${DOCS}; do \ + @for doc in ${PORTDOCS}; do \ ${INSTALL_DATA} ${WRKSRC}/$${doc} ${DOCSDIR}; \ done .endif @@ -115,9 +115,9 @@ do-install: post-install: @${INSTALL_DATA} ${WRKSRC}/monitorix.conf ${PREFIX}/etc/monitorix.conf.sample @if [ ! -f ${PREFIX}/etc/monitorix.conf ]; then \ - ${CP} -p ${PREFIX}/etc/monitorix.conf.sample ${PREFIX}/etc/monitorix.conf ; \ + ${CP} -p ${PREFIX}/etc/monitorix.conf.sample \ + ${PREFIX}/etc/monitorix.conf ; \ fi - @${MKDIR} ${DATADIR}/usage @${CAT} ${PKGMESSAGE} .include <bsd.port.mk> diff --git a/sysutils/monitorix/distinfo b/sysutils/monitorix/distinfo index 8f9a3d9ed863..3ae58a3c11c9 100644 --- a/sysutils/monitorix/distinfo +++ b/sysutils/monitorix/distinfo @@ -1,2 +1,2 @@ -SHA256 (monitorix-1.5.1.tar.gz) = e3bb853209e6fc56a883b34ab3a0395d3db0a8c512d87b40b6420620b102252b -SIZE (monitorix-1.5.1.tar.gz) = 141695 +SHA256 (monitorix-2.1.0.tar.gz) = 647b36ac80f15a805eecb68fc507334ebcbb0cb1fe7efd381eed6a7cf3bc0210 +SIZE (monitorix-2.1.0.tar.gz) = 85689 diff --git a/sysutils/monitorix/files/monitorix.in b/sysutils/monitorix/files/monitorix.in index 7548ad93fe26..b7fbfdb2b8e8 100644 --- a/sysutils/monitorix/files/monitorix.in +++ b/sysutils/monitorix/files/monitorix.in @@ -1,11 +1,6 @@ #!/bin/sh # -# @(#) Fibranet NSP, SL -# Copyright (C) 2005-2010 by Jordi Sanfeliu <jordi@fibranet.cat> -# -# /usr/local/etc/rc.d/monitorix -# -# Starts Monitorix on FreeBSD systems +# $FreeBSD$ # # PROVIDE: monitorix # REQUIRE: DAEMON @@ -18,20 +13,24 @@ monitorix_enable=${monitorix_enable:-"NO"} name="monitorix" rcvar=`set_rcvar` -command_interpreter=%%PERL%% -start_cmd=monitorix_start -stop_cmd=monitorix_stop -monitorix_start() -{ # Creates RRDs files (if needed) - %%PREFIX%%/sbin/monitorix.pl create - %%PREFIX%%/sbin/monitorix.pl init -} +load_rc_config $name -monitorix_stop() +start_cmd="${name}_start" + +pidfile="/var/run/${name}.pid" +command_interpreter="." +procname="/usr/local/sbin/${name}" + +monitorix_start() { - %%PREFIX%%/sbin/monitorix.pl stop + if [ -z "$rc_fast" -a -n "$rc_pid" ]; then + echo 1>&2 "${name} already running? (pid=$rc_pid)." + return 1 + fi + echo "Starting ${name}." + rc_flags="-c %%PREFIX%%/etc/${name}.conf -p ${pidfile} ${rc_flags}" + %%PERL%% %%PREFIX%%/sbin/${name} ${rc_flags} ${command_args} } -load_rc_config $name run_rc_command "$1" diff --git a/sysutils/monitorix/files/patch-monitorix b/sysutils/monitorix/files/patch-monitorix new file mode 100644 index 000000000000..05eea4ad435c --- /dev/null +++ b/sysutils/monitorix/files/patch-monitorix @@ -0,0 +1,96 @@ +--- monitorix.orig 2011-03-09 16:59:52.000000000 +0000 ++++ monitorix 2011-03-27 15:57:13.322625798 +0100 +@@ -47,7 +47,7 @@ + use constant RELDATE => "09-Mar-2011"; + + my $pid; +-my ($opt_config, $opt_debug, $opt_version); ++my ($opt_config, $opt_pidfile, $opt_debug, $opt_version); + my @graphs; + my $root_disk; + my $root_disk_p; +@@ -138,7 +138,7 @@ + + sub usage { + print(STDERR << "EOF"); +-usage: monitorix -c|--config <config_file> [-d|--debug] [-v|--version] ++usage: monitorix -c|--config <config_file> [-p|--pidfile <pidfile>] [-d|--debug] [-v|--version] + + EOF + exit(1); +@@ -1609,10 +1609,8 @@ + alarm $TIMEOUT; + open(IN, "df -P / |"); + while(<IN>) { +- if(/dev/ && /\//) { +- ($root_disk) = split(' ', $_); +- last; +- } ++ next if /Filesystem/; ++ @tmp = split; + } + close(IN); + alarm 0; +@@ -1693,7 +1691,7 @@ + } + } elsif($os eq "FreeBSD") { + $root_disk =~ s/.*\///; # removes /dev/ +- $root_disk =~ s/...$//; # removes part number ++ $root_disk =~ s/[sp][0-9][a-z]?$//; # removes part number + } + our $fs_hist = 0; + +@@ -1710,10 +1708,8 @@ + alarm $TIMEOUT; + open(IN, "df -P / |"); + while(<IN>) { +- if(/dev/ && /\//) { +- @tmp = split(' ', $_); +- last; +- } ++ next if /Filesystem/; ++ @tmp = split; + } + close(IN); + alarm 0; +@@ -3661,6 +3657,7 @@ + # ---------------------------------------------------------------------------- + GetOptions( + "config=s" => \$opt_config, ++ "pidfile=s" => \$opt_pidfile, + "debug" => \$opt_debug, + "version" => \$opt_version, + ); +@@ -3681,7 +3678,7 @@ + } + + # check configuration file syntax +-if(system("perl -wc $opt_config >/dev/null 2>&1")) { ++if(!system("perl -wc $opt_config >/dev/null 2>&1")) { + print("FATAL: configuration file '$opt_config' had compilation errors.\n"); + exit(1); + } +@@ -3698,14 +3695,22 @@ + exit(1); + } + +-$0 = sprintf("%s %s%s%s", ++$0 = sprintf("%s %s%s%s%s", + $^V lt 5.6.2 ? monitorix : abs_path($0), + $opt_config ? "-c $opt_config" : "", ++ $opt_pidfile ? "-p $opt_pidfile" : "", + $opt_debug ? " -d" : "", + $opt_version ? " -v" : ""); + daemonize(); + logger("Starting Monitorix version " . VERSION . " (pid $pid)."); + ++if($opt_pidfile = abs_path($opt_pidfile)) { ++ open(PIDFILE, ">", $opt_pidfile) ++ || die("could not open $opt_pidfile for writing."); ++ print(PIDFILE "$pid"); ++ close(PIDFILE); ++} ++ + if($opt_debug) { + logger("Entering in debug mode."); + logger("Changed process name to '$0'."); diff --git a/sysutils/monitorix/files/patch-monitorix.pl b/sysutils/monitorix/files/patch-monitorix.pl deleted file mode 100644 index 043203c7e468..000000000000 --- a/sysutils/monitorix/files/patch-monitorix.pl +++ /dev/null @@ -1,65 +0,0 @@ ---- ./monitorix.pl.orig 2010-06-21 10:54:38.000000000 +0200 -+++ ./monitorix.pl 2010-08-15 20:20:34.000000000 +0200 -@@ -733,20 +733,25 @@ - if($ENABLE_CROND_MAIL ne "Y") { - $mailto = "MAILTO=\"\""; - } -- open(OCRON, "> $O_CRON"); -- print OCRON <<EOF; --# @(#) Fibranet NSP, SL --# Copyright (C) 2005-2010 by Jordi Sanfeliu <jordi\@fibranet.cat> --# --PATH=/sbin:/bin:/usr/sbin:/usr/bin --$mailto -+# FreeBSD: -+# The crontab replacment was removed for the port, -+# we can not risc the damage of existing crontabs! -+ print <<EOF; -+ =========================================================================== -+ To prevent replacement of the root crontab this -+ function is disabled in the FreeBSD port! - --* * * * * $crontabuser $PATH_BIN{$OSTYPE} update --00 00 * * * $crontabuser $PATH_BIN{$OSTYPE} collect --01 00 1 * * $crontabuser $PATH_BIN{$OSTYPE} report -+ Please place the following entries in the root crontab -+ or /etc/crontab manually! -+ -+ $mailto -+ * * * * * $PATH_BIN{$OSTYPE} update -+ 00 00 * * * $PATH_BIN{$OSTYPE} collect -+ 01 00 1 * * $PATH_BIN{$OSTYPE} report -+ -+ =========================================================================== - - EOF -- close(OCRON); - - if($THEME_COLOR eq "black") { - $bgcolor = "#000000"; -@@ -1053,7 +1058,24 @@ - unlink($PATH_CRON{$OSTYPE}); - unlink($PATH_CRON{$OSTYPE} . ".sh"); # old name - } elsif($OSTYPE eq "FreeBSD") { -- system("echo 'y' | crontab -u root -r"); -+# FreeBSD: -+# The crontab replacment was removed for the port, -+# we can not risc the damage of existing crontabs! -+ print <<EOF; -+ -+ ======================================================================== -+ To prevent deletion of the root crontab this function has been disabled! -+ -+ Please remove the following entries from the root crontab or from -+ /etc/crontab manually! -+ -+ * * * * * $PATH_BIN{$OSTYPE} update -+ 00 00 * * * $PATH_BIN{$OSTYPE} collect -+ 01 00 1 * * $PATH_BIN{$OSTYPE} report -+ -+ ======================================================================== -+ -+EOF - } - } - diff --git a/sysutils/monitorix/files/pkg-message.in b/sysutils/monitorix/files/pkg-message.in index 48423cc29068..cc33d3e672d9 100644 --- a/sysutils/monitorix/files/pkg-message.in +++ b/sysutils/monitorix/files/pkg-message.in @@ -3,14 +3,4 @@ The port has a generic default config, please adjust your settings in file: %%PREFIX%%/etc/monitorix.conf - To initialize monitorix follow this steps - %%PREFIX%%/sbin/monitorix.pl create - - Then place the following entries into root crontab: - --------------------------------------------------- - PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin - * * * * * %%PREFIX%%/sbin/monitorix.pl update - 00 00 * * * %%PREFIX%%/sbin/monitorix.pl collect - 01 00 1 * * %%PREFIX%%/sbin/monitorix.pl report - ================================================================ diff --git a/sysutils/monitorix/pkg-plist b/sysutils/monitorix/pkg-plist index 01e44d8d6e61..a3153d1b7367 100644 --- a/sysutils/monitorix/pkg-plist +++ b/sysutils/monitorix/pkg-plist @@ -1,56 +1,16 @@ -@exec mkdir -p /var/db/monitorix/usage @exec mkdir -p %D/%%WWWDIR%%/imgs @exec chown %%WWW_OWNER%%:%%WWW_GROUP%% %D/%%WWWDIR%%/imgs @unexec if cmp -s %D/etc/monitorix.conf %D/etc/monitorix.conf.sample; then rm -f %D/etc/monitorix.conf; fi etc/monitorix.conf.sample @exec if [ ! -f %D/etc/monitorix.conf ]; then cp %B/%f %D/etc/monitorix.conf; fi -sbin/monitorix.pl +sbin/monitorix %%CGIDIR%%/monitorix.cgi @dirrmtry %%CGIDIR%% -%%PORTDOCS%%%%DOCSDIR%%/COPYING -%%PORTDOCS%%%%DOCSDIR%%/Changes -%%PORTDOCS%%%%DOCSDIR%%/README -%%PORTDOCS%%%%DOCSDIR%%/README.FreeBSD -%%PORTDOCS%%%%DOCSDIR%%/README.nginx -%%PORTDOCS%%%%DOCSDIR%%/TODO -%%PORTDOCS%%%%DOCSDIR%%/monitorix-alert.sh -%%PORTDOCS%%%%DOCSDIR%%/monitorix-apache.conf -%%PORTDOCS%%@dirrm %%DOCSDIR%% -%%REPORTS%%monitorix/reports/ca/imgs_email/blank.png -%%REPORTS%%monitorix/reports/ca/imgs_email/logo.jpg -%%REPORTS%%monitorix/reports/ca/imgs_email/signature.png -%%REPORTS%%monitorix/reports/ca/imgs_email/title.jpg -%%REPORTS%%monitorix/reports/ca/traffic_report.html -%%REPORTS%%monitorix/reports/ca/traffic_report.sh -%%REPORTS%%monitorix/reports/de/imgs_email/blank.png -%%REPORTS%%monitorix/reports/de/imgs_email/logo.jpg -%%REPORTS%%monitorix/reports/de/imgs_email/signature.png -%%REPORTS%%monitorix/reports/de/imgs_email/title.jpg -%%REPORTS%%monitorix/reports/de/traffic_report.html -%%REPORTS%%monitorix/reports/de/traffic_report.sh -%%REPORTS%%monitorix/reports/en/imgs_email/blank.png -%%REPORTS%%monitorix/reports/en/imgs_email/logo.jpg -%%REPORTS%%monitorix/reports/en/imgs_email/signature.png -%%REPORTS%%monitorix/reports/en/imgs_email/title.jpg -%%REPORTS%%monitorix/reports/en/traffic_report.html -%%REPORTS%%monitorix/reports/en/traffic_report.sh -%%REPORTS%%monitorix/reports/it/imgs_email/blank.png -%%REPORTS%%monitorix/reports/it/imgs_email/logo.jpg -%%REPORTS%%monitorix/reports/it/imgs_email/signature.png -%%REPORTS%%monitorix/reports/it/imgs_email/title.jpg -%%REPORTS%%monitorix/reports/it/traffic_report.html -%%REPORTS%%monitorix/reports/it/traffic_report.sh -%%REPORTS%%@dirrm monitorix/reports/it/imgs_email -%%REPORTS%%@dirrm monitorix/reports/it -%%REPORTS%%@dirrm monitorix/reports/en/imgs_email -%%REPORTS%%@dirrm monitorix/reports/en -%%REPORTS%%@dirrm monitorix/reports/de/imgs_email -%%REPORTS%%@dirrm monitorix/reports/de -%%REPORTS%%@dirrm monitorix/reports/ca/imgs_email -%%REPORTS%%@dirrm monitorix/reports/ca -%%REPORTS%%@dirrm monitorix/reports -@dirrmtry monitorix/usage -@dirrmtry monitorix +%%REPORTS%%%%WWWDIR%%/reports/ca.html +%%REPORTS%%%%WWWDIR%%/reports/de.html +%%REPORTS%%%%WWWDIR%%/reports/en.html +%%REPORTS%%%%WWWDIR%%/reports/it.html +%%REPORTS%%@dirrm %%WWWDIR%%/reports %%WWWDIR%%/logo_bot.png %%WWWDIR%%/logo_top.png %%WWWDIR%%/monitorixico.png |