diff options
Diffstat (limited to 'mdkapplet')
-rwxr-xr-x | mdkapplet | 35 |
1 files changed, 25 insertions, 10 deletions
@@ -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 ); } } |