aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mailgraph
diff options
context:
space:
mode:
authorvs <vs@FreeBSD.org>2004-05-12 19:59:07 +0800
committervs <vs@FreeBSD.org>2004-05-12 19:59:07 +0800
commitfd60b1ca64153f5a856081a115b6f82cc5d09b0c (patch)
tree45d214895e6b73bca3ed4251bc2b6928674cb6de /mail/mailgraph
parentb4311da3ccfbedcf501741a372786e5f30e6cece (diff)
downloadfreebsd-ports-gnome-fd60b1ca64153f5a856081a115b6f82cc5d09b0c.tar.gz
freebsd-ports-gnome-fd60b1ca64153f5a856081a115b6f82cc5d09b0c.tar.zst
freebsd-ports-gnome-fd60b1ca64153f5a856081a115b6f82cc5d09b0c.zip
- Modify mail/mailgraph to use rc.subr
- Change rrd database from to /var/db/mailgraph. PR: ports/66562 Submitted by: Rong-En Fan (maintainer)
Diffstat (limited to 'mail/mailgraph')
-rw-r--r--mail/mailgraph/Makefile27
-rw-r--r--mail/mailgraph/files/mailgraph.sh17
-rw-r--r--mail/mailgraph/files/mailgraph.sh.tmpl38
-rw-r--r--mail/mailgraph/files/patch-mailgraph.cgi13
-rw-r--r--mail/mailgraph/pkg-deinstall9
-rw-r--r--mail/mailgraph/pkg-install9
-rw-r--r--mail/mailgraph/pkg-message6
-rw-r--r--mail/mailgraph/pkg-plist4
8 files changed, 78 insertions, 45 deletions
diff --git a/mail/mailgraph/Makefile b/mail/mailgraph/Makefile
index cffa3eb278eb..17f2415414a4 100644
--- a/mail/mailgraph/Makefile
+++ b/mail/mailgraph/Makefile
@@ -7,6 +7,7 @@
PORTNAME= mailgraph
PORTVERSION= 1.8
+PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= http://people.ee.ethz.ch/~dws/software/mailgraph/pub/ \
http://people.ee.ethz.ch/~dws/software/mailgraph/pub/old/
@@ -19,19 +20,29 @@ RUN_DEPENDS= ${SITE_PERL}/RRDp.pm:${PORTSDIR}/net/rrdtool \
NO_BUILD= yes
-STARTUP_SCRIPT= mailgraph.sh.sample
+DATADIR= /var/db/mailgraph
+
+USE_REINPLACE= yes
+USE_RC_SUBR= yes
+RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} DATADIR=${DATADIR}
+STARTUP_FILE= ${PREFIX}/etc/rc.d/mailgraph.sh
+
+MSG_FILE= ${PKGDIR}/pkg-message
+PKGMESSAGE= ${WRKSRC}/pkg-message
post-patch:
- @${SED} -e "s,%%PREFIX%%,${PREFIX}," ${FILESDIR}/mailgraph.sh > ${WRKSRC}/${STARTUP_SCRIPT}
+ @${REINPLACE_CMD} -e "s,%%DATADIR%%,${DATADIR}," ${WRKSRC}/mailgraph.cgi
+ @${SED} 's|%%DATADIR%%|${DATADIR}|g' ${MSG_FILE} > ${PKGMESSAGE}
do-install:
${MKDIR} ${PREFIX}/www/cgi-bin
-.for FILE in mailgraph.cgi mailgraph.pl
- @${INSTALL_SCRIPT} ${WRKSRC}/${FILE} ${PREFIX}/www/cgi-bin/
-.endfor
- @${INSTALL_SCRIPT} ${WRKSRC}/${STARTUP_SCRIPT} ${PREFIX}/etc/rc.d/
- @${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL}
- @${CHOWN} www:www ${PREFIX}/www/cgi-bin/
+ ${MKDIR} ${DATADIR}
+ @${CHOWN} www:www ${DATADIR}
+ @${INSTALL_SCRIPT} ${WRKSRC}/mailgraph.pl ${PREFIX}/sbin
+ @${INSTALL_SCRIPT} ${WRKSRC}/mailgraph.cgi ${PREFIX}/www/cgi-bin
+ @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${FILESDIR}/mailgraph.sh.tmpl > ${STARTUP_FILE}
+ @${CHMOD} 755 ${STARTUP_FILE}
post-install:
@${ECHO}
diff --git a/mail/mailgraph/files/mailgraph.sh b/mail/mailgraph/files/mailgraph.sh
deleted file mode 100644
index bfa9bc3e35ac..000000000000
--- a/mail/mailgraph/files/mailgraph.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-PREFIX=%%PREFIX%%
-
-case "$1" in
-start)
- /usr/bin/su www -c "cd ${PREFIX}/www/cgi-bin; ./mailgraph.pl -l /var/log/maillog" & > /dev/null 2>&1 && echo -n ' mailgraph'
- ;;
-stop)
- ps -U www | grep mailgraph | awk '{print $1}' | xargs kill && echo -n ' mailgraph'
- ;;
-*)
- echo "Usage: `basename $0` {start|stop}" >&2
- ;;
-esac
-
-exit 0
diff --git a/mail/mailgraph/files/mailgraph.sh.tmpl b/mail/mailgraph/files/mailgraph.sh.tmpl
new file mode 100644
index 000000000000..1d54483209ef
--- /dev/null
+++ b/mail/mailgraph/files/mailgraph.sh.tmpl
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: mailgraph
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD
+#
+# Add the following line to /etc/rc.conf to enable mailgraph:
+#
+# mailgraph_enable="YES"
+#
+
+. %%RC_SUBR%%
+
+name=mailgraph
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/mailgraph.pl > /dev/null 2>&1
+command_interpreter=perl
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+ rm -f $pidfile
+}
+
+mailgraph_enable=${mailgraph_enable:-"NO"}
+mailgraph_pidfile=${mailgraph_pidfile:-"%%DATADIR%%/mailgraph.pid"}
+mailgraph_flags=${mailgraph_flags:-"--logfile /var/log/maillog --daemon-rrd=%%DATADIR%% --ignore-localhost --daemon --daemon-pid=${mailgraph_pidfile}"}
+mailgraph_user=${mailgraph_user:-"www"}
+mailgraph_chdir=${mailgraph_chdir:-"%%DATADIR%%"}
+
+load_rc_config $name
+
+pidfile=${mailgraph_pidfile}
+
+run_rc_command "$1"
diff --git a/mail/mailgraph/files/patch-mailgraph.cgi b/mail/mailgraph/files/patch-mailgraph.cgi
new file mode 100644
index 000000000000..15bd606d673e
--- /dev/null
+++ b/mail/mailgraph/files/patch-mailgraph.cgi
@@ -0,0 +1,13 @@
+--- mailgraph.cgi.orig Sat Feb 7 21:48:52 2004
++++ mailgraph.cgi Mon Apr 12 02:45:53 2004
+@@ -15,8 +15,8 @@
+ my $points_per_sample = 3;
+ my $ypoints = 150;
+ my $ypoints_err = 80;
+-my $rrd = 'mailgraph.rrd'; # path to where the RRD database is
+-my $rrd_virus = 'mailgraph_virus.rrd'; # path to where the Virus RRD database is
++my $rrd = '%%DATADIR%%/mailgraph.rrd'; # path to where the RRD database is
++my $rrd_virus = '%%DATADIR%%/mailgraph_virus.rrd'; # path to where the Virus RRD database is
+ my $tmp_dir = '/tmp/mailgraph'; # temporary directory where to store the images
+
+ my @graphs = (
diff --git a/mail/mailgraph/pkg-deinstall b/mail/mailgraph/pkg-deinstall
deleted file mode 100644
index a864c53ea469..000000000000
--- a/mail/mailgraph/pkg-deinstall
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-PW="/usr/sbin/pw"
-
-${PW} usermod www -d /nonexistent -s /sbin/nologin
-
diff --git a/mail/mailgraph/pkg-install b/mail/mailgraph/pkg-install
deleted file mode 100644
index a1a7b78e5a2c..000000000000
--- a/mail/mailgraph/pkg-install
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-PW="/usr/sbin/pw"
-
-${PW} usermod www -d ${PREFIX}/www -s /bin/sh
-
diff --git a/mail/mailgraph/pkg-message b/mail/mailgraph/pkg-message
index 28192286c134..a1db11731f14 100644
--- a/mail/mailgraph/pkg-message
+++ b/mail/mailgraph/pkg-message
@@ -1,2 +1,8 @@
Make sure this script should be invoked with privilege to read
/var/log/maillog.
+
+
+*** WARNING ***
+
+The rrd database has been moved to %%DATADIR%%.
+If you have previous ones, please move them to %%DATADIR%%.
diff --git a/mail/mailgraph/pkg-plist b/mail/mailgraph/pkg-plist
index ab50ca82667a..8cfd82887507 100644
--- a/mail/mailgraph/pkg-plist
+++ b/mail/mailgraph/pkg-plist
@@ -1,5 +1,5 @@
-etc/rc.d/mailgraph.sh.sample
+etc/rc.d/mailgraph.sh
www/cgi-bin/mailgraph.cgi
-www/cgi-bin/mailgraph.pl
+sbin/mailgraph.pl
@unexec rmdir %D/www/cgi-bin 2>/dev/null || true
@unexec rmdir %D/www 2>/dev/null || true