Last active
August 24, 2016 11:08
-
-
Save dreyks/3d54da3cdbed0e43995b81046cc4274a to your computer and use it in GitHub Desktop.
Install heroku client on a system with no sudo/su permissions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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