mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 08:18:51 -05:00
makepkg: limit sudo usage to allowed pacman commands
This is particularly useful when using pacman wrappers which call sudo by themselves and therefore should not be run as root. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
66c6d288fd
commit
05ff276eef
@ -343,7 +343,7 @@ download_file() {
|
|||||||
|
|
||||||
run_pacman() {
|
run_pacman() {
|
||||||
local ret=0
|
local ret=0
|
||||||
if (( ! ASROOT )) && [[ $1 != "-T" ]]; then
|
if (( ! ASROOT )) && [[ $1 != "-T" ]] && sudo -l $PACMAN &>/dev/null; then
|
||||||
sudo $PACMAN $PACMAN_OPTS "$@" || ret=$?
|
sudo $PACMAN $PACMAN_OPTS "$@" || ret=$?
|
||||||
else
|
else
|
||||||
$PACMAN $PACMAN_OPTS "$@" || ret=$?
|
$PACMAN $PACMAN_OPTS "$@" || ret=$?
|
||||||
|
Loading…
Reference in New Issue
Block a user