From 13714d49e1d0a8e975e176bd66a7e3e8203a7432 Mon Sep 17 00:00:00 2001 From: Daouda Lo Date: Mon, 15 Mar 2004 21:58:21 +0000 Subject: - new algo to circumvent check fail --- mdkapplet | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/mdkapplet b/mdkapplet index af6ad2c3..6cbcdd4c 100755 --- a/mdkapplet +++ b/mdkapplet @@ -169,7 +169,7 @@ sub installUpdates { system "/usr/sbin/mdkupdate", "--applet"; } sub silentCheck { - my $link = "https://www.mandrakeonline.net/online3_RemoteAction.php" . '?action=UpdateList'; + my $link = "http://www.mandrakeonline.net/online3_RemoteAction.php" . '?action=UpdateList'; my %h = getVarsFromSh($conffile); my $u; require LWP::UserAgent; @@ -192,13 +192,13 @@ sub silentCheck { 10 => sub { go2State('okay') }, 11 => sub { my @contents = sort ( split /\n/, $ct); - my @r = sort( split /\n/, `rpm -qa` ); + my @t = split /\n/, `rpm -qa`; foreach my $cand (@contents) { $cand =~ s/\.(i586|ppc|ia64).rpm//; - $cand =~ /(.*)-(.*)$/; my ($namever, $release) = ($1, $2); - if (member($namever, @r) && $cand ne chomp_(`rpm -q $namever`)) { - go2State('error') and last - } + $cand =~ /(.*)-(.*)-(.*)$/; my ($name, $ver, $rel) = ($1, $2, $3); + my $comp = compareWithInstalled($name, $ver, $rel, \@t); + $comp and go2State('error'); + $comp and last; } }, 97 => sub { go2State('disabled'); }, @@ -207,6 +207,19 @@ sub silentCheck { }; $retcode->{$u}->(); } +sub compareWithInstalled { + my ($name, $ver, $rel, $t) = @_; + my $isUpdate = 0; + foreach my $p (@{$t}) { + $p =~ /(.*)-(.*)-(.*)$/; + if ($name eq $1 ) { + if ($ver ne $2 || $rel ne $3) { + $isUpdate = 1 and last; + } + } + } + $isUpdate +} sub cronUpdate { my ($to) = shift; $timeout = Glib::Timeout->add(60*60*1000, sub { -- cgit v1.2.1