diff options
author | Thierry Vignaud <tv@mageia.org> | 2011-12-10 13:36:01 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2011-12-10 13:36:01 +0000 |
commit | 3fd95ad88603f0eb89493d82f64a157042680324 (patch) | |
tree | 934397805d7ba3bd57f474def8f6995dc6458f24 /perl-install/run_program.pm | |
parent | f04f8ee05ef40926a04d2c32460aabda7e42ba6c (diff) | |
download | drakx-3fd95ad88603f0eb89493d82f64a157042680324.tar drakx-3fd95ad88603f0eb89493d82f64a157042680324.tar.gz drakx-3fd95ad88603f0eb89493d82f64a157042680324.tar.bz2 drakx-3fd95ad88603f0eb89493d82f64a157042680324.tar.xz drakx-3fd95ad88603f0eb89493d82f64a157042680324.zip |
(raw) fix $HOME for all when runing as another user instead of root (mga#287)
make rpmdrake fix more generic
Diffstat (limited to 'perl-install/run_program.pm')
-rw-r--r-- | perl-install/run_program.pm | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm index 82bdb5964..65e3a0f56 100644 --- a/perl-install/run_program.pm +++ b/perl-install/run_program.pm @@ -48,12 +48,15 @@ sub raw { ($stdout_mode, $stdout_raw, @args) = @args if $args[0] =~ /^>>?$/; ($stderr_mode, $stderr_raw, @args) = @args if $args[0] =~ /^2>>?$/; + my $home; if ($options->{as_user}) { my $user; $user = $ENV{USERHELPER_UID} && getpwuid($ENV{USERHELPER_UID}); $user ||= common::get_parent_uid(); $options->{setuid} = getpwnam($user) if $user; + $home = $user->[7] if $user; } + local $ENV{HOME} = $home if $home; my $args = $options->{sensitive_arguments} ? '<hidden arguments>' : join(' ', @args); log::explanations("running: $real_name $args" . ($root ? " with root $root" : "")); |