diff options
author | Ray Kohler <ataraxia937@gmail.com> | 2010-03-04 21:57:46 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-05-05 19:26:56 -0500 |
commit | 590606a5d7c699e4d4705501377ca83fb696b61c (patch) | |
tree | 4f6961d1179267f57be942ef6453c16010587308 | |
parent | ccbef232c97fda061eee54a96bcd60b13a77f5d1 (diff) | |
download | pacman-590606a5d7c699e4d4705501377ca83fb696b61c.tar.xz |
makepkg: fall back to su if sudo is not available
Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | scripts/makepkg.sh.in | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index baf47032..08b4c9e6 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -344,8 +344,12 @@ download_file() { run_pacman() { local ret=0 - if (( ! ASROOT )) && [[ $1 != "-T" && $1 != "-Qq" ]] && sudo -l $PACMAN &>/dev/null; then - sudo $PACMAN $PACMAN_OPTS "$@" || ret=$? + if (( ! ASROOT )) && [[ $1 != "-T" && $1 != "-Qq" ]]; then + if [ "$(type -p sudo)" ] && sudo -l $PACMAN &>/dev/null; then + sudo $PACMAN $PACMAN_OPTS "$@" || ret=$? + else + su -c "$PACMAN $PACMAN_OPTS $*" || ret=$? + fi else $PACMAN $PACMAN_OPTS "$@" || ret=$? fi @@ -1694,12 +1698,9 @@ else fi # check for sudo if we will need it during makepkg execution -if (( ! ASROOT && ( DEP_BIN || RMDEPS || INSTALL ) )); then +if (( ! ( ASROOT || INFAKEROOT ) && ( DEP_BIN || RMDEPS || INSTALL ) )); then if [ ! "$(type -p sudo)" ]; then - error "$(gettext "Cannot find the sudo binary! Is sudo installed?")" - plain "$(gettext "Missing dependencies cannot be installed or removed as a normal user")" - plain "$(gettext "without sudo; install and configure sudo to auto-resolve dependencies.")" - exit 1 + warning "$(gettext "Sudo can not be found. Will use su to acquire root privileges.")" fi fi |