summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Victor Duarte Martins <jvictor@mandriva.com>2010-07-27 22:12:55 +0000
committerJoão Victor Duarte Martins <jvictor@mandriva.com>2010-07-27 22:12:55 +0000
commit9de16b896af952c00c12e60751f7fb602a9f5a84 (patch)
tree63dc419aff900535bf6b91dc8c950a1699d11872
parent95131d42ad6fc221a36f22d002b1b36601c0b2ec (diff)
downloadmgaonline-9de16b896af952c00c12e60751f7fb602a9f5a84.tar
mgaonline-9de16b896af952c00c12e60751f7fb602a9f5a84.tar.gz
mgaonline-9de16b896af952c00c12e60751f7fb602a9f5a84.tar.bz2
mgaonline-9de16b896af952c00c12e60751f7fb602a9f5a84.tar.xz
mgaonline-9de16b896af952c00c12e60751f7fb602a9f5a84.zip
* mdkapplet-upgrade-helper (run_gurpmi): create windows before upgrade
(fix #59025); send SIGHUP to mdkapplet so it will restarts (fix #59481). * mdkapplet (get_extended_maintenance): updated to mdkapplet-add-media-helper. (restart_applet): restart handler to SIGHUP.
-rwxr-xr-xmdkapplet16
-rwxr-xr-xmdkapplet-upgrade-helper9
2 files changed, 19 insertions, 6 deletions
diff --git a/mdkapplet b/mdkapplet
index 0d39413a..8dee807c 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -289,6 +289,7 @@ Glib::Timeout->add_seconds($config{FIRST_CHECK_DELAY}/1000, sub {
$SIG{USR1} = 'IGNORE';
$SIG{USR2} = 'IGNORE';
$SIG{CHLD} = \&harvester;
+$SIG{HUP} = \&restart_applet;
run_program::raw({ detach => 1 }, 'ionice', '-p', $$, '-n7');
@@ -433,6 +434,13 @@ sub harvester {
return @pids;
}
+sub restart_applet {
+ local $SIG{CHLD} = 'DEFAULT';
+ log::explanations(N("Received SIGHUP (probably an upgrade has finished), restarting applet."));
+ { redo if wait() > 0 }
+ exec($0, '--auto-update');
+}
+
# FIXME: we can run many drakconnect when network is down:
sub configNetwork() {
log::explanations(N_("Launching drakconnect\n"));
@@ -612,10 +620,10 @@ sub no_more_supported() {
sub get_extended_maintenance() {
- $mdv_update_pid = fork_exec('mdkapplet-extended-maintenance-helper', $product_id->{version},
- if_($::testing, '--testing'),
- if_($download_all, "--download-all=$download_dir"),
- if_($root, "--urpmi-root=$root"));
+ $mdv_update_pid = fork_exec('mdkapplet-add-media-helper',
+ if_($root, "--urpmi-root=$root"),
+ '--product=extended',
+ $product_id->{version});
}
diff --git a/mdkapplet-upgrade-helper b/mdkapplet-upgrade-helper
index a40a2885..0231051a 100755
--- a/mdkapplet-upgrade-helper
+++ b/mdkapplet-upgrade-helper
@@ -90,8 +90,11 @@ sub run_gurpmi() {
my @initial_args = ('--replacefiles', '--clean');
push @initial_args, "--download-all=$download_dir" if $download_dir;
+ # Windows are created before upgrading packages, to guarantee that
+ # any possible related GTK upgrade won't affect us...
my $succeeded_win = create_upgrade_succeeded_window();
my $failed_win = create_upgrade_failed_window();
+
while ($refork_gurpmi) {
my $ok = fork_gurpmi(@initial_args);
@@ -110,6 +113,8 @@ sub run_gurpmi() {
} else {
rm_rf(get_stale_upgrade_filename());
$succeeded_win->main && !$::testing && any::reboot();
+ my $mdkapp_pid = common::is_running('mdkapplet');
+ defined($mdkapp_pid) && kill('HUP', $mdkapp_pid);
}
}
}
@@ -123,7 +128,7 @@ my @common = (
width => $width - 50,
);
-sub get_upgrade_failed_window() {
+sub create_upgrade_failed_window() {
local $mygtk2::left_padding = 0;
my $w = ugtk2->new(N("Error"));
gtkadd($w->{window},
@@ -138,7 +143,7 @@ sub get_upgrade_failed_window() {
return $w;
}
-sub get_upgrade_succeeded_window() {
+sub create_upgrade_succeeded_window() {
local $mygtk2::left_padding = 0;
my $w = ugtk2->new(N("Congratulations"));
gtkadd($w->{window},