]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Pakfire erweitert.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 5 Jun 2007 13:44:26 +0000 (13:44 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 5 Jun 2007 13:44:26 +0000 (13:44 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@610 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

src/pakfire/lib/functions.pl
src/pakfire/pakfire
src/pakfire/pakfire.conf

index 13c9127103347305c70a5cf4e71a1ba59ff3de88..cd99c85973fb26e1acc8c63724815d98f78a04f9 100644 (file)
@@ -53,7 +53,7 @@ sub fetchfile {
        $bfile = basename("$file");
        
        my $ua = LWP::UserAgent->new;
-       $ua->agent('Pakfire/$Conf::version');
+       $ua->agent("Pakfire/$Conf::version");
        #$ua->timeout(5);
        #$ua->env_proxy;
  
@@ -391,7 +391,6 @@ sub setuppak {
                message("Setup returned: $return. Sorry. Please search our forum to find a solution for this problem.");
                exit $return;
        }
-       
        return $return;
 }
 
@@ -411,8 +410,7 @@ sub updatepak {
                message("Setup returned: $return. Sorry. Please search our forum to find a solution for this problem.");
                exit $return;
        }
-
-       exit $return;
+       return $return;
 }
 
 sub removepak {
@@ -440,8 +438,7 @@ sub removepak {
                message("Setup returned: $return. Sorry. Please search our forum to find a solution for this problem.");
                exit $return;
        }
-
-       exit $return;
+       return $return;
 }
 
 sub beautifysize {
@@ -460,5 +457,28 @@ sub beautifysize {
        return $string;
 }
 
+sub makeuuid {
+       unless ( -e "$Conf::dbdir/uuid" ) {
+               message("Creating a random key...");
+               open(FILE, "</proc/sys/kernel/random/uuid");
+               my @line = <FILE>;
+               close(FILE);
+               
+               open(FILE, ">$Conf::dbdir/uuid");
+               foreach (@line) {
+                       print FILE $_;
+               }
+               close(FILE);
+       }
+}
+
+sub senduuid {
+       unless("$Conf::uuid") {
+               $Conf::uuid = `cat $Conf::dbdir/uuid`;
+       }
+       logger("Sending my uuid: $Conf::uuid");
+       fetchfile("cgi-bin/counter?ver=$Conf::version&uuid=$Conf::uuid", "$Conf::mainserver");
+       system("rm -f $Conf::cachedir/counter.cgi* 2>/dev/null");
+}
 
 1;
index d2b0d9a010b8c2061e14896b75c32dccb535a2fd..94f8558eff93180a4d61575516ca9f119bc37ad1 100644 (file)
@@ -91,6 +91,8 @@
        
        
        } elsif ("$ARGV[0]" eq "update") {
+               &Pakfire::makeuuid();
+               &Pakfire::senduuid();
                &Pakfire::getmirrors();
                &Pakfire::dbgetlist();
        }
index 5024a770ec1a34d3982e1f96f5e0905b1a0e9747..bda07b6751d720bf7658987c70a564060c882c2f 100644 (file)
@@ -11,4 +11,8 @@ $dbdir = "/opt/pakfire/db";
 $tmpdir = "/opt/pakfire/tmp";
 $logdir = "/opt/pakfire/logs";
 
+if ( -e "$dbdir/uuid" ) {
+       $uuid = `cat $dbdir/uuid`;
+}
+
 1;