makepkg: use regex to match options for privilege escalation

Eases maintanence if we need to add further options in the future.

Extracted from a patch supplied by Andres P <aepd87@gmail.com>

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2010-08-05 20:44:34 +10:00 committed by Dan McGee
parent 48589ccc64
commit 298cbf2cb1
1 changed files with 1 additions and 1 deletions

View File

@ -372,7 +372,7 @@ download_file() {
run_pacman() {
local cmd
printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@"
if (( ! ASROOT )) && [[ $1 != "-T" && $1 != "-Qq" ]]; then
if (( ! ASROOT )) && [[ ! $1 =~ ^-(T|Qq)$" ]]; then
if [ "$(type -p sudo)" ]; then
cmd="sudo $cmd"
else