From 320e11dcf97872907ac03979139d507b102e205e Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Fri, 10 Jul 2020 21:07:52 +0200 Subject: [PATCH] genprotimg/check_hostkeydoc: fix bash detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We cannot rely on what $SHELL says as it describes what the users default shell is and not which kind of shell /bin/sh is. So instead of checking the environment variable $SHELL, we can test whether the environment variable $BASH is set. If this is the case, we can be pretty sure that the script is executed by the bash shell. This fixes the error on Ubuntu 20.04: ./check_hostkeydoc se-certs/host-key.crt se-certs/ibm-z-host-key-signing.crt -c se-certs/DigiCertCA.crt -r se-certs/ibm-z-host-key.crl ./check_hostkeydoc: 42: set: Illegal option -o pipefail Reviewed-by: Viktor Mihajlovski Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- genprotimg/samples/check_hostkeydoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genprotimg/samples/check_hostkeydoc b/genprotimg/samples/check_hostkeydoc index 77453215..7e9f2321 100755 --- a/genprotimg/samples/check_hostkeydoc +++ b/genprotimg/samples/check_hostkeydoc @@ -37,7 +37,7 @@ cleanup() trap cleanup EXIT # Enhanced error checking for bash -if echo $SHELL | grep /bin/bash > /dev/null +if [ -n "${BASH}" ] then set -o pipefail set -o nounset