summaryrefslogtreecommitdiffstats
path: root/mdkapplet
diff options
context:
space:
mode:
Diffstat (limited to 'mdkapplet')
-rwxr-xr-xmdkapplet25
1 files changed, 24 insertions, 1 deletions
diff --git a/mdkapplet b/mdkapplet
index ba65cc87..1e2bdeae 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -23,6 +23,8 @@
use strict;
use lib qw(/usr/lib/libDrakX);
use common;
+use Digest::MD5;
+
BEGIN { unshift @::textdomains, 'mdkonline' }
use Gtk2::TrayIcon;
@@ -174,13 +176,34 @@ sub showMainWindow() {
));
$w->show_all
}
+sub md5file {
+ my @md5;
+ foreach my $file (@_) {
+ open(FILE, $file) or do { print STDERR "Can't open '$file': $!"; push @md5, "" };
+ binmode(FILE);
+ push @md5, Digest::MD5->new->addfile(*FILE)->hexdigest;
+ close(FILE);
+ }
+ return wantarray() ? @md5 : $md5[0];
+}
sub setLabel {
my ($widget, $string) = shift;
$widget->set_label($string) if defined $widget;
gtkflush();
}
sub configNetwork { logIt(N("Launching drakconnect\n")); system "/usr/sbin/drakconnect &" }
-sub installUpdates { logIt(N("Launching mdkupdate --applet\n")); gtkroot()->set_cursor(Gtk2::Gdk::Cursor->new('watch')); system "/usr/sbin/mdkupdate", "--applet"; silentCheck(); gtkflush(); gtkroot()->set_cursor(Gtk2::Gdk::Cursor->new('left-ptr')); }
+sub installUpdates {
+ my $binfile = '/usr/bin/mdkapplet';
+ my $oldmd5 = md5file($binfile);
+ logIt(N("Launching mdkupdate --applet\n"));
+ gtkroot()->set_cursor(Gtk2::Gdk::Cursor->new('watch'));
+ system "/usr/sbin/mdkupdate", "--applet";
+ my $newmd5 = md5file($binfile);
+ print "NEW($newmd5) = OLD($oldmd5)\n"
+ if ($newmd5 ne $oldmd5) { logIt(N("Mdkonline seems to be reinstalled, reloading applet ....")); exec('/usr/bin/mdkapplet') };
+ silentCheck(); gtkflush();
+ gtkroot()->set_cursor(Gtk2::Gdk::Cursor->new('left-ptr'));
+}
sub silentCheck {
my $link = "http://www.mandrakeonline.net/online3_RemoteAction.php" . '?action=UpdateList';
my %h = getVarsFromSh($conffile);