Skip to content

Instantly share code, notes, and snippets.

@jcoene
Created March 15, 2016 16:41
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 jcoene/017cce30e4fc4d9b4c1d to your computer and use it in GitHub Desktop.
Save jcoene/017cce30e4fc4d9b4c1d to your computer and use it in GitHub Desktop.
glide-install
#!/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