detals-check-generate-matrix.sh 877 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. curl "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/serverlist.csv" | grep -v '^[[:blank:]]*$' > serverlist.csv
  3. echo -n "{" > "shortnamearray.json"
  4. echo -n "\"include\":[" >> "shortnamearray.json"
  5. while read -r line; do
  6. shortname=$(echo "$line" | awk -F, '{ print $1 }')
  7. export shortname
  8. servername=$(echo "$line" | awk -F, '{ print $2 }')
  9. export servername
  10. gamename=$(echo "$line" | awk -F, '{ print $3 }')
  11. export gamename
  12. distro=$(echo "$line" | awk -F, '{ print $4 }')
  13. export distro
  14. echo -n "{" >> "shortnamearray.json"
  15. echo -n "\"shortname\":" >> "shortnamearray.json"
  16. echo -n "\"${shortname}\"" >> "shortnamearray.json"
  17. echo -n "}," >> "shortnamearray.json"
  18. done < serverlist.csv
  19. sed -i '$ s/.$//' "shortnamearray.json"
  20. echo -n "]" >> "shortnamearray.json"
  21. echo -n "}" >> "shortnamearray.json"
  22. rm serverlist.csv