-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_ffsconfiggenerator.sh
30 lines (30 loc) · 1.02 KB
/
setup_ffsconfiggenerator.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
setup_ffsconfiggenerator_config() {
if [ ! -d FfsConfigGenerator ]; then
pip2 install --upgrade netaddr
git clone https://github.com/freifunk-stuttgart/FfsConfigGenerator.git
cd FfsConfigGenerator
else
cd FfsConfigGenerator
git checkout -- config.json
git pull origin develop
fi
python -c '
import json, sys
GWID='$GWID'
GWSUBID='$GWSUBID'
fp = open("config.json","rb")
config = json.load(fp)
fp.close()
if ( "$GWID,$GWSUBID" not in config["gws"] ):
fp = open("config.json","wb")
config["gws"]["'$GWID','$GWSUBID'"] = {}
config["gws"]["'$GWID','$GWSUBID'"]["legacyipv4"] = "'$LEGIP'"
config["gws"]["'$GWID','$GWSUBID'"]["legacyipv6"] = "fd21:b4dc:4b1e::a38:'$GWLID'"
config["gws"]["'$GWID','$GWSUBID'"]["externalipv4"] = "'$EXT_IP_V4'"
config["gws"]["'$GWID','$GWSUBID'"]["externalipv6"] = "'$EXT_IPS_V6'"
config["gws"]["'$GWID','$GWSUBID'"]["ipv4start"] = "172.21.'$((4*$GWID))'.2"
config["gws"]["'$GWID','$GWSUBID'"]["ipv4end"] = "172.21.'$((4*$((GWID+1))-1))'.254"
json.dump(config, fp, indent=2)
fp.close()
'
}