From ff49e66b0570412c839cea16a407cf4be206398d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 23 Jul 2018 13:00:45 +0200 Subject: [PATCH] test.sh: Wrap all sudo calls in CAN_SUDO check One call had been missed. --- test/test.sh | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/test/test.sh b/test/test.sh index 5fd7c1e..330af7b 100755 --- a/test/test.sh +++ b/test/test.sh @@ -37,19 +37,24 @@ which initdb > /dev/null || { # System configuration checks grep -q "^\"${USER}\"" userlist.txt || echo "\"${USER}\" \"01234\"" >> userlist.txt -case `uname` in -Darwin|OpenBSD) - sudo pfctl -a pgbouncer -F all -q 2>&1 | grep -q "pfctl:" && { - cat <<-EOF - Please enable PF and add the following rule to /etc/pf.conf - - anchor "pgbouncer/*" - - EOF - exit 1 - } - ;; -esac +echo "Testing for sudo access." +sudo true && CAN_SUDO=1 + +if test -n "$CAN_SUDO"; then + case `uname` in + Darwin|OpenBSD) + sudo pfctl -a pgbouncer -F all -q 2>&1 | grep -q "pfctl:" && { + cat <<-EOF + Please enable PF and add the following rule to /etc/pf.conf + + anchor "pgbouncer/*" + + EOF + exit 1 + } + ;; + esac +fi # System configuration checks SED_ERE_OP='-E' @@ -466,9 +471,6 @@ test_auth_user() { return 0 } -echo "Testing for sudo access." -sudo true && CAN_SUDO=1 - testlist=" test_server_login_retry test_auth_user -- 2.50.1