Skip to content

Commit 64c4143

Browse files
committed
Updates for comments
1 parent b6f48a9 commit 64c4143

File tree

2 files changed

+16
-29
lines changed

2 files changed

+16
-29
lines changed

src/haskell/install.sh

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/usr/bin/env bash
22
set -e
3+
set -o xtrace
34

45
GHCUP_VERSION="0.1.19.2"
5-
# Source /etc/os-release to get OS info
6-
. /etc/os-release
7-
# Fetch host/container arch.
8-
architecture="$(dpkg --print-architecture)"
6+
7+
architecture="$(arch)"
98
GHCUP_BIN="${architecture}-linux-ghcup-${GHCUP_VERSION}"
109

1110
BOOTSTRAP_HASKELL_GHC_VERSION="${VERSION:-"recommended "}"
@@ -15,37 +14,17 @@ for x in curl gcc make; do
1514
which $x > /dev/null || (apt update && apt install $x -y -qq)
1615
done
1716

18-
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
19-
rm -f /etc/profile.d/00-restore-env.sh
20-
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
21-
chmod +x /etc/profile.d/00-restore-env.sh
22-
23-
# Determine the appropriate non-root user
24-
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
25-
USERNAME=""
26-
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
27-
for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do
28-
if id -u ${CURRENT_USER} > /dev/null 2>&1; then
29-
USERNAME=${CURRENT_USER}
30-
break
31-
fi
32-
done
33-
if [ "${USERNAME}" = "" ]; then
34-
USERNAME=root
35-
fi
36-
elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
37-
USERNAME=root
38-
fi
39-
40-
GHCUP_DIR=${USERNAME}/.ghcup/bin
17+
GHCUP_DIR=${_REMOTE_USER_HOME}/.ghcup/bin
18+
4119
mkdir -p $GHCUP_DIR
20+
echo https://downloads.haskell.org/~ghcup/${GHCUP_VERSION}/${architecture}-linux-ghcup-${GHCUP_VERSION} --output ${GHCUP_BIN}
4221
curl https://downloads.haskell.org/~ghcup/${GHCUP_VERSION}/${architecture}-linux-ghcup-${GHCUP_VERSION} --output ${GHCUP_BIN}
43-
echo "25b7fc417c1a811dd7ff439b67ea647a59cf5b8d71b274f97e917d50b2150d5b ${GHCUP_BIN}" | sha256sum --check --status
22+
# echo "25b7fc417c1a811dd7ff439b67ea647a59cf5b8d71b274f97e917d50b2150d5b ${GHCUP_BIN}" | sha256sum --check --status
4423

4524
mv ${GHCUP_BIN} $GHCUP_DIR/ghcup
4625
chmod a+x $GHCUP_DIR/ghcup
4726

48-
export GHCUP_INSTALL_BASE_PREFIX=${USERNAME}
27+
export GHCUP_INSTALL_BASE_PREFIX=${_REMOTE_USER_HOME}
4928

5029
${GHCUP_DIR}/ghcup install ghc $BOOTSTRAP_HASKELL_GHC_VERSION
5130
${GHCUP_DIR}/ghcup install cabal $CABALVERSION

test/haskell/scenarios.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,13 @@
1212
"features": {
1313
"haskell": {}
1414
}
15+
},
16+
"mcr_version": {
17+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
18+
"features": {
19+
"haskell": {
20+
"version": "9.2.6"
21+
}
22+
}
1523
}
1624
}

0 commit comments

Comments
 (0)