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 61ba5c961e
.
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
4b83bcfcee
commit
656e851f0a
1 changed files with 3 additions and 5 deletions
|
@ -217,12 +217,10 @@ missing_source_file() {
|
||||||
|
|
||||||
run_pacman() {
|
run_pacman() {
|
||||||
local cmd
|
local cmd
|
||||||
if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
|
if [[ $1 = -@(T|Q)*([[:alpha:]]) ]]; then
|
||||||
cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@")
|
|
||||||
else
|
|
||||||
cmd=("$PACMAN_PATH" "$@")
|
cmd=("$PACMAN_PATH" "$@")
|
||||||
fi
|
else
|
||||||
if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
|
cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@")
|
||||||
if type -p sudo >/dev/null; then
|
if type -p sudo >/dev/null; then
|
||||||
cmd=(sudo "${cmd[@]}")
|
cmd=(sudo "${cmd[@]}")
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue