Update build.sh

This commit is contained in:
sump pump 2020-05-21 21:40:40 +00:00
parent 930af3e280
commit f6418e3867

View File

@ -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