From c9c2b864fa265b44aa662716c12193da7c957754 Mon Sep 17 00:00:00 2001
From: Ian Douglas Scott <ian@iandouglasscott.com>
Date: Fri, 23 Jun 2017 12:32:02 -0700
Subject: [PATCH] ca-certificates package; needed by cargo

---
 cook.sh                           | 52 ++++++++++++++++++-------------
 recipes/ca-certificates/recipe.sh | 39 +++++++++++++++++++++++
 2 files changed, 69 insertions(+), 22 deletions(-)
 create mode 100644 recipes/ca-certificates/recipe.sh

diff --git a/cook.sh b/cook.sh
index 1e13b5d9f..b70b43826 100755
--- a/cook.sh
+++ b/cook.sh
@@ -48,35 +48,43 @@ function op {
             op $1 unprepare
             ;;
         fetch)
-            if [ -n "$TAR" ]
+            skip=0
+            if [ "$(type -t recipe_fetch)" = "function" ]
+            then
+                recipe_fetch
+            fi
+            if [ "$skip" -eq "0" ]
             then
-                if [ ! -f source.tar ]
+                if [ -n "$TAR" ]
                 then
-                    wget "$TAR" -O source.tar
-                fi
+                    if [ ! -f source.tar ]
+                    then
+                        wget "$TAR" -O source.tar
+                    fi
 
-                if [ ! -d source ]
-                then
-                    mkdir source
-                    tar xvf source.tar -C source --strip-components 1
-                fi
-            elif [ -n "$GIT" ]
-            then
-                if [ ! -d source ]
+                    if [ ! -d source ]
+                    then
+                        mkdir source
+                        tar xvf source.tar -C source --strip-components 1
+                    fi
+                elif [ -n "$GIT" ]
                 then
-                    if [ -n "$BRANCH" ]
+                    if [ ! -d source ]
                     then
-                        git clone --recursive "$GIT" -b "$BRANCH" source
-                    else
-                        git clone --recursive "$GIT" source
+                        if [ -n "$BRANCH" ]
+                        then
+                            git clone --recursive "$GIT" -b "$BRANCH" source
+                        else
+                            git clone --recursive "$GIT" source
+                        fi
                     fi
-                fi
 
-                pushd source > /dev/null
-                git pull
-                git submodule sync
-                git submodule update --init --recursive
-                popd > /dev/null
+                    pushd source > /dev/null
+                    git pull
+                    git submodule sync
+                    git submodule update --init --recursive
+                    popd > /dev/null
+                fi
             fi
             ;;
         unfetch)
diff --git a/recipes/ca-certificates/recipe.sh b/recipes/ca-certificates/recipe.sh
new file mode 100644
index 000000000..dc5a06b49
--- /dev/null
+++ b/recipes/ca-certificates/recipe.sh
@@ -0,0 +1,39 @@
+function recipe_fetch {
+    mkdir source
+    pushd source
+        curl -o make-ca.sh http://anduin.linuxfromscratch.org/BLFS/other/make-ca.sh-20170514
+        curl -o certdata.txt http://anduin.linuxfromscratch.org/BLFS/other/certdata.txt
+    popd
+    skip=1
+}
+
+function recipe_update {
+    curl -o make-ca.sh --time-cond make-ca.sh http://anduin.linuxfromscratch.org/BLFS/other/make-ca.sh-20170514
+    curl -o certdata.txt --time-cond certdata.txt http://anduin.linuxfromscratch.org/BLFS/other/certdata.txt
+    skip=1
+}
+
+function recipe_build {
+    rm -rf build
+    mkdir build
+    chmod +x ./make-ca.sh
+    ./make-ca.sh -D "$PWD/build"
+    skip=1
+}
+
+function recipe_test {
+    echo "skipping test"
+    skip=1
+}
+
+function recipe_clean {
+    rm -rf build
+    skip=1
+}
+
+function recipe_stage {
+    dest="$(realpath $1)"
+    mkdir -p "$1/ssl"
+    cp -rL build/etc/ssl/certs "$1/ssl"
+    skip=1
+}
-- 
GitLab