Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Mar 2004 02:22:47 +0100
From:      Cyrille Lefevre <cyrille.lefevre@laposte.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        Pierre Etchemaite <petchema@concept-micro.com>
Subject:   ports/63824: Maintainer update: french/plgrenouille (0.70.6)
Message-ID:  <20040306012246.GA31600@gits.dyndns.org>
Resent-Message-ID: <200403060130.i261UGSZ038948@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
	Note: There was a bad value `no=20' for the field `>Confidential:'.
	It was set to the default value of `yes'.


>Number:         63824
>Category:       ports
>Synopsis:       Maintainer update: french/plgrenouille (0.70.6)
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 05 17:30:16 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Cyrille Lefevre
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
ACME
>Environment:
System: FreeBSD gits 5.2-CURRENT FreeBSD 5.2-CURRENT #1: Sat Jan 31 15:17:0=
5 CET 2004 root@gits:/disk3/freebsd/current/obj/disk3/freebsd/current/src/s=
ys/CUSTOM i386
>Description:
	Makefile
		PORTVERSION bumped
		LIB_DEPENDS added
		RUN_DEPENDS enhanced
		USE_RC_SUBR added
		*_SUB and *_DIR added
		patch-script, patch-rc and patch-pkgmessage rewritten
		patch-lib added (don't know why, but use Grenouille::System
		qw(swap_privileges); don't work ! since I'm not perl aware...)
		install-script updated
		install-lib added
	distinfo
		updated
	pkg-plist
		updated and rewritten
	files/patch-plgrenouille.pl
		updated
	patch-Grenouille::Preferences.pm
	patch-Grenouille::Vars.pm
		new files

>How-To-Repeat:
	n/a
>Fix:
	take care, this patch is in two parts, the first one is
	a diff against /dev/null and the second one a cvs diff.

--- /dev/null	Sat Mar  6 02:15:31 2004
+++ files/patch-Grenouille::Preferences.pm	Thu Mar  4 04:05:14 2004
@@ -0,0 +1,18 @@
+--- Grenouille/Preferences.pm.orig	Mon Mar 17 15:26:46 2003
++++ Grenouille/Preferences.pm	Thu Mar  4 03:55:34 2004
+@@ -15,6 +15,7 @@
+ %preferences =3D ();
+=20
+ sub load_preferences() {
++    swap_privileges();
+     eval {
+ 	if (open(CONFIG, "<$MYRC")) {
+ 	    while (<CONFIG>) {
+@@ -25,6 +26,7 @@
+ 	    close(CONFIG);
+ 	}
+     };
++    swap_privileges();
+     die if $@;
+ }
+=20
--- /dev/null	Sat Mar  6 02:15:31 2004
+++ files/patch-Grenouille::Vars.pm	Thu Mar  4 15:55:09 2004
@@ -0,0 +1,49 @@
+--- Grenouille/Vars.pm.orig	Wed Dec  5 23:42:30 2001
++++ Grenouille/Vars.pm	Thu Mar  4 03:59:13 2004
+@@ -8,6 +8,7 @@
+ use vars qw(@ISA @EXPORT_OK
+             $MYRC $DATAPATH $DOWNLOADFILE $UPLOADFILE $QUEUEFILE=20
+             $LASTCONFIGFILE $LASTVERSIONFILE $PIDFILE $LOGFILE
++            $BEFOREFILE $AFTERFILE
+             $ASAP $SEC $MIN $HOUR $DAY @MONTHS
+             $USER
+             %VERSION %DEBUG
+@@ -15,6 +16,7 @@
+ @ISA=3Dqw(Exporter);
+ @EXPORT_OK=3Dqw($MYRC $DATAPATH $DOWNLOADFILE $UPLOADFILE $QUEUEFILE
+               $LASTCONFIGFILE $LASTVERSIONFILE $PIDFILE $LOGFILE=20
++              $BEFOREFILE $AFTERFILE
+               $ASAP $SEC $MIN $HOUR $DAY @MONTHS
+               $USER
+               %VERSION %DEBUG
+@@ -30,15 +32,17 @@
+              'system' =3D> ($^O eq 'win32' ? 'windows' : $^O) );
+=20
+ # Paths
+-$MYRC ||=3D '/etc/grenouillerc';
+-$DATAPATH ||=3D '/var/spool/plgrenouille';
++$MYRC ||=3D '%%PREFIX%%/etc/grenouillerc';
++$BEFOREFILE ||=3D '%%PREFIX%%/etc/plgrenouille-before';
++$AFTERFILE ||=3D '%%PREFIX%%/etc/plgrenouille-after';
++$DATAPATH ||=3D '%%SPOOL_DIR%%';
+ $DOWNLOADFILE ||=3D "$DATAPATH/downloadfile";
+ $UPLOADFILE ||=3D "$DATAPATH/uploadfile";
+ $QUEUEFILE ||=3D "$DATAPATH/queued_results.txt";
+ $LASTCONFIGFILE ||=3D "$DATAPATH/last_configuration.txt";
+ $LASTVERSIONFILE ||=3D "$DATAPATH/last_known_version.txt";
+-$PIDFILE ||=3D "/var/run/plgrenouille.pid";
+-$LOGFILE ||=3D "/var/log/plgrenouille.log";
++$PIDFILE ||=3D "%%RUN_DIR%%/plgrenouille.pid";
++$LOGFILE ||=3D "%%LOG_DIR%%/plgrenouille.log";
+=20
+ # Time constants
+ $ASAP ||=3D 0;
+@@ -48,7 +52,7 @@
+ $DAY ||=3D 24 * $HOUR;
+ @MONTHS =3D qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
+=20
+-$USER ||=3D 'daemon';
++$USER ||=3D '%%SPOOL_USER%%';
+=20
+ # Debugging
+ # what features do we want to debug ?
Index: Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/ports/french/plgrenouille/Makefile,v
retrieving revision 1.7
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.7 Makefile
--- Makefile	12 Dec 2003 12:21:55 -0000	1.7
+++ Makefile	4 Mar 2004 14:18:54 -0000
@@ -6,7 +6,7 @@
 #
=20
 PORTNAME=3D	plgrenouille
-PORTVERSION=3D	0.61.7
+PORTVERSION=3D	0.70.6
 CATEGORIES=3D	french net
 MASTER_SITES=3D	ftp://blade.concept-micro.com/debian/
 DISTNAME=3D	${PORTNAME}_${PORTVERSION:R}-${PORTVERSION:E}
@@ -14,7 +14,10 @@
 MAINTAINER=3D	cyrille.lefevre@laposte.net
 COMMENT=3D	Un client pour determiner votre bande passante a un raccordemen=
t large bande
=20
-RUN_DEPENDS=3D	${SITE_PERL}/Net/FTP.pm:${PORTSDIR}/net/p5-Net
+LIB_DEPENDS=3D	netsnmp.6:${PORTSDIR}/net/net-snmp
+RUN_DEPENDS=3D	${SITE_PERL}/Net/FTP.pm:${PORTSDIR}/net/p5-Net \
+		${SITE_PERL}/Net/SNMP.pm:${PORTSDIR}/net/p5-Net-SNMP \
+		${SITE_PERL}/${PERL_ARCH}/Time/HiRes.pm:${PORTSDIR}/devel/p5-Time-HiRes
=20
 .if !defined(BATCH)
 IS_INTERACTIVE=3D	yes
@@ -23,41 +26,68 @@
 NO_BUILD=3D	yes
 USE_PERL5=3D	yes
 USE_REINPLACE=3D	yes
+USE_RC_SUBR=3D	yes
 SCRIPTS_ENV=3D	PKG_PREFIX=3D${PREFIX}
 WRKSRC=3D		${WRKDIR}/${PORTNAME}-${PORTVERSION:R}
 MSG_FILE=3D	${PKGDIR}/pkg-message
 PKGMESSAGE=3D	${WRKDIR}/pkg-message
 PKGDEINSTALL=3D	${PKGINSTALL}
+PLIST_SUB=3D	LBIN_DIR=3D"${LBIN_DIR:S,^${PREFIX}/,,}" \
+		CONF_DIR=3D"${CONF_DIR:S,^${PREFIX}/,,}" \
+		RC_DIR=3D"${RC_DIR:S,^${PREFIX}/,,}"
+REINPLACE_SUB=3D	PREFIX=3D${PREFIX} PERL=3D${PERL} \
+		LBIN_DIR=3D${LBIN_DIR} CONF_DIR=3D${CONF_DIR} \
+		RUN_DIR=3D${RUN_DIR} LOG_DIR=3D${LOG_DIR} \
+		SPOOL_DIR=3D${SPOOL_DIR} SPOOL_USER=3D${SPOOL_USER}
+RCSCRIPTS_SUB=3D	${REINPLACE_SUB} RC_SUBR=3D${RC_SUBR}
+PKGMESSAGE_SUB=3D	PREFIX=3D${PREFIX}
=20
 MAN1=3D		plgrenouille.1
 DOC_FILES=3D	FAQ README
+LBIN_DIR=3D	${PREFIX}/libexec
+MAN_DIR=3D	${MAN1PREFIX}/man/man1
+CONF_DIR=3D	${PREFIX}/etc
+RC_DIR=3D		${PREFIX}/etc/rc.d
 RUN_DIR=3D	/var/run
 LOG_DIR=3D	/var/log
 SPOOL_DIR=3D	/var/spool/${PORTNAME}
 SPOOL_USER=3D	daemon
=20
-post-patch: patch-script patch-pkgmessage
+post-patch: patch-script patch-lib patch-rc patch-pkgmessage
=20
 patch-script:
-	@${REINPLACE_CMD} -e 's|%%PERL%%|${PERL}|;s|%%PREFIX%%|${PREFIX}|' \
-		-e 's|%%RUN_DIR%%|${RUN_DIR}|;s|%%SPOOL_DIR%%|${SPOOL_DIR}|' \
-		-e 's|%%LOG_DIR%%|${LOG_DIR}|;s|%%SPOOL_USER%%|${SPOOL_USER}|' \
-		${WRKSRC}/plgrenouille.pl
+	@${REINPLACE_CMD} ${REINPLACE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=3D/%%!/} \
+		${WRKSRC}/plgrenouille.pl ${WRKSRC}/Grenouille/Vars.pm
+
+patch-lib:
+	@${REINPLACE_CMD} 's!swap_privileges!Grenouille::System::&!g' \
+		${WRKSRC}/Grenouille/Log.pm ${WRKSRC}/Grenouille/Preferences.pm
+
+patch-rc:
+	@${SED} ${RCSCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=3D/%%!/} \
+		${FILESDIR}/plgrenouille.sh > ${WRKDIR}/plgrenouille.sh
=20
 patch-pkgmessage:
-	@${SED} 's|%%PREFIX%%|${PREFIX}|g' ${MSG_FILE} > ${PKGMESSAGE}
+	@${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=3D/%%!/} \
+		${MSG_FILE} > ${PKGMESSAGE}
=20
-do-install: install-script install-man install-data install-doc install-rc
+do-install: install-script install-lib install-man \
+		install-data install-doc install-rc
=20
 install-script:
 	@${INSTALL_SCRIPT} ${WRKSRC}/plgrenouille.pl \
-		${PREFIX}/libexec/plgrenouille
+		${LBIN_DIR}/plgrenouille
+
+install-lib:
+	@${MKDIR} ${SITE_PERL}/Grenouille
+	@${INSTALL_SCRIPT} ${WRKSRC}/Grenouille/*.pm \
+		${SITE_PERL}/Grenouille
=20
 install-man:
-	@${INSTALL_MAN} ${WRKSRC}/plgrenouille.1 ${MAN1PREFIX}/man/man1
+	@${INSTALL_MAN} ${WRKSRC}/plgrenouille.1 ${MAN_DIR}
=20
 install-data:
-	@${INSTALL_DATA} ${WRKSRC}/grenouillerc.sample ${PREFIX}/etc
+	@${INSTALL_DATA} ${WRKSRC}/grenouillerc.sample ${CONF_DIR}
=20
 install-doc:
 .if !defined(NOPORTDOCS)
@@ -68,7 +98,7 @@
 .endif
=20
 install-rc:
-	@${INSTALL_SCRIPT} ${FILESDIR}/plgrenouille.sh ${PREFIX}/etc/rc.d
+	@${INSTALL_SCRIPT} ${WRKDIR}/plgrenouille.sh ${RC_DIR}
=20
 post-install: display-message configure-package
=20
Index: distinfo
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/ports/french/plgrenouille/distinfo,v
retrieving revision 1.3
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.3 distinfo
--- distinfo	12 Jun 2003 11:57:32 -0000	1.3
+++ distinfo	4 Mar 2004 02:24:58 -0000
@@ -1 +1,2 @@
-MD5 (plgrenouille_0.61-7.tar.gz) =3D 6dbeb8c7c9de4724f4fd4b809913f08b
+MD5 (plgrenouille_0.70-6.tar.gz) =3D a49fbe1187c8436ff788186b31c321c9
+SIZE (plgrenouille_0.70-6.tar.gz) =3D 38409
Index: pkg-plist
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/ports/french/plgrenouille/pkg-plist,v
retrieving revision 1.1
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.1 pkg-plist
--- pkg-plist	13 Nov 2002 17:30:05 -0000	1.1
+++ pkg-plist	4 Mar 2004 02:44:13 -0000
@@ -1,9 +1,20 @@
-@comment $FreeBSD$
-@unexec if cmp -s %D/etc/grenouillerc %D/etc/grenouillerc.sample; then rm =
-f %D/etc/grenouillerc; fi
-etc/grenouillerc.sample
+@comment $FreeBSD: ports/french/plgrenouille/pkg-plist,v 1.1 2002/11/13 17=
:30:05 naddy Exp $
+@unexec if cmp -s %D/%%CONF_DIR%%/grenouillerc %D/%%CONF_DIR%%/grenouiller=
c.sample; then rm -f %D/%%CONF_DIR%%/grenouillerc; fi
+%%CONF_DIR%%/grenouillerc.sample
 @comment no @exec: see pkg-install/+INSTALL for details.
-etc/rc.d/plgrenouille.sh
-libexec/plgrenouille
-%%PORTDOCS%%share/doc/plgrenouille/FAQ
-%%PORTDOCS%%share/doc/plgrenouille/README
-%%PORTDOCS%%@dirrm share/doc/plgrenouille
+%%RC_DIR%%/plgrenouille.sh
+%%LBIN_DIR%%/plgrenouille
+%%SITE_PERL%%/Grenouille/Comm.pm
+%%SITE_PERL%%/Grenouille/Config.pm
+%%SITE_PERL%%/Grenouille/Log.pm
+%%SITE_PERL%%/Grenouille/Numbers.pm
+%%SITE_PERL%%/Grenouille/Preferences.pm
+%%SITE_PERL%%/Grenouille/Queue.pm
+%%SITE_PERL%%/Grenouille/Scheduler.pm
+%%SITE_PERL%%/Grenouille/System.pm
+%%SITE_PERL%%/Grenouille/Vars.pm
+%%SITE_PERL%%/Grenouille/Version.pm
+%%PORTDOCS%%%%DOCSDIR%%/FAQ
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+@dirrm %%SITE_PERL%%/Grenouille
Index: files/patch-plgrenouille.pl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/ports/french/plgrenouille/files/patch-plgrenouille.pl,v
retrieving revision 1.2
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.2 patch-plgrenouille.pl
--- files/patch-plgrenouille.pl	12 Jun 2003 11:57:32 -0000	1.2
+++ files/patch-plgrenouille.pl	4 Mar 2004 20:43:55 -0000
@@ -1,164 +1,53 @@
---- plgrenouille.pl.orig	Mon Mar 17 15:52:56 2003
-+++ plgrenouille.pl	Wed Apr 30 22:56:55 2003
+--- plgrenouille.pl.orig	Fri Oct  3 16:00:23 2003
++++ plgrenouille.pl	Thu Mar  4 15:58:57 2004
 @@ -1,4 +1,4 @@
 -#!/usr/bin/perl -Tw
 +#!%%PERL%% -Tw
- # plgrenouille 0.61
+ # plgrenouille 0.70       -- don't forget to update Grenouille::Vars
  # version 0.4 by momtchev, <momtchev@fil.univ-lille1.fr>
  # modified by Pierre Etchemaite, <petchema@concept-micro.com>
-@@ -18,7 +18,7 @@
- use Net::Ping qw();
- use Net::FTP qw();
+@@ -19,6 +19,7 @@
+ use Grenouille::Vars qw(%VERSION %DEBUG
+                         $MYRC $DATAPATH $DOWNLOADFILE $UPLOADFILE $QUEUEF=
ILE
+                         $LASTCONFIGFILE $LASTVERSIONFILE $PIDFILE
++			$BEFOREFILE $AFTERFILE
+                         $ASAP $SEC $MIN $DAY
+                         %vars);
+ use Grenouille::Numbers qw(digits jitter);
+@@ -35,7 +36,7 @@
+ use Grenouille::System qw(init_privileges swap_privileges
+                           autodetect_interface get_traffic_counters);
 =20
 -$ENV{'PATH'} =3D '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin=
:/bin';
 +$ENV{'PATH'} =3D '%%PREFIX%%/sbin:%%PREFIX%%/bin:/usr/sbin:/usr/bin:/sbin=
:/bin';
 =20
- my(%VERSION) =3D ( 'client' =3D> 'plgrenouille',
- 		 'version' =3D> 0.61,
-@@ -28,17 +28,20 @@
- 		               # where anyone can fork his own version
- 		 'system' =3D> $^O );
-=20
--my $MYRC ||=3D '/etc/grenouillerc';
--my $DATAPATH ||=3D '/var/spool/plgrenouille';
-+my $PREFIX ||=3D '%%PREFIX%%';
-+my $MYRC ||=3D "$PREFIX/etc/grenouillerc";
-+my $DATAPATH ||=3D '%%SPOOL_DIR%%';
- my $DOWNLOADFILE ||=3D "$DATAPATH/downloadfile";
- my $UPLOADFILE ||=3D "$DATAPATH/uploadfile";
- my $QUEUEFILE ||=3D "$DATAPATH/queued_results.txt";
- my $LASTCONFIGFILE ||=3D "$DATAPATH/last_configuration.txt";
- my $LASTVERSIONFILE ||=3D "$DATAPATH/last_known_version.txt";
--my $PIDFILE ||=3D "/var/run/plgrenouille.pid";
--my $LOGFILE ||=3D "/var/log/plgrenouille.log";
-+my $PIDFILE ||=3D "%%RUN_DIR%%/plgrenouille.pid";
-+my $LOGFILE ||=3D "%%LOG_DIR%%/plgrenouille.log";
-+my $NETSTAT ||=3D '/usr/bin/netstat';
-+my $IFCONFIG ||=3D '/sbin/ifconfig';
-=20
--my $USER ||=3D 'daemon';
-+my $USER ||=3D '%%SPOOL_USER%%';
-=20
- # what features do we want to debug ?
- my(%DEBUG) =3D ( 'protocol' =3D> 0, 'scheduler' =3D> 0 );
-@@ -61,6 +64,7 @@
-=20
- sub usage($) {
-     my($exitcode) =3D @_;
-+    display_version();
-     print <<"EOUSAGE";
- Usage: $VERSION{'client'} [-c|--configure] [-b|--background] [-h|-?|--hel=
p]
-               [[-l |--log=3D]priorit=E9] [[-v |--verbose=3D]priorit=E9]
-@@ -109,7 +113,7 @@
-=20
- # for milliseconds; otherwise would use built-in time.
-=20
--my $SYS_gettimeofday ||=3D 78;
-+my $SYS_gettimeofday ||=3D 116;
-=20
- sub microtime() {
-     my ($timeval, $timezone, $sec, $usec);
-@@ -205,36 +209,21 @@
-   die "Priorit=E9 $level inconnue" unless $DISPLAY_LEVEL;
- }
-=20
--# parse /proc/net/dev (Linux)
-+# parse netstat -ib (FreeBSD)
- sub get_traffic_counters($) {
-     my ($if_device) =3D @_;
-    =20
--    # Sometimes fails with EOVERFLOW ("Value too large for defined data t=
ype")
--    # on my box, maybe some LFS bug in /proc ? (kernel 2.4.5)
--    open(PROC_NET_DEV, '</proc/net/dev') or=20
--	die "Can't read /proc/net/dev: $!";
--    while (<PROC_NET_DEV>) {
--	if (/^\s*$if_device:\s*(.*)$/) {
-+    open(NETSTAT_PIPE, '-|') or exec($NETSTAT, '-ib') or die "netstat: $!=
";
-+    while (<NETSTAT_PIPE>) {
-+	if (/^($if_device.*<Link.*)/) {
- 	    my(@counters) =3D split(/\s+/, $1);
--	    close(PROC_NET_DEV);
--	    if(scalar @counters =3D=3D 16) {
--		# linux >2.1.90
--		return { 'rx' =3D> $counters[0],
--			 'tx' =3D> $counters[8] };
--	    }
--	    if(scalar @counters =3D=3D 14) {
--		# linux 2.1.0..2.1.90
--		return { 'rx' =3D> $counters[0],
--			 'tx' =3D> $counters[6] };
--	    }
--	    if(scalar @counters =3D=3D 11) {
--		die 'D=E9sol=E9, les noyaux ant=E9rieurs =E0 2.1.0 ne sont pas support=
=E9s';
--	    }
--	    die 'Format de /proc/net/dev non reconnu, envoyer un exemple au main=
teneur SVP';
-+	    close(NETSTAT_PIPE);
-+	    return { 'rx' =3D> $counters[6],
-+		     'tx' =3D> $counters[9] };
- 	}
-     }
-    =20
--    close(PROC_NET_DEV);
-+    close(NETSTAT_PIPE);
-     die "Pas d'interface $if_device ?";
- }
-=20
-@@ -350,6 +339,7 @@
- }
-=20
- sub load_preferences() {
-+    swap_privileges();
-     eval {
- 	if (open(CONFIG, "<$MYRC")) {
- 	    while (<CONFIG>) {
-@@ -360,6 +350,7 @@
- 	    close(CONFIG);
- 	}
-     };
-+    swap_privileges();
-     die if $@;
- }
-=20
-@@ -442,7 +433,7 @@
- sub get_preferences() {
-     load_preferences();
-    =20
--    die "plgrenouille n'a pas =E9t=E9 totalement param=E9tr=E9, lancez pl=
grenouille --config ou modifiez /etc/grenouillerc"=20
-+    die "plgrenouille n'a pas =E9t=E9 totalement param=E9tr=E9, lancez pl=
grenouille --config ou modifiez $MYRC"
- 	if not defined $preferences{'user'} or=20
- 	   not defined $preferences{'pass'} or
- 	   not defined $preferences{'email'} or=20
-@@ -456,20 +447,20 @@
- # plgrenouille uses the default route interface
- sub autodetect_interface() {
-     $vars{'ip'} =3D '';
--    open(ROUTE, '-|') or exec('/bin/netstat', '-r') or die "netstat: $!";
--    while (<ROUTE>) {
--	if (/^default.*((?:eth|ppp|sl)[0-9]+)$/) {
-+    open(ROUTE_PIPE, '-|') or exec($NETSTAT, '-r') or die "netstat: $!";
-+    while (<ROUTE_PIPE>) {
-+      if (/^default.* ([^ ]+[0-9]+)$/) {
- 	    $preferences{'interface'} =3D $1;
--	}
-+      }
+ # ---------------------------------------------------------------
+=20
+@@ -243,9 +244,9 @@
+ sub before_test() {
+ # stop or pause processes that could interfere with bandwidth measurement=
s,
+ # etc.
+-    if(-x '/etc/plgrenouille-before') {
++    if(-x '$BEFOREFILE') {
+ 	eval {
+-	    system '/etc/plgrenouille-before';
++	    system '$BEFOREFILE';
+ 	};
+ 	display_and_log('ERROR', "plgrenouille-before: $@") if $@;
      }
--    close(ROUTE);
--    open(IFCONFIG, '-|') or exec('/sbin/ifconfig', $preferences{'interfac=
e'}) or die "ifconfig: $!";
--    while(<IFCONFIG>) {
--	if (/inet add?r:([.0-9]+)/) {
-+    close(ROUTE_PIPE);
-+    open(IFCONFIG_PIPE, '-|') or exec($IFCONFIG, $preferences{'interface'=
}) or die "ifconfig: $!";
-+    while(<IFCONFIG_PIPE>) {
-+	if (/inet ([.0-9]+)/) {
- 	    $vars{'ip'} =3D $1;
- 	}
+@@ -253,9 +254,9 @@
+=20
+ sub after_test() {
+ # revert anything done by before_test()
+-    if(-x '/etc/plgrenouille-after') {
++    if(-x '$AFTERFILE') {
+ 	eval {
+-	    system '/etc/plgrenouille-after';
++	    system '$AFTERFILE';
+ 	};
+ 	display_and_log('ERROR', "plgrenouille-after: $@") if $@;
      }
--    close IFCONFIG;
-+    close(IFCONFIG_PIPE);
-    =20
-     display_and_log('NOTICE', "$preferences{'interface'} sera utilis=E9 p=
our les mesures") if $preferences{'interface'};
- }
-@@ -1182,8 +1173,6 @@
+@@ -620,8 +621,6 @@
 =20
  # --------------------------- MAIN ----------------------------
 =20
@@ -167,7 +56,7 @@
  Getopt::Long::Configure('bundling'); # 'no_ignore_case'
  eval {
    GetOptions(\%params,
-@@ -1191,6 +1180,7 @@
+@@ -629,6 +628,7 @@
               'verbose|v=3Ds', \&set_verbose_level,
               'configure|setup|c',
               'background|b',
@@ -175,7 +64,7 @@
               'help|h|?');
  };
  if ($@) {
-@@ -1199,6 +1189,10 @@
+@@ -637,6 +637,10 @@
  }
  usage(1) if scalar @ARGV;
  usage(0) if $params{'help'};
Index: files/plgrenouille.sh
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/ports/french/plgrenouille/files/plgrenouille.sh,v
retrieving revision 1.1
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.1 plgrenouille.sh
--- files/plgrenouille.sh	13 Nov 2002 17:30:05 -0000	1.1
+++ files/plgrenouille.sh	4 Mar 2004 02:20:22 -0000
@@ -1,59 +1,31 @@
 #! /bin/sh
 #
-# $FreeBSD$
+# $FreeBSD: ports/french/plgrenouille/files/plgrenouille.sh,v 1.1 2002/11/=
13 17:30:05 naddy Exp $
 #
-# Start or stop portsentry.
+# PROVIDE: plgrenouille
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD
+#
+# Add the following line to /etc/rc.conf to enable upclient:
+#
+# plgrenouille_enable=3D"YES"
 #
=20
-rc_file=3D${0##*/}
-rc_arg=3D$1
-
-if ! PREFIX=3D$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
-	echo "${rc_file}: Cannot determine PREFIX." >&2
-	echo "Please use the complete pathname." >&2
-	exit 64
-fi
+plgrenouille_enable=3DNO
+plgrenouille_flags=3D-b
=20
-program_args=3D-b
-program_dir=3D${PREFIX}/libexec
-program_file=3D${rc_file%.sh}
-program_path=3D${program_dir}/${program_file}
+. %%RC_SUBR%%
=20
-pid_dir=3D/var/run
-pid_file=3D${program_file}.pid
-pid_path=3D${pid_dir}/${pid_file}
+name=3Dplgrenouille
+rcvar=3D$(set_rcvar)
=20
-syslog_facility=3Ddaemon.err
+command=3D%%LBIN_DIR%%/${name}
+command_interpreter=3D%%PERL%%
+pidfile=3D%%RUN_DIR%%/${name}.pid
+logfile=3D%%LOG_DIR%%/${name}.log
+required_files=3D%%CONF_DIR%%/grenouillerc
+extra_commands=3Dconfigure
+configure_cmd=3D"${command} -c"
=20
-case "$rc_arg" in
-start)
-	if [ ! -x ${program_path} ]; then
-		logger -sp ${syslog_facility} -t ${program_file} \
-			"unable to start: ${program_path} is missing."
-		exit 72
-	fi
-	${program_path} ${program_args} > /dev/null &&
-	echo -n " ${program_file}"
-	;;
-stop)
-	if [ -r ${pid_path} ]; then
-		kill $(cat ${pid_path}) 2> /dev/null
-	else
-		killall ${program_file} 2> /dev/null
-	fi
-	;;
-restart)
-	$0 stop
-	$0 start
-	;;
-status)
-	ps auxww | egrep ${program_file} | egrep -v "($0|egrep)"
-	;;
-configure)
-	${program_path} -c
-	;;
-*)
-	echo "usage: ${rc_file} {start|stop|restart|status}" >&2
-	exit 64
-	;;
-esac
+load_rc_config ${name}
+run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:



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