Last active
August 29, 2015 13:56
-
-
Save netj/9065580 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
# Download and install 3X: a Workbench for eXecuting eXploratory eXperiments | |
# Usage: curl -s https://gist.github.com/netj/9065580/raw/get-3x | bash -s release=LATEST dest=~/bin | |
set -eu | |
# export any given definition as arguments | |
export "$@" | |
# defaults to downloading the LATEST release, installing at $HOME/bin/ | |
: ${release:=LATEST} ${dest:=~/bin} | |
system=`uname -s`-`uname -m` | |
package=3x-$release-$system.sh | |
# download the correct binary from GitHub | |
url=https://github.com/netj/3x/releases/download/$release/$package | |
echo "Downloading $url" | |
curl -RLO $url | |
# make it an executable | |
chmod +x $package | |
# install it | |
mkdir -p $dest | |
mv -f $package $dest/3x | |
# modify bash profile to setup PATH if necessary | |
[ $(type -p 3x) -ef $dest/3x ] || { | |
echo '# add '"$dest"' to PATH' | |
echo 'PATH='"$dest"':"$PATH"' | |
} >>~/.bash_profile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment