Created
March 15, 2016 16:41
-
-
Save jcoene/017cce30e4fc4d9b4c1d to your computer and use it in GitHub Desktop.
glide-install
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 | |
set -e | |
# You can override GLIDE_VERSION to get a different version | |
GLIDE_VERSION=${GLIDE_VERSION:-0.9.3} | |
# Try to auto-detect kernel and arch | |
KERNEL=`uname -s | awk '{print tolower($0)}'` | |
ARCH=`uname -m` | |
case $ARCH in | |
i386) | |
ARCH=386 | |
;; | |
x86_64) | |
ARCH=amd64 | |
;; | |
*) | |
echo "Warning: unknown arch $ARCH" | |
esac | |
GLIDE_URL="https://github.com/Masterminds/glide/releases/download/$GLIDE_VERSION/glide-$GLIDE_VERSION-$KERNEL-$ARCH.tar.gz" | |
# Make sure we have a GOPATH | |
if [ -z $GOPATH ]; then | |
echo "Fatal: GOPATH is not set" | |
exit 1 | |
fi | |
# Make sure $GOPATH/bin exists | |
if [ ! -d ${GOPATH}/bin ]; then | |
echo "Creating ${GOPATH}/bin..." | |
mkdir $GOPATH/bin | |
fi | |
# Download and install glide if needed | |
if [ ! -f $GOPATH/bin/glide ]; then | |
echo "Downloading glide from $GLIDE_URL..." | |
curl -s -L $GLIDE_URL | tar zxv -C $GOPATH/bin --strip-components=1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment