summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-02-21 02:55:44 +0100
committerAllan McRae <allan@archlinux.org>2019-02-21 05:18:25 +0100
commit656e851f0a3947a997d852da267e06e47355d134 (patch)
treefcc1d340a0c56b53c862677b8923c913d8efacab
parent4b83bcfcee46b6adcb80fc7a9fb85d3af58fb741 (diff)
downloadpacman-656e851f0a3947a997d852da267e06e47355d134.tar.gz
pacman-656e851f0a3947a997d852da267e06e47355d134.tar.xz
makepkg: simplify run_pacman logic
We don't need to check the options twice, since it is the same check both times. Instead, merge the conditionals. As far as I can tell, the only reason the checks for: - PACMAN_OPTS and - whether to use sudo were ever separated is due to the historic existence of --asroot, since the second check included a check for (( ! ASROOT )) until it was cleaned up in commit 61ba5c961e4a3536c4bbf41edb348987a9993fdb. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--scripts/makepkg.sh.in8
1 files changed, 3 insertions, 5 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 4e7b2e6c..bca71c70 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -217,12 +217,10 @@ missing_source_file() {
run_pacman() {
local cmd
- if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
- cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@")
- else
+ if [[ $1 = -@(T|Q)*([[:alpha:]]) ]]; then
cmd=("$PACMAN_PATH" "$@")
- fi
- if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
+ else
+ cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@")
if type -p sudo >/dev/null; then
cmd=(sudo "${cmd[@]}")
else