From 69969857ba807c528530cc081e7647f2bce72aa5 Mon Sep 17 00:00:00 2001 From: b13rg <13488329+B13rg@users.noreply.github.com> Date: Wed, 18 Sep 2024 18:23:14 -0700 Subject: [PATCH 1/6] set pyenv version --- .python-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .python-version diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..8531a3b --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12.2 From 39adcbbf3828ad54a3408ba75e53a97fc240b356 Mon Sep 17 00:00:00 2001 From: b13rg <13488329+B13rg@users.noreply.github.com> Date: Wed, 18 Sep 2024 18:23:45 -0700 Subject: [PATCH 2/6] add yq for json parsing for build planning --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index bcd1cb9..a9c1158 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ jinjanator +yq From 5af2d63a4a0ad42af8174f11cd7ec5eaa554251e Mon Sep 17 00:00:00 2001 From: b13rg <13488329+B13rg@users.noreply.github.com> Date: Wed, 18 Sep 2024 19:15:05 -0700 Subject: [PATCH 3/6] adjust how dockerfile vars are fetched and recalled --- Dockerfile.j2 | 10 +- data/serverlist.csv | 137 +++++++ data/shortnamearray.json | 820 +++++++++++++++++++++++++++++++++++++++ generate-dockerfiles.sh | 29 +- 4 files changed, 977 insertions(+), 19 deletions(-) create mode 100644 data/serverlist.csv create mode 100644 data/shortnamearray.json diff --git a/Dockerfile.j2 b/Dockerfile.j2 index 41a6236..877a81d 100644 --- a/Dockerfile.j2 +++ b/Dockerfile.j2 @@ -1,18 +1,18 @@ # -# LinuxGSM {{ gamename }} Dockerfile +# LinuxGSM {{ game.gamename }} Dockerfile # # https://github.com/GameServerManagers/docker-gameserver # -FROM gameservermanagers/linuxgsm:{{ distro }} +FROM gameservermanagers/linuxgsm:{{ game.distro }} LABEL maintainer="LinuxGSM " -ARG SHORTNAME={{ shortname }} -ENV GAMESERVER={{ shortname }}server +ARG SHORTNAME={{ game.shortname }} +ENV GAMESERVER={{ game.shortname }}server WORKDIR /app ## Auto install game server requirements -RUN depshortname=$(curl --connect-timeout 10 -s https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/{{ distro }}.csv |awk -v shortname="{{ shortname }}" -F, '$1==shortname {$1=""; print $0}') \ +RUN depshortname=$(curl --connect-timeout 10 -s https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/{{ game.distro }}.csv |awk -v shortname="{{ game.shortname }}" -F, '$1==shortname {$1=""; print $0}') \ && if [ -n "${depshortname}" ]; then \ echo "**** Install ${depshortname} ****" \ && apt-get update \ diff --git a/data/serverlist.csv b/data/serverlist.csv new file mode 100644 index 0000000..ae270f9 --- /dev/null +++ b/data/serverlist.csv @@ -0,0 +1,137 @@ +shortname,gameservername,gamename,os +ac,acserver,Assetto Corsa,ubuntu-22.04 +ahl,ahlserver,Action Half-Life,ubuntu-22.04 +ahl2,ahl2server,Action: Source,ubuntu-20.04 +ark,arkserver,ARK: Survival Evolved,ubuntu-22.04 +arma3,arma3server,ARMA 3,ubuntu-22.04 +armar,armarserver,Arma Reforger,ubuntu-20.04 +ats,atsserver,American Truck Simulator,ubuntu-22.04 +av,avserver,Avorion,ubuntu-22.04 +bb,bbserver,BrainBread,ubuntu-22.04 +bb2,bb2server,BrainBread 2,ubuntu-22.04 +bd,bdserver,Base Defense,ubuntu-22.04 +bf1942,bf1942server,Battlefield 1942,ubuntu-22.04 +bfv,bfvserver,Battlefield: Vietnam,ubuntu-22.04 +bmdm,bmdmserver,Black Mesa: Deathmatch,ubuntu-22.04 +bo,boserver,Ballistic Overkill,ubuntu-22.04 +bs,bsserver,Blade Symphony,ubuntu-22.04 +bt,btserver,Barotrauma,ubuntu-22.04 +btl,btlserver,BATTALION: Legacy,ubuntu-20.04 +cc,ccserver,Codename CURE,ubuntu-22.04 +ck,ckserver,Core Keeper,ubuntu-22.04 +cmw,cmwserver,Chivalry: Medieval Warfare,ubuntu-22.04 +cod,codserver,Call of Duty,ubuntu-22.04 +cod2,cod2server,Call of Duty 2,ubuntu-22.04 +cod4,cod4server,Call of Duty 4,ubuntu-22.04 +coduo,coduoserver,Call of Duty: United Offensive,ubuntu-22.04 +codwaw,codwawserver,Call of Duty: World at War,ubuntu-22.04 +col,colserver,Colony Survival,ubuntu-22.04 +cs,csserver,Counter-Strike 1.6,ubuntu-22.04 +cs2,cs2server,Counter-Strike 2,ubuntu-22.04 +cscz,csczserver,Counter-Strike: Condition Zero,ubuntu-22.04 +csgo,csgoserver,Counter-Strike: Global Offensive,ubuntu-22.04 +css,cssserver,Counter-Strike: Source,ubuntu-22.04 +ct,ctserver,Craftopia,ubuntu-22.04 +dab,dabserver,Double Action: Boogaloo,ubuntu-22.04 +dayz,dayzserver,DayZ,ubuntu-22.04 +dmc,dmcserver,Deathmatch Classic,ubuntu-22.04 +dod,dodserver,Day of Defeat,ubuntu-22.04 +dodr,dodrserver,Day of Dragons,ubuntu-22.04 +dods,dodsserver,Day of Defeat: Source,ubuntu-22.04 +doi,doiserver,Day of Infamy,ubuntu-22.04 +dst,dstserver,Don't Starve Together,ubuntu-22.04 +dys,dysserver,Dystopia,ubuntu-22.04 +eco,ecoserver,Eco,ubuntu-22.04 +em,emserver,Empires Mod,ubuntu-22.04 +etl,etlserver,ET: Legacy,ubuntu-22.04 +ets2,ets2server,Euro Truck Simulator 2,ubuntu-22.04 +fctr,fctrserver,Factorio,ubuntu-22.04 +fof,fofserver,Fistful of Frags,ubuntu-22.04 +gmod,gmodserver,Garrys Mod,ubuntu-22.04 +hcu,hcuserver,HYPERCHARGE: Unboxed,ubuntu-22.04 +hl2dm,hl2dmserver,Half-Life 2: Deathmatch,ubuntu-22.04 +hldm,hldmserver,Half-Life: Deathmatch,ubuntu-22.04 +hldms,hldmsserver,Half-Life Deathmatch: Source,ubuntu-22.04 +hw,hwserver,Hurtworld,ubuntu-22.04 +hz,hzserver,Humanitz,ubuntu-22.04 +ins,insserver,Insurgency,ubuntu-22.04 +inss,inssserver,Insurgency: Sandstorm,ubuntu-22.04 +ios,iosserver,IOSoccer,ubuntu-22.04 +jc2,jc2server,Just Cause 2,ubuntu-22.04 +jc3,jc3server,Just Cause 3,ubuntu-22.04 +jk2,jk2server,Jedi Knight II: Jedi Outcast,ubuntu-22.04 +kf,kfserver,Killing Floor,ubuntu-22.04 +kf2,kf2server,Killing Floor 2,ubuntu-22.04 +l4d,l4dserver,Left 4 Dead,ubuntu-22.04 +l4d2,l4d2server,Left 4 Dead 2,ubuntu-22.04 +mc,mcserver,Minecraft,ubuntu-22.04 +mcb,mcbserver,Minecraft Bedrock,ubuntu-22.04 +mh,mhserver,MORDHAU,ubuntu-22.04 +mohaa,mohaaserver,Medal of Honor: Allied Assault,ubuntu-22.04 +mom,momserver,Memories of Mars,ubuntu-22.04 +mta,mtaserver,Multi Theft Auto,ubuntu-22.04 +nd,ndserver,Nuclear Dawn,ubuntu-22.04 +nec,necserver,Necesse,ubuntu-22.04 +nmrih,nmrihserver,No More Room in Hell,ubuntu-22.04 +ns,nsserver,Natural Selection,ubuntu-22.04 +ns2,ns2server,Natural Selection 2,ubuntu-22.04 +ns2c,ns2cserver,NS2: Combat,ubuntu-22.04 +ohd,ohdserver,Operation: Harsh Doorstop,ubuntu-22.04 +onset,onsetserver,Onset,ubuntu-20.04 +opfor,opforserver,Opposing Force,ubuntu-22.04 +pc,pcserver,Project Cars,ubuntu-22.04 +pc2,pc2server,Project Cars 2,ubuntu-22.04 +pmc,pmcserver,PaperMC,ubuntu-22.04 +ps,psserver,Post Scriptum,ubuntu-22.04 +pvkii,pvkiiserver,Pirates Vikings & Knights II,ubuntu-22.04 +pvr,pvrserver,Pavlov VR,ubuntu-22.04 +pw,pwserver,Palworld,ubuntu-22.04 +pz,pzserver,Project Zomboid,ubuntu-22.04 +q2,q2server,Quake 2,ubuntu-22.04 +q3,q3server,Quake 3: Arena,ubuntu-22.04 +q4,q4server,Quake 4,ubuntu-22.04 +ql,qlserver,Quake Live,ubuntu-22.04 +qw,qwserver,Quake World,ubuntu-22.04 +ricochet,ricochetserver,Ricochet,ubuntu-22.04 +ro,roserver,Red Orchestra: Ostfront 41-45,ubuntu-22.04 +rtcw,rtcwserver,Return to Castle Wolfenstein,ubuntu-22.04 +rust,rustserver,Rust,ubuntu-22.04 +rw,rwserver,Rising World,ubuntu-22.04 +samp,sampserver,San Andreas Multiplayer,ubuntu-22.04 +sb,sbserver,Starbound,ubuntu-22.04 +sbots,sbotsserver,StickyBots,ubuntu-22.04 +scpsl,scpslserver,SCP: Secret Laboratory,ubuntu-22.04 +scpslsm,scpslsmserver,SCP: Secret Laboratory ServerMod,ubuntu-22.04 +sdtd,sdtdserver,7 Days to Die,ubuntu-22.04 +sf,sfserver,Satisfactory,ubuntu-22.04 +sfc,sfcserver,SourceForts Classic,ubuntu-22.04 +sof2,sof2server,Soldier Of Fortune 2: Gold Edition,ubuntu-22.04 +sol,solserver,Soldat,ubuntu-22.04 +squad,squadserver,Squad,ubuntu-22.04 +st,stserver,Stationeers,ubuntu-22.04 +stn,stnserver,Survive the Nights,ubuntu-22.04 +sven,svenserver,Sven Co-op,ubuntu-20.04 +terraria,terrariaserver,Terraria,ubuntu-22.04 +tf,tfserver,The Front,ubuntu-22.04 +tf2,tf2server,Team Fortress 2,ubuntu-22.04 +tfc,tfcserver,Team Fortress Classic,ubuntu-22.04 +ti,tiserver,The Isle,ubuntu-22.04 +ts,tsserver,The Specialists,ubuntu-22.04 +ts3,ts3server,Teamspeak 3,ubuntu-22.04 +tu,tuserver,Tower Unite,ubuntu-22.04 +tw,twserver,Teeworlds,ubuntu-22.04 +unt,untserver,Unturned,ubuntu-22.04 +ut,utserver,Unreal Tournament,ubuntu-22.04 +ut2k4,ut2k4server,Unreal Tournament 2004,ubuntu-22.04 +ut3,ut3server,Unreal Tournament 3,ubuntu-22.04 +ut99,ut99server,Unreal Tournament 99,ubuntu-22.04 +vh,vhserver,Valheim,ubuntu-22.04 +vints,vintsserver,Vintage Story,ubuntu-22.04 +vpmc,vpmcserver,Velocity Proxy MC,ubuntu-22.04 +vs,vsserver,Vampire Slayer,ubuntu-22.04 +wet,wetserver,Wolfenstein: Enemy Territory,ubuntu-22.04 +wf,wfserver,Warfork,ubuntu-22.04 +wmc,wmcserver,WaterfallMC,ubuntu-22.04 +wurm,wurmserver,Wurm Unlimited,ubuntu-22.04 +zmr,zmrserver,Zombie Master: Reborn,ubuntu-22.04 +zps,zpsserver,Zombie Panic! Source,ubuntu-22.04 diff --git a/data/shortnamearray.json b/data/shortnamearray.json new file mode 100644 index 0000000..4804b19 --- /dev/null +++ b/data/shortnamearray.json @@ -0,0 +1,820 @@ +{ + "include": { + "ac": { + "shortname": "ac", + "servername": "acserver", + "gamename": "Assetto Corsa", + "distro": "ubuntu-22.04" + }, + "ahl": { + "shortname": "ahl", + "servername": "ahlserver", + "gamename": "Action Half-Life", + "distro": "ubuntu-22.04" + }, + "ahl2": { + "shortname": "ahl2", + "servername": "ahl2server", + "gamename": "Action: Source", + "distro": "ubuntu-20.04" + }, + "ark": { + "shortname": "ark", + "servername": "arkserver", + "gamename": "ARK: Survival Evolved", + "distro": "ubuntu-22.04" + }, + "arma3": { + "shortname": "arma3", + "servername": "arma3server", + "gamename": "ARMA 3", + "distro": "ubuntu-22.04" + }, + "armar": { + "shortname": "armar", + "servername": "armarserver", + "gamename": "Arma Reforger", + "distro": "ubuntu-20.04" + }, + "ats": { + "shortname": "ats", + "servername": "atsserver", + "gamename": "American Truck Simulator", + "distro": "ubuntu-22.04" + }, + "av": { + "shortname": "av", + "servername": "avserver", + "gamename": "Avorion", + "distro": "ubuntu-22.04" + }, + "bb": { + "shortname": "bb", + "servername": "bbserver", + "gamename": "BrainBread", + "distro": "ubuntu-22.04" + }, + "bb2": { + "shortname": "bb2", + "servername": "bb2server", + "gamename": "BrainBread 2", + "distro": "ubuntu-22.04" + }, + "bd": { + "shortname": "bd", + "servername": "bdserver", + "gamename": "Base Defense", + "distro": "ubuntu-22.04" + }, + "bf1942": { + "shortname": "bf1942", + "servername": "bf1942server", + "gamename": "Battlefield 1942", + "distro": "ubuntu-22.04" + }, + "bfv": { + "shortname": "bfv", + "servername": "bfvserver", + "gamename": "Battlefield: Vietnam", + "distro": "ubuntu-22.04" + }, + "bmdm": { + "shortname": "bmdm", + "servername": "bmdmserver", + "gamename": "Black Mesa: Deathmatch", + "distro": "ubuntu-22.04" + }, + "bo": { + "shortname": "bo", + "servername": "boserver", + "gamename": "Ballistic Overkill", + "distro": "ubuntu-22.04" + }, + "bs": { + "shortname": "bs", + "servername": "bsserver", + "gamename": "Blade Symphony", + "distro": "ubuntu-22.04" + }, + "bt": { + "shortname": "bt", + "servername": "btserver", + "gamename": "Barotrauma", + "distro": "ubuntu-22.04" + }, + "btl": { + "shortname": "btl", + "servername": "btlserver", + "gamename": "BATTALION: Legacy", + "distro": "ubuntu-20.04" + }, + "cc": { + "shortname": "cc", + "servername": "ccserver", + "gamename": "Codename CURE", + "distro": "ubuntu-22.04" + }, + "ck": { + "shortname": "ck", + "servername": "ckserver", + "gamename": "Core Keeper", + "distro": "ubuntu-22.04" + }, + "cmw": { + "shortname": "cmw", + "servername": "cmwserver", + "gamename": "Chivalry: Medieval Warfare", + "distro": "ubuntu-22.04" + }, + "cod": { + "shortname": "cod", + "servername": "codserver", + "gamename": "Call of Duty", + "distro": "ubuntu-22.04" + }, + "cod2": { + "shortname": "cod2", + "servername": "cod2server", + "gamename": "Call of Duty 2", + "distro": "ubuntu-22.04" + }, + "cod4": { + "shortname": "cod4", + "servername": "cod4server", + "gamename": "Call of Duty 4", + "distro": "ubuntu-22.04" + }, + "coduo": { + "shortname": "coduo", + "servername": "coduoserver", + "gamename": "Call of Duty: United Offensive", + "distro": "ubuntu-22.04" + }, + "codwaw": { + "shortname": "codwaw", + "servername": "codwawserver", + "gamename": "Call of Duty: World at War", + "distro": "ubuntu-22.04" + }, + "col": { + "shortname": "col", + "servername": "colserver", + "gamename": "Colony Survival", + "distro": "ubuntu-22.04" + }, + "cs": { + "shortname": "cs", + "servername": "csserver", + "gamename": "Counter-Strike 1.6", + "distro": "ubuntu-22.04" + }, + "cs2": { + "shortname": "cs2", + "servername": "cs2server", + "gamename": "Counter-Strike 2", + "distro": "ubuntu-22.04" + }, + "cscz": { + "shortname": "cscz", + "servername": "csczserver", + "gamename": "Counter-Strike: Condition Zero", + "distro": "ubuntu-22.04" + }, + "csgo": { + "shortname": "csgo", + "servername": "csgoserver", + "gamename": "Counter-Strike: Global Offensive", + "distro": "ubuntu-22.04" + }, + "css": { + "shortname": "css", + "servername": "cssserver", + "gamename": "Counter-Strike: Source", + "distro": "ubuntu-22.04" + }, + "ct": { + "shortname": "ct", + "servername": "ctserver", + "gamename": "Craftopia", + "distro": "ubuntu-22.04" + }, + "dab": { + "shortname": "dab", + "servername": "dabserver", + "gamename": "Double Action: Boogaloo", + "distro": "ubuntu-22.04" + }, + "dayz": { + "shortname": "dayz", + "servername": "dayzserver", + "gamename": "DayZ", + "distro": "ubuntu-22.04" + }, + "dmc": { + "shortname": "dmc", + "servername": "dmcserver", + "gamename": "Deathmatch Classic", + "distro": "ubuntu-22.04" + }, + "dod": { + "shortname": "dod", + "servername": "dodserver", + "gamename": "Day of Defeat", + "distro": "ubuntu-22.04" + }, + "dodr": { + "shortname": "dodr", + "servername": "dodrserver", + "gamename": "Day of Dragons", + "distro": "ubuntu-22.04" + }, + "dods": { + "shortname": "dods", + "servername": "dodsserver", + "gamename": "Day of Defeat: Source", + "distro": "ubuntu-22.04" + }, + "doi": { + "shortname": "doi", + "servername": "doiserver", + "gamename": "Day of Infamy", + "distro": "ubuntu-22.04" + }, + "dst": { + "shortname": "dst", + "servername": "dstserver", + "gamename": "Don't Starve Together", + "distro": "ubuntu-22.04" + }, + "dys": { + "shortname": "dys", + "servername": "dysserver", + "gamename": "Dystopia", + "distro": "ubuntu-22.04" + }, + "eco": { + "shortname": "eco", + "servername": "ecoserver", + "gamename": "Eco", + "distro": "ubuntu-22.04" + }, + "em": { + "shortname": "em", + "servername": "emserver", + "gamename": "Empires Mod", + "distro": "ubuntu-22.04" + }, + "etl": { + "shortname": "etl", + "servername": "etlserver", + "gamename": "ET: Legacy", + "distro": "ubuntu-22.04" + }, + "ets2": { + "shortname": "ets2", + "servername": "ets2server", + "gamename": "Euro Truck Simulator 2", + "distro": "ubuntu-22.04" + }, + "fctr": { + "shortname": "fctr", + "servername": "fctrserver", + "gamename": "Factorio", + "distro": "ubuntu-22.04" + }, + "fof": { + "shortname": "fof", + "servername": "fofserver", + "gamename": "Fistful of Frags", + "distro": "ubuntu-22.04" + }, + "gmod": { + "shortname": "gmod", + "servername": "gmodserver", + "gamename": "Garrys Mod", + "distro": "ubuntu-22.04" + }, + "hcu": { + "shortname": "hcu", + "servername": "hcuserver", + "gamename": "HYPERCHARGE: Unboxed", + "distro": "ubuntu-22.04" + }, + "hl2dm": { + "shortname": "hl2dm", + "servername": "hl2dmserver", + "gamename": "Half-Life 2: Deathmatch", + "distro": "ubuntu-22.04" + }, + "hldm": { + "shortname": "hldm", + "servername": "hldmserver", + "gamename": "Half-Life: Deathmatch", + "distro": "ubuntu-22.04" + }, + "hldms": { + "shortname": "hldms", + "servername": "hldmsserver", + "gamename": "Half-Life Deathmatch: Source", + "distro": "ubuntu-22.04" + }, + "hw": { + "shortname": "hw", + "servername": "hwserver", + "gamename": "Hurtworld", + "distro": "ubuntu-22.04" + }, + "hz": { + "shortname": "hz", + "servername": "hzserver", + "gamename": "Humanitz", + "distro": "ubuntu-22.04" + }, + "ins": { + "shortname": "ins", + "servername": "insserver", + "gamename": "Insurgency", + "distro": "ubuntu-22.04" + }, + "inss": { + "shortname": "inss", + "servername": "inssserver", + "gamename": "Insurgency: Sandstorm", + "distro": "ubuntu-22.04" + }, + "ios": { + "shortname": "ios", + "servername": "iosserver", + "gamename": "IOSoccer", + "distro": "ubuntu-22.04" + }, + "jc2": { + "shortname": "jc2", + "servername": "jc2server", + "gamename": "Just Cause 2", + "distro": "ubuntu-22.04" + }, + "jc3": { + "shortname": "jc3", + "servername": "jc3server", + "gamename": "Just Cause 3", + "distro": "ubuntu-22.04" + }, + "jk2": { + "shortname": "jk2", + "servername": "jk2server", + "gamename": "Jedi Knight II: Jedi Outcast", + "distro": "ubuntu-22.04" + }, + "kf": { + "shortname": "kf", + "servername": "kfserver", + "gamename": "Killing Floor", + "distro": "ubuntu-22.04" + }, + "kf2": { + "shortname": "kf2", + "servername": "kf2server", + "gamename": "Killing Floor 2", + "distro": "ubuntu-22.04" + }, + "l4d": { + "shortname": "l4d", + "servername": "l4dserver", + "gamename": "Left 4 Dead", + "distro": "ubuntu-22.04" + }, + "l4d2": { + "shortname": "l4d2", + "servername": "l4d2server", + "gamename": "Left 4 Dead 2", + "distro": "ubuntu-22.04" + }, + "mc": { + "shortname": "mc", + "servername": "mcserver", + "gamename": "Minecraft", + "distro": "ubuntu-22.04" + }, + "mcb": { + "shortname": "mcb", + "servername": "mcbserver", + "gamename": "Minecraft Bedrock", + "distro": "ubuntu-22.04" + }, + "mh": { + "shortname": "mh", + "servername": "mhserver", + "gamename": "MORDHAU", + "distro": "ubuntu-22.04" + }, + "mohaa": { + "shortname": "mohaa", + "servername": "mohaaserver", + "gamename": "Medal of Honor: Allied Assault", + "distro": "ubuntu-22.04" + }, + "mom": { + "shortname": "mom", + "servername": "momserver", + "gamename": "Memories of Mars", + "distro": "ubuntu-22.04" + }, + "mta": { + "shortname": "mta", + "servername": "mtaserver", + "gamename": "Multi Theft Auto", + "distro": "ubuntu-22.04" + }, + "nd": { + "shortname": "nd", + "servername": "ndserver", + "gamename": "Nuclear Dawn", + "distro": "ubuntu-22.04" + }, + "nec": { + "shortname": "nec", + "servername": "necserver", + "gamename": "Necesse", + "distro": "ubuntu-22.04" + }, + "nmrih": { + "shortname": "nmrih", + "servername": "nmrihserver", + "gamename": "No More Room in Hell", + "distro": "ubuntu-22.04" + }, + "ns": { + "shortname": "ns", + "servername": "nsserver", + "gamename": "Natural Selection", + "distro": "ubuntu-22.04" + }, + "ns2": { + "shortname": "ns2", + "servername": "ns2server", + "gamename": "Natural Selection 2", + "distro": "ubuntu-22.04" + }, + "ns2c": { + "shortname": "ns2c", + "servername": "ns2cserver", + "gamename": "NS2: Combat", + "distro": "ubuntu-22.04" + }, + "ohd": { + "shortname": "ohd", + "servername": "ohdserver", + "gamename": "Operation: Harsh Doorstop", + "distro": "ubuntu-22.04" + }, + "onset": { + "shortname": "onset", + "servername": "onsetserver", + "gamename": "Onset", + "distro": "ubuntu-20.04" + }, + "opfor": { + "shortname": "opfor", + "servername": "opforserver", + "gamename": "Opposing Force", + "distro": "ubuntu-22.04" + }, + "pc": { + "shortname": "pc", + "servername": "pcserver", + "gamename": "Project Cars", + "distro": "ubuntu-22.04" + }, + "pc2": { + "shortname": "pc2", + "servername": "pc2server", + "gamename": "Project Cars 2", + "distro": "ubuntu-22.04" + }, + "pmc": { + "shortname": "pmc", + "servername": "pmcserver", + "gamename": "PaperMC", + "distro": "ubuntu-22.04" + }, + "ps": { + "shortname": "ps", + "servername": "psserver", + "gamename": "Post Scriptum", + "distro": "ubuntu-22.04" + }, + "pvkii": { + "shortname": "pvkii", + "servername": "pvkiiserver", + "gamename": "Pirates Vikings & Knights II", + "distro": "ubuntu-22.04" + }, + "pvr": { + "shortname": "pvr", + "servername": "pvrserver", + "gamename": "Pavlov VR", + "distro": "ubuntu-22.04" + }, + "pw": { + "shortname": "pw", + "servername": "pwserver", + "gamename": "Palworld", + "distro": "ubuntu-22.04" + }, + "pz": { + "shortname": "pz", + "servername": "pzserver", + "gamename": "Project Zomboid", + "distro": "ubuntu-22.04" + }, + "q2": { + "shortname": "q2", + "servername": "q2server", + "gamename": "Quake 2", + "distro": "ubuntu-22.04" + }, + "q3": { + "shortname": "q3", + "servername": "q3server", + "gamename": "Quake 3: Arena", + "distro": "ubuntu-22.04" + }, + "q4": { + "shortname": "q4", + "servername": "q4server", + "gamename": "Quake 4", + "distro": "ubuntu-22.04" + }, + "ql": { + "shortname": "ql", + "servername": "qlserver", + "gamename": "Quake Live", + "distro": "ubuntu-22.04" + }, + "qw": { + "shortname": "qw", + "servername": "qwserver", + "gamename": "Quake World", + "distro": "ubuntu-22.04" + }, + "ricochet": { + "shortname": "ricochet", + "servername": "ricochetserver", + "gamename": "Ricochet", + "distro": "ubuntu-22.04" + }, + "ro": { + "shortname": "ro", + "servername": "roserver", + "gamename": "Red Orchestra: Ostfront 41-45", + "distro": "ubuntu-22.04" + }, + "rtcw": { + "shortname": "rtcw", + "servername": "rtcwserver", + "gamename": "Return to Castle Wolfenstein", + "distro": "ubuntu-22.04" + }, + "rust": { + "shortname": "rust", + "servername": "rustserver", + "gamename": "Rust", + "distro": "ubuntu-22.04" + }, + "rw": { + "shortname": "rw", + "servername": "rwserver", + "gamename": "Rising World", + "distro": "ubuntu-22.04" + }, + "samp": { + "shortname": "samp", + "servername": "sampserver", + "gamename": "San Andreas Multiplayer", + "distro": "ubuntu-22.04" + }, + "sb": { + "shortname": "sb", + "servername": "sbserver", + "gamename": "Starbound", + "distro": "ubuntu-22.04" + }, + "sbots": { + "shortname": "sbots", + "servername": "sbotsserver", + "gamename": "StickyBots", + "distro": "ubuntu-22.04" + }, + "scpsl": { + "shortname": "scpsl", + "servername": "scpslserver", + "gamename": "SCP: Secret Laboratory", + "distro": "ubuntu-22.04" + }, + "scpslsm": { + "shortname": "scpslsm", + "servername": "scpslsmserver", + "gamename": "SCP: Secret Laboratory ServerMod", + "distro": "ubuntu-22.04" + }, + "sdtd": { + "shortname": "sdtd", + "servername": "sdtdserver", + "gamename": "7 Days to Die", + "distro": "ubuntu-22.04" + }, + "sf": { + "shortname": "sf", + "servername": "sfserver", + "gamename": "Satisfactory", + "distro": "ubuntu-22.04" + }, + "sfc": { + "shortname": "sfc", + "servername": "sfcserver", + "gamename": "SourceForts Classic", + "distro": "ubuntu-22.04" + }, + "sof2": { + "shortname": "sof2", + "servername": "sof2server", + "gamename": "Soldier Of Fortune 2: Gold Edition", + "distro": "ubuntu-22.04" + }, + "sol": { + "shortname": "sol", + "servername": "solserver", + "gamename": "Soldat", + "distro": "ubuntu-22.04" + }, + "squad": { + "shortname": "squad", + "servername": "squadserver", + "gamename": "Squad", + "distro": "ubuntu-22.04" + }, + "st": { + "shortname": "st", + "servername": "stserver", + "gamename": "Stationeers", + "distro": "ubuntu-22.04" + }, + "stn": { + "shortname": "stn", + "servername": "stnserver", + "gamename": "Survive the Nights", + "distro": "ubuntu-22.04" + }, + "sven": { + "shortname": "sven", + "servername": "svenserver", + "gamename": "Sven Co-op", + "distro": "ubuntu-20.04" + }, + "terraria": { + "shortname": "terraria", + "servername": "terrariaserver", + "gamename": "Terraria", + "distro": "ubuntu-22.04" + }, + "tf": { + "shortname": "tf", + "servername": "tfserver", + "gamename": "The Front", + "distro": "ubuntu-22.04" + }, + "tf2": { + "shortname": "tf2", + "servername": "tf2server", + "gamename": "Team Fortress 2", + "distro": "ubuntu-22.04" + }, + "tfc": { + "shortname": "tfc", + "servername": "tfcserver", + "gamename": "Team Fortress Classic", + "distro": "ubuntu-22.04" + }, + "ti": { + "shortname": "ti", + "servername": "tiserver", + "gamename": "The Isle", + "distro": "ubuntu-22.04" + }, + "ts": { + "shortname": "ts", + "servername": "tsserver", + "gamename": "The Specialists", + "distro": "ubuntu-22.04" + }, + "ts3": { + "shortname": "ts3", + "servername": "ts3server", + "gamename": "Teamspeak 3", + "distro": "ubuntu-22.04" + }, + "tu": { + "shortname": "tu", + "servername": "tuserver", + "gamename": "Tower Unite", + "distro": "ubuntu-22.04" + }, + "tw": { + "shortname": "tw", + "servername": "twserver", + "gamename": "Teeworlds", + "distro": "ubuntu-22.04" + }, + "unt": { + "shortname": "unt", + "servername": "untserver", + "gamename": "Unturned", + "distro": "ubuntu-22.04" + }, + "ut": { + "shortname": "ut", + "servername": "utserver", + "gamename": "Unreal Tournament", + "distro": "ubuntu-22.04" + }, + "ut2k4": { + "shortname": "ut2k4", + "servername": "ut2k4server", + "gamename": "Unreal Tournament 2004", + "distro": "ubuntu-22.04" + }, + "ut3": { + "shortname": "ut3", + "servername": "ut3server", + "gamename": "Unreal Tournament 3", + "distro": "ubuntu-22.04" + }, + "ut99": { + "shortname": "ut99", + "servername": "ut99server", + "gamename": "Unreal Tournament 99", + "distro": "ubuntu-22.04" + }, + "vh": { + "shortname": "vh", + "servername": "vhserver", + "gamename": "Valheim", + "distro": "ubuntu-22.04" + }, + "vints": { + "shortname": "vints", + "servername": "vintsserver", + "gamename": "Vintage Story", + "distro": "ubuntu-22.04" + }, + "vpmc": { + "shortname": "vpmc", + "servername": "vpmcserver", + "gamename": "Velocity Proxy MC", + "distro": "ubuntu-22.04" + }, + "vs": { + "shortname": "vs", + "servername": "vsserver", + "gamename": "Vampire Slayer", + "distro": "ubuntu-22.04" + }, + "wet": { + "shortname": "wet", + "servername": "wetserver", + "gamename": "Wolfenstein: Enemy Territory", + "distro": "ubuntu-22.04" + }, + "wf": { + "shortname": "wf", + "servername": "wfserver", + "gamename": "Warfork", + "distro": "ubuntu-22.04" + }, + "wmc": { + "shortname": "wmc", + "servername": "wmcserver", + "gamename": "WaterfallMC", + "distro": "ubuntu-22.04" + }, + "wurm": { + "shortname": "wurm", + "servername": "wurmserver", + "gamename": "Wurm Unlimited", + "distro": "ubuntu-22.04" + }, + "zmr": { + "shortname": "zmr", + "servername": "zmrserver", + "gamename": "Zombie Master: Reborn", + "distro": "ubuntu-22.04" + }, + "zps": { + "shortname": "zps", + "servername": "zpsserver", + "gamename": "Zombie Panic! Source", + "distro": "ubuntu-22.04" + } + } +} diff --git a/generate-dockerfiles.sh b/generate-dockerfiles.sh index fdfbc8d..865d1bb 100755 --- a/generate-dockerfiles.sh +++ b/generate-dockerfiles.sh @@ -1,24 +1,25 @@ #!/bin/bash -curl -O "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/serverlist.csv" +echo "Fetching server list" +curl -o ./data/serverlist.csv "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/serverlist.csv" -echo -n "{" >"shortnamearray.json" -echo -n "\"include\":[" >>"shortnamearray.json" +echo '{"include": {}}' > ./data/shortnamearray.json +# convert csv to json while read line; do export shortname=$(echo "$line" | awk -F, '{ print $1 }') export servername=$(echo "$line" | awk -F, '{ print $2 }') export gamename=$(echo "$line" | awk -F, '{ print $3 }') export distro=$(echo "$line" | awk -F, '{ print $4 }') - touch "dockerfiles/Dockerfile.${shortname}" + + yq -iP '.include[strenv(shortname)]={"shortname": strenv(shortname),"servername": strenv(servername),"gamename": strenv(gamename),"distro": strenv(distro)}' ./data/shortnamearray.json -o json +done < <(tail -n +2 ./data/serverlist.csv) + +echo "Found $(yq '.include | keys | length' ./data/shortnamearray.json) items" + +while read sname; do + export gamename=$(yq ".include[strenv(shortname)].gamename" data/shortnamearray.json) + export shortname=$sname echo "Generating Dockerfile.${shortname} (${gamename})" - jinjanate Dockerfile.j2 >"dockerfiles/Dockerfile.${shortname}" - echo -n "{" >>"shortnamearray.json" - echo -n "\"shortname\":" >>"shortnamearray.json" - echo -n "\"${shortname}\"" >>"shortnamearray.json" - echo -n "}," >>"shortnamearray.json" -done < <(tail -n +2 serverlist.csv) -sed -i '$ s/.$//' "shortnamearray.json" -echo -n "]" >>"shortnamearray.json" -echo -n "}" >>"shortnamearray.json" -rm serverlist.csv + yq '.game=.include[env(shortname)]' data/shortnamearray.json | jinjanate --quiet -f json Dockerfile.j2 - > "dockerfiles/Dockerfile.${shortname}" +done < <(yq -r ".include| keys[]" data/shortnamearray.json ) From c4b829e61571cb27e7210c150cd311501bb7821c Mon Sep 17 00:00:00 2001 From: b13rg <13488329+B13rg@users.noreply.github.com> Date: Wed, 18 Sep 2024 19:30:32 -0700 Subject: [PATCH 4/6] syntax fizes --- generate-dockerfiles.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate-dockerfiles.sh b/generate-dockerfiles.sh index 865d1bb..f82e242 100755 --- a/generate-dockerfiles.sh +++ b/generate-dockerfiles.sh @@ -6,7 +6,7 @@ curl -o ./data/serverlist.csv "https://raw.githubusercontent.com/GameServerManag echo '{"include": {}}' > ./data/shortnamearray.json # convert csv to json -while read line; do +while read -r line; do export shortname=$(echo "$line" | awk -F, '{ print $1 }') export servername=$(echo "$line" | awk -F, '{ print $2 }') export gamename=$(echo "$line" | awk -F, '{ print $3 }') @@ -17,7 +17,7 @@ done < <(tail -n +2 ./data/serverlist.csv) echo "Found $(yq '.include | keys | length' ./data/shortnamearray.json) items" -while read sname; do +while read -r sname; do export gamename=$(yq ".include[strenv(shortname)].gamename" data/shortnamearray.json) export shortname=$sname echo "Generating Dockerfile.${shortname} (${gamename})" From dc11ad8cbde89d9ec1364e1c358f2aa1e4c6a986 Mon Sep 17 00:00:00 2001 From: b13rg <13488329+B13rg@users.noreply.github.com> Date: Wed, 18 Sep 2024 19:43:12 -0700 Subject: [PATCH 5/6] move data fetch to separate script --- fetch-game-data.sh | 18 ++++++++++++++++++ generate-dockerfiles.sh | 17 +---------------- 2 files changed, 19 insertions(+), 16 deletions(-) create mode 100755 fetch-game-data.sh diff --git a/fetch-game-data.sh b/fetch-game-data.sh new file mode 100755 index 0000000..b458478 --- /dev/null +++ b/fetch-game-data.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +echo "Fetching server list" +curl -o ./data/serverlist.csv "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/serverlist.csv" + +echo '{"include": {}}' > ./data/shortnamearray.json + +# convert csv to json +while read -r line; do + export shortname=$(echo "$line" | awk -F, '{ print $1 }') + export servername=$(echo "$line" | awk -F, '{ print $2 }') + export gamename=$(echo "$line" | awk -F, '{ print $3 }') + export distro=$(echo "$line" | awk -F, '{ print $4 }') + + yq -iP '.include[strenv(shortname)]={"shortname": strenv(shortname),"servername": strenv(servername),"gamename": strenv(gamename),"distro": strenv(distro)}' ./data/shortnamearray.json -o json +done < <(tail -n +2 ./data/serverlist.csv) + +echo "Found $(yq '.include | keys | length' ./data/shortnamearray.json) items" diff --git a/generate-dockerfiles.sh b/generate-dockerfiles.sh index f82e242..9554a3f 100755 --- a/generate-dockerfiles.sh +++ b/generate-dockerfiles.sh @@ -1,21 +1,6 @@ #!/bin/bash -echo "Fetching server list" -curl -o ./data/serverlist.csv "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/serverlist.csv" - -echo '{"include": {}}' > ./data/shortnamearray.json - -# convert csv to json -while read -r line; do - export shortname=$(echo "$line" | awk -F, '{ print $1 }') - export servername=$(echo "$line" | awk -F, '{ print $2 }') - export gamename=$(echo "$line" | awk -F, '{ print $3 }') - export distro=$(echo "$line" | awk -F, '{ print $4 }') - - yq -iP '.include[strenv(shortname)]={"shortname": strenv(shortname),"servername": strenv(servername),"gamename": strenv(gamename),"distro": strenv(distro)}' ./data/shortnamearray.json -o json -done < <(tail -n +2 ./data/serverlist.csv) - -echo "Found $(yq '.include | keys | length' ./data/shortnamearray.json) items" +./fetch-game-data.sh while read -r sname; do export gamename=$(yq ".include[strenv(shortname)].gamename" data/shortnamearray.json) From 421872b72fa8e138614892d118ca8953d7fd3ef9 Mon Sep 17 00:00:00 2001 From: b13rg <13488329+B13rg@users.noreply.github.com> Date: Wed, 18 Sep 2024 19:43:22 -0700 Subject: [PATCH 6/6] adjust docker-compose generation --- docker-compose.yml.j2 | 22 +++++++++++----------- generate-docker-compose.sh | 26 ++++++-------------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/docker-compose.yml.j2 b/docker-compose.yml.j2 index 2f87c88..cc81919 100644 --- a/docker-compose.yml.j2 +++ b/docker-compose.yml.j2 @@ -1,24 +1,24 @@ version: "3.8" services: # bind mount example - linuxgsm-{{ shortname }}-bind: - image: gameservermanagers/gameserver:{{ shortname }} - # image: ghcr.io/gameservermanagers/gameserver:{{ shortname }} - container_name: {{ shortname }}server + linuxgsm-{{ game.shortname }}-bind: + image: gameservermanagers/gameserver:{{ game.shortname }} + # image: ghcr.io/gameservermanagers/gameserver:{{ game.shortname }} + container_name: {{ game.shortname }}server restart: unless-stopped volumes: - - /path/to/linuxgsm/{{ shortname }}server:/data + - /path/to/linuxgsm/{{ game.shortname }}server:/data network_mode: host # volume example - linuxgsm-{{ shortname }}-volume: - image: gameservermanagers/gameserver:{{ shortname }} - # image: ghcr.io/gameservermanagers/gameserver:{{ shortname }} - container_name: {{ shortname }}server + linuxgsm-{{ game.shortname }}-volume: + image: gameservermanagers/gameserver:{{ game.shortname }} + # image: ghcr.io/gameservermanagers/gameserver:{{ game.shortname }} + container_name: {{ game.shortname }}server restart: unless-stopped volumes: - - linuxgsm-{{ shortname }}:/data + - linuxgsm-{{ game.shortname }}:/data network_mode: host volumes: - linuxgsm-{{ shortname }}: + linuxgsm-{{ game.shortname }}: diff --git a/generate-docker-compose.sh b/generate-docker-compose.sh index 217ce18..2b83f7b 100755 --- a/generate-docker-compose.sh +++ b/generate-docker-compose.sh @@ -1,24 +1,10 @@ #!/bin/bash -curl -O "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/serverlist.csv" +./fetch-game-data.sh -echo -n "{" >"shortnamearray.json" -echo -n "\"include\":[" >>"shortnamearray.json" - -while read line; do - export shortname=$(echo "$line" | awk -F, '{ print $1 }') - export servername=$(echo "$line" | awk -F, '{ print $2 }') - export gamename=$(echo "$line" | awk -F, '{ print $3 }') - export distro=$(echo "$line" | awk -F, '{ print $4 }') - touch "docker-compose/docker-compose-${shortname}.yml" +while read -r sname; do + export gamename=$(yq ".include[strenv(shortname)].gamename" data/shortnamearray.json) + export shortname=$sname echo "Generating docker-compose-${shortname}.yml (${gamename})" - jinjanate docker-compose.yml.j2 >"docker-compose/docker-compose-${shortname}.yml" - echo -n "{" >>"shortnamearray.json" - echo -n "\"shortname\":" >>"shortnamearray.json" - echo -n "\"${shortname}\"" >>"shortnamearray.json" - echo -n "}," >>"shortnamearray.json" -done < <(tail -n +1 serverlist.csv) -sed -i '$ s/.$//' "shortnamearray.json" -echo -n "]" >>"shortnamearray.json" -echo -n "}" >>"shortnamearray.json" -rm serverlist.csv + yq '.game=.include[env(shortname)]' data/shortnamearray.json | jinjanate --quiet -f json docker-compose.yml.j2 - > "docker-compose/docker-compose-${shortname}.yml" +done < <(yq -r ".include| keys[]" data/shortnamearray.json )