@@ -42,33 +42,28 @@ check_packages ca-certificates curl dirmngr gpg gpg-agent
4242
4343# Normalize version tag format
4444case " ${VERSION} " in
45- latest | v* )
46- TAG=" $VERSION "
47- ;;
48- * )
49- TAG=" v${VERSION} "
50- ;;
45+ latest) TAG=" $( curl -s https://dl.deno.land/release-latest.txt) " ;;
46+ v* ) TAG=" ${VERSION} " ;;
47+ * ) TAG=" v${VERSION} " ;;
5148esac
5249
5350# Run installer as non-root user
5451# 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
52+ if ! deno --version > /dev/null; then
53+ echo " Installing Deno ${TAG} ..."
54+ su " ${_REMOTE_USER} " -c " curl -fsSL https://deno.land/install.sh | sh -s -- --yes ${TAG} "
6255fi
6356
57+ INSTALL_ENV=DENO_INSTALL
58+ INSTALL_DIR=" ${! INSTALL_ENV:- ${_REMOTE_USER_HOME} / .deno} "
59+ BIN_DIR=" ${INSTALL_DIR} /bin"
60+ EXE=" ${BIN_DIR} /deno"
61+
6462# Install global packages if specified
65- # See # See https://docs.deno.com/runtime/reference/cli/install/#global-installation
63+ # See https://docs.deno.com/runtime/reference/cli/install/#global-installation
6664if [ " ${# PACKAGES[@]} " -gt 0 ]; then
6765 echo " Installing global packages..."
68- su " ${_REMOTE_USER} " -c " ${ EXE} install --global --allow-net --allow-read ${PACKAGES} "
66+ su " ${_REMOTE_USER} " -c " $EXE install --global --allow-net --allow-read ${PACKAGES} "
6967fi
7068
71- # Clean up installer
72- rm -rf " ${INSTALLER} "
73-
7469echo " Done!"
0 commit comments