From 5da92eac128f6ee42c399847779a54a12ce73a2a Mon Sep 17 00:00:00 2001
From: Manevolent <Manevolent@users.noreply.github.com>
Date: Mon, 24 Apr 2023 16:07:16 -0600
Subject: [PATCH] Update build.sh

---
 build.sh | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/build.sh b/build.sh
index f1c403b..d61c00f 100755
--- a/build.sh
+++ b/build.sh
@@ -99,8 +99,6 @@ do
     #  Build list of all peer IP addresses
     tinc_peers=$(cat $config_out/tinc/hosts/* | grep 'Subnet' | grep '/32' | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | sed -e ':a;N;$!ba;s/\n/,/g')
     sigil_vars=$(echo "$sigil_vars tinc_peers=$tinc_peers")
-    #  Fill out templates and remove them after
-    process_templates "$config_out/tinc/" "$sigil_vars"
     #  Copy private key
     cp -v /etc/lixonet/$netname/tinc.key $config_out/tinc/rsa_key.priv
     #  Set permissions for tinc scripts
@@ -112,8 +110,6 @@ do
     #  Copy all bird default files to /etc/(bird)
     find bird -type d | xargs -I '{}' mkdir --verbose -p $config_out/{}
     find bird -type f | sed -e "s@bird/@@g" | xargs -I '{}' cp --verbose bird/{} $config_out/bird/{}
-    #  Fill out templates and remove them after
-    process_templates "$config_out/bird/" "$sigil_vars"
 
     # BIND
     #  Remove existing configuration
@@ -121,8 +117,6 @@ do
     #  Copy all bind default files to /etc/(bind)
     find bind -type d | xargs -I '{}' mkdir --verbose -p $config_out/{}
     find bind -type f | sed -e "s@bind/@@g" | xargs -I '{}' cp --verbose bind/{} $config_out/bind/{}
-    #  Fill out templates and remove them after
-    process_templates "$config_out/bind/" "$sigil_vars"
 	
     # Wireguard
     if [ "${wg_enabled:-0}" -eq "1" ]; then
@@ -131,10 +125,11 @@ do
 	#  Copy all wireguard default files to /etc/(wireguard)
 	find wireguard -type d | xargs -I '{}' mkdir --verbose -p $config_out/{}
 	find wireguard -type f | sed -e "s@wireguard/@@g" | xargs -I '{}' cp --verbose wireguard/{} $config_out/wireguard/{}
-	#  Fill out templates and remove them after
-	process_templates "$config_out/wireguard/" "$sigil_vars"
     fi
     
+    # Process templates
+    process_templates "$config_out/" "$sigil_vars"
+    
     # Docker
     #  Copy templates and dependencies to directory
     mkdir docker/