install.sh

 1#!/bin/sh
 2# Adapted from the Deno installer: Copyright 2019 the Deno authors. All rights reserved. MIT license.
 3# Ref: https://github.com/denoland/deno_install
 4# TODO(everyone): Keep this script simple and easily auditable.
 5
 6# TODO(mf): this should work on Linux and macOS. Not intended for Windows.
 7
 8set -e
 9
10os=$(uname -s | tr '[:upper:]' '[:lower:]')
11arch=$(uname -m)
12
13if [ "$arch" = "aarch64" ]; then
14	arch="arm64"
15fi
16
17if [ $# -eq 0 ]; then
18	goose_uri="https://github.com/pressly/goose/releases/latest/download/goose_${os}_${arch}"
19else
20	goose_uri="https://github.com/pressly/goose/releases/download/${1}/goose_${os}_${arch}"
21fi
22
23goose_install="${GOOSE_INSTALL:-/usr/local}"
24bin_dir="${goose_install}/bin"
25exe="${bin_dir}/goose"
26
27if [ ! -d "${bin_dir}" ]; then
28	mkdir -p "${bin_dir}"
29fi
30
31curl --silent --show-error --location --fail --location --output "${exe}" "$goose_uri"
32chmod +x "${exe}"
33
34echo "Goose was installed successfully to ${exe}"
35if command -v goose >/dev/null; then
36	echo "Run 'goose --help' to get started"
37fi