2020-04-27 21:01:19 +00:00
|
|
|
#!/bin/ash
|
2020-04-27 20:08:55 +00:00
|
|
|
|
Update build.sh, README.md, bird/bird.conf.tmpl, tinc/subnet-down.tmpl, tinc/subnet-up.tmpl, tinc/tinc-up.tmpl, tinc/tinc.conf.tmpl, docker-compose.yml files
Deleted gortr/roas.json, tinc/lixonet/hosts/daltx_nurd_lixo, tinc/lixonet/hosts/denco_mane_lixo, tinc/lixonet/hosts/inwwv_nurd_lixo, tinc/lixonet/hosts/lkwco_mane_lixo, tinc/lixonet/hosts/manva_nurd_lixo, tinc/lixonet/subnet-down.tmpl, tinc/lixonet/subnet-up.tmpl, tinc/lixonet/tinc-up.tmpl, tinc/lixonet/tinc.conf.tmpl, bird/rpki/hosts/denco_mane_lixo, bird/rpki/known_hosts, bird/neighbors/daltx_nurd_lixo, bird/neighbors/denco_mane_lixo, bird/neighbors/glaz_nurd_lixo, bird/neighbors/lkwco_mane_lixo, bird/neighbors/phxaz_nurd_lixo files
2020-05-21 21:22:04 +00:00
|
|
|
topdir=`pwd`
|
|
|
|
|
2020-05-21 21:27:20 +00:00
|
|
|
for dir in `find /etc/lixonet/* -type d -maxdepth 0`
|
Update build.sh, README.md, bird/bird.conf.tmpl, tinc/subnet-down.tmpl, tinc/subnet-up.tmpl, tinc/tinc-up.tmpl, tinc/tinc.conf.tmpl, docker-compose.yml files
Deleted gortr/roas.json, tinc/lixonet/hosts/daltx_nurd_lixo, tinc/lixonet/hosts/denco_mane_lixo, tinc/lixonet/hosts/inwwv_nurd_lixo, tinc/lixonet/hosts/lkwco_mane_lixo, tinc/lixonet/hosts/manva_nurd_lixo, tinc/lixonet/subnet-down.tmpl, tinc/lixonet/subnet-up.tmpl, tinc/lixonet/tinc-up.tmpl, tinc/lixonet/tinc.conf.tmpl, bird/rpki/hosts/denco_mane_lixo, bird/rpki/known_hosts, bird/neighbors/daltx_nurd_lixo, bird/neighbors/denco_mane_lixo, bird/neighbors/glaz_nurd_lixo, bird/neighbors/lkwco_mane_lixo, bird/neighbors/phxaz_nurd_lixo files
2020-05-21 21:22:04 +00:00
|
|
|
# Pop directory
|
|
|
|
cd $topdir
|
|
|
|
|
|
|
|
dir=${dir%*/} # remove the trailing "/"
|
|
|
|
netname=${dir##*/} # print everything after the final "/"
|
|
|
|
|
|
|
|
# Load relevant environment variables from lixonet.conf
|
|
|
|
unset git
|
|
|
|
source $dir/lixonet.conf
|
|
|
|
|
|
|
|
echo "Configuring Lixonet3 network $netname from $git..."
|
|
|
|
|
|
|
|
# Clone and enter the repository
|
|
|
|
git clone $git
|
|
|
|
cd "$(basename "$git" .git)"
|
|
|
|
|
|
|
|
# Copy default files
|
|
|
|
cp -r ../tinc/* tinc/
|
|
|
|
cp -r ../bird/* bird/
|
|
|
|
|
|
|
|
# Tinc
|
|
|
|
# Remove existing configuration
|
|
|
|
rm -v -rf /etc/tinc/$netname/*
|
|
|
|
# Copy all tinc default files to /etc/(tinc)
|
|
|
|
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@tinc/${netname}@g" | xargs -I '{}' cp --verbose {} /etc/{}
|
|
|
|
# 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' | xargs -I '{}' rm -f {}
|
|
|
|
# Copy private key
|
|
|
|
cp /etc/lixonet/$netname/tinc.key /etc/tinc/$netname/rsa_key.priv
|
|
|
|
# Set permissions for tinc scripts
|
|
|
|
chmod +x /etc/tinc/$netname/tinc-up
|
|
|
|
chmod +x /etc/tinc/$netname/tinc-down
|
|
|
|
chmod +x /etc/tinc/$netname/subnet-up
|
|
|
|
chmod +x /etc/tinc/$netname/subnet-down
|
|
|
|
|
|
|
|
# Bird
|
|
|
|
# Remove existing configuration
|
|
|
|
rm -v -rf /etc/bird/$netname/*
|
|
|
|
# Copy all tinc default files to /etc/(bird)
|
|
|
|
find bird -type d | sed -e "s@bird@bird/${netname}@g" | xargs -I '{}' mkdir --verbose -p /etc/{}
|
|
|
|
find bird -type f | sed -e "s@bird@bird/${netname}@g" | xargs -I '{}' cp --verbose {} /etc/{}
|
|
|
|
# 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' | xargs -I '{}' rm -f {}
|
|
|
|
|
|
|
|
#docker-compose up -d --build
|
|
|
|
done
|