summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmdkapplet21
1 files changed, 13 insertions, 8 deletions
diff --git a/mdkapplet b/mdkapplet
index 20691579..aa5b1563 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -192,16 +192,19 @@ sub silentCheck {
# 98 - wrong pass
# 97 - host not active
my $retcode = {
- 10 => sub { $isAvailable = 0; $mLog .= N("System is up to date\n") ;go2State('okay') },
+ 10 => sub { okState() },
11 => sub {
my @contents = sort ( split /\n/, $ct);
my @t = split /\n/, `rpm -qa`;
+ my $comp = 0;
foreach my $cand (@contents) {
$cand =~ s/\.(i586|ppc|ia64).rpm//;
$cand =~ /(.*)-(.*)-(.*)$/; my ($name, $ver, $rel) = ($1, $2, $3);
- my $comp = compareWithInstalled($name, $ver, $rel, \@t);
- if ($comp) { $isAvailable = 1; $mLog .= N("Checking... Updates are available\n"); go2State('error') and last } else { $isAvailable = 0; go2State('okay') and last };
+ $comp = compareWithInstalled($name, $ver, $rel, \@t);
+ #print "COMP = $comp\n";
+ if ($comp) { $isAvailable = 1; $mLog .= N("Checking... Updates are available\n"); go2State('error') and last } else { $isAvailable = 0 };
}
+ !$comp and okState();
},
97 => sub { $mLog .= N("Online services disabled. Contact MandrakeOnline site\n") ; go2State('disabled'); },
98 => sub { $mLog .= N("Wrong Password.\n"); go2State('critical'); },
@@ -209,17 +212,19 @@ sub silentCheck {
};
$retcode->{$u}->();
}
+sub okState { $isAvailable = 0; $mLog=N("System is up to date"); go2State('okay') }
sub compareWithInstalled {
my ($name, $ver, $rel, $t) = @_;
my $isUpdate = 0;
foreach my $p (@{$t}) {
$p =~ /(.*)-(.*)-(.*)$/; my ($n, $v, $r) = ($1, $2, $3);
- if ($name eq $n ) {
- my $iu = rpmvercmp($ver, $v); my $ir = rpmvercmp( $rel, $r);
- #print "$name-$ver-$rel $n-$v-$r *** CMPVER=$iu ** CMPREL = $ir \n";
+ if ($name eq $n) {
+ #my $iu = rpmvercmp($ver, $v); my $ir = rpmvercmp( $rel,
+ #$r); print "$name-$ver-$rel $n-$v-$r *** CMPVER=$iu ** CMPREL = $ir \n";
+
if (rpmvercmp($ver, $v) > 0 || ( rpmvercmp($ver, $v) == 0 && rpmvercmp( $rel, $r) > 0)) {
$isUpdate = 1 and last;
- }
+ }
}
}
$isUpdate
@@ -329,7 +334,7 @@ sub checkUpdates {
} else {
$update_label and setLabel($update_label, N("Checking for Updates..."));
setLastTime();
- $lastch and setLabel($lastch, lastCheck() );
+ $lastch and setLabel($lastch, lastCheck());
silentCheck();
}
setLabel($update_label, $isAvailable ? N("Available") : N("Not Available"));