diff options
author | Daouda Lo <daouda@mandriva.com> | 2004-06-08 15:52:32 +0000 |
---|---|---|
committer | Daouda Lo <daouda@mandriva.com> | 2004-06-08 15:52:32 +0000 |
commit | 9474d88b01cf59cf70a5f95ec8fdb2e78e48ddec (patch) | |
tree | 488192055ee1fb09cf93ae80bf60cb65629c685e /mdkapplet | |
parent | 2e4bb943a40dba5080371fdb6dcf7ef219ebf8f9 (diff) | |
download | mgaonline-9474d88b01cf59cf70a5f95ec8fdb2e78e48ddec.tar mgaonline-9474d88b01cf59cf70a5f95ec8fdb2e78e48ddec.tar.gz mgaonline-9474d88b01cf59cf70a5f95ec8fdb2e78e48ddec.tar.bz2 mgaonline-9474d88b01cf59cf70a5f95ec8fdb2e78e48ddec.tar.xz mgaonline-9474d88b01cf59cf70a5f95ec8fdb2e78e48ddec.zip |
- added md5sum test file to reload applet on the fly when new
mdkonline is installed.
Diffstat (limited to 'mdkapplet')
-rwxr-xr-x | mdkapplet | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -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); |