diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-09-30 13:14:53 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-09-30 13:14:53 +0000 |
commit | 965de720384f3f83132eeb8d5798005fa1a28285 (patch) | |
tree | 6dd97ab5fce2d1a001a7bd0a6918e6bcaf420504 /perl-install | |
parent | ba97cf869a060191683f077e79a049a64f553b40 (diff) | |
download | drakx-965de720384f3f83132eeb8d5798005fa1a28285.tar drakx-965de720384f3f83132eeb8d5798005fa1a28285.tar.gz drakx-965de720384f3f83132eeb8d5798005fa1a28285.tar.bz2 drakx-965de720384f3f83132eeb8d5798005fa1a28285.tar.xz drakx-965de720384f3f83132eeb8d5798005fa1a28285.zip |
backport is_running() for draksnapshot
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/NEWS | 3 | ||||
-rw-r--r-- | perl-install/common.pm | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index 13603ef7f..b6a92d2d7 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,6 @@ +- libDrakX: + o backport is_running() for draksnapshot + Version 10.29.10 - 30 September 2008 - libDrakX: diff --git a/perl-install/common.pm b/perl-install/common.pm index f3aa17273..04bc570f7 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -10,7 +10,7 @@ use run_program; use Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw($SECTORSIZE N P N_ check_for_xserver files_exist formatTime MB formatXiB get_parent_uid makedev mandrake_release mandrake_release_info removeXiBSuffix require_root_capability setVirtual set_alternative set_l10n_sort set_permissions to_utf8 translate unmakedev); +our @EXPORT = qw($SECTORSIZE N P N_ check_for_xserver files_exist formatTime MB formatXiB get_parent_uid is_running makedev mandrake_release mandrake_release_info removeXiBSuffix require_root_capability setVirtual set_alternative set_l10n_sort set_permissions to_utf8 translate unmakedev); # perl_checker: RE-EXPORT-ALL push @EXPORT, @MDK::Common::EXPORT; @@ -294,6 +294,15 @@ sub set_permissions { chmod(oct($perms), $file) or die "chmod of file $file failed: $!\n"; } +sub is_running { + my ($name, $o_user) = @_; + my $user = $o_user || $ENV{USER}; + foreach (`ps -o '%P %p %c' -u $user`) { + my ($ppid, $pid, $n) = /^\s*(\d+)\s+(\d+)\s+(.*)/; + return $pid if $ppid != 1 && $pid != $$ && $n eq $name; + } +} + sub parse_release_file { my ($prefix, $f, $part) = @_; chomp(my $s = cat_("$prefix$f")); |