From 604083e17a89c558f1714ae044092660e8fa6c6e Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Sat, 10 Sep 2016 19:23:49 +0100
Subject: [PATCH] Separate clones of static blog themes

---
 src/freedombone-app-blogstatic | 76 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 35 deletions(-)

diff --git a/src/freedombone-app-blogstatic b/src/freedombone-app-blogstatic
index 011815497..dd87c323a 100755
--- a/src/freedombone-app-blogstatic
+++ b/src/freedombone-app-blogstatic
@@ -168,39 +168,7 @@ function create_pelican_publish_conf {
     echo 'DELETE_OUTPUT_DIRECTORY = True' >> $STATIC_BLOG_FILE
 }
 
-function mesh_install_blogstatic {
-    if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
-        return
-    fi
-
-    chroot "$rootdir" apt-get -y install python-pip
-    chroot "$rootdir" pip install ipython
-    chroot "$rootdir" pip install Markdown
-    chroot "$rootdir" pip install typogrify
-    chroot "$rootdir" pip install pelican
-
-    STATIC_BLOG_INSTALL_DIR=/home/$MY_USERNAME/CreateBlog
-    STATIC_BLOG_PATH=/home/$MY_USERNAME/Public/Blog
-
-    if [ ! -d $rootdir$STATIC_BLOG_INSTALL_DIR ]; then
-        mkdir -p $rootdir$STATIC_BLOG_INSTALL_DIR
-    fi
-
-    if [ ! -d $rootdir$STATIC_BLOG_PATH ]; then
-        mkdir -p $rootdir$STATIC_BLOG_PATH
-    fi
-
-    if [ ! -d $rootdir$STATIC_BLOG_INSTALL_DIR/content/images ]; then
-        mkdir -p $rootdir$STATIC_BLOG_INSTALL_DIR/content/images
-    fi
-
-    create_pelican_conf $rootdir$STATIC_BLOG_INSTALL_DIR/pelicanconf.py
-    create_pelican_makefile $rootdir$STATIC_BLOG_INSTALL_DIR/Makefile
-    create_pelican_publish_conf $rootdir$STATIC_BLOG_INSTALL_DIR/publishconf.py
-
-    mkdir -p $rootdir$STATIC_BLOG_INSTALL_DIR/themes
-    cd $rootdir$STATIC_BLOG_INSTALL_DIR/themes
-
+function blogstatic_themes {
     # Clone themes separately because the themes repo sometimes has bad refs
     git clone https://github.com/KenMercusLai/BT3-Flat
     git clone https://github.com/abr4xas/Casper2Pelican
@@ -273,6 +241,41 @@ function mesh_install_blogstatic {
     git clone https://github.com/samael500/w3-personal-blog
     git clone https://github.com/jarv/water-iris
     git clone https://github.com/kplaube/yapeme
+}
+
+function mesh_install_blogstatic {
+    if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
+        return
+    fi
+
+    chroot "$rootdir" apt-get -y install python-pip
+    chroot "$rootdir" pip install ipython
+    chroot "$rootdir" pip install Markdown
+    chroot "$rootdir" pip install typogrify
+    chroot "$rootdir" pip install pelican
+
+    STATIC_BLOG_INSTALL_DIR=/home/$MY_USERNAME/CreateBlog
+    STATIC_BLOG_PATH=/home/$MY_USERNAME/Public/Blog
+
+    if [ ! -d $rootdir$STATIC_BLOG_INSTALL_DIR ]; then
+        mkdir -p $rootdir$STATIC_BLOG_INSTALL_DIR
+    fi
+
+    if [ ! -d $rootdir$STATIC_BLOG_PATH ]; then
+        mkdir -p $rootdir$STATIC_BLOG_PATH
+    fi
+
+    if [ ! -d $rootdir$STATIC_BLOG_INSTALL_DIR/content/images ]; then
+        mkdir -p $rootdir$STATIC_BLOG_INSTALL_DIR/content/images
+    fi
+
+    create_pelican_conf $rootdir$STATIC_BLOG_INSTALL_DIR/pelicanconf.py
+    create_pelican_makefile $rootdir$STATIC_BLOG_INSTALL_DIR/Makefile
+    create_pelican_publish_conf $rootdir$STATIC_BLOG_INSTALL_DIR/publishconf.py
+
+    mkdir -p $rootdir$STATIC_BLOG_INSTALL_DIR/themes
+    cd $rootdir$STATIC_BLOG_INSTALL_DIR/themes
+    blogstatic_themes
 
     #git clone --recursive $PELICAN_PLUGINS_REPO $rootdir$STATIC_BLOG_INSTALL_DIR/plugins
 
@@ -315,8 +318,11 @@ function install_blogstatic {
     create_pelican_makefile $STATIC_BLOG_INSTALL_DIR/Makefile
     create_pelican_publish_conf $STATIC_BLOG_INSTALL_DIR/publishconf.py
 
-    git clone --recursive $PELICAN_THEMES_REPO $STATIC_BLOG_INSTALL_DIR/themes
-    git clone --recursive $PELICAN_PLUGINS_REPO $STATIC_BLOG_INSTALL_DIR/plugins
+    mkdir -p $PELICAN_THEMES_REPO $STATIC_BLOG_INSTALL_DIR/themes
+    cd $PELICAN_THEMES_REPO $STATIC_BLOG_INSTALL_DIR/themes
+    blogstatic_themes
+
+    #git clone --recursive $PELICAN_PLUGINS_REPO $STATIC_BLOG_INSTALL_DIR/plugins
 
     chown -R $MY_USERNAME:$MY_USERNAME $STATIC_BLOG_INSTALL_DIR
     chown -R www-data:www-data $STATIC_BLOG_PATH
-- 
GitLab