-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathgenerate-dockerfiles.sh
More file actions
executable file
·25 lines (22 loc) · 921 Bytes
/
generate-dockerfiles.sh
File metadata and controls
executable file
·25 lines (22 loc) · 921 Bytes
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
#!/bin/bash
curl -O "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/serverlist.csv"
echo -n "{" > "shortnamearray.json"
echo -n "\"include\":[" >> "shortnamearray.json"
while read -r line; do
shortname=$(echo "$line" | awk -F, '{ print $1 }')
export shortname
servername=$(echo "$line" | awk -F, '{ print $2 }')
export servername
gamename=$(echo "$line" | awk -F, '{ print $3 }')
export gamename
distro=$(echo "$line" | awk -F, '{ print $4 }')
export distro
touch "dockerfiles/Dockerfile-${shortname}"
echo "Generating Dockerfile-${shortname} (${gamename})"
jinjanate Dockerfile.j2 > "dockerfiles/Dockerfile-${shortname}"
{ printf '{"shortname":"%s"},' "$shortname"; } >> "shortnamearray.json"
done < <(tail -n +2 serverlist.csv)
sed -i '$ s/.$//' "shortnamearray.json"
echo -n "]" >> "shortnamearray.json"
echo -n "}" >> "shortnamearray.json"
rm serverlist.csv