summaryrefslogtreecommitdiffstats
path: root/move
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-06-21 02:58:57 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-06-21 02:58:57 +0000
commit6a5560dfcc0c33006fe55fadb88250f059d60b3a (patch)
treec889b3b121f3116222770e074c738c730f58aebd /move
parentea447f530a95197d95b591ddcda2c973853f51c3 (diff)
downloaddrakx-backup-do-not-use-6a5560dfcc0c33006fe55fadb88250f059d60b3a.tar
drakx-backup-do-not-use-6a5560dfcc0c33006fe55fadb88250f059d60b3a.tar.gz
drakx-backup-do-not-use-6a5560dfcc0c33006fe55fadb88250f059d60b3a.tar.bz2
drakx-backup-do-not-use-6a5560dfcc0c33006fe55fadb88250f059d60b3a.tar.xz
drakx-backup-do-not-use-6a5560dfcc0c33006fe55fadb88250f059d60b3a.zip
change the way we restart kdesktop and kicker
Diffstat (limited to 'move')
-rwxr-xr-xmove/tree/mdk_totem48
1 files changed, 25 insertions, 23 deletions
diff --git a/move/tree/mdk_totem b/move/tree/mdk_totem
index 2c8888562..e51af7487 100755
--- a/move/tree/mdk_totem
+++ b/move/tree/mdk_totem
@@ -25,22 +25,13 @@ sub busy_pids_and_files() {
} @pids;
}
-sub remove_simple_daemons {
- my (@busy) = @_;
- foreach (@busy) {
- $_->{to_kill} = $_->{cmdline} =~ m!\b(kdesud|kded|kdesktop|kicker|kio_uiserver|klaptopdaemon|artsd|portmap)\b!;
- }
- my @auto_killed = grep { $_->{to_restart} || $_->{to_kill} } @busy;
-
- if (@auto_killed) {
- kill 15, map { $_->{pid} } @auto_killed;
- sleep 1;
-
- $_ and system($_) foreach map { $_->{to_restart} } @auto_killed;
-
- @busy = busy_pids_and_files(); #- update list
- }
- @busy;
+my @to_restart_progs = qw(kded kdesktop kicker);
+my $restart_progs = join(";", @to_restart_progs);
+my @simple_daemons = qw(kdesud kio_uiserver klaptopdaemon artsd portmap);
+sub simple_daemon {
+ my ($e) = @_;
+ my $re = join('|', @to_restart_progs, @simple_daemons);
+ $e->{cmdline} =~ m!\b($re)\b!
}
my $in = interactive->vnew;
@@ -60,10 +51,10 @@ if (!$ENV{DEBUG} && find { $_->{cmdline} =~ /^($needed_processes)/ } @busy) {
$in->exit(1);
}
-@busy = remove_simple_daemons(@busy);
-if (@busy) {
+my ($simple_daemons, $bad_busy) = partition { simple_daemon($_) } @busy;
+if (@$bad_busy) {
warn '*' x 80, "\n";
- warn join("\n", "$_->{exe} ($_->{cmdline}) =>", map { " $_" } @{$_->{files}}) . "\n" foreach @busy;
+ warn join("\n", "$_->{exe} ($_->{cmdline}) =>", map { " $_" } @{$_->{files}}) . "\n" foreach @$bad_busy;
warn '*' x 80, "\n";
my @progs = map {
@@ -73,7 +64,7 @@ if (@busy) {
$s =~ s!^kdeinit:\s+(\S+).*!$1!;
$s =~ s!\s.*!!;
$s;
- } @busy;
+ } @$bad_busy;
my $choice = 'quit';
my @l = my %l = (
@@ -90,12 +81,22 @@ if (@busy) {
if ($choice eq 'keep') {
exec 'totem' or $in->exit;
} else {
- system('sudo', 'kill', map { $_->{pid} } @busy);
+ system('sudo', 'kill', map { $_->{pid} } @$bad_busy);
sleep 2;
- system('sudo', 'kill', '-9', map { $_->{pid} } @busy);
+ system('sudo', 'kill', '-9', map { $_->{pid} } @$bad_busy);
}
}
+kill 15, map { $_->{pid} } @$simple_daemons;
+sleep 1;
+
+@busy = busy_pids_and_files(); #- update list
+if (@busy) {
+ system($restart_progs);
+ exec 'totem' if $in->ask_okcancel('', N("You can only run with no CDROM support"));
+ $in->exit(1);
+}
+
my %file2loop = do {
my $_w = $in->wait_message('', N("Copying to memory to allow removing the CDROM"));
`GIVE_LOOP=1 mdk_move_loop to_memory always always_i18n totem nvidia` =~ /(.*?)=(.*)/g;
@@ -115,5 +116,6 @@ if (my $pid = fork()) {
'--boot-loop', $file2loop{'live_tree_boot.clp'},
'--main-loop', $file2loop{'live_tree.clp'},
'--totem-pid', $totem_pid,
- '--user', $ENV{USER};
+ '--user', $ENV{USER},
+ '--restore-cmd', $restart_progs;
}