From 8e58bd3706c55e31b691c266be9d5e043f9cce37 Mon Sep 17 00:00:00 2001 From: ms Date: Tue, 5 Jun 2007 13:44:26 +0000 Subject: [PATCH] Pakfire erweitert. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@610 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- src/pakfire/lib/functions.pl | 32 ++++++++++++++++++++++++++------ src/pakfire/pakfire | 2 ++ src/pakfire/pakfire.conf | 4 ++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index 13c9127103..cd99c85973 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -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, "; + 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; diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire index d2b0d9a010..94f8558eff 100644 --- a/src/pakfire/pakfire +++ b/src/pakfire/pakfire @@ -91,6 +91,8 @@ } elsif ("$ARGV[0]" eq "update") { + &Pakfire::makeuuid(); + &Pakfire::senduuid(); &Pakfire::getmirrors(); &Pakfire::dbgetlist(); } diff --git a/src/pakfire/pakfire.conf b/src/pakfire/pakfire.conf index 5024a770ec..bda07b6751 100644 --- a/src/pakfire/pakfire.conf +++ b/src/pakfire/pakfire.conf @@ -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; -- 2.39.2