Skip to content

Instantly share code, notes, and snippets.

@blacktaxi
Created September 29, 2015 17:06
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 blacktaxi/f774bd33ddd2ca7864e9 to your computer and use it in GitHub Desktop.
Save blacktaxi/f774bd33ddd2ca7864e9 to your computer and use it in GitHub Desktop.
stack bootstrapper
#!/bin/bash
which stack > /dev/null
if [ $? -ne 0 ]; then
if [ ! -f ./.stack/stack ]; then
OS=`uname`
if [ $OS == "Darwin" ]; then
STACK_URL=https://github.com/commercialhaskell/stack/releases/download/v0.1.3.1/stack-0.1.3.1-x86_64-osx.gz
elif [ $OS == "Linux" ]; then
STACK_URL=https://github.com/commercialhaskell/stack/releases/download/v0.1.3.1/stack-0.1.3.1-x86_64-linux.gz
else
echo "The OS $OS is not supported."
exit 1
fi
echo "Downloading stack..."
mkdir -p .stack
touch ./.stack/stack
wget -qO- $STACK_URL --no-check-certificate | gunzip -dc > ./.stack/stack
if [ $? -ne 0 ]; then
echo Could not download stack.
rm -f ./.stack/stack
exit 1
fi
chmod a+x ./.stack/stack
fi
./.stack/stack $*
else
stack $*
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment