[pacman-dev] [PATCH 2/3] makepkg: limit sudo usage to allowed pacman commands

Cedric Staniewski cedric at gmx.ca
Wed Dec 2 13:04:33 EST 2009


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 at gmx.ca>
---
 scripts/makepkg.sh.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index d5f032f..6bee915 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -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=$?
-- 
1.6.5.3



More information about the pacman-dev mailing list