Pakfire Installationsfixes und AJAX-Speedmeter.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sat, 5 May 2007 20:18:27 +0000 (20:18 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sat, 5 May 2007 20:18:27 +0000 (20:18 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@531 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/rootfiles/common/apache2
config/rootfiles/ver_full/pakfire [new file with mode: 0644]
doc/packages-list.txt
html/cgi-bin/speed.cgi [new file with mode: 0644]
html/html/themes/ipfire/include/functions.pl
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
lfs/pakfire

index ee131b9..c0da705 100644 (file)
@@ -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 (file)
index 0000000..b4657fb
--- /dev/null
@@ -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
index 1f80ace..8935b36 100644 (file)
 * 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 (file)
index 0000000..3436dd3
--- /dev/null
@@ -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 "<?xml version=\"1.0\"?>\n";
+print <<END
+<inetinfo>
+ <rx_kbs>$tx_kbs kb/s</rx_kbs>
+ <tx_kbs>$rx_kbs kb/s</tx_kbs>
+ <rxb>$rxb_now</rxb>
+ <txb>$txb_now</txb>
+</inetinfo>
+END
+;
index 78127c0..87e3167 100644 (file)
@@ -156,9 +156,61 @@ END
            }
         }
     </script>
-
+               <script type="text/javascript" language="javascript">
+                
+                   var http_request = false;
+                
+                   function LoadInetInfo(url) {
+                
+                       http_request = false;
+                
+                       if (window.XMLHttpRequest) { // Mozilla, Safari,...
+                           http_request = new XMLHttpRequest();
+                           if (http_request.overrideMimeType) {
+                               http_request.overrideMimeType('text/xml');
+                               // zu dieser Zeile siehe weiter unten
+                           }
+                       } else if (window.ActiveXObject) { // IE
+                           try {
+                               http_request = new ActiveXObject("Msxml2.XMLHTTP");
+                           } catch (e) {
+                               try {
+                                   http_request = new ActiveXObject("Microsoft.XMLHTTP");
+                               } catch (e) {}
+                           }
+                       }
+                
+                       if (!http_request) {
+                           alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
+                           return false;
+                       }
+                       http_request.onreadystatechange = DisplayInetInfo;
+                       http_request.open('GET', url, true);
+                       http_request.send(null);
+                
+                   }
+                
+                   function DisplayInetInfo() {
+                       if (http_request.readyState == 4) {
+                            var xmldoc = http_request.responseXML;
+                            var root1_node = xmldoc.getElementsByTagName('rx_kbs').item(0);
+                            var root2_node = xmldoc.getElementsByTagName('tx_kbs').item(0);
+                            var root3_node = xmldoc.getElementsByTagName('rxb').item(0);
+                            var root4_node = xmldoc.getElementsByTagName('txb').item(0);
+               
+                            document.forms['speed'].txkb.value  = root1_node.firstChild.data;
+                            document.forms['speed'].rxkb.value  = root2_node.firstChild.data;
+               
+                                       // document.getElementsByTagName("input")[0].style.color = "#00FF00";
+                                       url    = "speed.cgi?rxb_last=" + root3_node.firstChild.data + "&txb_last=" + root4_node.firstChild.data;
+               
+                             window.setTimeout("LoadInetInfo(url)", 3000);
+                       }
+                
+                   }
+               </script>
   </head>
-  <body>
+  <body onLoad="LoadInetInfo('speed.cgi')">
 <!-- IPFIRE HEADER -->
 
 <div id="header">
@@ -289,6 +341,11 @@ END
                <br class="clear" />    
                <div id="footer" class="fixed">
                        <b>Status:</b> $status <b>Uptime:</b>$uptime <b>Version:</b> $FIREBUILD
+                       <br />
+                       <form name='speed'>
+                               <b>$Lang::tr{'bandwidth usage'}:</b> $Lang::tr{'incoming'}:<input type="text" name="rxkb" size="16" value="0,00 kb/s" style="border: 1px solid #FFFFFF; padding: 0; background-color: #FFFFFF" />
+                               $Lang::tr{'outgoing'}: <input type="text" name="txkb" size="16" value="0,00 kb/s" style="border: 1px solid #FFFFFF; padding: 0; background-color: #FFFFFF" />
+                       </form>
                </div>
        </div>
 </div>
index 4c22d79..ebd18ef 100644 (file)
 'bad ignore filter' => 'Falscher &quot;Ignorieren&quot;-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:',
 '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',
 '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',
index f36f433..a4a7726 100644 (file)
 '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:',
 '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',
 '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',
index d7a15ab..4157aa9 100644 (file)
@@ -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)
-