aboutsummaryrefslogtreecommitdiffstats
path: root/rpmdrake.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-10-06 19:37:22 +0000
committerThierry Vignaud <tv@mandriva.org>2008-10-06 19:37:22 +0000
commit1edd490cf871b214aafeab61d1c91cf33ec0f995 (patch)
treeaa20986528c884f8f383bf29282228a3dab677cb /rpmdrake.pm
parentdd270712ddaeaff4f1a4afd9c3447824b8fc7317 (diff)
downloadrpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.tar
rpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.tar.gz
rpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.tar.bz2
rpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.tar.xz
rpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.zip
(run_as_user) open help & bug report as user instead of as root (#44497)
Diffstat (limited to 'rpmdrake.pm')
-rw-r--r--rpmdrake.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/rpmdrake.pm b/rpmdrake.pm
index aa3e6241..267f9cd4 100644
--- a/rpmdrake.pm
+++ b/rpmdrake.pm
@@ -937,17 +937,26 @@ sub add_distrib_update_media {
);
}
+sub run_as_user {
+ if (my $user = $ENV{USERHELPER_UID} && getpwuid($ENV{USERHELPER_UID})) {
+ run_program::raw({ detach => 1 }, 'su', $user, '-c', join(' ', @_));
+ } else {
+ run_program::raw({ detach => 1 }, @_);
+ }
+}
+
+
sub open_help {
my ($mode) = @_;
use run_program;
- run_program::raw({ detach => 1 }, 'drakhelp', '--id', $mode ? "software-management-$mode" : 'software-management');
+ run_as_user('drakhelp', '--id', $mode ? "software-management-$mode" : 'software-management');
N("Help launched in background");
statusbar_msg(N("The help window has been started, it should appear shortly on your desktop."), 1);
}
sub run_drakbug {
my ($id) = @_;
- run_program::raw({ detach => 1 }, 'drakbug', '--report', $id);
+ run_as_user('drakbug', '--report', $id);
}
sub strip_first_underscore { join '', map { s/_//; $_ } @_ }