summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2011-12-10 13:36:01 +0000
committerThierry Vignaud <tv@mageia.org>2011-12-10 13:36:01 +0000
commit3fd95ad88603f0eb89493d82f64a157042680324 (patch)
tree934397805d7ba3bd57f474def8f6995dc6458f24
parentf04f8ee05ef40926a04d2c32460aabda7e42ba6c (diff)
downloaddrakx-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
-rw-r--r--perl-install/NEWS2
-rw-r--r--perl-install/run_program.pm3
2 files changed, 5 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 05cc5452a..00b7bb3b6 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,5 @@
+- fix $HOME for all when runing as another user instead of root (mga#287)
+
Version 13.72 - 10 December 2011
- drakhelp: make it work somewhat despite lack of doc
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" : ""));