Import plgrenouille 0.61.5.
Bandwidth measurement and statics collection tool for a French project to this purpose. PR: 41133 Submitted by: Cyrille Lefevre <cyrille.lefevre@laposte.net>
This commit is contained in:
parent
34bf4de5e3
commit
951e8c596f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=70044
@ -12,6 +12,7 @@
|
||||
SUBDIR += ooodict-fr_FR
|
||||
SUBDIR += openoffice
|
||||
SUBDIR += php_doc
|
||||
SUBDIR += plgrenouille
|
||||
SUBDIR += staroffice52
|
||||
|
||||
.include <bsd.port.subdir.mk>
|
||||
|
81
french/plgrenouille/Makefile
Normal file
81
french/plgrenouille/Makefile
Normal file
@ -0,0 +1,81 @@
|
||||
# New ports collection makefile for: plgrenouille_0
|
||||
# Date created: 02 July 2002
|
||||
# Whom: cyrille.lefevre@laposte.net
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= plgrenouille
|
||||
PORTVERSION= 0.61.5
|
||||
CATEGORIES= french net
|
||||
MASTER_SITES= ftp://blade.concept-micro.com/
|
||||
DISTNAME= ${PORTNAME}_${PORTVERSION:R}-${PORTVERSION:E}
|
||||
|
||||
MAINTAINER= cyrille.lefevre@laposte.net
|
||||
|
||||
RUN_DEPENDS= ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Net/FTP.pm:${PORTSDIR}/net/p5-Net
|
||||
|
||||
.if !defined(BATCH)
|
||||
IS_INTERACTIVE= yes
|
||||
.endif
|
||||
|
||||
NO_BUILD= yes
|
||||
USE_PERL5= yes
|
||||
USE_REINPLACE= yes
|
||||
SCRIPTS_ENV= PKG_PREFIX=${PREFIX}
|
||||
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:R}
|
||||
MSG_FILE= ${PKGDIR}/pkg-message
|
||||
PKGMESSAGE= ${WRKDIR}/pkg-message
|
||||
|
||||
MAN1= plgrenouille.1
|
||||
DOC_FILES= FAQ README
|
||||
RUN_DIR= /var/run
|
||||
LOG_DIR= /var/log
|
||||
SPOOL_DIR= /var/spool/${PORTNAME}
|
||||
SPOOL_USER= daemon
|
||||
|
||||
post-patch: patch-script patch-pkgmessage
|
||||
|
||||
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
|
||||
|
||||
patch-pkgmessage:
|
||||
@${SED} 's|%%PREFIX%%|${PREFIX}|g' ${MSG_FILE} > ${PKGMESSAGE}
|
||||
|
||||
do-install: install-script install-man install-data install-doc install-rc
|
||||
|
||||
install-script:
|
||||
@${INSTALL_SCRIPT} ${WRKSRC}/plgrenouille.pl \
|
||||
${PREFIX}/libexec/plgrenouille
|
||||
|
||||
install-man:
|
||||
@${INSTALL_MAN} ${WRKSRC}/plgrenouille.1 ${MAN1PREFIX}/man/man1
|
||||
|
||||
install-data:
|
||||
@${INSTALL_DATA} ${WRKSRC}/grenouillerc.sample ${PREFIX}/etc
|
||||
|
||||
install-doc:
|
||||
.if !defined(NOPORTSDOC)
|
||||
@${MKDIR} ${DOCSDIR}
|
||||
.for file in ${DOC_FILES}
|
||||
@${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
install-rc:
|
||||
@${INSTALL_SCRIPT} ${FILESDIR}/plgrenouille.sh ${PREFIX}/etc/rc.d
|
||||
|
||||
post-install: display-message configure-package
|
||||
|
||||
display-message:
|
||||
@${ECHO_MSG}
|
||||
@${CAT} ${PKGMESSAGE}
|
||||
@${ECHO_MSG}
|
||||
|
||||
configure-package:
|
||||
@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
|
||||
|
||||
.include <bsd.port.mk>
|
1
french/plgrenouille/distinfo
Normal file
1
french/plgrenouille/distinfo
Normal file
@ -0,0 +1 @@
|
||||
MD5 (plgrenouille_0.61-5.tar.gz) = 68d38cb7bad287af418f019e11deae06
|
201
french/plgrenouille/files/patch-plgrenouille.pl
Normal file
201
french/plgrenouille/files/patch-plgrenouille.pl
Normal file
@ -0,0 +1,201 @@
|
||||
--- plgrenouille.pl.orig Tue Nov 5 19:42:49 2002
|
||||
+++ plgrenouille.pl Wed Nov 13 15:51:51 2002
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/perl -Tw
|
||||
+#!%%PERL%% -Tw
|
||||
# plgrenouille 0.61
|
||||
# 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();
|
||||
|
||||
-$ENV{'PATH'} = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin';
|
||||
+$ENV{'PATH'} = '%%PREFIX%%/sbin:%%PREFIX%%/bin:/usr/sbin:/usr/bin:/sbin:/bin';
|
||||
|
||||
my(%VERSION) = ( 'client' => 'plgrenouille',
|
||||
'version' => 0.61,
|
||||
@@ -28,17 +28,20 @@
|
||||
# where anyone can fork his own version
|
||||
'system' => $^O );
|
||||
|
||||
-my $MYRC ||= '/etc/grenouillerc';
|
||||
-my $DATAPATH ||= '/var/spool/plgrenouille';
|
||||
+my $PREFIX ||= '%%PREFIX%%';
|
||||
+my $MYRC ||= "$PREFIX/etc/grenouillerc";
|
||||
+my $DATAPATH ||= '%%SPOOL_DIR%%';
|
||||
my $DOWNLOADFILE ||= "$DATAPATH/downloadfile";
|
||||
my $UPLOADFILE ||= "$DATAPATH/uploadfile";
|
||||
my $QUEUEFILE ||= "$DATAPATH/queued_results.txt";
|
||||
my $LASTCONFIGFILE ||= "$DATAPATH/last_configuration.txt";
|
||||
my $LASTVERSIONFILE ||= "$DATAPATH/last_known_version.txt";
|
||||
-my $PIDFILE ||= "/var/run/plgrenouille.pid";
|
||||
-my $LOGFILE ||= "/var/log/plgrenouille.log";
|
||||
+my $PIDFILE ||= "%%RUN_DIR%%/plgrenouille.pid";
|
||||
+my $LOGFILE ||= "%%LOG_DIR%%/plgrenouille.log";
|
||||
+my $NETSTAT ||= '/usr/bin/netstat';
|
||||
+my $IFCONFIG ||= '/sbin/ifconfig';
|
||||
|
||||
-my $USER ||= 'daemon';
|
||||
+my $USER ||= '%%SPOOL_USER%%';
|
||||
|
||||
# what features do we want to debug ?
|
||||
my(%DEBUG) = ( 'protocol' => 0, 'scheduler' => 0 );
|
||||
@@ -61,6 +64,7 @@
|
||||
|
||||
sub usage($) {
|
||||
my($exitcode) = @_;
|
||||
+ display_version();
|
||||
print <<"EOUSAGE";
|
||||
Usage: $VERSION{'client'} [-c|--configure] [-b|--background] [-h|-?|--help]
|
||||
[[-l |--log=]priorité] [[-v |--verbose=]priorité]
|
||||
@@ -101,7 +105,7 @@
|
||||
|
||||
# for milliseconds; otherwise would use built-in time.
|
||||
|
||||
-my $SYS_gettimeofday ||= 78;
|
||||
+my $SYS_gettimeofday ||= 116;
|
||||
|
||||
sub microtime() {
|
||||
my ($timeval, $timezone, $sec, $usec);
|
||||
@@ -187,36 +191,21 @@
|
||||
die "Priorité $level inconnue" unless $DISPLAY_LEVEL;
|
||||
}
|
||||
|
||||
-# parse /proc/net/dev (Linux)
|
||||
+# parse netstat -ib (FreeBSD)
|
||||
sub get_traffic_counters($) {
|
||||
my ($if_device) = @_;
|
||||
|
||||
- # Sometimes fails with EOVERFLOW ("Value too large for defined data type")
|
||||
- # on my box, maybe some LFS bug in /proc ? (kernel 2.4.5)
|
||||
- open(PROC_NET_DEV, '</proc/net/dev') or
|
||||
- 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) = split(/\s+/, $1);
|
||||
- close(PROC_NET_DEV);
|
||||
- if(scalar @counters == 16) {
|
||||
- # linux >2.1.90
|
||||
- return { 'rx' => $counters[0],
|
||||
- 'tx' => $counters[8] };
|
||||
- }
|
||||
- if(scalar @counters == 14) {
|
||||
- # linux 2.1.0..2.1.90
|
||||
- return { 'rx' => $counters[0],
|
||||
- 'tx' => $counters[6] };
|
||||
- }
|
||||
- if(scalar @counters == 11) {
|
||||
- die 'Désolé, les noyaux antérieurs à 2.1.0 ne sont pas supportés';
|
||||
- }
|
||||
- die 'Format de /proc/net/dev non reconnu, envoyer un exemple au mainteneur SVP';
|
||||
+ close(NETSTAT_PIPE);
|
||||
+ return { 'rx' => $counters[6],
|
||||
+ 'tx' => $counters[9] };
|
||||
}
|
||||
}
|
||||
|
||||
- close(PROC_NET_DEV);
|
||||
+ close(NETSTAT_PIPE);
|
||||
die "Pas d'interface $if_device ?";
|
||||
}
|
||||
|
||||
@@ -332,6 +321,7 @@
|
||||
}
|
||||
|
||||
sub load_preferences() {
|
||||
+ swap_privileges();
|
||||
eval {
|
||||
if (open(CONFIG, "<$MYRC")) {
|
||||
while (<CONFIG>) {
|
||||
@@ -343,10 +333,12 @@
|
||||
}
|
||||
};
|
||||
die if $@;
|
||||
+ swap_privileges();
|
||||
}
|
||||
|
||||
sub store_preferences() {
|
||||
my($oldumask) = umask 0177;
|
||||
+ swap_privileges();
|
||||
eval {
|
||||
if(open(CONFIG, ">$MYRC")) {
|
||||
map { print CONFIG "$_=$preferences{$_}\n"; } sort keys %preferences;
|
||||
@@ -355,6 +347,7 @@
|
||||
display_and_log('WARNING', "Ecriture du fichier $MYRC impossible: vérifier les permissions");
|
||||
}
|
||||
};
|
||||
+ swap_privileges();
|
||||
umask $oldumask;
|
||||
die if $@;
|
||||
}
|
||||
@@ -420,7 +413,7 @@
|
||||
sub get_preferences() {
|
||||
load_preferences();
|
||||
|
||||
- die "plgrenouille n'a pas été totalement paramétré, lancez plgrenouille --config ou modifiez /etc/grenouillerc"
|
||||
+ die "plgrenouille n'a pas été totalement paramétré, lancez plgrenouille --config ou modifiez $MYRC"
|
||||
if not defined $preferences{'user'} or
|
||||
not defined $preferences{'pass'} or
|
||||
not defined $preferences{'email'} or
|
||||
@@ -434,20 +427,20 @@
|
||||
# plgrenouille uses the default route interface
|
||||
sub autodetect_interface() {
|
||||
$vars{'ip'} = '';
|
||||
- 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'} = $1;
|
||||
- }
|
||||
+ }
|
||||
}
|
||||
- close(ROUTE);
|
||||
- open(IFCONFIG, '-|') or exec('/sbin/ifconfig', $preferences{'interface'}) 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'} = $1;
|
||||
}
|
||||
}
|
||||
- close IFCONFIG;
|
||||
+ close(IFCONFIG_PIPE);
|
||||
|
||||
display_and_log('NOTICE', "$preferences{'interface'} sera utilisé pour les mesures") if $preferences{'interface'};
|
||||
}
|
||||
@@ -1160,8 +1153,6 @@
|
||||
|
||||
# --------------------------- MAIN ----------------------------
|
||||
|
||||
-display_version();
|
||||
-
|
||||
Getopt::Long::Configure('bundling'); # 'no_ignore_case'
|
||||
eval {
|
||||
GetOptions(\%params,
|
||||
@@ -1169,6 +1160,7 @@
|
||||
'verbose|v=s', \&set_verbose_level,
|
||||
'configure|setup|c',
|
||||
'background|b',
|
||||
+ 'version|V',
|
||||
'help|h|?');
|
||||
};
|
||||
if ($@) {
|
||||
@@ -1177,6 +1169,10 @@
|
||||
}
|
||||
usage(1) if scalar @ARGV;
|
||||
usage(0) if $params{'help'};
|
||||
+if($params{'version'}) {
|
||||
+ display_version();
|
||||
+ exit(0);
|
||||
+}
|
||||
|
||||
open_log();
|
||||
init_grenouille();
|
59
french/plgrenouille/files/plgrenouille.sh
Normal file
59
french/plgrenouille/files/plgrenouille.sh
Normal file
@ -0,0 +1,59 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
# Start or stop portsentry.
|
||||
#
|
||||
|
||||
rc_file=${0##*/}
|
||||
rc_arg=$1
|
||||
|
||||
if ! PREFIX=$(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
|
||||
|
||||
program_args=-b
|
||||
program_dir=${PREFIX}/libexec
|
||||
program_file=${rc_file%.sh}
|
||||
program_path=${program_dir}/${program_file}
|
||||
|
||||
pid_dir=/var/run
|
||||
pid_file=${program_file}.pid
|
||||
pid_path=${pid_dir}/${pid_file}
|
||||
|
||||
syslog_facility=daemon.err
|
||||
|
||||
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
|
1
french/plgrenouille/pkg-comment
Normal file
1
french/plgrenouille/pkg-comment
Normal file
@ -0,0 +1 @@
|
||||
Un client pour determiner votre bande passante a un raccordement large bande
|
37
french/plgrenouille/pkg-deinstall
Normal file
37
french/plgrenouille/pkg-deinstall
Normal file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
# Configure plgrenouille.
|
||||
#
|
||||
|
||||
[ $# != 2 ] && exit 1
|
||||
[ -z "${PKG_PREFIX}" ] && exit 1
|
||||
|
||||
PORTNAME=plgrenouille
|
||||
SPOOL_DIR=/var/spool/${PORTNAME}
|
||||
SPOOL_MODES=u+rw,go-rw
|
||||
SPOOL_USER=daemon
|
||||
|
||||
case "$2" in
|
||||
POST-INSTALL)
|
||||
if [ ! -d ${SPOOL_DIR} ]; then
|
||||
mkdir -p ${SPOOL_DIR} &&
|
||||
chmod ${SPOOL_MODES} ${SPOOL_DIR} &&
|
||||
chown ${SPOOL_USER} ${SPOOL_DIR}
|
||||
fi
|
||||
[ -n "${BATCH}" ] && exit 0
|
||||
[ -f ${PKG_PREFIX}/etc/rc.d/plgrenouille.sh ] &&
|
||||
sh ${PKG_PREFIX}/etc/rc.d/plgrenouille.sh configure
|
||||
;;
|
||||
DEINSTALL)
|
||||
if [ -f ${PKG_PREFIX}/etc/rc.d/plgrenouille.sh ]; then
|
||||
sh ${PKG_PREFIX}/etc/rc.d/plgrenouille.sh stop
|
||||
fi
|
||||
;;
|
||||
POST-DEINSTALL)
|
||||
if [ -d ${SPOOL_DIR} ]; then
|
||||
rm -rf ${SPOOL_DIR}
|
||||
fi
|
||||
;;
|
||||
esac
|
5
french/plgrenouille/pkg-descr
Normal file
5
french/plgrenouille/pkg-descr
Normal file
@ -0,0 +1,5 @@
|
||||
Ce logiciel est cense determiner votre bande passante a un raccordement
|
||||
large bande et envoie les resultats au site http://www.grenouille.com
|
||||
a des fins de statistiques.
|
||||
|
||||
WWW: ftp://blade.concept-micro.com/
|
37
french/plgrenouille/pkg-install
Normal file
37
french/plgrenouille/pkg-install
Normal file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
# Configure plgrenouille.
|
||||
#
|
||||
|
||||
[ $# != 2 ] && exit 1
|
||||
[ -z "${PKG_PREFIX}" ] && exit 1
|
||||
|
||||
PORTNAME=plgrenouille
|
||||
SPOOL_DIR=/var/spool/${PORTNAME}
|
||||
SPOOL_MODES=u+rw,go-rw
|
||||
SPOOL_USER=daemon
|
||||
|
||||
case "$2" in
|
||||
POST-INSTALL)
|
||||
if [ ! -d ${SPOOL_DIR} ]; then
|
||||
mkdir -p ${SPOOL_DIR} &&
|
||||
chmod ${SPOOL_MODES} ${SPOOL_DIR} &&
|
||||
chown ${SPOOL_USER} ${SPOOL_DIR}
|
||||
fi
|
||||
[ -n "${BATCH}" ] && exit 0
|
||||
[ -f ${PKG_PREFIX}/etc/rc.d/plgrenouille.sh ] &&
|
||||
sh ${PKG_PREFIX}/etc/rc.d/plgrenouille.sh configure
|
||||
;;
|
||||
DEINSTALL)
|
||||
if [ -f ${PKG_PREFIX}/etc/rc.d/plgrenouille.sh ]; then
|
||||
sh ${PKG_PREFIX}/etc/rc.d/plgrenouille.sh stop
|
||||
fi
|
||||
;;
|
||||
POST-DEINSTALL)
|
||||
if [ -d ${SPOOL_DIR} ]; then
|
||||
rm -rf ${SPOOL_DIR}
|
||||
fi
|
||||
;;
|
||||
esac
|
11
french/plgrenouille/pkg-message
Normal file
11
french/plgrenouille/pkg-message
Normal file
@ -0,0 +1,11 @@
|
||||
**** Avant d'executer ce client pour la premiere fois, assurez-vous de visiter
|
||||
le site web du projet Grenouille et de vous y enregistrer.
|
||||
(WWW: http://www.grenouille.com/ma_grenouille/).
|
||||
|
||||
**** Ensuite, vous devez executer %%PREFIX%%/etc/rc.d/plgrenouille.sh configure
|
||||
ou recopier le fichier de configuration %%PREFIX%%/etc/grenouillerc.sample
|
||||
en %%PREFIX%%/etc/grenouillerc afin de l'editer manuellement.
|
||||
|
||||
**** Notez qu'afin de pouvoir envoyer vos informations Grenouille au serveur
|
||||
Grenouille, votre machine doit avoir un acces plus ou moins continu a
|
||||
Internet au moyen d'une connection de type cable ou ADSL.
|
9
french/plgrenouille/pkg-plist
Normal file
9
french/plgrenouille/pkg-plist
Normal file
@ -0,0 +1,9 @@
|
||||
@comment $FreeBSD$
|
||||
@unexec if cmp -s %D/etc/grenouillerc %D/etc/grenouillerc.sample; then rm -f %D/etc/grenouillerc; fi
|
||||
etc/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
|
Loading…
Reference in New Issue
Block a user