#!/bin/sh
#
# From https://github.com/commercialhaskell/stack/blob/master/.travis.yml

set -eux

travis_retry() {
  cmd=$*
  $cmd || (sleep 2 && $cmd) || (sleep 10 && $cmd)
}

fetch_stack_osx() {
  curl -skL https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
}

fetch_stack_linux() {
  curl -sL https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
}

case "$BUILD" in
  stack)
    mkdir -p ~/.local/bin;
    if [ `uname` = "Darwin" ]; then
      travis_retry fetch_stack_osx
    else
      travis_retry fetch_stack_linux
    fi;

    travis_retry stack --no-terminal setup --verbose;
    ;;
  cabal)
mkdir -p $HOME/.cabal
cat > $HOME/.cabal/config <<EOF
remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/
remote-repo-cache: $HOME/.cabal/packages
jobs: \$ncpus
EOF
;;
esac

#!/bin/sh
#
# From https://github.com/commercialhaskell/stack/blob/master/.travis.yml

set -eux

travis_retry() {
  cmd=$*
  $cmd || (sleep 2 && $cmd) || (sleep 10 && $cmd)
}

fetch_stack_osx() {
  curl -skL https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
}

fetch_stack_linux() {
  curl -sL https://github.com/commercialhaskell/stack/releases/download/v1.9.3/stack-1.9.3-linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
}

case "$BUILD" in
  stack)
    mkdir -p ~/.local/bin;
    if [ `uname` = "Darwin" ]; then
      travis_retry fetch_stack_osx
    else
      travis_retry fetch_stack_linux
    fi;

    travis_retry stack --no-terminal setup --verbose;
    ;;
  cabal)
mkdir -p $HOME/.cabal
cat > $HOME/.cabal/config <<EOF
remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/
remote-repo-cache: $HOME/.cabal/packages
jobs: \$ncpus
EOF
;;
esac

--- 
+++ 
@@ -14,7 +14,7 @@
 }
 
 fetch_stack_linux() {
-  curl -sL https://github.com/commercialhaskell/stack/releases/download/v1.9.3/stack-1.9.3-linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
+  curl -sL https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
 }
 
 case "$BUILD" in
Revert "Try with older stack."

This reverts commit d32c27e1810c2645497f76b1a73f87d93222127f.
