refactoring

This commit is contained in:
Patrick Schleizer 2020-01-14 15:12:13 -05:00
parent 082f04f2d4
commit d90ca4b1ad
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -79,16 +79,17 @@ if [[ "$@" = "" ]]; then
exit $?
fi
exit_code=0
if [ "$use_sudo" = "true" ]; then
## 'sudo --user user' environment variables such as PATH.
lxqt-sudo sudo --user "$user_pkexec_wrapper" --set-home "$@" || { exit_code=$? ; true; };
else
## set PATH same as root
## This is required for gdebi.
## REVIEW: is it ok that users can find out the PATH setting of root?
## lxqt-sudo does not clear environment variables such as PATH.
PATH="$(sudo --non-interactive /usr/lib/security-misc/echo-path)"
export PATH
exit_code=0
if [ "$use_sudo" = "true" ]; then
lxqt-sudo sudo --user "$user_pkexec_wrapper" --set-home "$@" || { exit_code=$? ; true; };
else
lxqt-sudo "$@" || { exit_code=$? ; true; };
fi