summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/any.pm19
-rw-r--r--perl-install/diskdrake/interactive.pm16
-rwxr-xr-xperl-install/standalone/XFdrake16
3 files changed, 21 insertions, 30 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 5210a30f3..ccc68723d 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -1023,6 +1023,25 @@ sub ask_window_manager_to_logout {
1;
}
+sub ask_window_manager_to_logout_then_do {
+ my ($wm, $pid, $action) = @_;
+ if (fork()) {
+ any::ask_window_manager_to_logout($wm);
+ return;
+ }
+
+ open STDIN, "</dev/zero";
+ open STDOUT, ">/dev/null";
+ open STDERR, ">&STDERR";
+ c::setsid();
+ exec 'perl', '-e', q(
+ my ($wm, $pid) = @ARGV;
+ my $nb;
+ for ($nb = 30; $nb && -e "/proc/$pid"; $nb--) { sleep 1 }
+ system($action) if $nb;
+ ), $wm, $pid;
+}
+
sub alloc_raw_device {
my ($prefix, $device) = @_;
my $used = 0;
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index b5faef5cb..efe38a135 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -1282,21 +1282,7 @@ sub tell_wm_and_reboot() {
if (!$wm) {
system('reboot');
} else {
- if (fork()) {
- any::ask_window_manager_to_logout($wm);
- return;
- }
-
- open STDIN, "</dev/zero";
- open STDOUT, ">/dev/null";
- open STDERR, ">&STDERR";
- c::setsid();
- exec 'perl', '-e', q(
- my ($wm, $pid) = @ARGV;
- my $nb;
- for ($nb = 20; $nb && -e "/proc/$pid"; $nb--) { sleep 1 }
- exec 'reboot' if $nb;
- ), $wm, $pid;
+ any::ask_window_manager_to_logout_then_do($wm, $pid, 'reboot');
}
}
diff --git a/perl-install/standalone/XFdrake b/perl-install/standalone/XFdrake
index 2738057a6..47f138e47 100755
--- a/perl-install/standalone/XFdrake
+++ b/perl-install/standalone/XFdrake
@@ -95,19 +95,5 @@ sub ask_for_X_restart {
$in->ask_okcancel('', N("You need to log out and back in again for changes to take effect"), 1) or return;
- if (fork()) {
- any::ask_window_manager_to_logout($wm);
- return;
- }
-
- open STDIN, "</dev/zero";
- open STDOUT, ">/dev/null";
- open STDERR, ">&STDERR";
- c::setsid();
- exec 'perl', '-e', q(
- my ($wm, $pid) = @ARGV;
- my $nb;
- for ($nb = 30; $nb && -e "/proc/$pid"; $nb--) { sleep 1 }
- system("killall X") if $nb;
- ), $wm, $pid;
+ any::ask_window_manager_to_logout_then_do($wm, $pid, 'killall X');
}