Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 78 lines (65 sloc) 1.85 KB
# Originally based on https://github.com/heroku/cli/blob/master/install-standalone.sh
# The ISC License (ISC)
# Copyright © Heroku 2017
#!/bin/bash
{
set -e
SUDO=''
if [ "$(id -u)" != "0" ]; then
SUDO='sudo'
echo "This script requires superuser access."
echo "You will be prompted for your password by sudo."
# clear any previous sudo permission
sudo -k
fi
CHANNEL="${1:-stable}"
# run inside sudo
$SUDO bash <<SCRIPT
set -e
echoerr() { echo "\$@" 1>&2; }
if [[ ! ":\$PATH:" == *":/usr/local/bin:"* ]]; then
echoerr "Your path is missing /usr/local/bin, you need to add this to use this installer."
exit 1
fi
if [ "\$(uname)" == "Darwin" ]; then
OS=darwin
elif [ "\$(expr substr \$(uname -s) 1 5)" == "Linux" ]; then
OS=linux
else
echoerr "This installer is only supported on Linux and MacOS"
exit 1
fi
ARCH="\$(uname -m)"
if [ "\$ARCH" == "x86_64" ]; then
ARCH=x64
elif [[ "\$ARCH" == arm* ]]; then
ARCH=arm
else
echoerr "unsupported arch: \$ARCH"
exit 1
fi
mkdir -p /usr/local/lib
cd /usr/local/lib
rm -rf fly
rm -rf ~/.local/share/fly/client
URL=https://get.fly.io/tarballs/$CHANNEL/fly-\$OS-\$ARCH.tar.gz
TAR_ARGS="xz"
echo "Installing CLI from \$URL"
if [ \$(command -v curl) ]; then
curl "\$URL" | tar "\$TAR_ARGS"
else
wget -O- "\$URL" | tar "\$TAR_ARGS"
fi
# delete old fly bin if exists
rm -f \$(command -v fly) || true
rm -f /usr/local/bin/fly
ln -s /usr/local/lib/fly/bin/fly /usr/local/bin/fly
# on alpine (and maybe others) the basic node binary does not work
# remove our node binary and fall back to whatever node is on the PATH
/usr/local/lib/fly/bin/node -v || rm /usr/local/lib/fly/bin/node
SCRIPT
# test the CLI
LOCATION=$(command -v fly)
echo "fly installed to $LOCATION"
fly version
}
You can’t perform that action at this time.