Skip to content

Instantly share code, notes, and snippets.

@dreyks
Last active August 24, 2016 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dreyks/3d54da3cdbed0e43995b81046cc4274a to your computer and use it in GitHub Desktop.
Save dreyks/3d54da3cdbed0e43995b81046cc4274a to your computer and use it in GitHub Desktop.
Install heroku client on a system with no sudo/su permissions
#!/bin/bash
{
HEROKU_CLIENT_URL="https://s3.amazonaws.com/assets.heroku.com/heroku-client/heroku-client.tgz"
LOCAL="$HOME/.local"
LOCAL_HEROKU="$LOCAL/heroku"
LOCAL_BIN="$LOCAL/bin"
echo "This will install heroku-client to $LOCAL_BIN"
echo "This script does NOT require superuser access"
# download and extract the client tarball
mkdir -p $LOCAL_BIN
rm -rf $LOCAL_HEROKU
mkdir -p $LOCAL_HEROKU
cd $LOCAL_HEROKU
if [ -z "$(which wget)" ]; then
curl -s $HEROKU_CLIENT_URL | tar xz
else
wget -qO- $HEROKU_CLIENT_URL | tar xz
fi
mv heroku-client/* .
rmdir heroku-client
ln -sfn $LOCAL_HEROKU/bin/heroku $LOCAL_BIN
# remind the user to add to $PATH
case "$PATH" in
*$LOCAL_BIN*)
;;
*)
echo "Add the Heroku CLI to your PATH using:"
echo "$ echo 'PATH=\"$LOCAL_BIN:\$PATH\"' >> ~/.bashrc"
;;
esac
echo "Installation complete"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment