Skip to content

Commit d8f42c8

Browse files
authored
fix: fail to download and install (#4)
1 parent 37386ec commit d8f42c8

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

src/deno/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "deno",
33
"name": "Setup Deno",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"description": "Download, install, and setup specific version of Deno in your Dev Container.",
66
"documentationURL": "https://github.com/alertbox/feature-setup-deno/tree/main/src/deno",
77
"options": {

src/deno/install.sh

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,6 @@ rm -rf /var/lib/apt/lists/*
4040
# Install required dependencies
4141
check_packages ca-certificates curl dirmngr gpg gpg-agent
4242

43-
INSTALLER="install.sh"
44-
# Download the installer script
45-
echo "Downloading Deno installer..."
46-
curl "https://deno.land/${INSTALLER}" \
47-
--proto '=https' \
48-
--tlsv1.2 \
49-
-fsSLO \
50-
--compressed \
51-
--retry 5 || {
52-
echo "error: failed to download: ${TAG}"
53-
exit 1
54-
}
55-
56-
# Set installer permissions
57-
chmod +x "${INSTALLER}"
58-
5943
# Normalize version tag format
6044
case "${VERSION}" in
6145
latest | v*)
@@ -67,11 +51,15 @@ case "${VERSION}" in
6751
esac
6852

6953
# Run installer as non-root user
70-
echo "Installing Deno ${TAG}..."
71-
su "${_REMOTE_USER}" -c "./${INSTALLER} ${TAG}" || {
72-
echo "error: failed to install deno."
73-
exit 1
74-
}
54+
# If we don't already have Deno installed, install it now.
55+
if ! deno --version > /dev/null ; then
56+
echo "Installing Deno..."
57+
if [ "${DENO_VERSION}" = "latest" ]; then
58+
curl -fsSL https://deno.land/install.sh | sh
59+
else
60+
curl -fsSL https://deno.land/install.sh | sh -s ${TAG}
61+
fi
62+
fi
7563

7664
# Install global packages if specified
7765
# See # See https://docs.deno.com/runtime/reference/cli/install/#global-installation

0 commit comments

Comments
 (0)