summaryrefslogtreecommitdiffstats
path: root/mdkapplet
diff options
context:
space:
mode:
authorDaouda Lo <daouda@mandriva.com>2004-03-23 13:07:52 +0000
committerDaouda Lo <daouda@mandriva.com>2004-03-23 13:07:52 +0000
commit9098f49f7c8fc637e023157cbfe5b8cc7cf2d527 (patch)
tree89dea6490ad4cf87f819912ba5554196deb1f00c /mdkapplet
parent532f907e677d2fa7266d55f43ab934886557dc94 (diff)
downloadmgaonline-9098f49f7c8fc637e023157cbfe5b8cc7cf2d527.tar
mgaonline-9098f49f7c8fc637e023157cbfe5b8cc7cf2d527.tar.gz
mgaonline-9098f49f7c8fc637e023157cbfe5b8cc7cf2d527.tar.bz2
mgaonline-9098f49f7c8fc637e023157cbfe5b8cc7cf2d527.tar.xz
mgaonline-9098f49f7c8fc637e023157cbfe5b8cc7cf2d527.zip
- last check
Diffstat (limited to 'mdkapplet')
-rwxr-xr-xmdkapplet35
1 files changed, 25 insertions, 10 deletions
diff --git a/mdkapplet b/mdkapplet
index e7123eff..04ea8f0a 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -40,6 +40,7 @@ my $arch = arch();
my ($av_pkgs, $update_label, $mLog);
my ($need_update, $raisedwindow, $isAvailable) = (0, 0, 0);
my $conffile = '/etc/sysconfig/mdkonline';
+my $localfile = "$ENV{HOME}/.mdkonline";
my %state = (
okay => {
@@ -111,7 +112,7 @@ $eventbox->signal_connect(button_press_event => sub {
my ($opt) = @ARGV;
if ($opt eq '--force' || $opt eq '-f') { setAutoStart('TRUE') };
-shouldStart() or die "$ENV{HOME}/.mdkonline should be set to TRUE";
+shouldStart() or die "$localfile should be set to TRUE";
checkUpdates();
cronUpdate();
@@ -215,7 +216,7 @@ sub compareWithInstalled {
$p =~ /(.*)-(.*)-(.*)$/; my ($n, $v, $r) = ($1, $2, $3);
if ($name eq $n ) {
if ($ver eq $v) {
- if ($rel ne $r) { $isUpdate = 1 and last }
+ if ($rel gt $r) { $isUpdate = 1 and last }
} elsif (isNewVersion($ver, $v)) { $isUpdate = 1 and last }
}
}
@@ -242,12 +243,21 @@ sub cronUpdate {
});
}
sub lastCheck {
- my %h = getVarsFromSh($conffile);
+ my %h = getVarsFromSh($localfile);
my ($t, $l);
$t = $h{LASTCHECK} ;
$t =~ s/\_/ /g;
$t ? $t : N("No check")
}
+sub getTime {
+ my $d = localtime();
+ $d =~ s/\s+/_/g;
+ $d
+}
+sub setLastTime {
+ my $date = getTime() ;
+ setVar($localfile, 'LASTCHECK', $date);
+}
sub checkUpdates {
if (!isNetwork()) {
$mLog .= N("Checking Network: seems disabled\n");
@@ -326,15 +336,20 @@ sub about {
my $b = browser();
system("$b " . "https://mandrakeonline.net/info.php" . "&")
}
+sub setVar {
+ my ($file, $var, $st) = @_;
+ my %s = getVarsFromSh($file);
+ $s{$var} = $st;
+ setVarsInSh($file, \%s);
+}
sub setAutoStart {
my $state = shift;
- my $file = "$ENV{HOME}/.mdkonline";
- if (-f $file) {
- my %s = getVarsFromSh($file);
- $s{AUTOSTART} = $state;
- setVarsInSh($file, \%s);
- } else { output_p $file,
- qq(AUTOSTART=$state
+ my $date = getTime();
+ if (-f $localfile) {
+ setVar($localfile, 'AUTOSTART', $state);
+ } else { output_p $localfile,
+ qq(AUTOSTART=$state
+LASTCHECK=$date
);
}
}