diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2021-01-01 00:22:23 -0600 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2021-06-23 01:32:58 -0500 |
commit | 8fa084dc0f0d3eac2714f15bc478f10b33ad433c (patch) | |
tree | e4465af1bbadf82ced0e1eb4a85959c500230901 /pkgs/stdenv | |
parent | ba4b4aea566ee8783f9196a6b6cefe64cb9ec491 (diff) | |
download | nixlib-8fa084dc0f0d3eac2714f15bc478f10b33ad433c.tar nixlib-8fa084dc0f0d3eac2714f15bc478f10b33ad433c.tar.gz nixlib-8fa084dc0f0d3eac2714f15bc478f10b33ad433c.tar.bz2 nixlib-8fa084dc0f0d3eac2714f15bc478f10b33ad433c.tar.lz nixlib-8fa084dc0f0d3eac2714f15bc478f10b33ad433c.tar.xz nixlib-8fa084dc0f0d3eac2714f15bc478f10b33ad433c.tar.zst nixlib-8fa084dc0f0d3eac2714f15bc478f10b33ad433c.zip |
stdenv/setup.sh: Add version check to setup script
Only bash 4+ works in setup.sh. To make sure this is obvious, we can check BASH_VERSINFO to get the major version number of Bash. While Bash 3 is pretty rare, it still comes stock in macOS. We *could* provide a warning here for non-Bash shells, but it’s not always clear whether they will work or not. Zsh should have no trouble while busybox sh, fish, or any others. There’s no great way to detect what feature set the shell supports. Fixes #71625
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 4ff0a6caf760..e583054779b5 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1,6 +1,12 @@ set -eu set -o pipefail +if [ -n "${BASH_VERSINFO-}" ] && [ "${BASH_VERSINFO-}" -lt 4 ]; then + echo "Detected Bash version that isn't supported by Nixpkgs (${BASH_VERSION})" + echo "Please install Bash 4 or greater to continue." + exit 1 +fi + if (( "${NIX_DEBUG:-0}" >= 6 )); then set -x fi |