From c0daf481abaa537e638749e3c88fc146f803ec21 Mon Sep 17 00:00:00 2001 From: Gerwin Klein Date: Mon, 13 May 2024 18:13:17 +1000 Subject: [PATCH] make ghcup install available everywhere Signed-off-by: Gerwin Klein --- dockerfiles/l4v.Dockerfile | 2 -- scripts/camkes.sh | 1 + scripts/l4v.sh | 3 +++ scripts/utils/user.sh | 6 ++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dockerfiles/l4v.Dockerfile b/dockerfiles/l4v.Dockerfile index 75f9880..899e75c 100644 --- a/dockerfiles/l4v.Dockerfile +++ b/dockerfiles/l4v.Dockerfile @@ -30,5 +30,3 @@ RUN /bin/bash /tmp/l4v.sh \ && apt-get clean autoclean \ && apt-get autoremove --purge --yes \ && rm -rf /var/lib/apt/lists/* - -ENV PATH "${PATH}:/opt/mlton/bin" diff --git a/scripts/camkes.sh b/scripts/camkes.sh index 92fa7c2..c8878d2 100644 --- a/scripts/camkes.sh +++ b/scripts/camkes.sh @@ -92,6 +92,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_H # shellcheck disable=SC1091 source "$GHCUP_INSTALL_BASE_PREFIX/.ghcup/env" +echo "export GHCUP_INSTALL_BASE_PREFIX=/opt/ghcup" >> "$HOME/.bashrc" echo "source $GHCUP_INSTALL_BASE_PREFIX/.ghcup/env" >> "$HOME/.bashrc" as_root rm -f "$GHCUP_INSTALL_BASE_PREFIX"/.ghcup/cache/* diff --git a/scripts/l4v.sh b/scripts/l4v.sh index a5e680d..d2fc2f8 100644 --- a/scripts/l4v.sh +++ b/scripts/l4v.sh @@ -7,6 +7,9 @@ set -exuo pipefail +# make sure PATH etc is set up +source "$HOME/.bashrc" + # Source common functions DIR="${BASH_SOURCE%/*}" test -d "$DIR" || DIR=$PWD diff --git a/scripts/utils/user.sh b/scripts/utils/user.sh index fddd5ab..be3d381 100644 --- a/scripts/utils/user.sh +++ b/scripts/utils/user.sh @@ -108,10 +108,13 @@ grep "export" /root/.bashrc >> "/home/${UNAME}/.bashrc" # Note that this block does not do parameter expansion, so will be # copied verbatim into the user's .bashrc. # We use this to ensure they have the repo program in their path, +# that they pick up any potentially present Haskell installation, # and to ensure they start in the /host dir (aka, their own file # path) cat << 'EOF' >> "/home/${UNAME}/.bashrc" export PATH=/scripts/repo:$PATH +export GHCUP_INSTALL_BASE_PREFIX=/opt/ghcup +[ -r /opt/ghcup/.ghcup/env ] && source /opt/ghcup/.ghcup/env cd /host EOF @@ -128,6 +131,9 @@ chown -R "$chown_setting" /isabelle # Isabelle expects a home dir folder. ln -s /isabelle "/home/${UNAME}/.isabelle" +# Make Haskell installation writable if it exists +[ -d /opt/ghcup ] && chown -R "${UNAME}" /opt/ghcup + # Make sure the user owns their home dir chown -R "$chown_setting" "/home/${UNAME}" chmod -R ug+rw "/home/${UNAME}"