From 16f6c28c8950259587f18d8c93729dcd2fdd0c46 Mon Sep 17 00:00:00 2001 From: ms Date: Sat, 5 May 2007 20:18:27 +0000 Subject: [PATCH] Pakfire Installationsfixes und AJAX-Speedmeter. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@531 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- config/rootfiles/common/apache2 | 3 +- config/rootfiles/ver_full/pakfire | 15 ++++ doc/packages-list.txt | 1 - html/cgi-bin/speed.cgi | 72 ++++++++++++++++++++ html/html/themes/ipfire/include/functions.pl | 61 ++++++++++++++++- langs/de/cgi-bin/de.pl | 3 + langs/en/cgi-bin/en.pl | 3 + lfs/pakfire | 7 +- 8 files changed, 156 insertions(+), 9 deletions(-) create mode 100644 config/rootfiles/ver_full/pakfire create mode 100644 html/cgi-bin/speed.cgi diff --git a/config/rootfiles/common/apache2 b/config/rootfiles/common/apache2 index ee131b911e..c0da705964 100644 --- a/config/rootfiles/common/apache2 +++ b/config/rootfiles/common/apache2 @@ -1261,7 +1261,6 @@ srv/web/ipfire/cgi-bin/aliases.cgi #srv/web/ipfire/cgi-bin/asterisk.cgi/calls #srv/web/ipfire/cgi-bin/asterisk.cgi/conf #srv/web/ipfire/cgi-bin/asterisk.cgi/status -#srv/web/ipfire/cgi-bin/changepw.cgi srv/web/ipfire/cgi-bin/chpasswd.cgi srv/web/ipfire/cgi-bin/connections.cgi srv/web/ipfire/cgi-bin/connscheduler.cgi @@ -1314,10 +1313,10 @@ srv/web/ipfire/cgi-bin/proxy.cgi srv/web/ipfire/cgi-bin/proxygraphs.cgi srv/web/ipfire/cgi-bin/qos.cgi srv/web/ipfire/cgi-bin/remote.cgi -srv/web/ipfire/cgi-bin/samba.cgi srv/web/ipfire/cgi-bin/services.cgi srv/web/ipfire/cgi-bin/shaping.cgi srv/web/ipfire/cgi-bin/shutdown.cgi +srv/web/ipfire/cgi-bin/speed.cgi srv/web/ipfire/cgi-bin/system.cgi srv/web/ipfire/cgi-bin/time.cgi srv/web/ipfire/cgi-bin/traffic.cgi diff --git a/config/rootfiles/ver_full/pakfire b/config/rootfiles/ver_full/pakfire new file mode 100644 index 0000000000..b4657fb4aa --- /dev/null +++ b/config/rootfiles/ver_full/pakfire @@ -0,0 +1,15 @@ +#opt/pakfire +opt/pakfire/cache +#opt/pakfire/db +opt/pakfire/db/lists +opt/pakfire/db/meta +opt/pakfire/db/rootfiles +#opt/pakfire/etc +opt/pakfire/etc/pakfire.conf +#opt/pakfire/lib +opt/pakfire/lib/functions.pl +opt/pakfire/logs +#opt/pakfire/meta +opt/pakfire/pakfire +opt/pakfire/pakfire.conf +opt/pakfire/tmp diff --git a/doc/packages-list.txt b/doc/packages-list.txt index 1f80ace15a..8935b3610d 100644 --- a/doc/packages-list.txt +++ b/doc/packages-list.txt @@ -148,7 +148,6 @@ * libvorbis-1.1.2 * libwww-perl-5.803 * libxml2-2.6.26 -* linux-2.6.16.42 * linux-2.6.16.50 * linux-atm-2.4.1 * linux-libc-headers-2.6.12.0 diff --git a/html/cgi-bin/speed.cgi b/html/cgi-bin/speed.cgi new file mode 100644 index 0000000000..3436dd3b3a --- /dev/null +++ b/html/cgi-bin/speed.cgi @@ -0,0 +1,72 @@ +#!/usr/bin/perl +# +# IPFire CGIs +# +# This code is distributed under the terms of the GPL +# +# (c) The IPFire Team +# + +my $data_last = $ENV{'QUERY_STRING'}; +my $rxb_last = 0; +my $txb_last = 0; + +my (@fields, $field, $name, $value); +@fields = split(/&/, $data_last); +foreach $field (@fields) { + ($name, $value) = split(/=/, $field); + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + if ("$name" eq "rxb_last") { + $rxb_last = $value; + } elsif ("$name" eq "txb_last") { + $txb_last = $value; + } +} + +my @data_now = `ip -s link show red0`; + +my $lastline; +my $rxb_now = 0; +my $txb_now = 0; +foreach (@data_now) { + if ( $lastline =~ /RX/ ) { + @fields = split(/ /, $_); + $rxb_now = $fields[4]; + } elsif ( $lastline =~ /TX/ ) { + @fields = split(/ /, $_); + $txb_now = $fields[4]; + } + $lastline = $_; +} + +my ($rx_kbs, $tx_kbs); +my $rxb_diff = $rxb_now - $rxb_last; +my $txb_diff = $txb_now - $txb_last; + +if(( $rxb_diff == $rxb_now ) && ( $txb_diff == $txb_now )) +{ + $rx_kbs = "0.00"; + $tx_kbs = "0.00"; +} +else +{ + $rx_kbs = $rxb_diff / 1024; + $rx_kbs = $rx_kbs / 2.2; + $rx_kbs = int($rx_kbs); + $tx_kbs = $txb_diff / 1024; + $tx_kbs = $tx_kbs / 2.2; + $tx_kbs = int($tx_kbs); +} + +print "Content-type: text/xml\n\n"; +print "\n"; +print < + $tx_kbs kb/s + $rx_kbs kb/s + $rxb_now + $txb_now + +END +; diff --git a/html/html/themes/ipfire/include/functions.pl b/html/html/themes/ipfire/include/functions.pl index 78127c0de8..87e31674dc 100644 --- a/html/html/themes/ipfire/include/functions.pl +++ b/html/html/themes/ipfire/include/functions.pl @@ -156,9 +156,61 @@ END } } - + - + diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 4c22d79cf7..ebd18effbb 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -333,6 +333,7 @@ 'bad ignore filter' => 'Falscher "Ignorieren"-Filter:', 'bad return code' => 'Das Hilfsprogramm hat einen Fehlercode gemeldet', 'bad source range' => 'Der erste Wert des Quellportbereich ist größer oder gleich dem zweiten Wert.', +'bandwidth usage' => 'Bandbreitenauslastung (extern)', 'basic options' => 'Basisoptionen', 'beep when ppp connects or disconnects' => 'Piepen, wenn IPFire verbindet oder trennt', 'behind a proxy' => 'Hinter einem Proxy:', @@ -759,6 +760,7 @@ 'importkey' => 'PSK importieren', 'in' => 'Ein', 'inactive' => 'inaktiv', +'incoming' => 'eingehend', 'incoming traffic in bytes per second' => 'Eingehender Verkehr in Bytes pro Sekunde', 'incorrect password' => 'Fehlerhaftes Passwort', 'info' => 'Info', @@ -1065,6 +1067,7 @@ 'other countries' => 'Andere Länder', 'other login script' => 'Anderes Anmeldeskript', 'out' => 'Aus', +'outgoing' => 'ausgehend', 'outgoing firewall' => 'Ausgehende Firewall', 'outgoing traffic in bytes per second' => 'Abgehender Verkehr in Bytes pro Sekunde', 'override mtu' => 'Überschreibe Standard MTU', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index f36f43367b..a4a77269ac 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -349,6 +349,7 @@ 'bad ignore filter' => 'Bad ignore filter:', 'bad return code' => 'Helper program returned error code', 'bad source range' => 'The Source port range has a first value that is greater than or equal to the second value.', +'bandwidth usage' => 'bandwidth usage (external)', 'basic options' => 'Basic Options', 'beep when ppp connects or disconnects' => 'Beep when IPFire connects or disconnects', 'behind a proxy' => 'Behind a proxy:', @@ -772,6 +773,7 @@ 'importkey' => 'Import PSK', 'in' => 'In', 'inactive' => 'inactive', +'incoming' => 'incoming', 'incoming traffic in bytes per second' => 'Incoming Traffic in Bytes per Second', 'incorrect password' => 'Incorrect password', 'info' => 'Info', @@ -1081,6 +1083,7 @@ 'other countries' => 'Other countries', 'other login script' => 'Other login script', 'out' => 'Out', +'outgoing' => 'outgoing', 'outgoing firewall' => 'Outgoing Firewall', 'outgoing traffic in bytes per second' => 'Outgoing Traffic in Bytes per Second', 'override mtu' => 'Override default MTU', diff --git a/lfs/pakfire b/lfs/pakfire index d7a15abc39..4157aa968d 100644 --- a/lfs/pakfire +++ b/lfs/pakfire @@ -52,9 +52,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) -mkdir -p /opt/pakfire/{cache,db/{meta,lists,rootfiles},etc,lib,logs,tmp} - cd $(DIR_SRC) && cp -fRv src/pakfire $(DIR_APP) - cd $(DIR_APP) && mv -vf pakfire.conf /opt/pakfire/etc - cd $(DIR_APP) && chown root.root $(DIR_APP) -R + cp -fRv $(DIR_SRC)/src/pakfire/* $(DIR_APP) + cp -vf $(DIR_SRC)/src/pakfire/pakfire.conf $(DIR_APP)/etc/ + chown root.root $(DIR_APP) -R -cd $(DIR_APP) && find $(DIR_APP) -name .svn -exec rm -rf {} \; @$(POSTBUILD) - -- 2.39.2