Dependency handling is a really useful feature, but I don't like the whole sudo/su thing. How about removing explicit support for sudo/su and leave it to the user to properly configure it for his needs? It could look similar to this: diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index cbc344d..2599e3c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -369,12 +369,8 @@ download_file() { run_pacman() { local ret=0 - if (( ! ASROOT )) && [[ $1 != "-T" && $1 != "-Qq" ]]; then - if type -p sudo >/dev/null && sudo -l $PACMAN &>/dev/null; then - sudo $PACMAN $PACMAN_OPTS "$@" || ret=$? - else - su -c "$PACMAN $PACMAN_OPTS $*" || ret=$? - fi + if [[ $1 = "-T" || $1 = "-Qq" ]]; then + $PACMANBIN $PACMAN_OPTS "$@" || ret=$? else $PACMAN $PACMAN_OPTS "$@" || ret=$? fi @@ -1631,7 +1627,8 @@ if [[ -r ~/.makepkg.conf ]]; then fi # set pacman command if not already defined -PACMAN=${PACMAN:-pacman} +PACMANBIN=${PACMANBIN:-pacman} +PACMAN=${PACMAN:-sudo $PACMANBIN} # check if messages are to be printed using color unset ALL_OFF BOLD BLUE GREEN RED YELLOW @@ -1734,13 +1731,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 @@ -1896,7 +1886,7 @@ if (( NODEPS || ( (NOBUILD || REPKG) && !DEP_BIN ) )); then if (( NODEPS || ( REPKG && PKGFUNC ) )); then warning "$(gettext "Skipping dependency checks.")" fi -elif type -p "${PACMAN%% *}" >/dev/null; then +else if (( RMDEPS )); then original_pkglist=($(run_pacman -Qq)) # required by remove_dep fi @@ -1916,8 +1906,6 @@ elif type -p "${PACMAN%% *}" >/dev/null; then error "$(gettext "Could not resolve all dependencies.")" exit 1 fi -else - warning "$(gettext "%s was not found in PATH; skipping dependency checks.")" "${PACMAN%% *}" fi # ensure we have a sane umask set -- 1.7.1