From 66c0d8e7e499d94f4a817c89ef394031c7ce0a53 Mon Sep 17 00:00:00 2001
From: Luke <git@luke.fastmail.us>
Date: Sat, 3 Jun 2023 18:18:36 -0700
Subject: [PATCH] Added logo protection to the build script

---
 0-builder                 | 33 +++++++++++++++++++++++++++++++++
 hostname/kusanagi.meta.sh | 12 ++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 hostname/kusanagi.meta.sh

diff --git a/0-builder b/0-builder
index d8e34e8..759f487 100644
--- a/0-builder
+++ b/0-builder
@@ -3,6 +3,26 @@ export IFS=$'\n'
 
 BASHRC_D="$HOME/.bashrc.d"
 COMPILED_SRC="$BASHRC_D/1-compiled"
+
+################################################################################
+# Setup the default build functions
+export __BUILDER__WORKING_DIR="$BASHRC_D"
+function __builder_prebuild { :; }
+function __builder_postbuild { :; }
+
+__builder_prebuild_exec() {
+	pushd $__BUILDER__WORKING_DIR >/dev/null; printf '\e[34m'; 
+	( __builder_prebuild; )
+	printf '\e[0m'; popd >/dev/null
+}
+
+__builder_postbuild_exec() {
+	pushd $__BUILDER__WORKING_DIR >/dev/null; printf '\e[34m'
+	( __builder_postbuild; )
+	printf '\e[0m'; popd >/dev/null
+}
+
+################################################################################
 echo "Rebuilding $COMPILED_SRC"
 
 echo """#!/bin/bash
@@ -10,6 +30,17 @@ echo """#!/bin/bash
 
 """ > $COMPILED_SRC
 
+
+HOST_SPECIFIC_META_SRC="$BASHRC_D/hostname/$(hostname).meta.sh"
+if [[ -e $HOST_SPECIFIC_META_SRC ]]; then
+	echo "Executing host specific config file $HOST_SPECIFIC_META_SRC"
+	source "$HOST_SPECIFIC_META_SRC"
+else
+	echo "No host specific file found at $HOST_SPECIFIC_META_SRC"
+fi
+
+__builder_prebuild_exec
+
 SELF_SRC=$(readlink -f $0)
 for F in $(find $BASHRC_D -maxdepth 1 -iname "*.sh"); do
 	echo "  Building in $F"
@@ -32,6 +63,7 @@ else
 	echo "No host specific file found at $HOST_SPECIFIC_SRC"
 fi
 
+
 echo "##################" >> $COMPILED_SRC
 echo "# Reloader Script" >> $COMPILED_SRC
 echo """##################
@@ -40,3 +72,4 @@ function __rebuild_bashrcd() {
 }
 """ >> $COMPILED_SRC
 
+__builder_postbuild_exec
diff --git a/hostname/kusanagi.meta.sh b/hostname/kusanagi.meta.sh
new file mode 100644
index 0000000..f7b1c6c
--- /dev/null
+++ b/hostname/kusanagi.meta.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+export IFS=$'\n'
+
+__builder_prebuild() {
+	set -x
+	ln -s logos/tachikoma-ref-b.png.sh ./logo.sh
+}
+
+__builder_postbuild() {
+	set -x
+	unlink logo.sh
+}
\ No newline at end of file