diff options
-rw-r--r-- | scripts/makepkg.sh.in | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index f3c72172..516e1d7c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -368,17 +368,16 @@ download_file() { } run_pacman() { - local ret=0 + local cmd + printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@" if (( ! ASROOT )) && [[ $1 != "-T" && $1 != "-Qq" ]]; then - if [ "$(type -p sudo)" ] && sudo -l $PACMAN &>/dev/null; then - sudo $PACMAN $PACMAN_OPTS "$@" || ret=$? + if [ "$(type -p sudo)" ]; then + cmd="sudo $cmd" else - su -c "$PACMAN $PACMAN_OPTS $*" || ret=$? + cmd="su -c '$cmd'" fi - else - $PACMAN $PACMAN_OPTS "$@" || ret=$? fi - return $ret + eval "$cmd" } check_deps() { |