From 9902adab6d83e24106edf5ff804fbd60a563b765 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 30 Sep 2022 13:27:48 +0800 Subject: [PATCH] Make stack GHC install hook posix compliant See https://github.com/commercialhaskell/stack/issues/5888 --- scripts/hooks/stack/ghc-install.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/hooks/stack/ghc-install.sh b/scripts/hooks/stack/ghc-install.sh index 01d20ff..34e0c0e 100644 --- a/scripts/hooks/stack/ghc-install.sh +++ b/scripts/hooks/stack/ghc-install.sh @@ -1,13 +1,16 @@ -#!/bin/bash +#!/bin/sh + +# !! KEEP THIS SCRIPT POSIX COMPLIANT !! # see https://docs.haskellstack.org/en/stable/yaml_configuration/#ghc-installation-customisation-experimental # for documentation about hooks -set -euo pipefail +set -eu case $HOOK_GHC_TYPE in bindist) - echo "$(ghcup run --ghc "$HOOK_GHC_VERSION" --install)/ghc" + ghcdir=$(ghcup run --ghc "$HOOK_GHC_VERSION" --install) || exit 3 + printf "%s/ghc" "${ghcdir}" ;; git) # TODO: should be somewhat possible