From 656e851f0a3947a997d852da267e06e47355d134 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 20 Feb 2019 20:55:44 -0500 Subject: 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 Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'scripts') 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 -- cgit v1.2.3-70-g09d2