From f6418e38678f25e4ab67d23771ca7858893f3839 Mon Sep 17 00:00:00 2001
From: sump pump <admin@example.com>
Date: Thu, 21 May 2020 21:40:40 +0000
Subject: [PATCH] Update build.sh

---
 build.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/build.sh b/build.sh
index 13d9821..136d67d 100644
--- a/build.sh
+++ b/build.sh
@@ -13,6 +13,7 @@ do
     unset git
     source $dir/lixonet.conf
     if [ -z "$git" ]; then echo "Missing 'git' variable in $dir/lixonet.conf"; exit 1; fi
+    sigil_vars=$(cat /etc/lixonet/${netname}/lixonet.conf | tr "\\n" " ")
 
     echo "Configuring Lixonet3 network $netname from $git..."
 
@@ -32,7 +33,7 @@ do
     find tinc -type d | sed -e "s@tinc@tinc/${netname}@g" | xargs -I '{}' mkdir --verbose -p /etc/{}
     find tinc -type f | sed -e "s@tinc/@@g" | xargs -I '{}' cp --verbose tinc/{} /etc/tinc/$netname/{}
     #  Fill out templates and remove them after
-    find /etc/tinc/$netname/ -type f -name '*.tmpl' -exec sh -c 'sigil -f {} -p $(cat /etc/lixonet/$netname/lixonet.conf | tr "\\n" " ") > "$(dirname {})/$(basename {} .tmpl)"' {} \;
+    find /etc/tinc/$netname/ -type f -name '*.tmpl' -exec sh -c 'sigil -f {} -p $sigil_vars > "$(dirname {})/$(basename {} .tmpl)"' {} \;
     find /etc/tinc/$netname/ -type f -name '*.tmpl' | xargs -I '{}' rm -f {}
     #  Copy private key
     cp /etc/lixonet/$netname/tinc.key /etc/tinc/$netname/rsa_key.priv
@@ -49,7 +50,7 @@ do
     find bird -type d | sed -e "s@bird@bird/${netname}@g" | xargs -I '{}' mkdir --verbose -p /etc/{}
     find tinc -type f | sed -e "s@bird/@@g" | xargs -I '{}' cp --verbose bird/{} /etc/bird/$netname/{}
     #  Fill out templates and remove them after
-    find /etc/bird/$netname/ -type f -name '*.tmpl' -exec sh -c 'sigil -f {} -p $(cat /etc/lixonet/$netname/lixonet.conf | tr "\\n" " ") > "$(dirname {})/$(basename {} .tmpl)"' {} \;
+    find /etc/bird/$netname/ -type f -name '*.tmpl' -exec sh -c 'sigil -f {} -p $sigil_vars > "$(dirname {})/$(basename {} .tmpl)"' {} \;
     find /etc/bird/$netname/ -type f -name '*.tmpl' | xargs -I '{}' rm -f {}
 
     #docker-compose up -d --build