1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00

Bring back from the dead; take ownership

Distfile is hosted in my public_distfiles
This commit is contained in:
Mark Felder 2014-04-01 21:14:39 +00:00
parent dccc538a20
commit ad2b8c72fa
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=349891
8 changed files with 185 additions and 0 deletions

View File

@ -13,6 +13,7 @@
SUBDIR += aide
SUBDIR += aimsniff
SUBDIR += amap
SUBDIR += amavis-stats
SUBDIR += amavisd-milter
SUBDIR += amavisd-new
SUBDIR += aolserver-nsencrypt

View File

@ -0,0 +1,53 @@
# Created by: Mantas Kaulakys <stone@tainet.lt>
# $FreeBSD$
PORTNAME= amavis-stats
PORTVERSION= 0.1.12
PORTREVISION= 3
CATEGORIES= security
MASTER_SITES= LOCAL
MASTER_SITE_SUBDIR= feld
MAINTAINER= feld@FreeBSD.org
COMMENT= Simple AMaViS statistics generator based on rrdtool
RUN_DEPENDS= rrdtool>=0:${PORTSDIR}/databases/rrdtool
USES= perl5
USE_PERL5= run
USE_PHP= pcre
NO_BUILD= yes
PORTDOCS= README
AMAVISUSER?= amavis
AMAVISGROUP?= amavis
USERS= ${AMAVISUSER}
GROUPS= ${AMAVISGROUP}
PLIST_SUB+= WWWOWN=${WWWOWN} WWWGRP=${WWWGRP} USERS=${USERS} GROUPS=${GROUPS}
PKGMESSAGE= ${WRKDIR}/pkg-message
SUB_FILES= pkg-message
.include <bsd.port.options.mk>
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/amavis-stats ${STAGEDIR}${PREFIX}/sbin
${INSTALL_DATA} ${WRKSRC}/amavis-stats.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
${MKDIR} ${STAGEDIR}${PREFIX}/www/amavis-stats
${MKDIR} ${STAGEDIR}${PREFIX}/www/amavis-stats/img
${TOUCH} ${STAGEDIR}${PREFIX}/www/amavis-stats/img/.keep
${INSTALL_DATA} ${WRKSRC}/amavis-stats.php ${STAGEDIR}${PREFIX}/www/amavis-stats
cd ${STAGEDIR}${PREFIX}/www/amavis-stats && ${LN} -s amavis-stats.php index.php
.if ${PORT_OPTIONS:MDOCS}
${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/${PORTDOCS} ${STAGEDIR}${DOCSDIR}
.endif
post-install:
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (amavis-stats-0.1.12.tar.gz) = 0c802f43a0107cd094c422c9771133bef6d4a2b36e5676ed7d02f2e91787be1b
SIZE (amavis-stats-0.1.12.tar.gz) = 60626

View File

@ -0,0 +1,86 @@
--- amavis-stats.orig Sat Mar 27 23:25:27 2004
+++ amavis-stats Mon Jul 10 22:55:19 2006
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#!/usr/bin/perl -w
#
# amavis-stats -- generate rrds from amavis log output
#
@@ -28,6 +28,7 @@
# ########################################################################
use strict;
use warnings;
+use diagnostics;
use Getopt::Std;
use Time::localtime;
use Time::Local;
@@ -83,8 +84,8 @@
$version = "0.1.12"; # this value is auto-updated by packing system
$pkg = "amavis-stats";
$locale = "C";
-$lockfile = "/var/lock/$pkg";
-$statedir = "/var/lib/$pkg";
+$lockfile = "/var/tmp/$pkg";
+$statedir = "/usr/local/www/$pkg";
$statefile = "$statedir/$pkg.state"; # last read position of the logfile
$namesfile = "$statedir/$pkg.names"; # stores the virus name to id mappings
$countfile = "$statedir/$pkg.count"; # per virus totals
@@ -212,7 +213,7 @@
sub semlock {
open (LOCKF, ">$lockfile") or do_exit(1, "Could not open $lockfile: $!");
unless (flock(LOCKF, LOCK_EX | LOCK_NB)) {
- err("warning: Could not lock $lockfile: $!");
+ print_err("warning: Could not lock $lockfile: $!");
sleep 2;
unless (flock(LOCKF, LOCK_EX | LOCK_NB)) {
do_exit(1, "Could not lock $lockfile: $!");
@@ -680,8 +681,8 @@
if (defined($rotlogfile)) {
parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]);
} else {
- err("Could not open rotated logfile.");
- err(" Tried extentions .0, .1, .01, -$today, -$yesterday");
+ print_err("Could not open rotated logfile.");
+ print_err(" Tried extentions .0, .1, .01, -$today, -$yesterday");
do_exit(1);
}
}
@@ -707,7 +708,7 @@
my $err = RRDs::error;
if ($err) {
- err("createRRD: $err");
+ print_err("createRRD: $err");
return -1;
}
@@ -736,7 +737,7 @@
$last = RRDs::last($rrdfile);
$err = RRDs::error;
if ($err) {
- err("updateRRD: $err");
+ print_err("updateRRD: $err");
return -1;
}
@@ -750,8 +751,8 @@
$err = RRDs::error;
if ($err) {
- err("updateRRD: $err");
- err("Attempted to update $rrdfile at $epoch count $count");
+ print_err("updateRRD: $err");
+ print_err("Attempted to update $rrdfile at $epoch count $count");
return -1;
}
}
@@ -769,7 +770,8 @@
print "$me: @_\n" if ($verbose);
}
-sub err {
+sub print_err
+{
print STDERR "$me: error: @_\n";
}

View File

@ -0,0 +1,11 @@
--- amavis-stats.php.orig Sat Mar 27 17:25:27 2004
+++ amavis-stats.php Sun Jun 6 01:21:35 2004
@@ -286,7 +286,7 @@
function asLoadStats () {
global $as_libdir, $virus, $pid, $psid, $iid, $bid,$nid,$nsid, $lastupdate, $maxi;
- $as_libdir = "/var/lib/amavis-stats";
+ $as_libdir = "/usr/local/www/amavis-stats";
$as_statefile = $as_libdir . "/amavis-stats.state";
$as_namefile = $as_libdir . "/amavis-stats.names";
$as_seenfile = $as_libdir . "/amavis-stats.seen";

View File

@ -0,0 +1,16 @@
-----
To view the statistics via you browser you must:
create a symlink, like:
cd /usr/local/www/data ; ln -s ../amavis-stats amavis-stats
or modify your Apache httpd.conf including this line:
Alias /amavis-stats %%PREFIX%%/www/amavis-stats
You can view then the statistics in http://your-site/amavis-stats
To update the statistics every 5 minutes, you also
can setup cronjob for amavis-stats by putting this line to /etc/crontab
*/5 * * * * amavis %%PREFIX%%/sbin/amavis-stats /var/log/maillog 2>&1 > /dev/null
-----

View File

@ -0,0 +1,7 @@
amavis-stats is a simple AMaViS statistics generator based on rrdtool.
It produces graphs of clean emails, spam emails and infected emails
broken down by virus, from amavis log entries. RRD files are created
and updated by a perl script run from cron. Graphs are generated by
a php script and viewed with a web browser.
WWW: http://rekudos.net/amavis-stats/

View File

@ -0,0 +1,9 @@
man/man1/amavis-stats.1.gz
sbin/amavis-stats
www/amavis-stats/index.php
www/amavis-stats/amavis-stats.php
www/amavis-stats/img/.keep
@dirrm www/amavis-stats/img
@dirrm www/amavis-stats
@exec /usr/sbin/chown -R %%USERS%%:%%GROUPS%% %D/www/amavis-stats
@exec /usr/sbin/chown %%WWWOWN%%:%%WWWGRP%% %D/www/amavis-stats/img