diff --git a/bootstrap-haskell b/bootstrap-haskell index 7d9bf2a..80819cd 100755 --- a/bootstrap-haskell +++ b/bootstrap-haskell @@ -16,11 +16,11 @@ edo() } eghcup() { - if [ -z "${BOOTSTRAP_HASKELL_VERBOSE}" ] ; then - edo ghcup "$@" - else - edo ghcup --verbose "$@" - fi + if [ -z "${BOOTSTRAP_HASKELL_VERBOSE}" ] ; then + edo ghcup "$@" + else + edo ghcup --verbose "$@" + fi } echo @@ -40,29 +40,29 @@ echo "PATH components." echo if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then - printf "\\033[0;35m%s\\033[0m\\n" "To proceed with the ghcup installation press ENTER, to cancel press ctrl-c." - printf "\\033[0;35m%s\\033[0m\\n" "Note that this script can be re-run at any given time." - echo - # Wait for user input to continue. - # shellcheck disable=SC2034 - read -r answer /dev/null 2>&1 ; then - if [ -z "${BOOTSTRAP_HASKELL_NO_UPGRADE}" ] ; then - eghcup upgrade - fi + if [ -z "${BOOTSTRAP_HASKELL_NO_UPGRADE}" ] ; then + eghcup upgrade + fi else - edo curl --silent https://gitlab.haskell.org/haskell/ghcup/raw/master/ghcup > "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/ghcup - edo chmod +x "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/ghcup + edo curl --silent https://gitlab.haskell.org/haskell/ghcup/raw/master/ghcup > "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/ghcup + edo chmod +x "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/ghcup cat <<-EOF > "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/env || die "Failed to create env file" export PATH="\$HOME/.cabal/bin:\${GHCUP_INSTALL_BASE_PREFIX:=\$HOME}/.ghcup/bin:\$PATH" EOF # shellcheck disable=SC1090 - edo . "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/env + edo . "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/env fi echo @@ -71,13 +71,13 @@ echo " $(ghcup print-system-reqs)" echo if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then - printf "\\033[0;35m%s\\033[0m\\n" "You may want to install these now, then press ENTER to proceed" - printf "\\033[0;35m%s\\033[0m\\n" "or press ctrl-c to abort. Installation may take a while." - echo + printf "\\033[0;35m%s\\033[0m\\n" "You may want to install these now, then press ENTER to proceed" + printf "\\033[0;35m%s\\033[0m\\n" "or press ctrl-c to abort. Installation may take a while." + echo - # Wait for user input to continue. - # shellcheck disable=SC2034 - read -r answer > "${GHCUP_PROFILE_FILE}" - exit 0;; - [Nn]*) - exit 0;; - *) - echo "Please type YES or NO and press enter.";; - esac - done - fi + case $next_answer in + [Yy]*) + echo "source $GHCUP_INSTALL_BASE_PREFIX/.ghcup/env" >> "${GHCUP_PROFILE_FILE}" + exit 0;; + [Nn]*) + exit 0;; + *) + echo "Please type YES or NO and press enter.";; + esac + done fi )