summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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" : ""));