urbit/sh/travis-install-stack
2019-12-11 20:11:51 -08:00

46 lines
765 B
Bash
Executable File

#!/usr/bin/env bash
set -ex
##
## Make sure this is running OSX/Linux in Travis
##
os="$TRAVIS_OS_NAME"
[ "$os" = osx ] || [ "$os" = linux ]
##
## Download the stack executable.
##
mkdir -p ~/.local/bin
stackurl="https://get.haskellstack.org/stable/$os-x86_64.tar.gz"
case $os in
osx)
curl -L "$stackurl" |
tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
;;
linux)
mkdir -p tmp
curl -L "$stackurl" | tar xz -C tmp
mv tmp/stack-*/stack ~/.local/bin
;;
esac
##
## Use the more reliable S3 mirror of Hackage.
##
mkdir -p ~/.cabal
cat > ~/.cabal/config <<EOF
remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/
remote-repo-cache: $HOME/.cabal/packages
EOF