#!/usr/bin/env bash # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ##@Version : 202207101834-git # @Author : Jason Hempstead # @Contact : jason@casjaysdev.com # @License : LICENSE.md # @ReadME : get-deno.sh --help # @Copyright : Copyright: (c) 2022 Jason Hempstead, Casjays Developments # @Created : Sunday, Jul 10, 2022 18:34 EDT # @File : get-deno.sh # @Description : Download binaries for amd64 and arm64 # @TODO : # @Other : # @Resource : # @sudo/root : no # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set bash options [ -n "$DEBUG" ] && set -x # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DENO_VERSION="${DENO_VERSION:-v1.26.1}" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "x86_64" ]; then ARCH="x86_64" CHANNEL="denoland" URL="https://github.com/denoland/deno/releases/download/$DENO_VERSION/deno-$ARCH-unknown-linux-gnu.zip" BIN_FILE="/usr/bin/deno" TMP_DIR="/tmp/deno-$ARCH" TMP_FILE="/tmp/deno-$ARCH.zip" elif [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then ARCH="arm64" CHANNEL="LukeChannings" URL="https://github.com/LukeChannings/deno-arm64/releases/download/$DENO_VERSION/deno-linux-$ARCH.zip" BIN_FILE="/usr/bin/deno" TMP_DIR="/tmp/deno-$ARCH" TMP_FILE="/tmp/deno-$ARCH.zip" else echo "Unsupported architecture" exit 1 fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo "grabbing deno $DENO_VERSION from $CHANNEL for $ARCH" if curl -q -LSsf -o "$TMP_FILE" "$URL" && [ -f "$TMP_FILE" ]; then mkdir -p "$TMP_DIR" && cd "$TMP_DIR" || exit 10 unzip "$TMP_FILE" cp -Rf "$TMP_DIR/deno" "$BIN_FILE" ls -lA "$BIN_FILE" "$TMP_DIR/deno" chmod -Rf 755 "$BIN_FILE" else echo "Failed to download deno from $URL" exitCode=2 fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rm -Rf "$TMP_FILE" "$TMP_DIR" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ -f "$BIN_FILE" ] && $BIN_FILE upgrade && exit 0 || exit 10 exit ${exitCode:-0}