diff options
-rwxr-xr-x | mdkapplet | 16 | ||||
-rwxr-xr-x | mdkapplet-upgrade-helper | 9 |
2 files changed, 19 insertions, 6 deletions
@@ -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}, |