From de611e0d4ea6a6ed7524256b8714084fe2d0c5a8 Mon Sep 17 00:00:00 2001 From: Geoffrey Noel Date: Sat, 13 Jan 2024 14:03:22 -0500 Subject: [PATCH 1/2] Consider STACK_XDG env to determine the stack root path --- scripts/bootstrap/bootstrap-haskell | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap/bootstrap-haskell b/scripts/bootstrap/bootstrap-haskell index 7c2ca66b..c0e01639 100755 --- a/scripts/bootstrap/bootstrap-haskell +++ b/scripts/bootstrap/bootstrap-haskell @@ -738,6 +738,15 @@ ask_stack() { unset stack_answer } +find_stack_root() { + if [ -n "${STACK_ROOT}" ] ; then + echo "${STACK_ROOT}" + elif [ -n "${STACK_XDG}" ] ; then + echo "${XDG_DATA_HOME}/stack" + else + echo "${HOME}/.stack" + fi +} find_shell @@ -850,8 +859,9 @@ case $ask_stack_answer in ;; 2) (_eghcup --cache install stack) || die "Stack installation failed" - edo mkdir -p "${STACK_ROOT:-$HOME/.stack}"/hooks - hook_exe="${STACK_ROOT:-$HOME/.stack}"/hooks/ghc-install.sh + stack_root="$(find_stack_root)" + edo mkdir -p "${stack_root}"/hooks + hook_exe="${stack_root}"/hooks/ghc-install.sh hook_url="https://www.haskell.org/ghcup/sh/hooks/stack/ghc-install.sh" if [ -e "${hook_exe}" ] ; then From 8d6445c632babb79b5da4cfb3c639ee7b3982c32 Mon Sep 17 00:00:00 2001 From: Geoffrey Noel Date: Sat, 13 Jan 2024 18:35:37 -0500 Subject: [PATCH 2/2] Assume /home/gnoel/.local/share if XDG_DATA_HOME is not set --- scripts/bootstrap/bootstrap-haskell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap/bootstrap-haskell b/scripts/bootstrap/bootstrap-haskell index c0e01639..1d23bfc2 100755 --- a/scripts/bootstrap/bootstrap-haskell +++ b/scripts/bootstrap/bootstrap-haskell @@ -742,7 +742,7 @@ find_stack_root() { if [ -n "${STACK_ROOT}" ] ; then echo "${STACK_ROOT}" elif [ -n "${STACK_XDG}" ] ; then - echo "${XDG_DATA_HOME}/stack" + echo "${XDG_DATA_HOME:-$HOME/.local/share}/stack" else echo "${HOME}/.stack" fi