diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2006-04-10 13:48:05 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2006-04-10 13:48:05 +0000 |
commit | c54f5f5b0f9fb7a2e6b795227d3679651ecd386e (patch) | |
tree | e1f09f6e2c73889f727470c4734ae87b5626667c /migrate-mdvonline-applet.pl | |
parent | c4435ffc27b5d0b2aa90f684e6c20c66fdf8e242 (diff) | |
download | mgaonline-c54f5f5b0f9fb7a2e6b795227d3679651ecd386e.tar mgaonline-c54f5f5b0f9fb7a2e6b795227d3679651ecd386e.tar.gz mgaonline-c54f5f5b0f9fb7a2e6b795227d3679651ecd386e.tar.bz2 mgaonline-c54f5f5b0f9fb7a2e6b795227d3679651ecd386e.tar.xz mgaonline-c54f5f5b0f9fb7a2e6b795227d3679651ecd386e.zip |
fix restarting old applets by providing them the right DISPLAY
Diffstat (limited to 'migrate-mdvonline-applet.pl')
-rwxr-xr-x | migrate-mdvonline-applet.pl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/migrate-mdvonline-applet.pl b/migrate-mdvonline-applet.pl index a194bd20..ca666398 100755 --- a/migrate-mdvonline-applet.pl +++ b/migrate-mdvonline-applet.pl @@ -22,6 +22,7 @@ use lib qw(/usr/lib/libDrakX); use standalone; # for explanations +use MDK::Common; my $run_file = '/var/run/mdkapplet'; @@ -50,10 +51,13 @@ if ($mode eq 'new') { my ($pid, $user, $cmd) = /^\s*(\d+)\s*(\S*)\s*(.*)$/; # do not match su running mdkapplet: next if $cmd !~ /perl.*mdkapplet/; + my ($DISPLAY) = grep { /^DISPLAY=/ } split('\0', cat_("/proc/$pid/environ")); + $DISPLAY =~ s/^DISPLAY=//; log::explanations(qq(killing "$cmd" (pid=$pid))); kill 15, $pid; my $pid2 = fork(); if (defined $pid2) { + local $ENV{DISPLAY} = $DISPLAY; !$pid2 and do { exec('su', $user, '-c', 'mdkapplet --auto-update') or do { require POSIX; POSIX::_exit() } }; log::explanations("restarting applet (pid=$pid2)"); } else { |