FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-19-2010, 12:47 AM
Andres P
 
Default makepkg: allow specifying means for privilege escalation

Given that certain sudoers settings cause issues with excessive password
prompts, and that certain users don't want to use sudo to begin with, makepkg
will now refrain from making assumptions that couldn't possibly be accurate.

>From this point on, there are no artificial dependencies nor
second hand guesses regarding su/sudo.

Signed-off-by: Andres P <aepd87@gmail.com>
---
scripts/makepkg.sh.in | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2258d2a..29b5664 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -372,10 +372,10 @@ download_file() {
run_pacman() {
local cmd=$(printf "%q " "$PACMAN" $PACMAN_OPTS "$@")
if (( ! ASROOT )) && [[ ! $1 =~ ^-(T|Qq)$ ]]; then
- if type -p sudo >/dev/null && sudo -l "$PACMAN" &>/dev/null; then
- cmd="sudo $cmd"
+ if [[ $PACMAN_AUTH =~ %p ]]; then
+ cmd="${PACMAN_AUTH//%p/$cmd}"
else
- cmd="su -c '$cmd'"
+ cmd="$PACMAN_AUTH $cmd"
fi
fi
eval "$cmd"
@@ -1610,8 +1610,9 @@ if [[ -r ~/.makepkg.conf ]]; then
source ~/.makepkg.conf
fi

-# set pacman command if not already defined
-PACMAN=${PACMAN:-pacman}
+# set pacman commands if not already defined
+PACMAN=${PACMAN:-"pacman"}
+PACMAN_AUTH=${PACMAN_AUTH:-"sudo %p"}

# check if messages are to be printed using color
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
@@ -1714,13 +1715,6 @@ else
fi
fi

-# check for sudo if we will need it during makepkg execution
-if (( ! ( ASROOT || INFAKEROOT ) && ( DEP_BIN || RMDEPS || INSTALL ) )); then
- if ! type -p sudo >/dev/null; then
- warning "$(gettext "Sudo can not be found. Will use su to acquire root privileges.")"
- fi
-fi
-
unset pkgname pkgbase pkgver pkgrel pkgdesc url license groups provides
unset md5sums replaces depends conflicts backup source install changelog build
unset makedepends optdepends options noextract
--
1.7.1
 

Thread Tools




All times are GMT. The time now is 02:42 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org