Date: Mon, 29 Jul 2002 22:48:50 +0200 (CEST) From: Cyrille Lefevre <cyrille.lefevre@laposte.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/41133: New port: french/plgrenouille (0.61.3) Message-ID: <200207292048.g6TKmo55030392@gits.gits.dyndns.org>
next in thread | raw e-mail | index | archive | help
>Number: 41133 >Category: ports >Synopsis: New port: french/plgrenouille (0.61.3) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Mon Jul 29 13:50:04 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Cyrille Lefevre >Release: FreeBSD 4.6-STABLE i386 >Organization: ACME >Environment: System: FreeBSD gits 4.6-STABLE FreeBSD 4.6-STABLE #21: Sun Jul 28 09:42:24 CEST 2002 root@gits:/disk2/freebsd/stable/src/sys/compile/CUSTOM i386 >Description: A client for WAN measurement. see http://www.grenouille.com for details. >How-To-Repeat: n/a >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # french/plgrenouille # french/plgrenouille/Makefile # french/plgrenouille/distinfo # french/plgrenouille/pkg-comment # french/plgrenouille/pkg-descr # french/plgrenouille/pkg-plist # french/plgrenouille/files # french/plgrenouille/files/plgrenouille.sh # french/plgrenouille/files/patch-plgrenouille.pl # french/plgrenouille/pkg-message # french/plgrenouille/pkg-install # echo c - french/plgrenouille mkdir -p french/plgrenouille > /dev/null 2>&1 echo x - french/plgrenouille/Makefile sed 's/^X//' >french/plgrenouille/Makefile << 'END-of-french/plgrenouille/Makefile' X# New ports collection makefile for: plgrenouille_0 X# Date created: 02 July 2002 X# Whom: cyrille.lefevre@laposte.net X# X# $FreeBSD$ X# X XPORTNAME= plgrenouille XPORTVERSION= 0.61.3 XCATEGORIES= french net XMASTER_SITES= ftp://blade.concept-micro.com/ XDISTNAME= ${PORTNAME}_${PORTVERSION:R}-${PORTVERSION:E} X XMAINTAINER= cyrille.lefevre@laposte.net X XRUN_DEPENDS= ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Net/FTP.pm:${PORTSDIR}/net/p5-Net X X.if !defined(BATCH) XIS_INTERACTIVE= yes X.endif X XNO_BUILD= yes XUSE_PERL5= yes XUSE_REINPLACE= yes XSCRIPTS_ENV+= PKG_PREFIX=${PREFIX} XPLIST_SUB= SPOOL_DIR=${SPOOL_DIR} \ X SPOOL_MODES=${SPOOL_MODES} \ X SPOOL_USER=${SPOOL_USER} XWRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:R} XMSG_FILE= ${PKGDIR}/pkg-message XPKGMESSAGE= ${WRKDIR}/pkg-message X XMAN1= plgrenouille.1 XDOC_FILES= FAQ README XRUN_DIR= /var/run XLOG_DIR= /var/log XSPOOL_DIR= /var/spool/${PORTNAME} XSPOOL_MODES= u+rw,go-rw XSPOOL_USER= daemon X Xpost-patch: patch-script patch-message X Xpatch-script: X @${REINPLACE_CMD} -e 's|%%PERL%%|${PERL}|;s|%%PREFIX%%|${PREFIX}|' \ X -e 's|%%RUN_DIR%%|${RUN_DIR}|;s|%%SPOOL_DIR%%|${SPOOL_DIR}|' \ X -e 's|%%LOG_DIR%%|${LOG_DIR}|;s|%%SPOOL_USER%%|${SPOOL_USER}|' \ X ${WRKSRC}/plgrenouille.pl X Xpatch-message: X @${SED} 's|%%PREFIX%%|${PREFIX}|g' ${MSG_FILE} > ${PKGMESSAGE} X Xdo-install: install-script install-man install-data install-doc \ X install-spool install-rc X Xinstall-script: X @${INSTALL_SCRIPT} ${WRKSRC}/plgrenouille.pl \ X ${PREFIX}/libexec/plgrenouille X Xinstall-man: X @${INSTALL_MAN} ${WRKSRC}/plgrenouille.1 ${MAN1PREFIX}/man/man1 X Xinstall-data: X @${INSTALL_DATA} ${WRKSRC}/grenouillerc.sample ${PREFIX}/etc X# .if !exists(${PREFIX}/etc/grenouillerc) X# @${INSTALL_DATA} ${WRKSRC}/grenouillerc.sample \ X# ${PREFIX}/etc/grenouillerc X# @${CHMOD} ${SPOOL_MODES} ${PREFIX}/etc/grenouillerc X# @${CHOWN} ${SPOOL_USER} ${PREFIX}/etc/grenouillerc X# .endif X Xinstall-doc: X.if !defined(NOPORTSDOC) X @${MKDIR} ${DOCSDIR} X.for file in ${DOC_FILES} X @${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR} X.endfor X.endif X Xinstall-spool: X @${MKDIR} ${SPOOL_DIR} X @${CHMOD} ${SPOOL_MODES} ${SPOOL_DIR} X @${CHOWN} ${SPOOL_USER} ${SPOOL_DIR} X Xinstall-rc: X @${INSTALL_SCRIPT} ${FILESDIR}/plgrenouille.sh ${PREFIX}/etc/rc.d X Xpost-install: display-message configure-package X Xdisplay-message: X @${ECHO_MSG} X @${CAT} ${PKGMESSAGE} X @${ECHO_MSG} X Xconfigure-package: X.if !defined(BATCH) X @${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL X.endif X X.include <bsd.port.mk> END-of-french/plgrenouille/Makefile echo x - french/plgrenouille/distinfo sed 's/^X//' >french/plgrenouille/distinfo << 'END-of-french/plgrenouille/distinfo' XMD5 (plgrenouille_0.61-3.tar.gz) = 748b03ec64c984d0d19acbf4fc2f0dea END-of-french/plgrenouille/distinfo echo x - french/plgrenouille/pkg-comment sed 's/^X//' >french/plgrenouille/pkg-comment << 'END-of-french/plgrenouille/pkg-comment' XUn client pour determiner votre bande passante a un raccordement large bande END-of-french/plgrenouille/pkg-comment echo x - french/plgrenouille/pkg-descr sed 's/^X//' >french/plgrenouille/pkg-descr << 'END-of-french/plgrenouille/pkg-descr' XCe logiciel est cense determiner votre bande passante a un raccordement Xlarge bande et envoie les resultats au site http://www.grenouille.com Xa des fins de statistiques. X XWWW: ftp://blade.concept-micro.com/ END-of-french/plgrenouille/pkg-descr echo x - french/plgrenouille/pkg-plist sed 's/^X//' >french/plgrenouille/pkg-plist << 'END-of-french/plgrenouille/pkg-plist' X@comment $FreeBSD$ X@unexec if cmp -s %D/etc/grenouillerc %D/etc/grenouillerc.sample; then rm -f %D/etc/grenouillerc; fi Xetc/grenouillerc.sample X@comment @exec if [ ! -f %D/etc/grenouillerc ]; then cp %D/etc/grenouillerc.sample %D/etc/grenouillerc; fi Xetc/rc.d/plgrenouille.sh Xlibexec/plgrenouille X%%PORTDOCS%%share/doc/plgrenouille/FAQ X%%PORTDOCS%%share/doc/plgrenouille/README X%%PORTDOCS%%@dirrm share/doc/plgrenouille X@exec if [ ! -d %%SPOOL_DIR%% ]; then mkdir %%SPOOL_DIR%% && chmod %%SPOOL_MODES%% %%SPOOL_DIR%% && chown %%SPOOL_USER%% %%SPOOL_DIR%%; fi X@unexec if [ -d %%SPOOL_DIR%% ]; then rm -rf %%SPOOL_DIR%%; fi END-of-french/plgrenouille/pkg-plist echo c - french/plgrenouille/files mkdir -p french/plgrenouille/files > /dev/null 2>&1 echo x - french/plgrenouille/files/plgrenouille.sh sed 's/^X//' >french/plgrenouille/files/plgrenouille.sh << 'END-of-french/plgrenouille/files/plgrenouille.sh' X#! /bin/sh X# X# $FreeBSD$ X# X# Start or stop portsentry. X# X Xrc_file=${0##*/} Xrc_arg=$1 X Xif ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then X echo "${rc_file}: Cannot determine PREFIX." >&2 X echo "Please use the complete pathname." >&2 X exit 64 Xfi X Xprogram_args=-b Xprogram_dir=${PREFIX}/libexec Xprogram_file=${rc_file%.sh} Xprogram_path=${program_dir}/${program_file} X Xpid_dir=/var/run Xpid_file=${program_file}.pid Xpid_path=${pid_dir}/${pid_file} X Xsyslog_facility=daemon.err X Xcase "$rc_arg" in Xstart) X if [ ! -x ${program_path} ]; then X logger -sp ${syslog_facility} -t ${program_file} \ X "unable to start: ${program_path} is missing." X exit 72 X fi X ${program_path} ${program_args} > /dev/null && X echo -n " ${program_file}" X ;; Xstop) X if [ -r ${pid_path} ]; then X kill $(cat ${pid_path}) 2> /dev/null X else X killall ${program_file} 2> /dev/null X fi X ;; Xrestart) X $0 stop X $0 start X ;; Xstatus) X ps auxww | egrep ${program_file} | egrep -v "($0|egrep)" X ;; Xconfigure) X ${program_path} -c X ;; X*) X echo "usage: ${rc_file} {start|stop|restart|status}" >&2 X exit 64 X ;; Xesac END-of-french/plgrenouille/files/plgrenouille.sh echo x - french/plgrenouille/files/patch-plgrenouille.pl sed 's/^X//' >french/plgrenouille/files/patch-plgrenouille.pl << 'END-of-french/plgrenouille/files/patch-plgrenouille.pl' X--- plgrenouille.pl.orig Mon Jul 29 22:37:34 2002 X+++ plgrenouille.pl Mon Jul 29 22:38:21 2002 X@@ -1,4 +1,4 @@ X-#!/usr/bin/perl -Tw X+#!%%PERL%% -Tw X # plgrenouille 0.61 X # version 0.4 by momtchev, <momtchev@fil.univ-lille1.fr> X # modified by Pierre Etchemaite, <petchema@concept-micro.com> X@@ -18,7 +18,7 @@ X use Net::Ping qw(); X use Net::FTP qw(); X X-$ENV{'PATH'} = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'; X+$ENV{'PATH'} = '%%PREFIX%%/sbin:%%PREFIX%%/bin:/usr/sbin:/usr/bin:/sbin:/bin'; X X my(%VERSION) = ( 'client' => 'plgrenouille', X 'version' => 0.61, X@@ -28,17 +28,19 @@ X # where anyone can fork his own version X 'system' => $^O ); X X-my $MYRC ||= '/etc/grenouillerc'; X-my $DATAPATH ||= '/var/spool/plgrenouille'; X+my $PREFIX ||= '%%PREFIX%%'; X+my $MYRC ||= "$PREFIX/etc/grenouillerc"; X+my $DATAPATH ||= '%%SPOOL_DIR%%'; X my $DOWNLOADFILE ||= "$DATAPATH/downloadfile"; X my $UPLOADFILE ||= "$DATAPATH/uploadfile"; X my $QUEUEFILE ||= "$DATAPATH/queued_results.txt"; X my $LASTCONFIGFILE ||= "$DATAPATH/last_configuration.txt"; X my $LASTVERSIONFILE ||= "$DATAPATH/last_known_version.txt"; X-my $PIDFILE ||= "/var/run/plgrenouille.pid"; X-my $LOGFILE ||= "/var/log/plgrenouille.log"; X+my $PIDFILE ||= "%%RUN_DIR%%/plgrenouille.pid"; X+my $LOGFILE ||= "%%LOG_DIR%%/plgrenouille.log"; X+my $NETSTAT ||= '/usr/bin/netstat'; X X-my $USER ||= 'daemon'; X+my $USER ||= '%%SPOOL_USER%%'; X X # what features do we want to debug ? X my(%DEBUG) = ( 'protocol' => 0, 'scheduler' => 0 ); X@@ -61,6 +63,7 @@ X X sub usage($) { X my($exitcode) = @_; X+ display_version(); X print <<"EOUSAGE"; X Usage: $VERSION{'client'} [-c|--configure] [-b|--background] [-h|-?|--help] X [[-l |--log=]priorité] [[-v |--verbose=]priorité] X@@ -101,7 +104,7 @@ X X # for milliseconds; otherwise would use built-in time. X X-my $SYS_gettimeofday ||= 78; X+my $SYS_gettimeofday ||= 116; X X sub microtime() { X my ($timeval, $timezone, $sec, $usec); X@@ -187,36 +190,21 @@ X die "Priorité $level inconnue" unless $DISPLAY_LEVEL; X } X X-# parse /proc/net/dev (Linux) X+# parse netstat -ib (FreeBSD) X sub get_traffic_counters($) { X my ($if_device) = @_; X X- # Sometimes fails with EOVERFLOW ("Value too large for defined data type") X- # on my box, maybe some LFS bug in /proc ? (kernel 2.4.5) X- open(PROC_NET_DEV, '</proc/net/dev') or X- die "Can't read /proc/net/dev: $!"; X- while (<PROC_NET_DEV>) { X- if (/^\s*$if_device:\s*(.*)$/) { X+ open(NETSTAT_PIPE, '-|') or exec($NETSTAT, '-ib') or die "netstat: $!"; X+ while (<NETSTAT_PIPE>) { X+ if (/^($if_device.*<Link.*)/) { X my(@counters) = split(/\s+/, $1); X- close(PROC_NET_DEV); X- if(scalar @counters == 16) { X- # linux >2.1.90 X- return { 'rx' => $counters[0], X- 'tx' => $counters[8] }; X- } X- if(scalar @counters == 14) { X- # linux 2.1.0..2.1.90 X- return { 'rx' => $counters[0], X- 'tx' => $counters[6] }; X- } X- if(scalar @counters == 11) { X- die 'Désolé, les noyaux antérieurs à 2.1.0 ne sont pas supportés'; X- } X- die 'Format de /proc/net/dev non reconnu, envoyer un exemple au mainteneur SVP'; X+ close(NETSTAT_PIPE); X+ return { 'rx' => $counters[6], X+ 'tx' => $counters[9] }; X } X } X X- close(PROC_NET_DEV); X+ close(NETSTAT_PIPE); X die "Pas d'interface $if_device ?"; X } X X@@ -332,6 +320,7 @@ X } X X sub load_preferences() { X+ swap_privileges(); X eval { X if (open(CONFIG, "<$MYRC")) { X while (<CONFIG>) { X@@ -343,10 +332,12 @@ X } X }; X die if $@; X+ swap_privileges(); X } X X sub store_preferences() { X my($oldumask) = umask 0177; X+ swap_privileges(); X eval { X if(open(CONFIG, ">$MYRC")) { X map { print CONFIG "$_=$preferences{$_}\n"; } sort keys %preferences; X@@ -355,6 +346,7 @@ X display_and_log('WARNING', "Ecriture du fichier $MYRC impossible: vérifier les permissions"); X } X }; X+ swap_privileges(); X umask $oldumask; X die if $@; X } X@@ -420,7 +412,7 @@ X sub get_preferences() { X load_preferences(); X X- die "plgrenouille n'a pas été totalement paramétré, lancez plgrenouille --config ou modifiez /etc/grenouillerc" X+ die "plgrenouille n'a pas été totalement paramétré, lancez plgrenouille --config ou modifiez $MYRC" X if not defined $preferences{'user'} or X not defined $preferences{'pass'} or X not defined $preferences{'email'} or X@@ -433,13 +425,13 @@ X X # plgrenouille uses the default route interface X sub autodetect_interface() { X- open(ROUTE, '-|') or exec('/bin/netstat', '-r') or die "netstat: $!"; X- while (<ROUTE>) { X- if (/^default.*((?:eth|ppp|sl)[0-9]+)$/) { X+ open(ROUTE_PIPE, '-|') or exec($NETSTAT, '-r') or die "netstat: $!"; X+ while (<ROUTE_PIPE>) { X+ if (/^default.* ([^ ]+[0-9]+)$/) { X $preferences{'interface'} = $1; X } X } X- close(ROUTE); X+ close(ROUTE_PIPE); X X display_and_log('NOTICE', "$preferences{'interface'} sera utilisé pour les mesures") if $preferences{'interface'}; X } X@@ -1148,8 +1140,6 @@ X X # --------------------------- MAIN ---------------------------- X X-display_version(); X- X Getopt::Long::Configure('bundling'); # 'no_ignore_case' X eval { X GetOptions(\%params, X@@ -1157,6 +1147,7 @@ X 'verbose|v=s', \&set_verbose_level, X 'configure|setup|c', X 'background|b', X+ 'version|V', X 'help|h|?'); X }; X if ($@) { X@@ -1165,6 +1156,10 @@ X } X usage(1) if scalar @ARGV; X usage(0) if $params{'help'}; X+if($params{'version'}) { X+ display_version(); X+ exit(0); X+} X X open_log(); X init_grenouille(); END-of-french/plgrenouille/files/patch-plgrenouille.pl echo x - french/plgrenouille/pkg-message sed 's/^X//' >french/plgrenouille/pkg-message << 'END-of-french/plgrenouille/pkg-message' X**** Avant d'executer ce client pour la premiere fois, assurez-vous de visiter X le site web du projet Grenouille et de vous y enregistrer. X (WWW: http://www.grenouille.com/ma_grenouille/). X X**** Ensuite, vous devez executer %%PREFIX%%/etc/rc.d/plgrenouille.sh configure X ou recopier le fichier de configuration %%PREFIX%%/etc/grenouillerc.sample X en %%PREFIX%%/etc/grenouillerc afin de l'editer manuellement. X X**** Notez qu'afin de pouvoir envoyer vos informations Grenouille au serveur X Grenouille, votre machine doit avoir un acces plus ou moins continu a X Internet au moyen d'une connection de type cable ou ADSL. END-of-french/plgrenouille/pkg-message echo x - french/plgrenouille/pkg-install sed 's/^X//' >french/plgrenouille/pkg-install << 'END-of-french/plgrenouille/pkg-install' X#!/bin/sh X# X# $FreeBSD$ X# X# Configure plgrenouille. X# X X[ $# != 2 ] && exit 1 X[ -z "${PKG_PREFIX}" ] && exit 1 X[ -n "${BATCH}" ] && exit 0 X Xif [ "$2" = POST-INSTALL ]; then X sh ${PKG_PREFIX}/etc/rc.d/plgrenouille.sh configure Xelse X exit 0 Xfi END-of-french/plgrenouille/pkg-install exit >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207292048.g6TKmo55030392>