2022-09-15 21:13:10 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# modified from https://github.com/foundry-rs/foundry/blob/master/foundryup/foundryup
|
|
|
|
|
2022-10-25 22:23:43 +00:00
|
|
|
REPO="a16z/helios"
|
|
|
|
NAME=helios
|
2022-09-15 21:13:10 +00:00
|
|
|
|
|
|
|
DIR=$HOME/.$NAME
|
|
|
|
BIN_DIR=$DIR/bin
|
|
|
|
|
|
|
|
# delete existing binaries
|
|
|
|
rm -f $BIN_DIR/$NAME
|
|
|
|
|
|
|
|
TAG=$(curl https://api.github.com/repos/$REPO/releases/latest | grep -o '"tag_name": "[^"]*' | grep -o '[^"]*$')
|
|
|
|
|
|
|
|
PLATFORM="$(uname -s)"
|
|
|
|
case $PLATFORM in
|
|
|
|
Linux)
|
|
|
|
PLATFORM="linux"
|
|
|
|
;;
|
|
|
|
Darwin)
|
|
|
|
PLATFORM="darwin"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
err "unsupported platform: $PLATFORM"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
ARCHITECTURE="$(uname -m)"
|
|
|
|
if [ "${ARCHITECTURE}" = "x86_64" ]; then
|
|
|
|
# Redirect stderr to /dev/null to avoid printing errors if non Rosetta.
|
|
|
|
if [ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" = "1" ]; then
|
|
|
|
ARCHITECTURE="arm64" # Rosetta.
|
|
|
|
else
|
|
|
|
ARCHITECTURE="amd64" # Intel.
|
|
|
|
fi
|
|
|
|
elif [ "${ARCHITECTURE}" = "arm64" ] ||[ "${ARCHITECTURE}" = "aarch64" ] ; then
|
|
|
|
ARCHITECTURE="arm64" # Arm.
|
|
|
|
else
|
|
|
|
ARCHITECTURE="amd64" # Amd.
|
|
|
|
fi
|
|
|
|
|
|
|
|
TARBALL_URL="https://github.com/$REPO/releases/download/${TAG}/${NAME}_${PLATFORM}_${ARCHITECTURE}.tar.gz"
|
|
|
|
curl -L $TARBALL_URL | tar -xzC $BIN_DIR
|
|
|
|
|
2022-11-30 01:31:25 +00:00
|
|
|
echo "Installed $NAME"
|