lixonet-ee/build.sh

24 lines
817 B
Bash
Raw Normal View History

2020-04-27 21:01:19 +00:00
#!/bin/ash
2020-04-27 20:08:55 +00:00
# Tinc
# Remove existing configuration
2020-04-27 20:36:33 +00:00
rm -v -rf /etc/tinc/*
2020-04-27 20:56:40 +00:00
# Copy all tinc default files to /etc/(tinc)
2020-04-27 20:34:45 +00:00
find tinc -type d | xargs -I '{}' mkdir --verbose -p /etc/{}
2020-04-27 20:56:40 +00:00
find tinc -type f | xargs -I '{}' cp --verbose {} /etc/{}
# Fill out templates and remove them after
2020-04-27 22:08:29 +00:00
find /etc/tinc/ -type f -name '*.tmpl' -exec sh -c 'sigil -f {} -p $(cat /etc/lixonet/lixonet.conf | tr "\\n" " ") > "$(dirname {})/$(basename {} .tmpl)"' {} \;
find /etc/tinc/ -type f -name '*.tmpl' | xargs -I '{}' rm -f {}
2020-04-27 20:56:40 +00:00
# Copy private key
cp /etc/lixonet/tinc.key /etc/tinc/rsa_key.priv
2020-04-28 00:17:03 +00:00
# Set permissions for tinc scripts
chmod +x /etc/tinc/lixonet/tinc-up
chmod +x /etc/tinc/lixonet/tinc-down
2020-04-28 00:17:03 +00:00
chmod +x /etc/tinc/lixonet/subnet-up
chmod +x /etc/tinc/lixonet/subnet-down
# Bird
rm -rf /etc/bird/*
2020-04-27 20:08:55 +00:00
docker-compose up -d --build