Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 May 2004 18:30:09 +0800 (CST)
From:      Rong-En Fan <rafan@infor.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/66562: Update Port: mail/mailgraph by maintainer 
Message-ID:  <20040512103009.E96A552ED0@muse.csie.ntu.edu.tw>
Resent-Message-ID: <200405121040.i4CAeCPF008457@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         66562
>Category:       ports
>Synopsis:       Update Port: mail/mailgraph by maintainer
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 12 03:40:12 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Rong-En Fan
>Release:        FreeBSD 4.9-RELEASE-p4 i386
>Organization:
NTU CSIE 
>Environment:
System: FreeBSD muse.csie.ntu.edu.tw 4.9-RELEASE-p4 FreeBSD 4.9-RELEASE-p4 #4: Mon Mar 22 00:36:52 CST 2004 root@muse.csie.ntu.edu.tw:/home/admin/usr/obj/home/admin/usr/src/sys/MUSE i386


	
>Description:
	Modify mail/mailgraph to use rc.subr and
	change rrd database from ${PREFIX}/www/cgi-bin to
	/var/db/mailgraph.

	Since there is a www account in default installation,
	pkg-install/pkg-desinall is no long needed.

	Thanks Jun Kuriyama <kuriyama _at_ imgsrc _dot_ co _dot_ jp> and
	vanilla@ for patches.

	
>How-To-Repeat:
	
>Fix:

diff -ruN mailgraph.orig/Makefile mailgraph/Makefile
--- mailgraph.orig/Makefile	Wed May 12 09:55:35 2004
+++ mailgraph/Makefile	Wed May 12 16:49:29 2004
@@ -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,23 +20,30 @@
 
 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
+
 
 post-patch:
-	@${SED} -e "s,%%PREFIX%%,${PREFIX}," ${FILESDIR}/mailgraph.sh > ${WRKSRC}/${STARTUP_SCRIPT}
+	@${REINPLACE_CMD} -e "s,%%DATADIR%%,${DATADIR}," ${WRKSRC}/mailgraph.cgi
 
 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}
-	@${CAT} ${PKGMESSAGE}
+	@${CAT} ${PKGMESSAGE} | ${SED} -e "s,%%DATADIR%%,${DATADIR}," ${PKGMESSAGE}
 	@${ECHO}
 
 .include <bsd.port.mk>
diff -ruN mailgraph.orig/files/mailgraph.sh mailgraph/files/mailgraph.sh
--- mailgraph.orig/files/mailgraph.sh	Wed May 12 09:55:35 2004
+++ mailgraph/files/mailgraph.sh	Thu Jan  1 08:00:00 1970
@@ -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 -ruN mailgraph.orig/files/mailgraph.sh.tmpl mailgraph/files/mailgraph.sh.tmpl
--- mailgraph.orig/files/mailgraph.sh.tmpl	Thu Jan  1 08:00:00 1970
+++ mailgraph/files/mailgraph.sh.tmpl	Wed May 12 18:15:01 2004
@@ -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 -ruN mailgraph.orig/files/patch-mailgraph.cgi mailgraph/files/patch-mailgraph.cgi
--- mailgraph.orig/files/patch-mailgraph.cgi	Thu Jan  1 08:00:00 1970
+++ mailgraph/files/patch-mailgraph.cgi	Wed May 12 14:05:02 2004
@@ -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 -ruN mailgraph.orig/pkg-deinstall mailgraph/pkg-deinstall
--- mailgraph.orig/pkg-deinstall	Wed May 12 09:55:35 2004
+++ mailgraph/pkg-deinstall	Thu Jan  1 08:00:00 1970
@@ -1,9 +0,0 @@
-#!/bin/sh
-#
-#	$FreeBSD: ports/mail/mailgraph/pkg-deinstall,v 1.1 2002/07/11 07:11:58 ijliao Exp $
-#
-
-PW="/usr/sbin/pw"
-
-${PW} usermod www -d /nonexistent -s /sbin/nologin
-
diff -ruN mailgraph.orig/pkg-install mailgraph/pkg-install
--- mailgraph.orig/pkg-install	Wed May 12 09:55:35 2004
+++ mailgraph/pkg-install	Thu Jan  1 08:00:00 1970
@@ -1,9 +0,0 @@
-#!/bin/sh
-#
-#	$FreeBSD: ports/mail/mailgraph/pkg-install,v 1.1 2002/07/11 07:11:58 ijliao Exp $
-#
-
-PW="/usr/sbin/pw"
-
-${PW} usermod www -d ${PREFIX}/www -s /bin/sh
-
diff -ruN mailgraph.orig/pkg-message mailgraph/pkg-message
--- mailgraph.orig/pkg-message	Wed May 12 09:55:35 2004
+++ mailgraph/pkg-message	Wed May 12 14:50:17 2004
@@ -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 -ruN mailgraph.orig/pkg-plist mailgraph/pkg-plist
--- mailgraph.orig/pkg-plist	Wed May 12 09:55:35 2004
+++ mailgraph/pkg-plist	Wed May 12 11:50:04 2004
@@ -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
	


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040512103009.E96A552ED0>