From 00f6361fce3e75d76fe3b84ea70f5a285a1cf407 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Thu, 29 Jul 2021 13:53:45 +0200
Subject: [PATCH] Fix(bash<5.1): shell option "inherit_errexit" was not
 available before bash 5.1

Change-Id: I9afa6b83e82fc6bbbd54183bac68afe28416b05c
---
 .ci/bootstrap_spack.sh                                       | 2 +-
 .ci/build_image.sh                                           | 2 +-
 .ci/build_sandbox.sh                                         | 2 +-
 .ci/commons.sh                                               | 2 +-
 .ci/complete_spack_install_routine_called_in_post_as_root.sh | 2 +-
 .ci/generate_modules.sh                                      | 2 +-
 .ci/install_singularity_as_root.sh                           | 2 +-
 .ci/install_visionary_spack.sh                               | 2 +-
 .ci/prepare_spack_as_root.sh                                 | 2 +-
 .ci/preserve_built_spack_packages.sh                         | 2 +-
 .ci/restore_spack_user_settings.sh                           | 2 +-
 .ci/restore_spack_user_settings_as_root.sh                   | 2 +-
 .ci/setup_env_spack.sh                                       | 2 +-
 .ci/update_build_cache.sh                                    | 2 +-
 .ci/update_build_cache_in_container.sh                       | 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/.ci/bootstrap_spack.sh b/.ci/bootstrap_spack.sh
index a4b9e0cc..d349008d 100755
--- a/.ci/bootstrap_spack.sh
+++ b/.ci/bootstrap_spack.sh
@@ -3,7 +3,7 @@
 # Prepare spack by bootstrapping and installing the visionary compiler
 #
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 sourcedir="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")"
 source "${sourcedir}/commons.sh"
diff --git a/.ci/build_image.sh b/.ci/build_image.sh
index 139e3cce..020161a6 100755
--- a/.ci/build_image.sh
+++ b/.ci/build_image.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 if (( $(find sandboxes -mindepth 1 -maxdepth 1 | wc -l) > 1 )); then
     echo "More than one sandbox found, this should never happen!" >&2
diff --git a/.ci/build_sandbox.sh b/.ci/build_sandbox.sh
index c07a41b3..e32af6d6 100755
--- a/.ci/build_sandbox.sh
+++ b/.ci/build_sandbox.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 # set generic locale for building
 export LANG=C.UTF-8
diff --git a/.ci/commons.sh b/.ci/commons.sh
index 0ef7a1b8..104e893f 100755
--- a/.ci/commons.sh
+++ b/.ci/commons.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 JENKINS_ENV_FILE_INSIDE="/tmp/spack/jenkins.env"
 if [ -n "${WORKSPACE:-}" ]; then
diff --git a/.ci/complete_spack_install_routine_called_in_post_as_root.sh b/.ci/complete_spack_install_routine_called_in_post_as_root.sh
index b78e641d..9aca0cb6 100755
--- a/.ci/complete_spack_install_routine_called_in_post_as_root.sh
+++ b/.ci/complete_spack_install_routine_called_in_post_as_root.sh
@@ -6,7 +6,7 @@
 #
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 SOURCE_DIR="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")"
 source "${SOURCE_DIR}/commons.sh"
diff --git a/.ci/generate_modules.sh b/.ci/generate_modules.sh
index a3541df7..1fa44698 100755
--- a/.ci/generate_modules.sh
+++ b/.ci/generate_modules.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 # This script searches the environment-modules install folder for the init
 # folder which contains the init scripts for a variety of shells.
diff --git a/.ci/install_singularity_as_root.sh b/.ci/install_singularity_as_root.sh
index e1af2cd4..e02844fc 100755
--- a/.ci/install_singularity_as_root.sh
+++ b/.ci/install_singularity_as_root.sh
@@ -3,7 +3,7 @@
 # regenerated!)
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 sourcedir="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")"
 source "${sourcedir}/commons.sh"
diff --git a/.ci/install_visionary_spack.sh b/.ci/install_visionary_spack.sh
index 980cee74..5656102d 100755
--- a/.ci/install_visionary_spack.sh
+++ b/.ci/install_visionary_spack.sh
@@ -3,7 +3,7 @@
 # has been installed).
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 sourcedir="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")"
 source "${sourcedir}/commons.sh"
diff --git a/.ci/prepare_spack_as_root.sh b/.ci/prepare_spack_as_root.sh
index 38ac0c7a..c89c31e2 100755
--- a/.ci/prepare_spack_as_root.sh
+++ b/.ci/prepare_spack_as_root.sh
@@ -3,7 +3,7 @@
 # prepare spack as root during container setup
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 SOURCE_DIR="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")"
 source "${SOURCE_DIR}/commons.sh"
diff --git a/.ci/preserve_built_spack_packages.sh b/.ci/preserve_built_spack_packages.sh
index 40f35027..7672aadf 100755
--- a/.ci/preserve_built_spack_packages.sh
+++ b/.ci/preserve_built_spack_packages.sh
@@ -17,7 +17,7 @@
 # .ci/create_temporary_build_cache_after_failure.sh).
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 sourcedir="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")"
 source "${sourcedir}/commons.sh"
diff --git a/.ci/restore_spack_user_settings.sh b/.ci/restore_spack_user_settings.sh
index 26cda805..ec03def3 100755
--- a/.ci/restore_spack_user_settings.sh
+++ b/.ci/restore_spack_user_settings.sh
@@ -5,7 +5,7 @@
 #
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 sourcedir="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")"
 source "${sourcedir}/commons.sh"
diff --git a/.ci/restore_spack_user_settings_as_root.sh b/.ci/restore_spack_user_settings_as_root.sh
index 75083a0e..db7d4e78 100755
--- a/.ci/restore_spack_user_settings_as_root.sh
+++ b/.ci/restore_spack_user_settings_as_root.sh
@@ -5,7 +5,7 @@
 #
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 sourcedir="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")"
 source "${sourcedir}/commons.sh"
diff --git a/.ci/setup_env_spack.sh b/.ci/setup_env_spack.sh
index 9f25e6b3..42fbc34f 100755
--- a/.ci/setup_env_spack.sh
+++ b/.ci/setup_env_spack.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 # inside the container the tmpdir is mounted to /tmp/spack
 export SPACK_TMPDIR="/tmp/spack"
diff --git a/.ci/update_build_cache.sh b/.ci/update_build_cache.sh
index 5806cc6e..379727b7 100755
--- a/.ci/update_build_cache.sh
+++ b/.ci/update_build_cache.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 # only update build cache for stable builds
 if [ "${CONTAINER_BUILD_TYPE:-}" != "stable" ]; then
diff --git a/.ci/update_build_cache_in_container.sh b/.ci/update_build_cache_in_container.sh
index 5c4ffad3..aa7061c3 100755
--- a/.ci/update_build_cache_in_container.sh
+++ b/.ci/update_build_cache_in_container.sh
@@ -7,7 +7,7 @@
 #
 
 set -euo pipefail
-shopt -s inherit_errexit
+shopt -s inherit_errexit 2>/dev/null || true
 
 usage() { cat  1>&2 <<EOF
 Usage: ${0} [-c <base-cache>] [-d <destination-folder>]
-- 
GitLab