From f1e261f8683e9a986381226a242d6945b67284b4 Mon Sep 17 00:00:00 2001
From: Ian Douglas Scott <ian@iandouglasscott.com>
Date: Wed, 29 Mar 2017 12:10:41 -0700
Subject: [PATCH] Support downloading tar archive, instead of git repo

---
 cook.sh | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/cook.sh b/cook.sh
index 6736008f1..68520818a 100755
--- a/cook.sh
+++ b/cook.sh
@@ -48,19 +48,41 @@ function op {
             op $1 unfetch
             ;;
         fetch)
-            if [ ! -d build ]
+            if [ -z "$GIT" ]
             then
-                git clone --recursive "$GIT" build
+                if [ ! -f "$(basename "$SRC")" ]
+                then
+                    wget "$SRC"
+                fi
+
+                rm -rf build
+                tar xvf "$(basename "$SRC")"
+                mv "$DIR" build
+	    else
+                if [ ! -d build ]
+                then
+                    git clone --recursive "$GIT" build
+                fi
+
+                pushd build > /dev/null
+                git pull
+                git submodule sync
+                git submodule update --init --recursive
+                popd > /dev/null
+            fi
+
+            if [ -f "patch" ]
+            then
+	        patch -p1 -d build < patch
             fi
 
-            pushd build > /dev/null
-            git pull
-            git submodule sync
-            git submodule update --init --recursive
-            popd > /dev/null
             ;;
         unfetch)
             rm -rfv build
+            if [ ! -z "$SRC" ]
+            then
+                rm -f "$(basename "$SRC")"
+            fi
             ;;
         version)
             pushd build > /dev/null
-- 
GitLab