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:
Cedric Staniewski 2009-12-02 19:04:33 +01:00 committed by Dan McGee
parent 66c6d288fd
commit 05ff276eef
1 changed files with 1 additions and 1 deletions

View File

@ -343,7 +343,7 @@ download_file() {
run_pacman() {
local ret=0
if (( ! ASROOT )) && [[ $1 != "-T" ]]; then
if (( ! ASROOT )) && [[ $1 != "-T" ]] && sudo -l $PACMAN &>/dev/null; then
sudo $PACMAN $PACMAN_OPTS "$@" || ret=$?
else
$PACMAN $PACMAN_OPTS "$@" || ret=$?