From 1fae8771f6ef1edb6ef97c6b3293956c1c544954 Mon Sep 17 00:00:00 2001
From: Duncan Coutts <duncan@haskell.org>
Date: Tue, 26 Aug 2008 23:34:00 +0000
Subject: [PATCH] Allow use of curl in bootstrap.sh Patch from jsnx. Fixes
 ticket #343. Also, use "cd blah; cd .." instead of "pushd blah; popd" as some
 shells lack pushd/popd

---
 bootstrap.sh | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/bootstrap.sh b/bootstrap.sh
index bf814b5095..bc9432941b 100644
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -15,23 +15,34 @@ CABAL_URL=${HACKAGE_URL}/Cabal/${CABAL_VER}/Cabal-${CABAL_VER}.tar.gz
 HTTP_URL=${HACKAGE_URL}/HTTP/${HTTP_VER}/HTTP-${HTTP_VER}.tar.gz
 ZLIB_URL=${HACKAGE_URL}/zlib/${ZLIB_VER}/zlib-${ZLIB_VER}.tar.gz
 
-wget ${CABAL_URL} ${HTTP_URL} ${ZLIB_URL}
+case `which wget curl` in
+  *curl)
+    curl -O ${CABAL_URL} -O ${HTTP_URL} -O ${ZLIB_URL}
+    ;;
+  *wget)
+    wget ${CABAL_URL} ${HTTP_URL} ${ZLIB_URL}
+    ;;
+  *)
+    echo "Failed to find a downloader, 'wget' or 'curl' is required" >&2
+    exit 2
+    ;;
+esac
 
 tar -zxf Cabal-${CABAL_VER}.tar.gz
-pushd Cabal-${CABAL_VER}
+cd Cabal-${CABAL_VER}
 ghc --make Setup
 ./Setup configure --user && ./Setup build && ./Setup install
-popd
+cd ..
 
 tar -zxf HTTP-${HTTP_VER}.tar.gz
-pushd HTTP-${HTTP_VER}
+cd HTTP-${HTTP_VER}
 runghc Setup configure --user && runghc Setup build && runghc Setup install
-popd
+cd ..
 
 tar -zxf zlib-${ZLIB_VER}.tar.gz
-pushd zlib-${ZLIB_VER}
+cd zlib-${ZLIB_VER}
 runghc Setup configure --user && runghc Setup build && runghc Setup install
-popd
+cd ..
 
 runghc Setup configure --user && runghc Setup build && runghc Setup install
 
-- 
GitLab