Browse Source

Merge branch 'release/v25.1.0'

hotfix/v25.1.1
Daniel Gibbs 2 months ago
parent
commit
65e9eb520d
  1. 2
      .github/workflows/serverlist-validate-game-icons.sh
  2. 4
      .github/workflows/serverlist-validate.sh
  3. 2
      LICENSE.md
  4. 2
      README.md
  5. 4
      lgsm/config-default/config-lgsm/bfvserver/_default.cfg
  6. 5
      lgsm/config-default/config-lgsm/cs2server/_default.cfg
  7. 2
      lgsm/config-default/config-lgsm/jc2server/_default.cfg
  8. 2
      lgsm/config-default/config-lgsm/sof2server/_default.cfg
  9. 0
      lgsm/config-default/config-lgsm/squad44server/_default.cfg
  10. 4
      lgsm/config-default/config-lgsm/stserver/_default.cfg
  11. 2
      lgsm/config-default/config-lgsm/ts3server/_default.cfg
  12. 2
      lgsm/data/debian-10.csv
  13. 2
      lgsm/data/debian-11.csv
  14. 2
      lgsm/data/debian-12.csv
  15. 2
      lgsm/data/debian-13.csv
  16. 2
      lgsm/data/debian-9.csv
  17. 268
      lgsm/data/serverlist.csv
  18. 2
      lgsm/data/ubuntu-16.04.csv
  19. 2
      lgsm/data/ubuntu-18.04.csv
  20. 2
      lgsm/data/ubuntu-20.04.csv
  21. 2
      lgsm/data/ubuntu-22.04.csv
  22. 2
      lgsm/data/ubuntu-23.04.csv
  23. 2
      lgsm/data/ubuntu-23.10.csv
  24. 2
      lgsm/data/ubuntu-24.04.csv
  25. 104
      lgsm/modules/alert_discord.sh
  26. 2
      lgsm/modules/alert_email.sh
  27. 36
      lgsm/modules/alert_gotify.sh
  28. 34
      lgsm/modules/alert_ifttt.sh
  29. 35
      lgsm/modules/alert_pushbullet.sh
  30. 24
      lgsm/modules/alert_pushover.sh
  31. 34
      lgsm/modules/alert_rocketchat.sh
  32. 38
      lgsm/modules/alert_slack.sh
  33. 37
      lgsm/modules/alert_telegram.sh
  34. 2
      lgsm/modules/check.sh
  35. 20
      lgsm/modules/check_deps.sh
  36. 2
      lgsm/modules/check_gamedig.sh
  37. 2
      lgsm/modules/check_logs.sh
  38. 4
      lgsm/modules/check_permissions.sh
  39. 13
      lgsm/modules/check_system_requirements.sh
  40. 14
      lgsm/modules/command_backup.sh
  41. 11
      lgsm/modules/command_console.sh
  42. 13
      lgsm/modules/command_debug.sh
  43. 2
      lgsm/modules/command_details.sh
  44. 2
      lgsm/modules/command_dev_clear_modules.sh
  45. 2
      lgsm/modules/command_dev_debug.sh
  46. 8
      lgsm/modules/command_dev_detect_deps.sh
  47. 14
      lgsm/modules/command_dev_detect_glibc.sh
  48. 10
      lgsm/modules/command_dev_detect_ldd.sh
  49. 7
      lgsm/modules/command_dev_parse_distro_details.sh
  50. 7
      lgsm/modules/command_dev_parse_game_details.sh
  51. 91
      lgsm/modules/command_dev_query_raw.sh
  52. 110
      lgsm/modules/command_dev_ui.sh
  53. 110
      lgsm/modules/command_fastdl.sh
  54. 2
      lgsm/modules/command_install_resources_mta.sh
  55. 2
      lgsm/modules/command_mods_install.sh
  56. 12
      lgsm/modules/command_mods_remove.sh
  57. 2
      lgsm/modules/command_mods_update.sh
  58. 79
      lgsm/modules/command_monitor.sh
  59. 12
      lgsm/modules/command_postdetails.sh
  60. 2
      lgsm/modules/command_send.sh
  61. 2
      lgsm/modules/command_skeleton.sh
  62. 2
      lgsm/modules/command_sponsor.sh
  63. 6
      lgsm/modules/command_start.sh
  64. 10
      lgsm/modules/command_stop.sh
  65. 2
      lgsm/modules/command_ts3_server_pass.sh
  66. 77
      lgsm/modules/command_update_linuxgsm.sh
  67. 6
      lgsm/modules/command_validate.sh
  68. 31
      lgsm/modules/command_wipe.sh
  69. 2
      lgsm/modules/compress_unreal2_maps.sh
  70. 2
      lgsm/modules/compress_ut99_maps.sh
  71. 49
      lgsm/modules/core_dl.sh
  72. 10
      lgsm/modules/core_exit.sh
  73. 17
      lgsm/modules/core_getopt.sh
  74. 6
      lgsm/modules/core_legacy.sh
  75. 306
      lgsm/modules/core_messages.sh
  76. 12
      lgsm/modules/core_modules.sh
  77. 139
      lgsm/modules/core_steamcmd.sh
  78. 5
      lgsm/modules/fix.sh
  79. 2
      lgsm/modules/fix_bt.sh
  80. 2
      lgsm/modules/fix_rust.sh
  81. 9
      lgsm/modules/info_distro.sh
  82. 12
      lgsm/modules/info_game.sh
  83. 80
      lgsm/modules/info_messages.sh
  84. 15
      lgsm/modules/install_complete.sh
  85. 260
      lgsm/modules/install_config.sh
  86. 2
      lgsm/modules/install_dst_token.sh
  87. 4
      lgsm/modules/install_eula.sh
  88. 20
      lgsm/modules/install_gslt.sh
  89. 98
      lgsm/modules/install_logs.sh
  90. 12
      lgsm/modules/install_server_dir.sh
  91. 7
      lgsm/modules/install_server_files.sh
  92. 2
      lgsm/modules/install_squad_license.sh
  93. 4
      lgsm/modules/install_stats.sh
  94. 4
      lgsm/modules/install_ts3db.sh
  95. 2
      lgsm/modules/install_ut2k4_key.sh
  96. 62
      lgsm/modules/mods_core.sh
  97. 4
      lgsm/modules/query_gamedig.sh
  98. 14
      lgsm/modules/query_gsquery.py
  99. 6
      lgsm/modules/update_jk2.sh
  100. 6
      lgsm/modules/update_mc.sh

2
.github/workflows/serverlist-validate-game-icons.sh

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
cd "lgsm/data" || exit cd "${datadir}" || exit
echo "" echo ""
echo "Checking that all the game servers listed in serverlist.csv have a shortname-icon.png file" echo "Checking that all the game servers listed in serverlist.csv have a shortname-icon.png file"

4
.github/workflows/serverlist-validate.sh

@ -2,7 +2,7 @@
echo "Checking that all the game servers are listed in all csv files" echo "Checking that all the game servers are listed in all csv files"
echo "this check will ensure serverlist.csv has the same number of lines (-2 lines) as the other csv files" echo "this check will ensure serverlist.csv has the same number of lines (-2 lines) as the other csv files"
# count the number of lines in the serverlist.csv # count the number of lines in the serverlist.csv
cd "lgsm/data" || exit cd "${datadir}" || exit
serverlistcount="$(tail -n +2 serverlist.csv | wc -l)" serverlistcount="$(tail -n +2 serverlist.csv | wc -l)"
echo "serverlistcount: $serverlistcount" echo "serverlistcount: $serverlistcount"
# get list of all csv files starting with ubunutu debian centos # get list of all csv files starting with ubunutu debian centos
@ -19,7 +19,7 @@ for csv in $csvlist; do
fi fi
done done
# Compare all game servers listed in serverlist.csv to $shortname-icon.png files in lgsm/data/gameicons # Compare all game servers listed in serverlist.csv to $shortname-icon.png files in ${datadir}/gameicons
# if the game server is listed in serverlist.csv then it will have a $shortname-icon.png file # if the game server is listed in serverlist.csv then it will have a $shortname-icon.png file
# loop though shortname in serverlist.csv # loop though shortname in serverlist.csv

2
LICENSE.md

@ -1,6 +1,6 @@
# The MIT License (MIT) # The MIT License (MIT)
Copyright (c) 2012-2024 Daniel Gibbs Copyright (c) 2012-2025 Daniel Gibbs
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

2
README.md

@ -4,7 +4,7 @@
<a href="https://bitbucket.org/GameServerManagers/linuxgsm"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/GameServerManagers/LinuxGSM/git-sync.yml?color=0052CC&logo=bitbucket&style=flat-square"></a> <a href="https://bitbucket.org/GameServerManagers/linuxgsm"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/GameServerManagers/LinuxGSM/git-sync.yml?color=0052CC&logo=bitbucket&style=flat-square"></a>
<a href="https://linuxgsm.com/discord"><img alt="Discord" src="https://img.shields.io/discord/127498813903601664?color=5865F2&label=%20&logo=discord&logoColor=ffffff&style=flat-square"></a> <a href="https://linuxgsm.com/discord"><img alt="Discord" src="https://img.shields.io/discord/127498813903601664?color=5865F2&label=%20&logo=discord&logoColor=ffffff&style=flat-square"></a>
<a href="https://developer.valvesoftware.com/wiki/SteamCMD"><img src="https://img.shields.io/badge/SteamCMD-000000?style=flat-square&amp;logo=Steam&amp;logoColor=white" alt="SteamCMD"></a> <a href="https://developer.valvesoftware.com/wiki/SteamCMD"><img src="https://img.shields.io/badge/SteamCMD-000000?style=flat-square&amp;logo=Steam&amp;logoColor=white" alt="SteamCMD"></a>
<a href="https://github.com/GameServerManagers/LinuxGSM/blob/main/LICENSE"><img src="https://img.shields.io/github/license/gameservermanagers/LinuxGSM?style=flat-square" alt="MIT License"></a> <a href="https://github.com/GameServerManagers/LinuxGSM/blob/master/LICENSE.md"><img src="https://img.shields.io/github/license/gameservermanagers/LinuxGSM?style=flat-square" alt="MIT License"></a>
</p> </p>
[LinuxGSM](https://linuxgsm.com) is the command-line tool for quick, simple deployment and management of Linux dedicated game servers. [LinuxGSM](https://linuxgsm.com) is the command-line tool for quick, simple deployment and management of Linux dedicated game servers.

4
lgsm/config-default/config-lgsm/bfvserver/_default.cfg

@ -123,8 +123,8 @@ stopmode="3"
# 3: gamedig # 3: gamedig
# 4: gsquery # 4: gsquery
# 5: tcp # 5: tcp
querymode="1" querymode="3"
querytype="" querytype="protocol-gamespy2"
## Console type ## Console type
consoleverbose="yes" consoleverbose="yes"

5
lgsm/config-default/config-lgsm/cs2server/_default.cfg

@ -15,6 +15,11 @@ port="27015"
maxplayers="16" maxplayers="16"
wsapikey="" wsapikey=""
## Game Server Login Token (GSLT): Required
# GSLT is required for running a public server.
# More info: https://docs.linuxgsm.com/steamcmd/gslt
gslt=""
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
startparameters="-dedicated -ip ${ip} -port ${port} -maxplayers ${maxplayers} -authkey ${wsapikey} +exec ${selfname}.cfg" startparameters="-dedicated -ip ${ip} -port ${port} -maxplayers ${maxplayers} -authkey ${wsapikey} +exec ${selfname}.cfg"

2
lgsm/config-default/config-lgsm/jc2server/_default.cfg

@ -134,7 +134,7 @@ stopmode="2"
# 4: gsquery # 4: gsquery
# 5: tcp # 5: tcp
querymode="2" querymode="2"
querytype="jc2m" querytype="jc2mp"
## Console type ## Console type
consoleverbose="yes" consoleverbose="yes"

2
lgsm/config-default/config-lgsm/sof2server/_default.cfg

@ -142,7 +142,7 @@ glibc="2.1"
# Edit with care # Edit with care
## Game Server Directories ## Game Server Directories
systemdir="${serverfiles}/main" systemdir="${serverfiles}/base"
executabledir="${serverfiles}" executabledir="${serverfiles}"
executable="./sof2ded" executable="./sof2ded"
servercfgdir="${systemdir}" servercfgdir="${systemdir}"

0
lgsm/config-default/config-lgsm/psserver/_default.cfg → lgsm/config-default/config-lgsm/squad44server/_default.cfg

4
lgsm/config-default/config-lgsm/stserver/_default.cfg

@ -9,11 +9,11 @@
#### Game Server Settings #### #### Game Server Settings ####
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters ## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
worldname="moon_save" worldsave="moon_save"
worldtype="Moon" worldtype="Moon"
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
startparameters="-LOADLATEST ${worldname} ${worldtype}" startparameters="-LOAD ${worldsave} ${worldtype}"
#### LinuxGSM Settings #### #### LinuxGSM Settings ####

2
lgsm/config-default/config-lgsm/ts3server/_default.cfg

@ -133,7 +133,7 @@ consoleinteract="no"
## Game Server Details ## Game Server Details
# Do not edit # Do not edit
gamename="TeamSpeak 3" gamename="TeamSpeak 3"
servername="TeamSpeak 3 Server" servername="LinuxGSM"
engine="null" engine="null"
glibc="2.17" glibc="2.17"

2
lgsm/data/debian-10.csv

@ -81,7 +81,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-11-jre pmc,openjdk-11-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 4.

2
lgsm/data/debian-11.csv

@ -82,7 +82,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-17-jre pmc,openjdk-17-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/data/debian-12.csv

@ -82,7 +82,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-17-jre pmc,openjdk-17-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/data/debian-13.csv

@ -82,7 +82,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-22-jre pmc,openjdk-22-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/data/debian-9.csv

@ -82,7 +82,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-8-jre pmc,openjdk-8-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 2.

268
lgsm/data/serverlist.csv

@ -1,138 +1,138 @@
shortname,gameservername,gamename,os shortname,gameservername,gamename,os
ac,acserver,Assetto Corsa,ubuntu-22.04 ac,acserver,Assetto Corsa,ubuntu-24.04
ahl,ahlserver,Action Half-Life,ubuntu-22.04 ahl,ahlserver,Action Half-Life,ubuntu-24.04
ahl2,ahl2server,Action: Source,ubuntu-20.04 ahl2,ahl2server,Action: Source,ubuntu-24.04
ark,arkserver,ARK: Survival Evolved,ubuntu-22.04 ark,arkserver,ARK: Survival Evolved,ubuntu-24.04
arma3,arma3server,ARMA 3,ubuntu-22.04 arma3,arma3server,ARMA 3,ubuntu-24.04
armar,armarserver,Arma Reforger,ubuntu-20.04 armar,armarserver,Arma Reforger,ubuntu-24.04
ats,atsserver,American Truck Simulator,ubuntu-22.04 ats,atsserver,American Truck Simulator,ubuntu-24.04
av,avserver,Avorion,ubuntu-22.04 av,avserver,Avorion,ubuntu-24.04
bb,bbserver,BrainBread,ubuntu-22.04 bb,bbserver,BrainBread,ubuntu-24.04
bb2,bb2server,BrainBread 2,ubuntu-22.04 bb2,bb2server,BrainBread 2,ubuntu-24.04
bd,bdserver,Base Defense,ubuntu-22.04 bd,bdserver,Base Defense,ubuntu-24.04
bf1942,bf1942server,Battlefield 1942,ubuntu-22.04 bf1942,bf1942server,Battlefield 1942,ubuntu-24.04
bfv,bfvserver,Battlefield: Vietnam,ubuntu-22.04 bfv,bfvserver,Battlefield: Vietnam,ubuntu-24.04
bmdm,bmdmserver,Black Mesa: Deathmatch,ubuntu-22.04 bmdm,bmdmserver,Black Mesa: Deathmatch,ubuntu-24.04
bo,boserver,Ballistic Overkill,ubuntu-22.04 bo,boserver,Ballistic Overkill,ubuntu-24.04
bs,bsserver,Blade Symphony,ubuntu-22.04 bs,bsserver,Blade Symphony,ubuntu-24.04
bt,btserver,Barotrauma,ubuntu-22.04 bt,btserver,Barotrauma,ubuntu-24.04
btl,btlserver,BATTALION: Legacy,ubuntu-20.04 btl,btlserver,BATTALION: Legacy,ubuntu-20.04
cc,ccserver,Codename CURE,ubuntu-22.04 cc,ccserver,Codename CURE,ubuntu-24.04
ck,ckserver,Core Keeper,ubuntu-22.04 ck,ckserver,Core Keeper,ubuntu-24.04
cmw,cmwserver,Chivalry: Medieval Warfare,ubuntu-22.04 cmw,cmwserver,Chivalry: Medieval Warfare,ubuntu-24.04
cod,codserver,Call of Duty,ubuntu-22.04 cod,codserver,Call of Duty,ubuntu-24.04
cod2,cod2server,Call of Duty 2,ubuntu-22.04 cod2,cod2server,Call of Duty 2,ubuntu-24.04
cod4,cod4server,Call of Duty 4,ubuntu-22.04 cod4,cod4server,Call of Duty 4,ubuntu-24.04
coduo,coduoserver,Call of Duty: United Offensive,ubuntu-22.04 coduo,coduoserver,Call of Duty: United Offensive,ubuntu-24.04
codwaw,codwawserver,Call of Duty: World at War,ubuntu-22.04 codwaw,codwawserver,Call of Duty: World at War,ubuntu-24.04
col,colserver,Colony Survival,ubuntu-22.04 col,colserver,Colony Survival,ubuntu-24.04
cs,csserver,Counter-Strike 1.6,ubuntu-22.04 cs,csserver,Counter-Strike 1.6,ubuntu-24.04
cs2,cs2server,Counter-Strike 2,ubuntu-22.04 cs2,cs2server,Counter-Strike 2,ubuntu-24.04
cscz,csczserver,Counter-Strike: Condition Zero,ubuntu-22.04 cscz,csczserver,Counter-Strike: Condition Zero,ubuntu-24.04
csgo,csgoserver,Counter-Strike: Global Offensive,ubuntu-22.04 csgo,csgoserver,Counter-Strike: Global Offensive,ubuntu-24.04
css,cssserver,Counter-Strike: Source,ubuntu-22.04 css,cssserver,Counter-Strike: Source,ubuntu-24.04
ct,ctserver,Craftopia,ubuntu-22.04 ct,ctserver,Craftopia,ubuntu-24.04
dab,dabserver,Double Action: Boogaloo,ubuntu-22.04 dab,dabserver,Double Action: Boogaloo,ubuntu-24.04
dayz,dayzserver,DayZ,ubuntu-22.04 dayz,dayzserver,DayZ,ubuntu-24.04
dmc,dmcserver,Deathmatch Classic,ubuntu-22.04 dmc,dmcserver,Deathmatch Classic,ubuntu-24.04
dod,dodserver,Day of Defeat,ubuntu-22.04 dod,dodserver,Day of Defeat,ubuntu-24.04
dodr,dodrserver,Day of Dragons,ubuntu-22.04 dodr,dodrserver,Day of Dragons,ubuntu-24.04
dods,dodsserver,Day of Defeat: Source,ubuntu-22.04 dods,dodsserver,Day of Defeat: Source,ubuntu-24.04
doi,doiserver,Day of Infamy,ubuntu-22.04 doi,doiserver,Day of Infamy,ubuntu-24.04
dst,dstserver,Don't Starve Together,ubuntu-22.04 dst,dstserver,Don't Starve Together,ubuntu-24.04
dys,dysserver,Dystopia,ubuntu-22.04 dys,dysserver,Dystopia,ubuntu-24.04
eco,ecoserver,Eco,ubuntu-22.04 eco,ecoserver,Eco,ubuntu-24.04
em,emserver,Empires Mod,ubuntu-22.04 em,emserver,Empires Mod,ubuntu-24.04
etl,etlserver,ET: Legacy,ubuntu-22.04 etl,etlserver,ET: Legacy,ubuntu-24.04
ets2,ets2server,Euro Truck Simulator 2,ubuntu-22.04 ets2,ets2server,Euro Truck Simulator 2,ubuntu-24.04
fctr,fctrserver,Factorio,ubuntu-22.04 fctr,fctrserver,Factorio,ubuntu-24.04
fof,fofserver,Fistful of Frags,ubuntu-22.04 fof,fofserver,Fistful of Frags,ubuntu-24.04
gmod,gmodserver,Garrys Mod,ubuntu-22.04 gmod,gmodserver,Garrys Mod,ubuntu-24.04
hcu,hcuserver,HYPERCHARGE: Unboxed,ubuntu-22.04 hcu,hcuserver,HYPERCHARGE: Unboxed,ubuntu-24.04
hl2dm,hl2dmserver,Half-Life 2: Deathmatch,ubuntu-22.04 hl2dm,hl2dmserver,Half-Life 2: Deathmatch,ubuntu-24.04
hldm,hldmserver,Half-Life: Deathmatch,ubuntu-22.04 hldm,hldmserver,Half-Life: Deathmatch,ubuntu-24.04
hldms,hldmsserver,Half-Life Deathmatch: Source,ubuntu-22.04 hldms,hldmsserver,Half-Life Deathmatch: Source,ubuntu-24.04
hw,hwserver,Hurtworld,ubuntu-22.04 hw,hwserver,Hurtworld,ubuntu-24.04
hz,hzserver,Humanitz,ubuntu-22.04 hz,hzserver,Humanitz,ubuntu-24.04
ins,insserver,Insurgency,ubuntu-22.04 ins,insserver,Insurgency,ubuntu-24.04
inss,inssserver,Insurgency: Sandstorm,ubuntu-22.04 inss,inssserver,Insurgency: Sandstorm,ubuntu-24.04
ios,iosserver,IOSoccer,ubuntu-22.04 ios,iosserver,IOSoccer,ubuntu-24.04
jc2,jc2server,Just Cause 2,ubuntu-22.04 jc2,jc2server,Just Cause 2,ubuntu-24.04
jc3,jc3server,Just Cause 3,ubuntu-22.04 jc3,jc3server,Just Cause 3,ubuntu-24.04
jk2,jk2server,Jedi Knight II: Jedi Outcast,ubuntu-22.04 jk2,jk2server,Jedi Knight II: Jedi Outcast,ubuntu-24.04
kf,kfserver,Killing Floor,ubuntu-22.04 kf,kfserver,Killing Floor,ubuntu-24.04
kf2,kf2server,Killing Floor 2,ubuntu-22.04 kf2,kf2server,Killing Floor 2,ubuntu-24.04
l4d,l4dserver,Left 4 Dead,ubuntu-22.04 l4d,l4dserver,Left 4 Dead,ubuntu-24.04
l4d2,l4d2server,Left 4 Dead 2,ubuntu-22.04 l4d2,l4d2server,Left 4 Dead 2,ubuntu-24.04
mc,mcserver,Minecraft,ubuntu-22.04 mc,mcserver,Minecraft,ubuntu-24.04
mcb,mcbserver,Minecraft Bedrock,ubuntu-22.04 mcb,mcbserver,Minecraft Bedrock,ubuntu-24.04
mh,mhserver,MORDHAU,ubuntu-22.04 mh,mhserver,MORDHAU,ubuntu-24.04
mohaa,mohaaserver,Medal of Honor: Allied Assault,ubuntu-22.04 mohaa,mohaaserver,Medal of Honor: Allied Assault,ubuntu-24.04
mta,mtaserver,Multi Theft Auto,ubuntu-22.04 mta,mtaserver,Multi Theft Auto,ubuntu-24.04
nd,ndserver,Nuclear Dawn,ubuntu-22.04 nd,ndserver,Nuclear Dawn,ubuntu-24.04
nec,necserver,Necesse,ubuntu-22.04 nec,necserver,Necesse,ubuntu-24.04
nmrih,nmrihserver,No More Room in Hell,ubuntu-22.04 nmrih,nmrihserver,No More Room in Hell,ubuntu-24.04
ns,nsserver,Natural Selection,ubuntu-22.04 ns,nsserver,Natural Selection,ubuntu-24.04
ns2,ns2server,Natural Selection 2,ubuntu-22.04 ns2,ns2server,Natural Selection 2,ubuntu-24.04
ns2c,ns2cserver,NS2: Combat,ubuntu-22.04 ns2c,ns2cserver,NS2: Combat,ubuntu-24.04
ohd,ohdserver,Operation: Harsh Doorstop,ubuntu-22.04 ohd,ohdserver,Operation: Harsh Doorstop,ubuntu-24.04
onset,onsetserver,Onset,ubuntu-20.04 onset,onsetserver,Onset,ubuntu-20.04
opfor,opforserver,Opposing Force,ubuntu-22.04 opfor,opforserver,Opposing Force,ubuntu-24.04
pc,pcserver,Project Cars,ubuntu-22.04 pc,pcserver,Project Cars,ubuntu-24.04
pc2,pc2server,Project Cars 2,ubuntu-22.04 pc2,pc2server,Project Cars 2,ubuntu-24.04
pmc,pmcserver,PaperMC,ubuntu-22.04 pmc,pmcserver,PaperMC,ubuntu-24.04
ps,psserver,Post Scriptum,ubuntu-22.04 pvkii,pvkiiserver,Pirates Vikings & Knights II,ubuntu-24.04
pvkii,pvkiiserver,Pirates Vikings & Knights II,ubuntu-22.04 pvr,pvrserver,Pavlov VR,ubuntu-24.04
pvr,pvrserver,Pavlov VR,ubuntu-22.04 pw,pwserver,Palworld,ubuntu-24.04
pw,pwserver,Palworld,ubuntu-22.04 pz,pzserver,Project Zomboid,ubuntu-24.04
pz,pzserver,Project Zomboid,ubuntu-22.04 q2,q2server,Quake 2,ubuntu-24.04
q2,q2server,Quake 2,ubuntu-22.04 q3,q3server,Quake 3: Arena,ubuntu-24.04
q3,q3server,Quake 3: Arena,ubuntu-22.04 q4,q4server,Quake 4,ubuntu-24.04
q4,q4server,Quake 4,ubuntu-22.04 ql,qlserver,Quake Live,ubuntu-24.04
ql,qlserver,Quake Live,ubuntu-22.04 qw,qwserver,Quake World,ubuntu-24.04
qw,qwserver,Quake World,ubuntu-22.04 ricochet,ricochetserver,Ricochet,ubuntu-24.04
ricochet,ricochetserver,Ricochet,ubuntu-22.04 ro,roserver,Red Orchestra: Ostfront 41-45,ubuntu-24.04
ro,roserver,Red Orchestra: Ostfront 41-45,ubuntu-22.04 rtcw,rtcwserver,Return to Castle Wolfenstein,ubuntu-24.04
rtcw,rtcwserver,Return to Castle Wolfenstein,ubuntu-22.04 rust,rustserver,Rust,ubuntu-24.04
rust,rustserver,Rust,ubuntu-22.04 rw,rwserver,Rising World,ubuntu-24.04
rw,rwserver,Rising World,ubuntu-22.04 samp,sampserver,San Andreas Multiplayer,ubuntu-24.04
samp,sampserver,San Andreas Multiplayer,ubuntu-22.04 sb,sbserver,Starbound,ubuntu-24.04
sb,sbserver,Starbound,ubuntu-22.04 sbots,sbotsserver,StickyBots,ubuntu-24.04
sbots,sbotsserver,StickyBots,ubuntu-22.04 scpsl,scpslserver,SCP: Secret Laboratory,ubuntu-24.04
scpsl,scpslserver,SCP: Secret Laboratory,ubuntu-22.04 scpslsm,scpslsmserver,SCP: Secret Laboratory ServerMod,ubuntu-24.04
scpslsm,scpslsmserver,SCP: Secret Laboratory ServerMod,ubuntu-22.04 sdtd,sdtdserver,7 Days to Die,ubuntu-24.04
sdtd,sdtdserver,7 Days to Die,ubuntu-22.04 sf,sfserver,Satisfactory,ubuntu-24.04
sf,sfserver,Satisfactory,ubuntu-22.04 sfc,sfcserver,SourceForts Classic,ubuntu-24.04
sfc,sfcserver,SourceForts Classic,ubuntu-22.04 sm,smserver,Soulmask,ubuntu-24.04
sm,smserver,Soulmask,ubuntu-22.04 sof2,sof2server,Soldier Of Fortune 2: Gold Edition,ubuntu-24.04
sof2,sof2server,Soldier Of Fortune 2: Gold Edition,ubuntu-22.04 sol,solserver,Soldat,ubuntu-24.04
sol,solserver,Soldat,ubuntu-22.04 squad,squadserver,Squad,ubuntu-24.04
squad,squadserver,Squad,ubuntu-22.04 squad44,squad44server,Squad 44,ubuntu-24.04
st,stserver,Stationeers,ubuntu-22.04 st,stserver,Stationeers,ubuntu-24.04
stn,stnserver,Survive the Nights,ubuntu-22.04 stn,stnserver,Survive the Nights,ubuntu-24.04
sven,svenserver,Sven Co-op,ubuntu-20.04 sven,svenserver,Sven Co-op,ubuntu-20.04
terraria,terrariaserver,Terraria,ubuntu-22.04 terraria,terrariaserver,Terraria,ubuntu-24.04
tf,tfserver,The Front,ubuntu-22.04 tf,tfserver,The Front,ubuntu-24.04
tf2,tf2server,Team Fortress 2,ubuntu-22.04 tf2,tf2server,Team Fortress 2,ubuntu-24.04
tfc,tfcserver,Team Fortress Classic,ubuntu-22.04 tfc,tfcserver,Team Fortress Classic,ubuntu-24.04
ti,tiserver,The Isle,ubuntu-22.04 ti,tiserver,The Isle,ubuntu-24.04
ts,tsserver,The Specialists,ubuntu-22.04 ts,tsserver,The Specialists,ubuntu-24.04
ts3,ts3server,Teamspeak 3,ubuntu-22.04 ts3,ts3server,Teamspeak 3,ubuntu-24.04
tu,tuserver,Tower Unite,ubuntu-22.04 tu,tuserver,Tower Unite,ubuntu-24.04
tw,twserver,Teeworlds,ubuntu-22.04 tw,twserver,Teeworlds,ubuntu-24.04
unt,untserver,Unturned,ubuntu-22.04 unt,untserver,Unturned,ubuntu-24.04
ut,utserver,Unreal Tournament,ubuntu-22.04 ut,utserver,Unreal Tournament,ubuntu-24.04
ut2k4,ut2k4server,Unreal Tournament 2004,ubuntu-22.04 ut2k4,ut2k4server,Unreal Tournament 2004,ubuntu-24.04
ut3,ut3server,Unreal Tournament 3,ubuntu-22.04 ut3,ut3server,Unreal Tournament 3,ubuntu-24.04
ut99,ut99server,Unreal Tournament 99,ubuntu-22.04 ut99,ut99server,Unreal Tournament 99,ubuntu-24.04
vh,vhserver,Valheim,ubuntu-22.04 vh,vhserver,Valheim,ubuntu-24.04
vints,vintsserver,Vintage Story,ubuntu-22.04 vints,vintsserver,Vintage Story,ubuntu-24.04
vpmc,vpmcserver,Velocity Proxy MC,ubuntu-22.04 vpmc,vpmcserver,Velocity Proxy MC,ubuntu-24.04
vs,vsserver,Vampire Slayer,ubuntu-22.04 vs,vsserver,Vampire Slayer,ubuntu-24.04
wet,wetserver,Wolfenstein: Enemy Territory,ubuntu-22.04 wet,wetserver,Wolfenstein: Enemy Territory,ubuntu-24.04
wf,wfserver,Warfork,ubuntu-22.04 wf,wfserver,Warfork,ubuntu-24.04
wmc,wmcserver,WaterfallMC,ubuntu-22.04 wmc,wmcserver,WaterfallMC,ubuntu-24.04
wurm,wurmserver,Wurm Unlimited,ubuntu-22.04 wurm,wurmserver,Wurm Unlimited,ubuntu-24.04
xnt,xntserver,Xonotic,ubuntu-22.04 xnt,xntserver,Xonotic,ubuntu-24.04
zmr,zmrserver,Zombie Master: Reborn,ubuntu-22.04 zmr,zmrserver,Zombie Master: Reborn,ubuntu-24.04
zps,zpsserver,Zombie Panic! Source,ubuntu-22.04 zps,zpsserver,Zombie Panic! Source,ubuntu-24.04

Can't render this file because it has a wrong number of fields in line 47.

2
lgsm/data/ubuntu-16.04.csv

@ -83,7 +83,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-8-jre pmc,openjdk-8-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pz,openjdk-8-jre,rng-tools pz,openjdk-8-jre,rng-tools

Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/data/ubuntu-18.04.csv

@ -83,7 +83,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-11-jre pmc,openjdk-11-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pz,openjdk-11-jre,rng-tools pz,openjdk-11-jre,rng-tools

Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/data/ubuntu-20.04.csv

@ -82,7 +82,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-21-jre pmc,openjdk-21-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/data/ubuntu-22.04.csv

@ -82,7 +82,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-21-jre pmc,openjdk-21-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/data/ubuntu-23.04.csv

@ -82,7 +82,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-21-jre pmc,openjdk-21-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/data/ubuntu-23.10.csv

@ -82,7 +82,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-21-jre pmc,openjdk-21-jre
ps,libgconf-2-4 squad44
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/data/ubuntu-24.04.csv

@ -82,7 +82,7 @@ opfor
pc pc
pc2 pc2
pmc,openjdk-21-jre pmc,openjdk-21-jre
ps,libgconf-2-4 ps
pvkii pvkii
pvr,libc++1 pvr,libc++1
pw pw

Can't render this file because it has a wrong number of fields in line 2.

104
lgsm/modules/alert_discord.sh

@ -7,7 +7,7 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
jsoninfo=$( json=$(
cat << EOF cat << EOF
{ {
"username": "LinuxGSM", "username": "LinuxGSM",
@ -29,103 +29,45 @@ jsoninfo=$(
"url": "${alerticon}" "url": "${alerticon}"
}, },
"fields": [ "fields": [
{
"name": "Server Name",
"value": "${servername}"
},
{
"name": "Information",
"value": "${alertmessage}"
},
{ {
"name": "Game", "name": "Server Name",
"value": "${gamename}", "value": "${servername}"
"inline": true
}, },
{ {
"name": "Server IP", "name": "Information",
"value": "\`${alertip}:${port}\`", "value": "${alertmessage}"
"inline": true
}, },
{ {
"name": "Hostname", "name": "Game",
"value": "${HOSTNAME}", "value": "${gamename}",
"inline": true "inline": true
}, },
{
"name": "More info",
"value": "${alerturl}",
"inline": true
},
{ {
"name": "Server Time", "name": "Server Time",
"value": "$(date)", "value": "$(date)",
"inline": true "inline": true
} }
],
"footer": {
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"text": "Sent by LinuxGSM ${version}"
}
}
]
}
EOF EOF
) )
jsonnoinfo=$( if [ -n "${querytype}" ]; then
cat << EOF json+=$(
{ cat << EOF
"username": "LinuxGSM", ,
"avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"file": "content",
"embeds": [
{
"author": {
"name": "LinuxGSM Alert",
"url": "",
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg"
},
"title": "${alerttitle}",
"url": "",
"description": "",
"color": "${alertcolourdec}",
"type": "content",
"thumbnail": {
"url": "${alerticon}"
},
"fields": [
{
"name": "Server Name",
"value": "${servername}"
},
{
"name": "Information",
"value": "${alertmessage}"
},
{ {
"name": "Game", "name": "Is my Game Server Online?",
"value": "${gamename}", "value": "https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}",
"inline": true
},
{
"name": "Server IP",
"value": "\`${alertip}:${port}\`",
"inline": true
},
{
"name": "Hostname",
"value": "${HOSTNAME}",
"inline": true
},
{
"name": "Server Time",
"value": "$(date)",
"inline": true "inline": true
} }
EOF
)
fi
json+=$(
cat << EOF
], ],
"footer": { "footer": {
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"text": "Sent by LinuxGSM ${version}" "text": "Sent by LinuxGSM ${version}"
} }
} }
@ -136,12 +78,6 @@ EOF
fn_print_dots "Sending Discord alert" fn_print_dots "Sending Discord alert"
if [ -z "${alerturl}" ]; then
json="${jsonnoinfo}"
else
json="${jsoninfo}"
fi
discordsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${discordwebhook}") discordsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${discordwebhook}")
if [ -n "${discordsend}" ]; then if [ -n "${discordsend}" ]; then

2
lgsm/modules/alert_email.sh

@ -15,7 +15,7 @@ else
mail -s "${alerttitle}" "${email}" < "${alertlog}" mail -s "${alerttitle}" "${email}" < "${alertlog}"
fi fi
exitcode=$? exitcode=$?
if [ "${exitcode}" == "0" ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_ok_nl "Sending Email alert: ${email}" fn_print_ok_nl "Sending Email alert: ${email}"
fn_script_log_pass "Sending Email alert: ${email}" fn_script_log_pass "Sending Email alert: ${email}"
else else

36
lgsm/modules/alert_gotify.sh

@ -5,34 +5,40 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Sends Gotify alert. # Description: Sends Gotify alert.
module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
jsoninfo=$( json=$(
cat << EOF cat << EOF
{ {
"title": "${alerttitle}", "title": "${alerttitle}",
"message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}\n\nServer Time\n$(date)", "message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n
"priority": 5
}
EOF EOF
) )
jsonnoinfo=$( if [ -n "${querytype}" ]; then
json+=$(
cat << EOF
Is my Game Server Online?\nhttps://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}\n\n
EOF
)
fi
if [ -n "${alerturl}" ]; then
json+=$(
cat << EOF
More info\n${alerturl}\n\n
EOF
)
fi
json+=$(
cat << EOF cat << EOF
{ Server Time\n$(date)",
"title": "${alerttitle}",
"message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nServer Time\n$(date)",
"priority": 5 "priority": 5
} }
EOF EOF
) )
if [ -z "${alerturl}" ]; then
json="${jsonnoinfo}"
else
json="${jsoninfo}"
fi
fn_print_dots "Sending Gotify alert" fn_print_dots "Sending Gotify alert"
gotifysend=$(curl --connect-timeout 3 -sSL "${gotifywebhook}/message"?token="${gotifytoken}" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)") gotifysend=$(curl --connect-timeout 3 -sSL "${gotifywebhook}/message"?token="${gotifytoken}" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)")

34
lgsm/modules/alert_ifttt.sh

@ -7,32 +7,38 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
jsoninfo=$( json=$(
cat << EOF cat << EOF
{ {
"value1": "${selfname}", "value1": "${selfname}",
"value2": "${alerttitle}", "value2": "${alerttitle}",
"value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}\n\nServer Time\n$(date)" "value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n
}
EOF EOF
) )
jsonnoinfo=$( if [ -n "${querytype}" ]; then
json+=$(
cat << EOF
Is my Game Server Online?\nhttps://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}\n\n
EOF
)
fi
if [ -n "${alerturl}" ]; then
json+=$(
cat << EOF
More info\n${alerturl}\n\n
EOF
)
fi
json+=$(
cat << EOF cat << EOF
{ Server Time\n$(date)"
"value1": "${selfname}",
"value2": "${alerttitle}",
"value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nServer Time\n$(date)"
} }
EOF EOF
) )
if [ -z "${alerturl}" ]; then
json="${jsonnoinfo}"
else
json="${jsoninfo}"
fi
fn_print_dots "Sending IFTTT alert" fn_print_dots "Sending IFTTT alert"
iftttsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request") iftttsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request")

35
lgsm/modules/alert_pushbullet.sh

@ -7,34 +7,39 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
jsoninfo=$( json=$(
cat << EOF cat << EOF
{ {
"channel_tag": "${channeltag}", "channel_tag": "${channeltag}",
"type": "note", "type": "note",
"title": "${alerttitle}", "title": "${alerttitle}",
"body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}\n\nServer Time\n$(date)" "body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n
}
EOF EOF
) )
jsonnoinfo=$( if [ -n "${querytype}" ]; then
json+=$(
cat << EOF
Is my Game Server Online?\nhttps://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}\n\n
EOF
)
fi
if [ -n "${alerturl}" ]; then
json+=$(
cat << EOF
More info\n${alerturl}\n\n
EOF
)
fi
json+=$(
cat << EOF cat << EOF
{ Server Time\n$(date)"
"channel_tag": "${channeltag}",
"type": "note",
"title": "${alerttitle}",
"body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nServer Time\n$(date)"
} }
EOF EOF
) )
if [ -z "${alerturl}" ]; then
json="${jsonnoinfo}"
else
json="${jsoninfo}"
fi
fn_print_dots "Sending Pushbullet alert" fn_print_dots "Sending Pushbullet alert"
pushbulletsend=$(curl --connect-timeout 3 -sSL -H "Access-Token: ${pushbullettoken}" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://api.pushbullet.com/v2/pushes" | grep "error_code") pushbulletsend=$(curl --connect-timeout 3 -sSL -H "Access-Token: ${pushbullettoken}" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://api.pushbullet.com/v2/pushes" | grep "error_code")

24
lgsm/modules/alert_pushover.sh

@ -22,12 +22,28 @@ else
alertpriority="0" alertpriority="0"
fi fi
if [ -z "${alerturl}" ]; then message=" <b>Server name</b><br>${servername}<br><br><b>Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br>"
pushoversend=$(curl --connect-timeout 3 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alerttitle}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br>Server Time<br>$(date)" "https://api.pushover.net/1/messages.json" | grep errors)
else if [ -n "${querytype}" ]; then
pushoversend=$(curl --connect-timeout 3 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alerttitle}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a><br><br>Server Time<br>$(date)" "https://api.pushover.net/1/messages.json" | grep errors) message+="<b>Is my Game Server Online?</b><br><a href='https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}'>Check here</a><br><br>"
fi
if [ -n "${alerturl}" ]; then
message+="<b>More info</b><br><a href='${alerturl}'>${alerturl}</a><br><br>"
fi fi
message+="Server Time<br>$(date)"
pushoversend=$(curl --connect-timeout 3 -sS \
-F token="${pushovertoken}" \
-F user="${pushoveruserkey}" \
-F html="1" \
-F sound="${alertsound}" \
-F priority="${alertpriority}" \
-F title="${alerttitle}" \
-F message="${message}" \
"https://api.pushover.net/1/messages.json" | grep errors)
if [ -n "${pushoversend}" ]; then if [ -n "${pushoversend}" ]; then
fn_print_fail_nl "Sending Pushover alert: ${pushoversend}" fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"
fn_script_log_fail "Sending Pushover alert: ${pushoversend}" fn_script_log_fail "Sending Pushover alert: ${pushoversend}"

34
lgsm/modules/alert_rocketchat.sh

@ -7,7 +7,7 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
jsoninfo=$( json=$(
cat << EOF cat << EOF
{ {
"alias": "LinuxGSM", "alias": "LinuxGSM",
@ -64,7 +64,31 @@ jsoninfo=$(
EOF EOF
) )
jsonnoinfo=$( if [ -n "${querytype}" ]; then
json+=$(
cat << EOF
{
"short": false,
"title": "Is my Game Server Online?",
"value": "<https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}|Check here>"
},
EOF
)
fi
if [ -n "${alerturl}" ]; then
json+=$(
cat << EOF
{
"short": false,
"title": "More info",
"value": "${alerturl}"
},
EOF
)
fi
json+=$(
cat << EOF cat << EOF
{ {
"alias": "LinuxGSM", "alias": "LinuxGSM",
@ -116,12 +140,6 @@ jsonnoinfo=$(
EOF EOF
) )
if [ -z "${alerturl}" ]; then
json="${jsonnoinfo}"
else
json="${jsoninfo}"
fi
fn_print_dots "Sending Rocketchat alert" fn_print_dots "Sending Rocketchat alert"
rocketchatsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${rocketchatwebhook}") rocketchatsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${rocketchatwebhook}")

38
lgsm/modules/alert_slack.sh

@ -7,7 +7,7 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
jsonnoinfo=$( json=$(
cat << EOF cat << EOF
{ {
"attachments": [ "attachments": [
@ -87,7 +87,35 @@ jsonnoinfo=$(
EOF EOF
) )
jsoninfo=$( if [ -n "${querytype}" ]; then
json+=$(
cat << EOF
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Is my Game Server Online?*\n<https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}|Check here>"
}
},
EOF
)
fi
if [ -n "${alerturl}" ]; then
json+=$(
cat << EOF
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*More info*\n<${alerturl}|${alerturl}>"
}
},
EOF
)
fi
json+=$(
cat << EOF cat << EOF
{ {
"attachments": [ "attachments": [
@ -174,12 +202,6 @@ jsoninfo=$(
EOF EOF
) )
if [ -z "${alerturl}" ]; then
json="${jsonnoinfo}"
else
json="${jsoninfo}"
fi
fn_print_dots "Sending Slack alert" fn_print_dots "Sending Slack alert"
slacksend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${slackwebhook}") slacksend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${slackwebhook}")

37
lgsm/modules/alert_telegram.sh

@ -7,38 +7,41 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
jsoninfo=$( json=$(
cat << EOF cat << EOF
{ {
"chat_id": "${telegramchatid}", "chat_id": "${telegramchatid}",
"message_thread_id": "${telegramthreadid}", "message_thread_id": "${telegramthreadid}",
"parse_mode": "HTML", "parse_mode": "HTML",
"disable_notification": "${telegramdisablenotification}", "disable_notification": "${telegramdisablenotification}",
"text": "<b>${alerttitle}</b>\n\n<b>Server name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n<b>More info</b>\n<a href='${alerturl}'>${alerturl}</a>\n\n<b>Server Time</b>\n$(date)", "text": "<b>${alerttitle}</b>\n\n<b>Server name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n
"disable_web_page_preview": "yes"
}
EOF EOF
) )
jsonnoinfo=$( if [ -n "${querytype}" ]; then
json+=$(
cat << EOF
<b>Is my Game Server Online?</b>\n<a href='https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}'>Check here</a>\n\n
EOF
)
fi
if [ -n "${alerturl}" ]; then
json+=$(
cat << EOF
<b>More info</b>\n<a href='${alerturl}'>${alerturl}</a>\n\n
EOF
)
fi
json+=$(
cat << EOF cat << EOF
{ <b>Server Time</b>\n$(date)",
"chat_id": "${telegramchatid}",
"message_thread_id": "${telegramthreadid}",
"parse_mode": "HTML",
"disable_notification": "${telegramdisablenotification}",
"text": "<b>${alerttitle}</b>\n\n<b>Server name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n<b>Server Time</b>\n$(date)",
"disable_web_page_preview": "yes" "disable_web_page_preview": "yes"
} }
EOF EOF
) )
if [ -z "${alerturl}" ]; then
json="${jsonnoinfo}"
else
json="${jsoninfo}"
fi
fn_print_dots "Sending Telegram alert" fn_print_dots "Sending Telegram alert"
telegramsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" ${curlcustomstring} "https://${telegramapi}/bot${telegramtoken}/sendMessage" | grep "error_code") telegramsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" ${curlcustomstring} "https://${telegramapi}/bot${telegramtoken}/sendMessage" | grep "error_code")

2
lgsm/modules/check.sh

@ -54,7 +54,7 @@ for allowed_command in "${allowed_commands_array[@]}"; do
fi fi
done done
allowed_commands_array=(BACKUP DEBUG START) allowed_commands_array=(BACKUP DEBUG DETAILS START UPDATE)
for allowed_command in "${allowed_commands_array[@]}"; do for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then if [ "${allowed_command}" == "${commandname}" ]; then
check_deps.sh check_deps.sh

20
lgsm/modules/check_deps.sh

@ -78,11 +78,12 @@ fn_install_mono_repo() {
# Did Mono repo install correctly? # Did Mono repo install correctly?
if [ "${monoautoinstall}" != "1" ]; then if [ "${monoautoinstall}" != "1" ]; then
if [ $? != 0 ]; then exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_failure_nl "Unable to install Mono repository." fn_print_failure_nl "Unable to install Mono repository."
fn_script_log_fail "Unable to install Mono repository." fn_script_log_fail "Unable to install Mono repository."
else else
fn_print_complete_nl "Installing Mono repository completed." fn_print_success_nl "Installing Mono repository completed."
fn_script_log_pass "Installing Mono repository completed." fn_script_log_pass "Installing Mono repository completed."
fi fi
fi fi
@ -113,13 +114,13 @@ fn_deps_email() {
elif [ -d /etc/sendmail ]; then elif [ -d /etc/sendmail ]; then
array_deps_required+=(sendmail) array_deps_required+=(sendmail)
elif [ "$(command -v yum 2> /dev/null)" ] || [ "$(command -v dnf 2> /dev/null)" ]; then elif [ "$(command -v yum 2> /dev/null)" ] || [ "$(command -v dnf 2> /dev/null)" ]; then
array_deps_required+=(mailx postfix) array_deps_required+=(s-nail postfix)
elif [ "$(command -v apt 2> /dev/null)" ]; then elif [ "$(command -v apt 2> /dev/null)" ]; then
array_deps_required+=(mailutils postfix) array_deps_required+=(mailutils postfix)
fi fi
else else
if [ "$(command -v yum 2> /dev/null)" ] || [ "$(command -v dnf 2> /dev/null)" ]; then if [ "$(command -v yum 2> /dev/null)" ] || [ "$(command -v dnf 2> /dev/null)" ]; then
array_deps_required+=(mailx postfix) array_deps_required+=(s-nail postfix)
elif [ "$(command -v apt 2> /dev/null)" ]; then elif [ "$(command -v apt 2> /dev/null)" ]; then
array_deps_required+=(mailutils postfix) array_deps_required+=(mailutils postfix)
fi fi
@ -195,9 +196,10 @@ fn_install_missing_deps() {
fi fi
autodepinstall="$?" autodepinstall="$?"
# If auto install passes remove steamcmd install failure. # If auto install passes, remove steamcmd install failure and set exit code to 0.
if [ "${autodepinstall}" == "0" ]; then if [ "${autodepinstall}" == "0" ]; then
unset steamcmdfail unset steamcmdfail
exitcode=0
fi fi
fi fi
@ -225,7 +227,7 @@ fn_install_missing_deps() {
else else
if [ "${commandname}" == "INSTALL" ]; then if [ "${commandname}" == "INSTALL" ]; then
fn_print_information_nl "Required dependencies already installed." fn_print_skip2_nl "Required dependencies already installed."
fn_script_log_info "Required dependencies already installed." fn_script_log_info "Required dependencies already installed."
fi fi
fi fi
@ -233,7 +235,7 @@ fn_install_missing_deps() {
fn_check_loop() { fn_check_loop() {
# Loop though required depenencies checking if they are installed. # Loop though required depenencies checking if they are installed.
for deptocheck in ${array_deps_required[*]}; do for deptocheck in "${array_deps_required[@]}"; do
fn_deps_detector fn_deps_detector
done done
@ -317,7 +319,7 @@ fn_deps_detector() {
fi fi
# If SteamCMD requirements are not met install will fail. # If SteamCMD requirements are not met install will fail.
if [ -n "${appid}" ]; then if [ -n "${appid}" ]; then
for steamcmddeptocheck in ${array_deps_required_steamcmd[*]}; do for steamcmddeptocheck in "${array_deps_required_steamcmd[@]}"; do
if [ "${deptocheck}" != "steamcmd" ] && [ "${deptocheck}" == "${steamcmddeptocheck}" ]; then if [ "${deptocheck}" != "steamcmd" ] && [ "${deptocheck}" == "${steamcmddeptocheck}" ]; then
steamcmdfail=1 steamcmdfail=1
fi fi
@ -360,7 +362,7 @@ if [ ! -f "${tmpdir}/dependency-no-check.tmp" ] && [ ! -f "${datadir}/${distroid
# Check that the distro dependency csv file exists. # Check that the distro dependency csv file exists.
fn_check_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" fn_check_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv"
if [ -n "${checkflag}" ] && [ "${checkflag}" == "0" ]; then if [ -n "${checkflag}" ] && [ "${checkflag}" == "0" ]; then
fn_fetch_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" "lgsm/data" "chmodx" "norun" "noforce" "nohash" fn_fetch_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" "${datadir}" "chmodx" "norun" "noforce" "nohash"
fi fi
fi fi

2
lgsm/modules/check_gamedig.sh

@ -5,6 +5,8 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Installs nodejs and gamedig # Description: Installs nodejs and gamedig
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ "$(command -v node)" ] && [ "$(command -v npm)" ] && [ "$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1)" -ge 16 ] && [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then if [ "$(command -v node)" ] && [ "$(command -v npm)" ] && [ "$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1)" -ge 16 ] && [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then
echo -e "" echo -e ""
echo -e "${bold}${lightyellow}Installing Gamedig${default}" echo -e "${bold}${lightyellow}Installing Gamedig${default}"

2
lgsm/modules/check_logs.sh

@ -10,7 +10,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_check_logs() { fn_check_logs() {
fn_print_dots "Checking for log files" fn_print_dots "Checking for log files"
fn_print_info_nl "Checking for log files: Creating log files" fn_print_info_nl "Checking for log files: Creating log files"
checklogs=1 checklogs=true
install_logs.sh install_logs.sh
} }

4
lgsm/modules/check_permissions.sh

@ -63,8 +63,8 @@ fn_check_permissions() {
findnotexecutable="$(find "${modulesdir}" -type f -not -executable)" findnotexecutable="$(find "${modulesdir}" -type f -not -executable)"
findnotexecutablewc="$(find "${modulesdir}" -type f -not -executable | wc -l)" findnotexecutablewc="$(find "${modulesdir}" -type f -not -executable | wc -l)"
if [ "${findnotexecutablewc}" -ne "0" ]; then if [ "${findnotexecutablewc}" -ne "0" ]; then
fn_print_fail_nl "Permissions issues found" fn_print_error_nl "Permissions issues found"
fn_script_log_fail "Permissions issues found" fn_script_log_error "Permissions issues found"
fn_print_information_nl "The following files are not executable:" fn_print_information_nl "The following files are not executable:"
fn_script_log_info "The following files are not executable:" fn_script_log_info "The following files are not executable:"
{ {

13
lgsm/modules/check_system_requirements.sh

@ -9,7 +9,11 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
info_distro.sh info_distro.sh
# RAM requirements in gigabytes for each game or engine. if [[ "${arch}" != "x86_64" && "${arch}" != "i386" && "${arch}" != "i686" ]]; then
echo -e "${red}Error: Only x86 type architectures are supported. Detected architecture: ${arch}${default}"
fn_script_log_error "Only x86 type architectures are supported. Detected architecture: ${arch}"
core_exit.sh
fi
if [ "${shortname}" == "ark" ]; then if [ "${shortname}" == "ark" ]; then
ramrequirementgb="7" ramrequirementgb="7"
@ -35,7 +39,7 @@ elif [ "${shortname}" == "mh" ]; then
ramrequirementgb="4" ramrequirementgb="4"
elif [ "${shortname}" == "ns2" ] || [ "${shortname}" == "ns2c" ]; then elif [ "${shortname}" == "ns2" ] || [ "${shortname}" == "ns2c" ]; then
ramrequirementgb="1" ramrequirementgb="1"
elif [ "${shortname}" == "ps" ]; then elif [ "${shortname}" == "squad44" ]; then
ramrequirementgb="2" ramrequirementgb="2"
elif [ "${shortname}" == "pvr" ]; then elif [ "${shortname}" == "pvr" ]; then
ramrequirementgb="1" ramrequirementgb="1"
@ -67,8 +71,9 @@ fi
if [ "${ramrequirementgb}" ]; then if [ "${ramrequirementgb}" ]; then
if (($(echo "${physmemtotalgb} < ${ramrequirementgb}" | bc -l))); then if (($(echo "${physmemtotalgb} < ${ramrequirementgb}" | bc -l))); then
fn_print_dots "Checking RAM" fn_print_dots "Checking RAM"
fn_print_warn_nl "Checking RAM: ${ramrequirementgb}G required, ${physmemtotal} available" fn_print_warn_nl "Checking RAM: Minumum RAM requirements not met"
echo "* ${gamename} server may fail to run or experience poor performance." fn_print_nl "* ${ramrequirementgb}G is required, but only ${physmemtotal} is available."
fn_print_nl "* ${gamename} server may fail to run or experience poor performance."
fn_sleep_time_5 fn_sleep_time_5
fi fi
fi fi

14
lgsm/modules/command_backup.sh

@ -6,7 +6,7 @@
# Description: Creates a .tar.gz file in the backup directory. # Description: Creates a .tar.gz file in the backup directory.
commandname="BACKUP" commandname="BACKUP"
commandaction="Backing up" commandaction="Backup"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
@ -115,7 +115,7 @@ fn_backup_compression() {
# Tells how much will be compressed using rootdirduexbackup value from info_distro and prompt for continue. # Tells how much will be compressed using rootdirduexbackup value from info_distro and prompt for continue.
fn_print_info "A total of ${rootdirduexbackup} will be compressed." fn_print_info "A total of ${rootdirduexbackup} will be compressed."
fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.tar.gz" fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.tar.gz"
fn_print_dots "Backup (${rootdirduexbackup}) ${backupname}.tar.gz, in progress..." fn_print_dots "Backup (${rootdirduexbackup}) ${backupname}.tar.gz, in progress ..."
fn_script_log_info "Backup ${rootdirduexbackup} ${backupname}.tar.gz, in progress" fn_script_log_info "Backup ${rootdirduexbackup} ${backupname}.tar.gz, in progress"
excludedir=$(fn_backup_relpath) excludedir=$(fn_backup_relpath)
@ -127,8 +127,8 @@ fn_backup_compression() {
fi fi
tar --use-compress-program=pigz -cf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}" --exclude "${tmpdir}" ./. tar --use-compress-program=pigz -cf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}" --exclude "${tmpdir}" ./.
local exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol fn_print_fail_eol
fn_script_log_fail "Backup in progress: FAIL" fn_script_log_fail "Backup in progress: FAIL"
echo -e "${extractcmd}" | tee -a "${lgsmlog}" echo -e "${extractcmd}" | tee -a "${lgsmlog}"
@ -136,7 +136,7 @@ fn_backup_compression() {
fn_script_log_fail "Starting backup" fn_script_log_fail "Starting backup"
else else
fn_print_ok_eol fn_print_ok_eol
fn_print_ok_nl "Completed: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')" fn_print_ok_nl "Completed: ${italic}${backupname}.tar.gz${default}, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')" fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
alert="backup" alert="backup"
alert.sh alert.sh
@ -190,7 +190,7 @@ fn_backup_prune() {
fn_backup_relpath() { fn_backup_relpath() {
# Written by CedarLUG as a "realpath --relative-to" alternative in bash. # Written by CedarLUG as a "realpath --relative-to" alternative in bash.
# Populate an array of tokens initialized from the rootdir components. # Populate an array of tokens initialized from the rootdir components.
declare -a rdirtoks=($(readlink -f "${rootdir}" | sed "s/\// /g")) mapfile -t rdirtoks < <(readlink -f "${rootdir}" | sed "s/\// /g")
if [ ${#rdirtoks[@]} -eq 0 ]; then if [ ${#rdirtoks[@]} -eq 0 ]; then
fn_print_fail_nl "Problem assessing rootdir during relative path assessment" fn_print_fail_nl "Problem assessing rootdir during relative path assessment"
fn_script_log_fail "Problem assessing rootdir during relative path assessment: ${rootdir}" fn_script_log_fail "Problem assessing rootdir during relative path assessment: ${rootdir}"
@ -198,7 +198,7 @@ fn_backup_relpath() {
fi fi
# Populate an array of tokens initialized from the backupdir components. # Populate an array of tokens initialized from the backupdir components.
declare -a bdirtoks=($(readlink -f "${backupdir}" | sed "s/\// /g")) mapfile -t bdirtoks < <(readlink -f "${backupdir}" | sed "s/\// /g")
if [ ${#bdirtoks[@]} -eq 0 ]; then if [ ${#bdirtoks[@]} -eq 0 ]; then
fn_print_fail_nl "Problem assessing backupdir during relative path assessment" fn_print_fail_nl "Problem assessing backupdir during relative path assessment"
fn_script_log_fail "Problem assessing backupdir during relative path assessment: ${rootdir}" fn_script_log_fail "Problem assessing backupdir during relative path assessment: ${rootdir}"

11
lgsm/modules/command_console.sh

@ -6,13 +6,14 @@
# Description: Gives access to the server tmux console. # Description: Gives access to the server tmux console.
commandname="CONSOLE" commandname="CONSOLE"
commandaction="Access console" commandaction="Access Console"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
check.sh
fn_print_header fn_print_header
check.sh
if [ "${consoleverbose}" == "yes" ]; then if [ "${consoleverbose}" == "yes" ]; then
echo -e "* Verbose output: ${lightgreen}yes${default}" echo -e "* Verbose output: ${lightgreen}yes${default}"
elif [ "${consoleverbose}" == "no" ]; then elif [ "${consoleverbose}" == "no" ]; then
@ -29,10 +30,10 @@ else
echo -e "* Interactive output: ${red}unknown${default}" echo -e "* Interactive output: ${red}unknown${default}"
fi fi
echo "" echo ""
fn_print_information_nl "Press \"CTRL+b\" then \"d\" to exit console." fn_print_information_nl "Press ${italic}\"CTRL+b\"${default} then ${italic}\"d\"${default} to exit console."
fn_print_warning_nl "Do NOT press CTRL+c to exit." fn_print_warning_nl "Do ${underline}NOT${default} press CTRL+c to exit."
echo -e "* https://docs.linuxgsm.com/commands/console"
echo -e "" echo -e ""
echo -e "${italic}https://docs.linuxgsm.com/commands/console${default}"
if ! fn_prompt_yn "Continue?" Y; then if ! fn_prompt_yn "Continue?" Y; then
exitcode=0 exitcode=0
core_exit.sh core_exit.sh

13
lgsm/modules/command_debug.sh

@ -6,7 +6,7 @@
# Description: Runs the server without tmux and directly from the terminal. # Description: Runs the server without tmux and directly from the terminal.
commandname="DEBUG" commandname="DEBUG"
commandaction="Debuging" commandaction="Debugging"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
@ -24,11 +24,13 @@ fn_lockfile_trap() {
core_exit.sh core_exit.sh
} }
fn_print_header
check.sh check.sh
fix.sh fix.sh
info_distro.sh info_distro.sh
info_game.sh info_game.sh
fn_print_header
{ {
echo -e "${lightblue}Distro:\t\t${default}${distroname}" echo -e "${lightblue}Distro:\t\t${default}${distroname}"
echo -e "${lightblue}Architecture:\t\t${default}${arch}" echo -e "${lightblue}Architecture:\t\t${default}${arch}"
@ -121,9 +123,10 @@ else
eval "${preexecutable} ${executable} ${startparameters}" eval "${preexecutable} ${executable} ${startparameters}"
fi fi
if [ $? -ne 0 ]; then exitcode=$?
fn_print_error_nl "Server has stopped: exit code: $?" if [ "${exitcode}" -ne 0 ]; then
fn_script_log_error "Server has stopped: exit code: $?" fn_print_error_nl "Server has stopped: exit code: ${exitcode}"
fn_script_log_error "Server has stopped: exit code: ${exitcode}"
fn_print_error_nl "Press ENTER to exit debug mode" fn_print_error_nl "Press ENTER to exit debug mode"
read -r read -r
else else

2
lgsm/modules/command_details.sh

@ -6,7 +6,7 @@
# Description: Displays server information. # Description: Displays server information.
commandname="DETAILS" commandname="DETAILS"
commandaction="Viewing details" commandaction="Display Details"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set

2
lgsm/modules/command_dev_clear_modules.sh

@ -6,7 +6,7 @@
# Description: Deletes the contents of the modules dir. # Description: Deletes the contents of the modules dir.
commandname="DEV-CLEAR-MODULES" commandname="DEV-CLEAR-MODULES"
commandaction="Clearing modules" commandaction="Clear Modules"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set

2
lgsm/modules/command_dev_debug.sh

@ -6,7 +6,7 @@
# Description: Dev only: Enables debugging log to be saved to dev-debug.log. # Description: Dev only: Enables debugging log to be saved to dev-debug.log.
commandname="DEV-DEBUG" commandname="DEV-DEBUG"
commandaction="Developer debug" commandaction="Developer Debug"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_reset fn_firstcommand_reset

8
lgsm/modules/command_dev_detect_deps.sh

@ -6,13 +6,11 @@
# Description: Detects dependencies the server binary requires. # Description: Detects dependencies the server binary requires.
commandname="DEV-DETECT-DEPS" commandname="DEV-DETECT-DEPS"
commandaction="Developer detect deps" commandaction="Dependency Checker"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
echo -e "" fn_print_header
echo -e "${bold}Dependencies Checker${default}"
fn_messages_separator
echo -e "Checking directory: " echo -e "Checking directory: "
echo -e "${serverfiles}" echo -e "${serverfiles}"
if [ "$(command -v eu-readelf 2> /dev/null)" ]; then if [ "$(command -v eu-readelf 2> /dev/null)" ]; then
@ -186,7 +184,7 @@ echo -e "${bold}Required Dependencies${default}"
fn_messages_separator fn_messages_separator
echo -e "${executable}" echo -e "${executable}"
echo -e "" echo -e ""
echo -e "CentOS" echo -e "${bold}CentOS"
fn_messages_separator fn_messages_separator
cat "${tmpdir}/.depdetect_centos_line" cat "${tmpdir}/.depdetect_centos_line"
echo -e "" echo -e ""

14
lgsm/modules/command_dev_detect_glibc.sh

@ -7,13 +7,11 @@
# Can check a file or directory recursively. # Can check a file or directory recursively.
commandname="DEV-DETECT-GLIBC" commandname="DEV-DETECT-GLIBC"
commandaction="Developer detect glibc" commandaction="Detect Glibc Requirements"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
fn_messages_separator fn_print_header
echo -e "glibc Requirements Checker"
fn_messages_separator
if [ ! "$(command -v objdump 2> /dev/null)" ]; then if [ ! "$(command -v objdump 2> /dev/null)" ]; then
fn_print_failure_nl "objdump is missing" fn_print_failure_nl "objdump is missing"
@ -48,17 +46,17 @@ for glibc_check_var in "${glibc_check_dir_array[@]}"; do
glibc_check_files=$(find "${glibc_check_dir}" | wc -l) glibc_check_files=$(find "${glibc_check_dir}" | wc -l)
find "${glibc_check_dir}" -type f -print0 \ find "${glibc_check_dir}" -type f -print0 \
| while IFS= read -r -d $'\0' line; do | while IFS= read -r -d $'\0' line; do
glibcversion=$(objdump -T "${line}" 2> /dev/null | grep -oP "GLIBC[^ ]+" | grep -v GLIBCXX | sort | uniq | sort -r --version-sort | head -n 1) glibcversion=$(objdump -T "${line}" 2> /dev/null | grep -oP "GLIBC[^ ]+" | grep -v GLIBCXX | sort | uniq | sort -r --version-sort | head -n 1 | sed 's/)$//')
if [ "${glibcversion}" ]; then if [ "${glibcversion}" ]; then
echo -e "${glibcversion}: ${line}" >> "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp" echo -e "${glibcversion}: ${line}" >> "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp"
fi fi
objdump -T "${line}" 2> /dev/null | grep -oP "GLIBC[^ ]+" >> "${tmpdir}/detect_glibc_${glibc_check_var}.tmp" objdump -T "${line}" 2> /dev/null | grep -oP "GLIBC[^ ]+" | sed 's/)$//' >> "${tmpdir}/detect_glibc_${glibc_check_var}.tmp"
echo -n "${i} / ${glibc_check_files}" $'\r' echo -n "${i} / ${glibc_check_files}" $'\r'
((i++)) ((i++))
done done
echo -e "" echo -e ""
echo -e "" echo -e ""
echo -e "${glibc_check_name} glibc Requirements" fn_print_nl "${bold}${lightyellow}${glibc_check_name} glibc Requirements"
fn_messages_separator fn_messages_separator
if [ -f "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp" ]; then if [ -f "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp" ]; then
echo -e "Required glibc" echo -e "Required glibc"
@ -80,7 +78,7 @@ for glibc_check_var in "${glibc_check_dir_array[@]}"; do
fi fi
done done
echo -e "" echo -e ""
echo -e "Final glibc Requirement" fn_print_nl "${bold}${lightyellow}Final glibc Requirement"
fn_messages_separator fn_messages_separator
if [ -f "${tmpdir}/detect_glibc_highest.tmp" ]; then if [ -f "${tmpdir}/detect_glibc_highest.tmp" ]; then
cat "${tmpdir}/detect_glibc_highest.tmp" | sort | uniq | sort -r --version-sort | head -1 cat "${tmpdir}/detect_glibc_highest.tmp" | sort | uniq | sort -r --version-sort | head -1

10
lgsm/modules/command_dev_detect_ldd.sh

@ -7,13 +7,11 @@
# Can check a file or directory recursively. # Can check a file or directory recursively.
commandname="DEV-DETECT-LDD" commandname="DEV-DETECT-LDD"
commandaction="Developer detect ldd" commandaction="Shared Object Dependencies Checker"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
fn_messages_separator fn_print_header
echo -e "Shared Object dependencies Checker"
fn_messages_separator
if [ -z "${serverfiles}" ]; then if [ -z "${serverfiles}" ]; then
dir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") dir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
@ -46,12 +44,12 @@ find "${serverfiles}" -type f -print0 \
done done
echo -e "" echo -e ""
echo -e "" echo -e ""
echo -e "All" fn_print_nl "${bold}${lightyellow}All${default}"
fn_messages_separator fn_messages_separator
cat "${tmpdir}/detect_ldd.tmp" cat "${tmpdir}/detect_ldd.tmp"
echo -e "" echo -e ""
echo -e "Not Found" fn_print_nl "${bold}${lightyellow}Not Found${default}"
fn_messages_separator fn_messages_separator
cat "${tmpdir}/detect_ldd_not_found.tmp" cat "${tmpdir}/detect_ldd_not_found.tmp"

7
lgsm/modules/command_dev_parse_distro_details.sh

@ -5,6 +5,13 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Display parsed distro details. # Description: Display parsed distro details.
commandname="DEV-PARSE-DISTRO-DETAILS"
commandaction="Parse Distro Details"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set
fn_print_header
check_ip.sh check_ip.sh
check_status.sh check_status.sh
info_distro.sh info_distro.sh

7
lgsm/modules/command_dev_parse_game_details.sh

@ -5,6 +5,13 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Display parsed gameserver details. # Description: Display parsed gameserver details.
commandname="DEV-PARSE-GAME-DETAILS"
commandaction="Parse Game Details"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set
fn_print_header
if [ -f "config" ]; then if [ -f "config" ]; then
servercfgfullpath="config" servercfgfullpath="config"
fi fi

91
lgsm/modules/command_dev_query_raw.sh

@ -6,10 +6,12 @@
# Description: Raw gamedig output of the server. # Description: Raw gamedig output of the server.
commandname="DEV-QUERY-RAW" commandname="DEV-QUERY-RAW"
commandaction="Developer query raw" commandaction="Developer Query Raw"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
fn_print_header
check.sh check.sh
info_game.sh info_game.sh
info_distro.sh info_distro.sh
@ -26,24 +28,24 @@ echo -e "Telnet IP: ${telnetip}"
echo -e "Display IP: ${displayip}" echo -e "Display IP: ${displayip}"
echo -e "" echo -e ""
echo -e "${lightgreen}Query IP Addresses${default}" echo -e "${bold}${lightyellow}Query IP Addresses${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
for queryip in "${queryips[@]}"; do for queryip in "${queryips[@]}"; do
echo -e "${queryip}" echo -e "${queryip}"
done done
echo -e "" echo -e ""
echo -e "${lightgreen}Game Server Ports${default}" echo -e "${bold}${lightyellow}Game Server Ports${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${lightblue}Port Name \tPort Number \tStatus \tTCP \tUDP${default}" echo -e "${lightblue}Port Name \tPort Number \tStatus \tTCP \tUDP${default}"
if [ -v port ]; then if [ -n "${port}" ]; then
echo -e "Game: \t${port} \t$(ss -tupl | grep -c "${port}") \t$(ss -tupl | grep "${port}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${port}" | grep udp | awk '{ print $2 }')" echo -e "Game: \t${port} \t$(ss -tupl | grep -c "${port}") \t$(ss -tupl | grep "${port}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${port}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Game:" echo -e "Game:"
fi fi
if [ "${shortname}" == "pvr" ]; then if [ "${shortname}" == "pvr" ]; then
if [ -v port401 ]; then if [ -n "${port401}" ]; then
echo -e "Game+400: \t${port401} \t$(ss -tupl | grep -c "${port401}") \t$(ss -tupl | grep "${port401}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${port401}" | grep udp | awk '{ print $2 }')" echo -e "Game+400: \t${port401} \t$(ss -tupl | grep -c "${port401}") \t$(ss -tupl | grep "${port401}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${port401}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Game+400:" echo -e "Game+400:"
@ -51,140 +53,140 @@ fn_messages_separator
fi fi
if [ "${shortname}" == "mcb" ]; then if [ "${shortname}" == "mcb" ]; then
if [ -v portipv6 ]; then if [ -n "${portipv6}" ]; then
echo -e "Game ipv6: \t${portipv6} \t$(ss -tupl | grep -c "${portipv6}") \t$(ss -tupl | grep "${portipv6}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${portipv6}" | grep udp | awk '{ print $2 }')" echo -e "Game ipv6: \t${portipv6} \t$(ss -tupl | grep -c "${portipv6}") \t$(ss -tupl | grep "${portipv6}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${portipv6}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Game ipv6:" echo -e "Game ipv6:"
fi fi
fi fi
if [ -v queryport ]; then if [ -n "${queryport}" ]; then
echo -e "Query: \t${queryport} \t$(ss -tupl | grep -c "${queryport}") \t$(ss -tupl | grep "${queryport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${queryport}" | grep udp | awk '{ print $2 }')" echo -e "Query: \t${queryport} \t$(ss -tupl | grep -c "${queryport}") \t$(ss -tupl | grep "${queryport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${queryport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Query:" echo -e "Query:"
fi fi
if [ -v apiport ]; then if [ -n "${apiport}" ]; then
echo -e "Game: \t${apiport} \t$(ss -tupl | grep -c "${apiport}") \t$(ss -tupl | grep "${apiport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${apiport}" | grep udp | awk '{ print $2 }')" echo -e "Game: \t${apiport} \t$(ss -tupl | grep -c "${apiport}") \t$(ss -tupl | grep "${apiport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${apiport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "API:" echo -e "API:"
fi fi
if [ -v appport ]; then if [ -n "${appport}" ]; then
echo -e "App: \t${appport} \t$(ss -tupl | grep -c "${appport}") \t$(ss -tupl | grep "${appport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${appport}" | grep udp | awk '{ print $2 }')" echo -e "App: \t${appport} \t$(ss -tupl | grep -c "${appport}") \t$(ss -tupl | grep "${appport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${appport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "App:" echo -e "App:"
fi fi
if [ -v battleeyeport ]; then if [ -n "${battleeyeport}" ]; then
echo -e "BattleEye: \t${battleeyeport} \t$(ss -tupl | grep -c "${battleeyeport}") \t$(ss -tupl | grep "${battleeyeport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${battleeyeport}" | grep udp | awk '{ print $2 }')" echo -e "BattleEye: \t${battleeyeport} \t$(ss -tupl | grep -c "${battleeyeport}") \t$(ss -tupl | grep "${battleeyeport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${battleeyeport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "BattleEye:" echo -e "BattleEye:"
fi fi
if [ -v beaconport ]; then if [ -n "${beaconport}" ]; then
echo -e "Beacon: \t${beaconport} \t$(ss -tupl | grep -c "${beaconport}") \t$(ss -tupl | grep "${beaconport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${beaconport}" | grep udp | awk '{ print $2 }')" echo -e "Beacon: \t${beaconport} \t$(ss -tupl | grep -c "${beaconport}") \t$(ss -tupl | grep "${beaconport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${beaconport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Beacon:" echo -e "Beacon:"
fi fi
if [ -v clientport ]; then if [ -n "${clientport}" ]; then
echo -e "Client: \t${clientport} \t$(ss -tupl | grep -c "${clientport}") \t$(ss -tupl | grep "${clientport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${clientport}" | grep udp | awk '{ print $2 }')" echo -e "Client: \t${clientport} \t$(ss -tupl | grep -c "${clientport}") \t$(ss -tupl | grep "${clientport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${clientport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Client:" echo -e "Client:"
fi fi
if [ -v fileport ]; then if [ -n "${fileport}" ]; then
echo -e "File: \t${fileport} \t$(ss -tupl | grep -c "${fileport}") \t$(ss -tupl | grep "${fileport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${fileport}" | grep udp | awk '{ print $2 }')" echo -e "File: \t${fileport} \t$(ss -tupl | grep -c "${fileport}") \t$(ss -tupl | grep "${fileport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${fileport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "File:" echo -e "File:"
fi fi
if [ -v httpport ]; then if [ -n "${httpport}" ]; then
echo -e "HTTP: \t${httpport} \t$(ss -tupl | grep -c "${httpport}") \t$(ss -tupl | grep "${httpport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${httpport}" | grep udp | awk '{ print $2 }')" echo -e "HTTP: \t${httpport} \t$(ss -tupl | grep -c "${httpport}") \t$(ss -tupl | grep "${httpport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${httpport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "HTTP:" echo -e "HTTP:"
fi fi
if [ -v httpqueryport ]; then if [ -n "${httpqueryport}" ]; then
echo -e "HTTP Query: \t${httpqueryport} \t$(ss -tupl | grep -c "${httpqueryport}") \t$(ss -tupl | grep" ${httpqueryport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${httpqueryport}" | grep udp | awk '{ print $2 }')" echo -e "HTTP Query: \t${httpqueryport} \t$(ss -tupl | grep -c "${httpqueryport}") \t$(ss -tupl | grep" ${httpqueryport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${httpqueryport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "HTTP Query:" echo -e "HTTP Query:"
fi fi
if [ -v httpport ]; then if [ -n "${httpport}" ]; then
echo -e "Web Interface: \t${httpport} \t$(ss -tupl | grep -c "${httpport}") \t$(ss -tupl | grep "${httpport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${httpport}" | grep udp | awk '{ print $2 }')" echo -e "Web Interface: \t${httpport} \t$(ss -tupl | grep -c "${httpport}") \t$(ss -tupl | grep "${httpport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${httpport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Web Interface:" echo -e "Web Interface:"
fi fi
if [ -v masterport ]; then if [ -n "${masterport}" ]; then
echo -e "Game: Master: \t${masterport} \t$(ss -tupl | grep -c "${masterport}") \t$(ss -tupl | grep "${masterport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${masterport}" | grep udp | awk '{ print $2 }')" echo -e "Game: Master: \t${masterport} \t$(ss -tupl | grep -c "${masterport}") \t$(ss -tupl | grep "${masterport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${masterport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Game: Master:" echo -e "Game: Master:"
fi fi
if [ -v rawport ]; then if [ -n "${rawport}" ]; then
echo -e "RAW UDP Socket: \t${rawport} \t$(ss -tupl | grep -c "${rawport}") \t$(ss -tupl | grep "${rawport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${rawport}" | grep udp | awk '{ print $2 }')" echo -e "RAW UDP Socket: \t${rawport} \t$(ss -tupl | grep -c "${rawport}") \t$(ss -tupl | grep "${rawport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${rawport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "RAW UDP Socket:" echo -e "RAW UDP Socket:"
fi fi
if [ -v rconport ]; then if [ -n "${rconport}" ]; then
echo -e "RCON: \t${rconport} \t$(ss -tupl | grep -c "${rconport}") \t$(ss -tupl | grep "${rconport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${rconport}" | grep udp | awk '{ print $2 }')" echo -e "RCON: \t${rconport} \t$(ss -tupl | grep -c "${rconport}") \t$(ss -tupl | grep "${rconport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${rconport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "RCON:" echo -e "RCON:"
fi fi
if [ -v steamport ]; then if [ -n "${steamport}" ]; then
echo -e "Steam: \t${steamport} \t$(ss -tupl | grep -c "${steamport}") \t$(ss -tupl | grep "${steamport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${steamport}" | grep udp | awk '{ print $2 }')" echo -e "Steam: \t${steamport} \t$(ss -tupl | grep -c "${steamport}") \t$(ss -tupl | grep "${steamport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${steamport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Steam:" echo -e "Steam:"
fi fi
if [ -v steamworksport ]; then if [ -n "${steamworksport}" ]; then
echo -e "Steamworks P2P: \t${steamworksport} \t$(ss -tupl | grep -c "${steamworksport}") \t$(ss -tupl | grep "${steamworksport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${steamworksport}" | grep udp | awk '{ print $2 }')" echo -e "Steamworks P2P: \t${steamworksport} \t$(ss -tupl | grep -c "${steamworksport}") \t$(ss -tupl | grep "${steamworksport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${steamworksport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Steamworks P2P:" echo -e "Steamworks P2P:"
fi fi
if [ -v steamauthport ]; then if [ -n "${steamauthport}" ]; then
echo -e "Steam: Auth: \t${steamauthport} \t$(ss -tupl | grep -c "${steamauthport}") \t$(ss -tupl | grep "${steamauthport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${steamauthport}" | grep udp | awk '{ print $2 }')" echo -e "Steam: Auth: \t${steamauthport} \t$(ss -tupl | grep -c "${steamauthport}") \t$(ss -tupl | grep "${steamauthport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${steamauthport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Steam: Auth:" echo -e "Steam: Auth:"
fi fi
if [ -v telnetport ]; then if [ -n "${telnetport}" ]; then
echo -e "Telnet: \t${telnetport} \t$(ss -tupl | grep -c "${telnetport}") \t$(ss -tupl | grep "${telnetport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${telnetport}" | grep udp | awk '{ print $2 }')" echo -e "Telnet: \t${telnetport} \t$(ss -tupl | grep -c "${telnetport}") \t$(ss -tupl | grep "${telnetport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${telnetport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Telnet:" echo -e "Telnet:"
fi fi
if [ -v statsport ]; then if [ -n "${statsport}" ]; then
echo -e "Stats: \t${battleeyeport} \t$(ss -tupl | grep -c "${statsport}") \t$(ss -tupl | grep "${statsport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${statsport}" | grep udp | awk '{ print $2 }')" echo -e "Stats: \t${battleeyeport} \t$(ss -tupl | grep -c "${statsport}") \t$(ss -tupl | grep "${statsport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${statsport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Stats:" echo -e "Stats:"
fi fi
if [ -v sourcetvport ]; then if [ -n "${sourcetvport}" ]; then
echo -e "SourceTV: \t${sourcetvport} \t$(ss -tupl | grep -c "${sourcetvport}") \t$(ss -tupl | grep "${sourcetvport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${sourcetvport}" | grep udp | awk '{ print $2 }')" echo -e "SourceTV: \t${sourcetvport} \t$(ss -tupl | grep -c "${sourcetvport}") \t$(ss -tupl | grep "${sourcetvport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${sourcetvport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "SourceTV:" echo -e "SourceTV:"
fi fi
if [ -v udplinkport ]; then if [ -n "${udplinkport}" ]; then
echo -e "UDP Link: \t${udplinkport} \t$(ss -tupl | grep -c "${udplinkport}") \t$(ss -tupl | grep "${udplinkport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${udplinkport}" | grep udp | awk '{ print $2 }')" echo -e "UDP Link: \t${udplinkport} \t$(ss -tupl | grep -c "${udplinkport}") \t$(ss -tupl | grep "${udplinkport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${udplinkport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "UDP Link:" echo -e "UDP Link:"
fi fi
if [ -v voiceport ]; then if [ -n "${voiceport}" ]; then
echo -e "Voice: \t${voiceport} \t$(ss -tupl | grep -c "${voiceport}") \t$(ss -tupl | grep "${voiceport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${voiceport}" | grep udp | awk '{ print $2 }')" echo -e "Voice: \t${voiceport} \t$(ss -tupl | grep -c "${voiceport}") \t$(ss -tupl | grep "${voiceport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${voiceport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Voice:" echo -e "Voice:"
fi fi
if [ -v voiceunusedport ]; then if [ -n "${voiceunusedport}" ]; then
echo -e "Voice (Unused): \t${voiceunusedport} \t$(ss -tupl | grep -c "${voiceunusedport}") \t$(ss -tupl | grep "${voiceunusedport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${voiceunusedport}" | grep udp | awk '{ print $2 }')" echo -e "Voice (Unused): \t${voiceunusedport} \t$(ss -tupl | grep -c "${voiceunusedport}") \t$(ss -tupl | grep "${voiceunusedport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${voiceunusedport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "Voice (Unused):" echo -e "Voice (Unused):"
@ -192,51 +194,56 @@ fn_messages_separator
} \ } \
| column -s $'\t' -t | column -s $'\t' -t
echo -e "" echo -e ""
echo -e "${lightgreen}SS Output${default}" echo -e "${bold}${lightyellow}SS Output${default}"
fn_messages_separator fn_messages_separator
fn_info_messages_ports fn_info_messages_ports
eval "${portcommand}" eval "${portcommand}"
echo -e "" echo -e ""
echo -e "${lightgreen}Query Port - Raw Output${default}" echo -e "${bold}${lightyellow}Query Port (${queryport}) - Gamedig Output${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
echo -e "PORT: ${port}" echo -e "PORT: ${port}"
echo -e "QUERY PORT: ${queryport}" echo -e "QUERY PORT: ${queryport}"
echo -e "" echo -e ""
echo -e "${lightgreen}Is My Game Server Online?${default}"
fn_messages_separator
echo -e "Game server status: https://ismygameserver.online/${imgsoquerytype}/${queryip}:${queryport}"
echo -e ""
echo -e "${lightgreen}Gamedig Raw Output${default}" echo -e "${lightgreen}Gamedig Raw Output${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
if [ ! "$(command -v gamedig 2> /dev/null)" ] && [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then if [ ! "$(command -v gamedig 2> /dev/null)" ] && [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then
fn_print_failure_nl "gamedig not installed" fn_print_failure_nl "gamedig not installed"
fi fi
if [ ! "$(command -v jq 2> /dev/null)" ]; then
fn_print_failure_nl "jq not installed"
fi
for queryip in "${queryips[@]}"; do for queryip in "${queryips[@]}"; do
query_gamedig.sh query_gamedig.sh
echo -e "${gamedigcmd}" echo -e "${italic}${gamedigcmd}${default}"
echo"" echo""
echo "${gamedigraw}" | jq echo "${gamedigraw}" | jq
done done
echo -e "" echo -e ""
echo -e "${lightgreen}gsquery Raw Output${default}" echo -e "${bold}${lightyellow}Query Port (${queryport}) - gsquery Output${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
for queryip in "${queryips[@]}"; do for queryip in "${queryips[@]}"; do
echo -e "./query_gsquery.py -a \"${queryip}\" -p \"${queryport}\" -e \"${querytype}\"" echo -e "${italic}./query_gsquery.py -a \"${queryip}\" -p \"${queryport}\" -e \"${querytype}\"${default}"
echo -e "" echo -e ""
if [ ! -f "${modulesdir}/query_gsquery.py" ]; then if [ ! -f "${modulesdir}/query_gsquery.py" ]; then
fn_fetch_file_github "lgsm/modules" "query_gsquery.py" "${modulesdir}" "chmodx" "norun" "noforce" "nohash" fn_fetch_file_github "lgsm/modules" "query_gsquery.py" "${modulesdir}" "chmodx" "norun" "noforce" "nohash"
fi fi
"${modulesdir}"/query_gsquery.py -a "${queryip}" -p "${queryport}" -e "${querytype}" "${modulesdir}"/query_gsquery.py -a "${queryip}" -p "${queryport}" -e "${querytype}"
done done
echo -e "" echo -e ""
echo -e "${lightgreen}TCP Raw Output${default}" echo -e "${bold}${lightyellow}Query Port (${queryport}) - TCP Output${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
for queryip in "${queryips[@]}"; do for queryip in "${queryips[@]}"; do
echo -e "bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}''" echo -e "${italic}bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}''${default}"
echo -e "" echo -e ""
timeout 3 bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}'' timeout 3 bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}''
querystatus="$?" querystatus="$?"
@ -248,14 +255,14 @@ for queryip in "${queryips[@]}"; do
fi fi
done done
echo -e "" echo -e ""
echo -e "${lightgreen}Game Port - Raw Output${default}" echo -e "${bold}${lightyellow}Game Port (${port}) - TCP Output${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
echo -e "${lightgreen}TCP Raw Output${default}" echo -e "${lightgreen}TCP Raw Output${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
for queryip in "${queryips[@]}"; do for queryip in "${queryips[@]}"; do
echo -e "bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${port}''" echo -e "${italic}bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${port}''${default}"
echo -e "" echo -e ""
timeout 3 bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${port}'' timeout 3 bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${port}''
querystatus="$?" querystatus="$?"
@ -267,10 +274,10 @@ for queryip in "${queryips[@]}"; do
fi fi
done done
echo -e "" echo -e ""
echo -e "${lightgreen}Steam Master Server Response${default}" echo -e "${bold}${lightyellow}Steam Master Server Response${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
echo -e "curl -m 3 -s https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${publicip}" echo -e "${italic}curl -m 3 -s https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${publicip}${default}"
echo -e "" echo -e ""
echo -e "Response: ${displaymasterserver}" echo -e "Response: ${displaymasterserver}"
echo -e "" echo -e ""

110
lgsm/modules/command_dev_ui.sh

@ -0,0 +1,110 @@
#!/bin/bash
# LinuxGSM command_dev_ui.sh module
# Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Dev only: Assist with UI development.
commandname="DEV-DEBUG"
commandaction="Developer UI"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set
fn_print_header
# Load ANSI colors
fn_ansi_loader
fn_print_nl ""
fn_print_nl "${lightgreen}Colours${default}"
fn_messages_separator
# Print supported colors
fn_print_nl "${default}default"
fn_print_nl "${black}black${default}"
fn_print_nl "${red}red${default}"
fn_print_nl "${lightred}lightred${default}"
fn_print_nl "${green}green${default}"
fn_print_nl "${lightgreen}lightgreen${default}"
fn_print_nl "${yellow}yellow${default}"
fn_print_nl "${lightyellow}lightyellow${default}"
fn_print_nl "${blue}blue${default}"
fn_print_nl "${lightblue}lightblue${default}"
fn_print_nl "${magenta}magenta${default}"
fn_print_nl "${lightmagenta}lightmagenta${default}"
fn_print_nl "${cyan}cyan${default}"
fn_print_nl "${lightcyan}lightcyan${default}"
fn_print_nl "${darkgrey}darkgrey${default}"
fn_print_nl "${lightgrey}lightgrey${default}"
fn_print_nl "${white}white${default}"
fn_print_nl "${bold}bold${default}"
fn_print_nl "${dim}dim${default}"
fn_print_nl "${italic}italic${default}"
fn_print_nl "${underline}underline${default}"
fn_print_nl "${reverse}reverse${default}"
fn_print_nl ""
fn_print_nl "${lightgreen}Non Interactive UI Status Messages${default}"
fn_messages_separator
fn_print_nl ""
fn_print_nl "Print Message"
fn_print_nl ""
fn_print_nl "${lightgreen}Status Messages${default}"
fn_messages_separator
fn_print_dots_nl "Dots"
fn_print_ok_nl "OK"
fn_print_fail_nl "Fail"
fn_print_error_nl "Error"
fn_print_warn_nl "Warn"
fn_print_info_nl "Info"
fn_print_start_nl "Start"
fn_print_nl ""
fn_print_nl "${lightgreen}Interactive UI Status Messages${default}"
fn_messages_separator
fn_print_success_nl
fn_print_failure_nl
fn_print_error2_nl
fn_print_warning_nl
fn_print_information_nl
fn_print_nl ""
fn_print_nl "${lightgreen}EOL Status Messages${default}"
fn_messages_separator
fn_print "Print yes message with eol"
fn_print_yes_eol_nl
fn_print "Print no message with eol"
fn_print_no_eol_nl
fn_print "Print ok message with eol"
fn_print_ok_eol_nl
fn_print "Print fail message with eol"
fn_print_fail_eol_nl
fn_print "Print error message with eol"
fn_print_error_eol_nl
fn_print "Print warn message with eol"
fn_print_wait_eol_nl
fn_print "Print info message with eol"
fn_print_warn_eol_nl
fn_print "Print querying message with eol"
fn_print_info_eol_nl
fn_print "Print checking message with eol"
fn_print_querying_eol_nl
fn_print "Print delay message with eol"
fn_print_checking_eol_nl
fn_print "Print canceled message with eol"
fn_print_delay_eol_nl
fn_print "Print removed message with eol"
fn_print_canceled_eol_nl
fn_print "Print update message with eol"
fn_print_removed_eol_nl
fn_print "Print skip message with eol"
fn_print_update_eol_nl
fn_print "Print skip message with eol"
fn_print_skip_eol_nl
fn_print_nl ""
fn_print_nl "${lightgreen}Restart warning${default}"
fn_messages_separator
fn_print_restart_warning
core_exit.sh

110
lgsm/modules/command_fastdl.sh

@ -3,7 +3,7 @@
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib # Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Creates a FastDL directory. # Description: Creates a Fastdl directory.
commandname="FASTDL" commandname="FASTDL"
commandaction="Fastdl" commandaction="Fastdl"
@ -30,18 +30,18 @@ fi
# Header # Header
fn_print_header fn_print_header
echo -e "More info: https://docs.linuxgsm.com/commands/fastdl" fn_print_nl "More info: ${italic}https://docs.linuxgsm.com/commands/fastdl"
echo -e "" fn_print_nl ""
# Prompts user for FastDL creation settings. # Prompts user for Fastdl creation settings.
echo -e "${commandaction} setup" fn_print_nl "${bold}${lightyellow}${commandaction} Setup"
fn_messages_separator fn_messages_separator
# Prompt for clearing old files if directory was already here. # Prompt for clearing old files if directory was already here.
if [ -d "${fastdldir}" ]; then if [ -d "${fastdldir}" ]; then
fn_print_warning_nl "FastDL directory already exists." fn_print_warning_nl "Fastdl directory already exists."
echo -e "${fastdldir}" fn_print_nl "${fastdldir}"
echo -e "" fn_print_nl ""
if fn_prompt_yn "Overwrite existing directory?" Y; then if fn_prompt_yn "Overwrite existing directory?" Y; then
fn_script_log_info "Overwrite existing directory: YES" fn_script_log_info "Overwrite existing directory: YES"
else else
@ -63,18 +63,18 @@ fi
# Clears any fastdl directory content. # Clears any fastdl directory content.
fn_clear_old_fastdl() { fn_clear_old_fastdl() {
# Clearing old FastDL. # Clearing old Fastdl.
if [ -d "${fastdldir}" ]; then if [ -d "${fastdldir}" ]; then
echo -en "clearing existing FastDL directory ${fastdldir}..." fn_print "clearing existing Fastdl directory ${fastdldir}"
rm -rf "${fastdldir:?}" rm -rf "${fastdldir:?}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Clearing existing FastDL directory ${fastdldir}" fn_script_log_fail "Clearing existing Fastdl directory ${fastdldir}"
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Clearing existing FastDL directory ${fastdldir}" fn_script_log_pass "Clearing existing Fastdl directory ${fastdldir}"
fi fi
fi fi
} }
@ -82,10 +82,10 @@ fn_clear_old_fastdl() {
fn_fastdl_dirs() { fn_fastdl_dirs() {
# Check and create directories. # Check and create directories.
if [ ! -d "${webdir}" ]; then if [ ! -d "${webdir}" ]; then
echo -en "creating web directory ${webdir}..." fn_print "creating web directory ${webdir}"
mkdir -p "${webdir}" mkdir -p "${webdir}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Creating web directory ${webdir}" fn_script_log_fail "Creating web directory ${webdir}"
core_exit.sh core_exit.sh
@ -95,10 +95,10 @@ fn_fastdl_dirs() {
fi fi
fi fi
if [ ! -d "${fastdldir}" ]; then if [ ! -d "${fastdldir}" ]; then
echo -en "creating fastdl directory ${fastdldir}..." fn_print "creating fastdl directory ${fastdldir}"
mkdir -p "${fastdldir}" mkdir -p "${fastdldir}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Creating fastdl directory ${fastdldir}" fn_script_log_fail "Creating fastdl directory ${fastdldir}"
core_exit.sh core_exit.sh
@ -125,7 +125,7 @@ fn_human_readable_file_size() {
local precision="${2}" local precision="${2}"
if [[ "${bytes}" == "1" ]]; then if [[ "${bytes}" == "1" ]]; then
echo -e "1 byte" fn_print_nl "1 byte"
else else
for item in "${abbrevs[@]}"; do for item in "${abbrevs[@]}"; do
local factor="${item%:*}" local factor="${item%:*}"
@ -145,7 +145,7 @@ fn_fastdl_preview() {
if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then
rm -f "${tmpdir:?}/fastdl_files_to_compress.txt" rm -f "${tmpdir:?}/fastdl_files_to_compress.txt"
fi fi
echo -e "analysing required files" fn_print_nl "analysing required files"
fn_script_log_info "Analysing required files" fn_script_log_info "Analysing required files"
# Garry's Mod # Garry's Mod
if [ "${shortname}" == "gmod" ]; then if [ "${shortname}" == "gmod" ]; then
@ -158,13 +158,13 @@ fn_fastdl_preview() {
((fileswc++)) ((fileswc++))
tput rc tput rc
tput el tput el
echo -e "gathering ${allowed_extention} : ${fileswc}..." fn_print "gathering ${allowed_extention} : ${fileswc}"
echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt" echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
done < <(find . -type f -iname "${allowed_extention}") done < <(find . -type f -iname "${allowed_extention}")
if [ ${fileswc} != 0 ]; then if [ ${fileswc} != 0 ]; then
fn_print_ok_eol_nl fn_print_ok_eol_nl
else else
fn_print_info_eol_nl fn_print_skip_eol_nl
fi fi
done done
# Source engine # Source engine
@ -190,12 +190,12 @@ fn_fastdl_preview() {
((fileswc++)) ((fileswc++))
tput rc tput rc
tput el tput el
echo -e "gathering ${directory} ${allowed_extention} : ${fileswc}..." fn_print "gathering ${directory} ${allowed_extention} : ${fileswc}"
echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt" echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
done < <(find "${systemdir}/${directory}" -type f -iname "${allowed_extention}") done < <(find "${systemdir}/${directory}" -type f -iname "${allowed_extention}")
tput rc tput rc
tput el tput el
echo -e "gathering ${directory} ${allowed_extention} : ${fileswc}..." fn_print "gathering ${directory} ${allowed_extention} : ${fileswc}"
if [ ${fileswc} != 0 ]; then if [ ${fileswc} != 0 ]; then
fn_print_ok_eol_nl fn_print_ok_eol_nl
else else
@ -206,7 +206,7 @@ fn_fastdl_preview() {
done done
fi fi
if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then
echo -e "calculating total file size..." fn_print_nl "calculating total file size"
fn_sleep_time_1 fn_sleep_time_1
totalfiles=$(wc -l < "${tmpdir}/fastdl_files_to_compress.txt") totalfiles=$(wc -l < "${tmpdir}/fastdl_files_to_compress.txt")
# Calculates total file size. # Calculates total file size.
@ -214,9 +214,9 @@ fn_fastdl_preview() {
filesize=$(stat -c %s "${dufile}") filesize=$(stat -c %s "${dufile}")
filesizetotal=$((filesizetotal + filesize)) filesizetotal=$((filesizetotal + filesize))
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Calculating total file size." fn_script_log_fail "Calculating total file size"
core_exit.sh core_exit.sh
fi fi
done < "${tmpdir}/fastdl_files_to_compress.txt" done < "${tmpdir}/fastdl_files_to_compress.txt"
@ -225,8 +225,8 @@ fn_fastdl_preview() {
fn_script_log_fail "Generating file list." fn_script_log_fail "Generating file list."
core_exit.sh core_exit.sh
fi fi
echo -e "about to compress ${totalfiles} files, total size $(fn_human_readable_file_size ${filesizetotal} 0)" fn_print_nl "about to compress ${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
fn_script_log_info "${totalfiles} files, total size $(fn_human_readable_file_size ${filesizetotal} 0)" fn_script_log_info "${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
rm -f "${tmpdir:?}/fastdl_files_to_compress.txt" rm -f "${tmpdir:?}/fastdl_files_to_compress.txt"
if ! fn_prompt_yn "Continue?" Y; then if ! fn_prompt_yn "Continue?" Y; then
fn_script_log "User exited" fn_script_log "User exited"
@ -244,10 +244,10 @@ fn_fastdl_gmod() {
((fileswc++)) ((fileswc++))
tput rc tput rc
tput el tput el
echo -e "copying ${allowed_extention} : ${fileswc}..." fn_print "copying ${allowed_extention} : ${fileswc}"
cp --parents "${fastdlfile}" "${fastdldir}" cp --parents "${fastdlfile}" "${fastdldir}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Copying ${fastdlfile} > ${fastdldir}" fn_script_log_fail "Copying ${fastdlfile} > ${fastdldir}"
core_exit.sh core_exit.sh
@ -259,12 +259,12 @@ fn_fastdl_gmod() {
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
done done
# Correct addons directory structure for FastDL. # Correct addons directory structure for Fastdl.
if [ -d "${fastdldir}/addons" ]; then if [ -d "${fastdldir}/addons" ]; then
echo -en "updating addons file structure..." fn_print "updating addons file structure..."
cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}" cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Updating addons file structure" fn_script_log_fail "Updating addons file structure"
core_exit.sh core_exit.sh
@ -273,11 +273,11 @@ fn_fastdl_gmod() {
fn_script_log_pass "Updating addons file structure" fn_script_log_pass "Updating addons file structure"
fi fi
# Clear addons directory in fastdl. # Clear addons directory in fastdl.
echo -en "clearing addons dir from fastdl dir..." fn_print "clearing addons dir from fastdl dir..."
fn_sleep_time_1 fn_sleep_time_1
rm -rf "${fastdldir:?}/addons" rm -rf "${fastdldir:?}/addons"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Clearing addons dir from fastdl dir" fn_script_log_fail "Clearing addons dir from fastdl dir"
core_exit.sh core_exit.sh
@ -288,11 +288,11 @@ fn_fastdl_gmod() {
fi fi
# Correct content that may be into a lua directory by mistake like some darkrpmodification addons. # Correct content that may be into a lua directory by mistake like some darkrpmodification addons.
if [ -d "${fastdldir}/lua" ]; then if [ -d "${fastdldir}/lua" ]; then
echo -en "correcting DarkRP files..." fn_print "correcting DarkRP files..."
fn_sleep_time_1 fn_sleep_time_1
cp -Rf "${fastdldir}/lua/"* "${fastdldir}" cp -Rf "${fastdldir}/lua/"* "${fastdldir}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Correcting DarkRP files" fn_script_log_fail "Correcting DarkRP files"
core_exit.sh core_exit.sh
@ -332,8 +332,8 @@ fn_fastdl_source() {
((fileswc++)) ((fileswc++))
tput rc tput rc
tput el tput el
echo -e "copying ${directory} ${allowed_extention} : ${fileswc}..." fn_print "copying ${directory} ${allowed_extention} : ${fileswc}"
fn_sleep_time_1 fn_sleep_time
# get relative path of file in the dir # get relative path of file in the dir
tmprelfilepath="${fastdlfile#"${systemdir}/"}" tmprelfilepath="${fastdlfile#"${systemdir}/"}"
copytodir="${tmprelfilepath%/*}" copytodir="${tmprelfilepath%/*}"
@ -343,7 +343,7 @@ fn_fastdl_source() {
fi fi
cp "${fastdlfile}" "${fastdldir}/${copytodir}" cp "${fastdlfile}" "${fastdldir}/${copytodir}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Copying ${fastdlfile} > ${fastdldir}/${copytodir}" fn_script_log_fail "Copying ${fastdlfile} > ${fastdldir}/${copytodir}"
core_exit.sh core_exit.sh
@ -361,8 +361,8 @@ fn_fastdl_source() {
# Builds the fastdl directory content. # Builds the fastdl directory content.
fn_fastdl_build() { fn_fastdl_build() {
# Copy all needed files for FastDL. # Copy all needed files for Fastdl.
echo -e "copying files to ${fastdldir}" fn_print_nl "copying files to ${fastdldir}"
fn_script_log_info "Copying files to ${fastdldir}" fn_script_log_info "Copying files to ${fastdldir}"
if [ "${shortname}" == "gmod" ]; then if [ "${shortname}" == "gmod" ]; then
fn_fastdl_gmod fn_fastdl_gmod
@ -372,14 +372,14 @@ fn_fastdl_build() {
fi fi
} }
# Generate lua file that will force download any file into the FastDL directory. # Generate lua file that will force download any file into the Fastdl directory.
fn_fastdl_gmod_dl_enforcer() { fn_fastdl_gmod_dl_enforcer() {
# Clear old lua file. # Clear old lua file.
if [ -f "${luafastdlfullpath}" ]; then if [ -f "${luafastdlfullpath}" ]; then
echo -en "removing existing download enforcer: ${luafastdlfile}..." fn_print "removing existing download enforcer: ${luafastdlfile}"
rm -f "${luafastdlfullpath:?}" rm -f "${luafastdlfullpath:?}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Removing existing download enforcer ${luafastdlfullpath}" fn_script_log_fail "Removing existing download enforcer ${luafastdlfullpath}"
core_exit.sh core_exit.sh
@ -390,14 +390,14 @@ fn_fastdl_gmod_dl_enforcer() {
fi fi
# Generate new one if user said yes. # Generate new one if user said yes.
if [ "${luaresource}" == "on" ]; then if [ "${luaresource}" == "on" ]; then
echo -en "creating new download enforcer: ${luafastdlfile}..." fn_print "creating new download enforcer: ${luafastdlfile}"
touch "${luafastdlfullpath}" touch "${luafastdlfullpath}"
# Read all filenames and put them into a lua file at the right path. # Read all filenames and put them into a lua file at the right path.
while read -r line; do while read -r line; do
echo -e "resource.AddFile( \"${line}\" )" >> "${luafastdlfullpath}" echo -e "resource.AddFile( \"${line}\" )" >> "${luafastdlfullpath}"
done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \) -printf '%P\n') done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \) -printf '%P\n')
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Creating new download enforcer ${luafastdlfullpath}" fn_script_log_fail "Creating new download enforcer ${luafastdlfullpath}"
core_exit.sh core_exit.sh
@ -408,21 +408,21 @@ fn_fastdl_gmod_dl_enforcer() {
fi fi
} }
# Compresses FastDL files using bzip2. # Compresses Fastdl files using bzip2.
fn_fastdl_bzip2() { fn_fastdl_bzip2() {
while read -r filetocompress; do while read -r filetocompress; do
echo -en "\r\033[Kcompressing ${filetocompress}..." fn_print "compressing ${filetocompress}"
bzip2 -f "${filetocompress}" bzip2 -f "${filetocompress}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Compressing ${filetocompress}" fn_script_log_fail "Compressing ${filetocompress}"
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl
fn_script_log_pass "Compressing ${filetocompress}" fn_script_log_pass "Compressing ${filetocompress}"
fi fi
done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \)) done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \))
fn_print_ok_eol_nl
} }
check.sh check.sh
@ -433,9 +433,9 @@ fn_fastdl_dirs
fn_fastdl_build fn_fastdl_build
fn_fastdl_bzip2 fn_fastdl_bzip2
# Finished message. # Finished message.
echo -e "FastDL files are located in:" fn_print_nl "Fastdl files are located in:"
echo -e "${fastdldir}" fn_print_nl "${fastdldir}"
echo -e "FastDL completed" fn_print_nl "Fastdl completed"
fn_script_log_info "FastDL completed" fn_script_log_info "Fastdl completed"
core_exit.sh core_exit.sh

2
lgsm/modules/command_install_resources_mta.sh

@ -12,7 +12,7 @@ fn_firstcommand_set
fn_install_resources() { fn_install_resources() {
echo -e "" echo -e ""
echo -e "${lightyellow}Installing Default Resources${default}" echo -e "${bold}${lightyellow}Installing Default Resources${default}"
fn_messages_separator fn_messages_separator
fn_fetch_file "http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip" "" "" "" "${tmpdir}" "mtasa-resources-latest.zip" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file "http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip" "" "" "" "${tmpdir}" "mtasa-resources-latest.zip" "nochmodx" "norun" "noforce" "nohash"
fn_dl_extract "${tmpdir}" "mtasa-resources-latest.zip" "${resourcesdir}" fn_dl_extract "${tmpdir}" "mtasa-resources-latest.zip" "${resourcesdir}"

2
lgsm/modules/command_mods_install.sh

@ -6,7 +6,7 @@
# Description: List and installs available mods along with mods_list.sh and mods_core.sh. # Description: List and installs available mods along with mods_list.sh and mods_core.sh.
commandname="MODS-INSTALL" commandname="MODS-INSTALL"
commandaction="Installing mods" commandaction="Installing Mods"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set

12
lgsm/modules/command_mods_remove.sh

@ -6,7 +6,7 @@
# Description: Uninstall mods along with mods_list.sh and mods_core.sh. # Description: Uninstall mods along with mods_list.sh and mods_core.sh.
commandname="MODS-REMOVE" commandname="MODS-REMOVE"
commandaction="Removing mods" commandaction="Removing Mods"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
@ -70,8 +70,8 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
if [ -f "${modinstalldir}/${currentfileremove}" ] || [ -d "${modinstalldir}/${currentfileremove}" ]; then if [ -f "${modinstalldir}/${currentfileremove}" ] || [ -d "${modinstalldir}/${currentfileremove}" ]; then
rm -rf "${modinstalldir:?}/${currentfileremove:?}" rm -rf "${modinstalldir:?}/${currentfileremove:?}"
((exitcode = $?)) exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "Removing ${modinstalldir}/${currentfileremove}" fn_script_log_fail "Removing ${modinstalldir}/${currentfileremove}"
break break
else else
@ -87,7 +87,7 @@ done
# Added logic not to fail since removing game specific mods (amxmodxcs) removes files that will # Added logic not to fail since removing game specific mods (amxmodxcs) removes files that will
# not be found when removing the base (amxmodx) mod # not be found when removing the base (amxmodx) mod
if [ "${modcommand}" != "amxmodx" ]; then if [ "${modcommand}" != "amxmodx" ]; then
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
else else
@ -102,7 +102,7 @@ echo -en "removing ${modcommand}-files.txt..."
fn_sleep_time_1 fn_sleep_time_1
rm -rf "${modsdir:?}/${modcommand}-files.txt" rm -rf "${modsdir:?}/${modcommand}-files.txt"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "Removing ${modsdir}/${modcommand}-files.txt" fn_script_log_fail "Removing ${modsdir}/${modcommand}-files.txt"
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
@ -117,7 +117,7 @@ fn_sleep_time_1
sed -i "/^${modcommand}$/d" "${modsinstalledlistfullpath}" sed -i "/^${modcommand}$/d" "${modsinstalledlistfullpath}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "Removing ${modcommand} from ${modsinstalledlist}" fn_script_log_fail "Removing ${modcommand} from ${modsinstalledlist}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh

2
lgsm/modules/command_mods_update.sh

@ -6,7 +6,7 @@
# Description: Updates installed mods along with mods_list.sh and mods_core.sh. # Description: Updates installed mods along with mods_list.sh and mods_core.sh.
commandname="MODS-UPDATE" commandname="MODS-UPDATE"
commandaction="Updating mods" commandaction="Updating Mods"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set

79
lgsm/modules/command_monitor.sh

@ -18,10 +18,10 @@ fn_monitor_check_monitoring() {
date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock" date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock"
elif [ ! -f "${lockdir}/${selfname}-monitoring.lock" ]; then elif [ ! -f "${lockdir}/${selfname}-monitoring.lock" ]; then
# Monitor does not run if lockfile is not found. # Monitor does not run if lockfile is not found.
fn_print_dots "Checking lockfile: " fn_print_dots "Checking lockfile"
fn_print_checking_eol fn_print_checking_eol
fn_script_log_info "Checking lockfile: CHECKING" fn_script_log_info "Checking lockfile: CHECKING"
fn_print_error "Checking lockfile: No lockfile found: " fn_print_error "Checking lockfile: No lockfile found"
fn_print_error_eol_nl fn_print_error_eol_nl
fn_script_log_error "Checking lockfile: No lockfile found: ERROR" fn_script_log_error "Checking lockfile: No lockfile found: ERROR"
echo -e "* Start ${selfname} to run monitor." echo -e "* Start ${selfname} to run monitor."
@ -31,10 +31,10 @@ fn_monitor_check_monitoring() {
fn_monitor_check_install() { fn_monitor_check_install() {
if [ "$(pgrep -fc -u "${USER}" "/bin/bash ./${selfname} install")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} i")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} auto-install")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} ai")" != "0" ]; then if [ "$(pgrep -fc -u "${USER}" "/bin/bash ./${selfname} install")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} i")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} auto-install")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} ai")" != "0" ]; then
fn_print_dots "Checking installer: " fn_print_dots "Checking installer"
fn_print_checking_eol fn_print_checking_eol
fn_script_log_info "Checking installer: CHECKING" fn_script_log_info "Checking installer: CHECKING"
fn_print_info "Checking installer: LinuxGSM is installing: " fn_print_info "Checking installer: LinuxGSM is installing"
fn_print_info_eol_nl fn_print_info_eol_nl
fn_script_log_pass "Checking installer: LinuxGSM is installing" fn_script_log_pass "Checking installer: LinuxGSM is installing"
core_exit.sh core_exit.sh
@ -43,9 +43,9 @@ fn_monitor_check_install() {
fn_monitor_check_debug() { fn_monitor_check_debug() {
if [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} debug")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} d")" != "0" ]; then if [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} debug")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} d")" != "0" ]; then
fn_print_dots "Checking debug: " fn_print_dots "Checking debug"
fn_print_checking_eol fn_print_checking_eol
fn_print_info "Checking debug: Debug is running: " fn_print_info "Checking debug: Debug is running"
fn_print_info_eol_nl fn_print_info_eol_nl
fn_script_log_pass "Checking debug: Debug is running" fn_script_log_pass "Checking debug: Debug is running"
core_exit.sh core_exit.sh
@ -54,9 +54,9 @@ fn_monitor_check_debug() {
fn_monitor_check_details() { fn_monitor_check_details() {
if [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} details")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} dt")" != "0" ]; then if [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} details")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} dt")" != "0" ]; then
fn_print_dots "Checking details: " fn_print_dots "Checking details"
fn_print_checking_eol fn_print_checking_eol
fn_print_info "Checking details: Details is running: " fn_print_info "Checking details: Details is running"
fn_print_info_eol_nl fn_print_info_eol_nl
fn_script_log_pass "Checking details: Details is running" fn_script_log_pass "Checking details: Details is running"
core_exit.sh core_exit.sh
@ -67,9 +67,9 @@ fn_monitor_check_starting() {
# Remove stale lockfile. # Remove stale lockfile.
if [ -f "${lockdir}/${selfname}-starting.lock" ]; then if [ -f "${lockdir}/${selfname}-starting.lock" ]; then
if [ "$(find "${lockdir}/${selfname}-starting.lock" -mmin +5)" ]; then if [ "$(find "${lockdir}/${selfname}-starting.lock" -mmin +5)" ]; then
fn_print_dots "Checking start: " fn_print_dots "Checking start"
fn_print_checking_eol fn_print_checking_eol
fn_print_warn "Checking start: Removing stale lockfile: " fn_print_warn "Checking start: Removing stale lockfile"
fn_print_warn_eol_nl fn_print_warn_eol_nl
fn_script_log_warn "Checking start: Removing stale lockfile" fn_script_log_warn "Checking start: Removing stale lockfile"
rm -f "${lockdir:?}/${selfname}-starting.lock" rm -f "${lockdir:?}/${selfname}-starting.lock"
@ -77,9 +77,9 @@ fn_monitor_check_starting() {
fi fi
if [ -f "${lockdir}/${selfname}-starting.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} start")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} s")" != "0" ]]; then if [ -f "${lockdir}/${selfname}-starting.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} start")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} s")" != "0" ]]; then
fn_print_dots "Checking start: " fn_print_dots "Checking start"
fn_print_checking_eol fn_print_checking_eol
fn_print_info "Checking start: LinuxGSM is starting: " fn_print_info "Checking start: LinuxGSM is starting"
fn_print_info_eol_nl fn_print_info_eol_nl
fn_script_log_info "Checking backup: LinuxGSM is starting" fn_script_log_info "Checking backup: LinuxGSM is starting"
core_exit.sh core_exit.sh
@ -90,9 +90,9 @@ fn_monitor_check_stopping() {
# Remove stale lockfile. # Remove stale lockfile.
if [ -f "${lockdir}/${selfname}-stopping.lock" ]; then if [ -f "${lockdir}/${selfname}-stopping.lock" ]; then
if [ "$(find "${lockdir}/${selfname}-stopping.lock" -mmin +5)" ]; then if [ "$(find "${lockdir}/${selfname}-stopping.lock" -mmin +5)" ]; then
fn_print_dots "Checking stop: " fn_print_dots "Checking stop"
fn_print_checking_eol fn_print_checking_eol
fn_print_warn "Checking stop: Removing stale lockfile: " fn_print_warn "Checking stop: Removing stale lockfile"
fn_print_warn_eol_nl fn_print_warn_eol_nl
fn_script_log_warn "Checking stop: Removing stale lockfile" fn_script_log_warn "Checking stop: Removing stale lockfile"
rm -f "${lockdir:?}/${selfname}-stopping.lock" rm -f "${lockdir:?}/${selfname}-stopping.lock"
@ -100,9 +100,9 @@ fn_monitor_check_stopping() {
fi fi
if [ -f "${lockdir}/${selfname}-stopping.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} stop")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} s")" != "0" ]]; then if [ -f "${lockdir}/${selfname}-stopping.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} stop")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} s")" != "0" ]]; then
fn_print_dots "Checking stop: " fn_print_dots "Checking stop"
fn_print_checking_eol fn_print_checking_eol
fn_print_info "Checking stop: LinuxGSM is stopping: " fn_print_info "Checking stop: LinuxGSM is stopping"
fn_print_info_eol_nl fn_print_info_eol_nl
fn_script_log_info "Checking backup: LinuxGSM is stopping" fn_script_log_info "Checking backup: LinuxGSM is stopping"
core_exit.sh core_exit.sh
@ -113,9 +113,9 @@ fn_monitor_check_backup() {
# Remove stale lockfile. # Remove stale lockfile.
if [ -f "${lockdir}/backup.lock" ]; then if [ -f "${lockdir}/backup.lock" ]; then
if [ "$(find "${lockdir}/backup.lock" -mmin +60)" ]; then if [ "$(find "${lockdir}/backup.lock" -mmin +60)" ]; then
fn_print_dots "Checking backup: " fn_print_dots "Checking backup"
fn_print_checking_eol fn_print_checking_eol
fn_print_warn "Checking backup: Removing stale lockfile: " fn_print_warn "Checking backup: Removing stale lockfile"
fn_print_warn_eol fn_print_warn_eol
fn_script_log_warn "Checking backup: Removing stale lockfile" fn_script_log_warn "Checking backup: Removing stale lockfile"
rm -f "${lockdir:?}/backup.lock" rm -f "${lockdir:?}/backup.lock"
@ -123,9 +123,9 @@ fn_monitor_check_backup() {
fi fi
if [ -f "${lockdir}/backup.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} backup")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} b")" != "0" ]]; then if [ -f "${lockdir}/backup.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} backup")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} b")" != "0" ]]; then
fn_print_dots "Checking backup: " fn_print_dots "Checking backup"
fn_print_checking_eol fn_print_checking_eol
fn_print_info "Checking backup: Backup is running: " fn_print_info "Checking backup: Backup is running"
fn_print_info_eol_nl fn_print_info_eol_nl
fn_script_log_info "Checking backup: Backup is running" fn_script_log_info "Checking backup: Backup is running"
core_exit.sh core_exit.sh
@ -136,9 +136,9 @@ fn_monitor_check_update() {
# Remove stale lockfile. # Remove stale lockfile.
if [ -f "${lockdir}/update.lock" ]; then if [ -f "${lockdir}/update.lock" ]; then
if [ "$(find "${lockdir}/update.lock" -mmin +15)" ]; then if [ "$(find "${lockdir}/update.lock" -mmin +15)" ]; then
fn_print_dots "Checking update: " fn_print_dots "Checking update"
fn_print_checking_eol fn_print_checking_eol
fn_print_warn "Checking update: Removing stale lockfile: " fn_print_warn "Checking update: Removing stale lockfile"
fn_print_warn_eol_nl fn_print_warn_eol_nl
fn_script_log_warn "Checking update: Removing stale lockfile" fn_script_log_warn "Checking update: Removing stale lockfile"
rm -f "${lockdir:?}/update.lock" rm -f "${lockdir:?}/update.lock"
@ -146,9 +146,9 @@ fn_monitor_check_update() {
fi fi
if [ -f "${lockdir}/update.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} update")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} validate")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} v")" != "0" || "$(pgrep -fc force-update "${USER}" "/bin/bash ./${selfname} fu")" != "0" ]]; then if [ -f "${lockdir}/update.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} update")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} validate")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} v")" != "0" || "$(pgrep -fc force-update "${USER}" "/bin/bash ./${selfname} fu")" != "0" ]]; then
fn_print_dots "Checking update: " fn_print_dots "Checking update"
fn_print_checking_eol fn_print_checking_eol
fn_print_info "Checking update: LinuxGSM is updating the game server: " fn_print_info "Checking update: LinuxGSM is updating the game server"
fn_print_info_eol_nl fn_print_info_eol_nl
fn_script_log_pass "Checking update: LinuxGSM is updating the game server" fn_script_log_pass "Checking update: LinuxGSM is updating the game server"
core_exit.sh core_exit.sh
@ -159,10 +159,10 @@ fn_monitor_check_update() {
fn_monitor_check_update_source() { fn_monitor_check_update_source() {
if [ -f "${consolelogdir}/${selfname}-console.log" ] && [ "${engine}" == "source" ]; then if [ -f "${consolelogdir}/${selfname}-console.log" ] && [ "${engine}" == "source" ]; then
if grep -q "Your server needs to be restarted in order to receive the latest update." "${consolelogdir}/${selfname}-console.log"; then if grep -q "Your server needs to be restarted in order to receive the latest update." "${consolelogdir}/${selfname}-console.log"; then
fn_print_dots "Checking update: " fn_print_dots "Checking update"
fn_print_checking_eol fn_print_checking_eol
fn_script_log_info "Checking update: CHECKING" fn_script_log_info "Checking update: CHECKING"
fn_print_ok "Checking update: " fn_print_ok "Checking update"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_info "Checking update: ${selfname} has requested an update and needs to be restarted" fn_script_log_info "Checking update: ${selfname} has requested an update and needs to be restarted"
alert="update-request" alert="update-request"
@ -174,7 +174,7 @@ fn_monitor_check_update_source() {
} }
fn_monitor_check_session() { fn_monitor_check_session() {
fn_print_dots "Checking session: " fn_print_dots "Checking session"
fn_print_checking_eol fn_print_checking_eol
fn_script_log_info "Checking session: CHECKING" fn_script_log_info "Checking session: CHECKING"
# Tmux session width and height needs to be reviewed as may no longer be required. # Tmux session width and height needs to be reviewed as may no longer be required.
@ -182,7 +182,7 @@ fn_monitor_check_session() {
sessionheight="23" sessionheight="23"
# Check for PIDS with identical tmux sessions running. # Check for PIDS with identical tmux sessions running.
if [ "$(pgrep -fcx "tmux -L ${socketname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" -ge "2" ]; then if [ "$(pgrep -fcx "tmux -L ${socketname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" -ge "2" ]; then
fn_print_error "Checking session: There are PIDS with identical tmux sessions running: " fn_print_error "Checking session: There are PIDS with identical tmux sessions running"
fn_print_error_eol_nl fn_print_error_eol_nl
fn_script_log_error "Checking session: ERROR" fn_script_log_error "Checking session: ERROR"
fn_script_log_error "Checking session: There are PIDS with identical tmux sessions running" fn_script_log_error "Checking session: There are PIDS with identical tmux sessions running"
@ -192,7 +192,7 @@ fn_monitor_check_session() {
core_exit.sh core_exit.sh
# Check for tmux pids with the same tmux session and socket names. This will reduce issues with migration to release v23.5.0. #4296 # Check for tmux pids with the same tmux session and socket names. This will reduce issues with migration to release v23.5.0. #4296
elif [ "$(pgrep -fc -u "${USER}" "tmux -L ${sessionname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then elif [ "$(pgrep -fc -u "${USER}" "tmux -L ${sessionname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then
fn_print_error "Checking session: PIDS with the same tmux session and socket names are running: " fn_print_error "Checking session: PIDS with the same tmux session and socket names are running"
fn_print_error_eol_nl fn_print_error_eol_nl
fn_script_log_error "Checking session: ERROR" fn_script_log_error "Checking session: ERROR"
fn_script_log_error "Checking session: PIDS with the same tmux session and socket names are running" fn_script_log_error "Checking session: PIDS with the same tmux session and socket names are running"
@ -202,7 +202,7 @@ fn_monitor_check_session() {
core_exit.sh core_exit.sh
# Check for tmux pids that are using the old type of tmux session. This will reduce issues with migration to release v23.5.0. #4296 # Check for tmux pids that are using the old type of tmux session. This will reduce issues with migration to release v23.5.0. #4296
elif [ "$(pgrep -fc -u "${USER}" "tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then elif [ "$(pgrep -fc -u "${USER}" "tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then
fn_print_error "Checking session: PIDS with old type tmux session are running: " fn_print_error "Checking session: PIDS with old type tmux session are running"
fn_print_error_eol_nl fn_print_error_eol_nl
fn_script_log_error "Checking session: ERROR" fn_script_log_error "Checking session: ERROR"
fn_script_log_error "Checking session: PIDS with old type tmux session are running" fn_script_log_error "Checking session: PIDS with old type tmux session are running"
@ -211,7 +211,7 @@ fn_monitor_check_session() {
command_restart.sh command_restart.sh
core_exit.sh core_exit.sh
elif [ "${status}" != "0" ]; then elif [ "${status}" != "0" ]; then
fn_print_ok "Checking session: " fn_print_ok "Checking session"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Checking session: OK" fn_script_log_pass "Checking session: OK"
# send LinuxGSM stats if monitor is OK. # send LinuxGSM stats if monitor is OK.
@ -219,7 +219,7 @@ fn_monitor_check_session() {
info_stats.sh info_stats.sh
fi fi
else else
fn_print_error "Checking session: " fn_print_error "Checking session"
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Checking session: FAIL" fn_script_log_fail "Checking session: FAIL"
alert="monitor-session" alert="monitor-session"
@ -233,7 +233,7 @@ fn_monitor_check_session() {
# Monitor will check queryport is set before continuing. # Monitor will check queryport is set before continuing.
fn_monitor_check_queryport() { fn_monitor_check_queryport() {
if [ -z "${queryport}" ] || [ "${queryport}" == "0" ]; then if [ -z "${queryport}" ] || [ "${queryport}" == "0" ]; then
fn_print_dots "Checking port: " fn_print_dots "Checking port"
fn_print_checking_eol fn_print_checking_eol
fn_script_log_info "Checking port: CHECKING" fn_script_log_info "Checking port: CHECKING"
if [ -n "${rconenabled}" ] && [ "${rconenabled}" != "true" ] && [ "${shortname}" == "av" ]; then if [ -n "${rconenabled}" ] && [ "${rconenabled}" != "true" ] && [ "${shortname}" == "av" ]; then
@ -266,12 +266,12 @@ fn_monitor_query() {
totalseconds=0 totalseconds=0
for queryattempt in {1..5}; do for queryattempt in {1..5}; do
for queryip in "${queryips[@]}"; do for queryip in "${queryips[@]}"; do
fn_print_dots "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_dots "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}"
fn_print_querying_eol fn_print_querying_eol
fn_script_log_info "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : QUERYING" fn_script_log_info "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : QUERYING"
# querydelay # querydelay
if [ "$(head -n 1 "${lockdir}/${selfname}-started.lock")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then if [ "$(head -n 1 "${lockdir}/${selfname}-started.lock")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then
fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}"
fn_print_delay_eol_nl fn_print_delay_eol_nl
fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : DELAY" fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : DELAY"
fn_script_log_info "Query bypassed: ${gameservername} started less than ${querydelay} minutes ago" fn_script_log_info "Query bypassed: ${gameservername} started less than ${querydelay} minutes ago"
@ -293,7 +293,7 @@ fn_monitor_query() {
if [ "${querystatus}" == "0" ]; then if [ "${querystatus}" == "0" ]; then
# Server query OK. # Server query OK.
fn_print_ok "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_ok "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : OK" fn_script_log_pass "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : OK"
monitorpass=1 monitorpass=1
@ -323,14 +323,14 @@ fn_monitor_query() {
core_exit.sh core_exit.sh
else else
# Server query FAIL. # Server query FAIL.
fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}"
fn_print_fail_eol fn_print_fail_eol
fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : FAIL" fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : FAIL"
# Monitor will try gamedig (if supported) for first 30s then gsquery before restarting. # Monitor will try gamedig (if supported) for first 30s then gsquery before restarting.
# gsquery will fail if longer than 60s # gsquery will fail if longer than 60s
if [ "${totalseconds}" -ge "59" ]; then if [ "${totalseconds}" -ge "59" ]; then
# Monitor will FAIL if over 60s and trigger gane server reboot. # Monitor will FAIL if over 60s and trigger gane server reboot.
fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : FAIL" fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : FAIL"
# Send alert if enabled. # Send alert if enabled.
@ -344,7 +344,8 @@ fn_monitor_query() {
done done
# Second counter will wait for 15s before breaking loop. # Second counter will wait for 15s before breaking loop.
for seconds in {1..15}; do for seconds in {1..15}; do
fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt} : ${cyan}WAIT${default}" fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}"
fn_print_wait_eol
fn_sleep_time_1 fn_sleep_time_1
totalseconds=$((totalseconds + 1)) totalseconds=$((totalseconds + 1))
if [ "${seconds}" == "15" ]; then if [ "${seconds}" == "15" ]; then

12
lgsm/modules/command_postdetails.sh

@ -6,20 +6,18 @@
# Description: Strips sensitive information out of Details output. # Description: Strips sensitive information out of Details output.
commandname="POST-DETAILS" commandname="POST-DETAILS"
commandaction="Posting details" commandaction="Post Details"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
posttarget="https://termbin.com"
# source all of the modules defined in the details command.
info_messages.sh
fn_bad_postdetailslog() { fn_bad_postdetailslog() {
fn_print_fail_nl "Unable to create temporary file ${postdetailslog}." fn_print_fail_nl "Unable to create temporary file ${postdetailslog}."
core_exit.sh core_exit.sh
} }
# source all of the modules defined in the details command.
info_messages.sh
# Remove any existing postdetails.log file. # Remove any existing postdetails.log file.
if [ -f "${postdetailslog}" ]; then if [ -f "${postdetailslog}" ]; then
rm -f "${postdetailslog:?}" rm -f "${postdetailslog:?}"
@ -68,7 +66,7 @@ pdurl="${link}"
if [ "${firstcommandname}" == "POST-DETAILS" ]; then if [ "${firstcommandname}" == "POST-DETAILS" ]; then
echo -e "" echo -e ""
echo -e "Please share the following url for support: " echo -e "Please share the following url for support: "
echo -e "${pdurl}" echo -e "${italic}${pdurl}${default}"
fi fi
fn_script_log_info "${pdurl}" fn_script_log_info "${pdurl}"
alerturl="${pdurl}" alerturl="${pdurl}"

2
lgsm/modules/command_send.sh

@ -26,8 +26,8 @@ if [ "${status}" != "0" ]; then
fi fi
echo "" echo ""
fn_print_dots "Sending command to console: \"${commandtosend}\"" fn_print_dots "Sending command to console: \"${commandtosend}\""
tmux -L "${socketname}" send-keys -t "${sessionname}" "${commandtosend}" ENTER
fn_print_ok_nl "Sending command to console: \"${commandtosend}\"" fn_print_ok_nl "Sending command to console: \"${commandtosend}\""
tmux -L "${socketname}" send-keys -t "${sessionname}" "${commandtosend}" ENTER
fn_script_log_pass "Command \"${commandtosend}\" sent to console" fn_script_log_pass "Command \"${commandtosend}\" sent to console"
else else
fn_print_error_nl "Server not running" fn_print_error_nl "Server not running"

2
lgsm/modules/command_skeleton.sh

@ -16,7 +16,7 @@ check.sh
# Find all directorys and create them in the skel directory # Find all directorys and create them in the skel directory
find "${rootdir}" -type d -not \( -path ./skel -prune \) | cpio -pdvm skel 2> /dev/null find "${rootdir}" -type d -not \( -path ./skel -prune \) | cpio -pdvm skel 2> /dev/null
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_nl "Creating skeleton directory" fn_print_fail_nl "Creating skeleton directory"
fn_script_log_fail "Creating skeleton directory" fn_script_log_fail "Creating skeleton directory"
else else

2
lgsm/modules/command_sponsor.sh

@ -11,7 +11,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
fn_print_ascii_logo fn_print_ascii_logo
echo -e "${lightyellow}Support LinuxGSM${default}" echo -e "${bold}${lightyellow}Support LinuxGSM${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
echo -e "Been using LinuxGSM?" echo -e "Been using LinuxGSM?"

6
lgsm/modules/command_start.sh

@ -127,12 +127,12 @@ fn_start_tmux() {
echo -e "" echo -e ""
echo -e " usermod -G tty $(whoami)" echo -e " usermod -G tty $(whoami)"
echo -e "" echo -e ""
echo -e "https://linuxgsm.com/tmux-op-perm" echo -e "${italic}https://linuxgsm.com/tmux-op-perm"
fn_script_log_info "https://linuxgsm.com/tmux-op-perm" fn_script_log_info "https://linuxgsm.com/tmux-op-perm"
else else
echo -e "No known fix currently. Please log an issue." echo -e "No known fix currently. Please log an issue."
fn_script_log_info "No known fix currently. Please log an issue." fn_script_log_info "No known fix currently. Please log an issue."
echo -e "https://linuxgsm.com/support" echo -e "${italic}https://linuxgsm.com/support"
fn_script_log_info "https://linuxgsm.com/support" fn_script_log_info "https://linuxgsm.com/support"
fi fi
fi fi
@ -176,7 +176,7 @@ check.sh
# If the server already started dont start again. # If the server already started dont start again.
if [ "${status}" != "0" ]; then if [ "${status}" != "0" ]; then
fn_print_dots "${servername}" fn_print_dots "${servername}"
fn_print_info_nl "${servername} is already running" fn_print_skip_nl "${servername} is already running"
fn_script_log_error "${servername} is already running" fn_script_log_error "${servername} is already running"
if [ -z "${exitbypass}" ]; then if [ -z "${exitbypass}" ]; then
# Remove starting lockfile when command ends. # Remove starting lockfile when command ends.

10
lgsm/modules/command_stop.sh

@ -20,7 +20,7 @@ fn_stop_graceful_ctrlc() {
for seconds in {1..30}; do for seconds in {1..30}; do
check_status.sh check_status.sh
if [ "${status}" == "0" ]; then if [ "${status}" == "0" ]; then
fn_print_ok "Graceful: CTRL+c: ${seconds}: " fn_print_ok "Graceful: CTRL+c: ${seconds}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Graceful: CTRL+c: OK: ${seconds} seconds" fn_script_log_pass "Graceful: CTRL+c: OK: ${seconds} seconds"
if [ "${statusalert}" == "on" ] && [ "${firstcommandname}" == "STOP" ]; then if [ "${statusalert}" == "on" ] && [ "${firstcommandname}" == "STOP" ]; then
@ -52,7 +52,7 @@ fn_stop_graceful_cmd() {
for ((seconds = 1; seconds <= ${2}; seconds++)); do for ((seconds = 1; seconds <= ${2}; seconds++)); do
check_status.sh check_status.sh
if [ "${status}" == "0" ]; then if [ "${status}" == "0" ]; then
fn_print_ok "Graceful: sending \"${1}\": ${seconds}: " fn_print_ok "Graceful: sending \"${1}\": ${seconds}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Graceful: sending \"${1}\": OK: ${seconds} seconds" fn_script_log_pass "Graceful: sending \"${1}\": OK: ${seconds} seconds"
if [ "${statusalert}" == "on" ] && [ "${firstcommandname}" == "STOP" ]; then if [ "${statusalert}" == "on" ] && [ "${firstcommandname}" == "STOP" ]; then
@ -85,7 +85,7 @@ fn_stop_graceful_goldsrc() {
fn_sleep_time_1 fn_sleep_time_1
fn_print_dots "Graceful: sending \"quit\": ${seconds}" fn_print_dots "Graceful: sending \"quit\": ${seconds}"
done done
fn_print_ok "Graceful: sending \"quit\": ${seconds}: " fn_print_ok "Graceful: sending \"quit\": ${seconds}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Graceful: sending \"quit\": OK: ${seconds} seconds" fn_script_log_pass "Graceful: sending \"quit\": OK: ${seconds} seconds"
if [ "${statusalert}" == "on" ] && [ "${firstcommandname}" == "STOP" ]; then if [ "${statusalert}" == "on" ] && [ "${firstcommandname}" == "STOP" ]; then
@ -297,7 +297,7 @@ fn_stop_graceful_avorion() {
for seconds in {1..30}; do for seconds in {1..30}; do
check_status.sh check_status.sh
if [ "${status}" == "0" ]; then if [ "${status}" == "0" ]; then
fn_print_ok "Graceful: /save /stop: ${seconds}: " fn_print_ok "Graceful: /save /stop: ${seconds}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Graceful: /save /stop: OK: ${seconds} seconds" fn_script_log_pass "Graceful: /save /stop: OK: ${seconds} seconds"
if [ "${statusalert}" == "on" ] && [ "${firstcommandname}" == "STOP" ]; then if [ "${statusalert}" == "on" ] && [ "${firstcommandname}" == "STOP" ]; then
@ -370,7 +370,7 @@ fn_stop_tmux() {
# Checks if the server is already stopped. # Checks if the server is already stopped.
fn_stop_pre_check() { fn_stop_pre_check() {
if [ "${status}" == "0" ]; then if [ "${status}" == "0" ]; then
fn_print_info_nl "${servername} is already stopped" fn_print_skip_nl "${servername} is already stopped"
fn_script_log_info "${servername} is already stopped" fn_script_log_info "${servername} is already stopped"
else else
# Select graceful shutdown. # Select graceful shutdown.

2
lgsm/modules/command_ts3_server_pass.sh

@ -6,7 +6,7 @@
# Description: Changes TS3 serveradmin password. # Description: Changes TS3 serveradmin password.
commandname="CHANGE-PASSWORD" commandname="CHANGE-PASSWORD"
commandaction="Changing password" commandaction="Changing Password"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set

77
lgsm/modules/command_update_linuxgsm.sh

@ -27,10 +27,11 @@ fn_script_log_info "Selecting repo"
# Select remotereponame # Select remotereponame
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
exitcode=$?
if [ $? != "0" ]; then if [ "${exitcode}" -ne "0" ]; then
curl curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null
if [ $? != "0" ]; then exitcode=$?
if [ "${exitcode}" -ne "0" ]; then
fn_print_fail_nl "Selecting repo: Unable to to access GitHub or Bitbucket repositories" fn_print_fail_nl "Selecting repo: Unable to to access GitHub or Bitbucket repositories"
fn_script_log_fail "Selecting repo: Unable to to access GitHub or Bitbucket repositories" fn_script_log_fail "Selecting repo: Unable to to access GitHub or Bitbucket repositories"
core_exit.sh core_exit.sh
@ -44,16 +45,17 @@ else
fi fi
# Check linuxsm.sh # Check linuxsm.sh
echo -en "checking ${remotereponame} linuxgsm.sh...\c" echo -en "checking ${remotereponame} script [ ${italic}linuxgsm.sh${default} ]\c"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
else else
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null
fi fi
if [ $? != "0" ]; then exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Checking ${remotereponame} linuxgsm.sh" fn_script_log_fail "Checking ${remotereponame} linuxgsm.sh"
fn_script_log_fail "Curl returned error: $?" fn_script_log_fail "Curl returned error: ${exitcode}"
core_exit.sh core_exit.sh
fi fi
@ -65,41 +67,42 @@ fi
if [ "${tmp_script_diff}" != "" ]; then if [ "${tmp_script_diff}" != "" ]; then
fn_print_update_eol_nl fn_print_update_eol_nl
fn_script_log_update "Checking ${remotereponame} linuxgsm.sh" fn_script_log "Checking ${remotereponame} script linuxgsm.sh"
rm -f "${tmpdir:?}/linuxgsm.sh" rm -f "${tmpdir:?}/linuxgsm.sh"
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "nochmodx" "norun" "noforcedl" "nohash" fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "nochmodx" "norun" "noforcedl" "nohash"
else else
fn_print_ok_eol_nl fn_print_skip_eol_nl
fn_script_log_pass "Checking ${remotereponame} linuxgsm.sh" fn_script_log_pass "Checking ${remotereponame} script linuxgsm.sh"
fi fi
# Check gameserver.sh # Check gameserver.sh
# Compare gameserver.sh against linuxgsm.sh in the tmp dir. # Compare gameserver.sh against linuxgsm.sh in the tmp dir.
# Ignoring server specific vars. # Ignoring server specific vars.
echo -en "checking ${selfname}...\c" echo -en "checking script [ ${italic}${selfname}${default} ]\c"
fn_script_log_info "Checking ${selfname}" fn_script_log_info "Checking ${selfname}"
script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}")) script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}"))
if [ "${script_diff}" != "" ]; then if [ "${script_diff}" != "" ]; then
fn_print_update_eol_nl fn_print_update_eol_nl
fn_script_log_update "Checking ${selfname}" fn_script_log "Checking script ${selfname}"
echo -en "backup ${selfname}...\c" echo -en "backup ${selfname}\c"
fn_script_log_info "Backup ${selfname}" fn_script_log_info "Backup script ${selfname}"
if [ ! -d "${backupdir}/script" ]; then if [ ! -d "${backupdir}/script" ]; then
mkdir -p "${backupdir}/script" mkdir -p "${backupdir}/script"
fi fi
cp "${rootdir}/${selfname}" "${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak" cp "${rootdir}/${selfname}" "${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
if [ $? != 0 ]; then exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Backup ${selfname}" fn_script_log_fail "Backup ${selfname}"
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Backup ${selfname}" fn_script_log_pass "Backup script${selfname}"
echo -e "backup location ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak" echo -e "backup location [ ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak ]"
fn_script_log_pass "Backup location ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak" fn_script_log_pass "Backup location ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
fi fi
echo -en "copying ${selfname}...\c" echo -en "copying ${selfname}"
fn_script_log_info "Copying ${selfname}" fn_script_log_info "Copying ${selfname}"
cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}" cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}"
sed -i "s+shortname=\"core\"+shortname=\"${shortname}\"+g" "${rootdir}/${selfname}" sed -i "s+shortname=\"core\"+shortname=\"${shortname}\"+g" "${rootdir}/${selfname}"
@ -109,7 +112,8 @@ if [ "${script_diff}" != "" ]; then
sed -i "s+githubrepo=\"LinuxGSM\"+githubrepo=\"${githubrepo}\"+g" "${rootdir}/${selfname}" sed -i "s+githubrepo=\"LinuxGSM\"+githubrepo=\"${githubrepo}\"+g" "${rootdir}/${selfname}"
sed -i "s+githubbranch=\"master\"+githubbranch=\"${githubbranch}\"+g" "${rootdir}/${selfname}" sed -i "s+githubbranch=\"master\"+githubbranch=\"${githubbranch}\"+g" "${rootdir}/${selfname}"
if [ $? != "0" ]; then exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "copying ${selfname}" fn_script_log_fail "copying ${selfname}"
core_exit.sh core_exit.sh
@ -118,22 +122,23 @@ if [ "${script_diff}" != "" ]; then
fn_script_log_pass "copying ${selfname}" fn_script_log_pass "copying ${selfname}"
fi fi
else else
fn_print_ok_eol_nl fn_print_skip_eol_nl
fn_script_log_info "Checking ${selfname}" fn_script_log_info "Checking ${selfname}"
fi fi
# Check _default.cfg. # Check _default.cfg.
echo -en "checking ${remotereponame} config _default.cfg...\c" echo -en "checking ${remotereponame} config [ ${italic}_default.cfg${default} ]\c"
fn_script_log_info "Checking ${remotereponame} config _default.cfg" fn_script_log_info "Checking ${remotereponame} config _default.cfg"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null
else else
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null
fi fi
if [ $? != "0" ]; then exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Checking ${remotereponame} config _default.cfg" fn_script_log_fail "Checking ${remotereponame} config _default.cfg"
fn_script_log_fail "Curl returned error: $?" fn_script_log_fail "Curl returned error: ${exitcode}"
core_exit.sh core_exit.sh
fi fi
@ -145,29 +150,30 @@ fi
if [ "${config_file_diff}" != "" ]; then if [ "${config_file_diff}" != "" ]; then
fn_print_update_eol_nl fn_print_update_eol_nl
fn_script_log_update "Checking ${remotereponame} config _default.cfg" fn_script_log "Checking ${remotereponame} config _default.cfg"
rm -f "${configdirdefault:?}/config-lgsm/${gameservername:?}/_default.cfg" rm -f "${configdirdefault:?}/config-lgsm/${gameservername:?}/_default.cfg"
fn_fetch_file_github "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "nochmodx" "norun" "noforce" "nohash"
alert="config" alert="config"
alert.sh alert.sh
else else
fn_print_ok_eol_nl fn_print_skip_eol_nl
fn_script_log_pass "Checking ${remotereponame} config _default.cfg" fn_script_log_pass "Checking ${remotereponame} config _default.cfg"
fi fi
# Check distro csv. ${datadir}/${distroid}-${distroversioncsv}.csv # Check distro csv. ${datadir}/${distroid}-${distroversioncsv}.csv
if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
echo -en "checking ${remotereponame} config ${distroid}-${distroversioncsv}.csv...\c" echo -en "checking ${remotereponame} config [ ${italic}${distroid}-${distroversioncsv}.csv${default} ]\c"
fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
else else
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
fi fi
if [ $? != "0" ]; then exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" fn_script_log_fail "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
fn_script_log_fail "Curl returned error: $?" fn_script_log_fail "Curl returned error: ${exitcode}"
core_exit.sh core_exit.sh
fi fi
@ -179,11 +185,11 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
if [ "${config_file_diff}" != "" ]; then if [ "${config_file_diff}" != "" ]; then
fn_print_update_eol_nl fn_print_update_eol_nl
fn_script_log_update "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" fn_script_log "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
rm -f "${datadir:?}/${distroid}-${distroversioncsv}.csv" rm -f "${datadir:?}/${distroid}-${distroversioncsv}.csv"
fn_fetch_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" "${datadir}" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}" "${distroid}-${distroversioncsv}.csv" "${datadir}" "nochmodx" "norun" "noforce" "nohash"
else else
fn_print_ok_eol_nl fn_print_skip_eol_nl
fn_script_log_pass "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" fn_script_log_pass "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
fi fi
fi fi
@ -195,14 +201,15 @@ if [ -n "${modulesdir}" ]; then
for modulefile in *; do for modulefile in *; do
# check if module exists in the repo and remove if missing. # check if module exists in the repo and remove if missing.
# commonly used if module names change. # commonly used if module names change.
echo -en "checking ${remotereponame} module ${modulefile}...\c" echo -en "checking ${remotereponame} module [ ${italic}${modulefile}${default} ]\c"
github_file_url_dir="lgsm/modules" github_file_url_dir="lgsm/modules"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null
else else
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null
fi fi
if [ $? != 0 ]; then exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_error_eol_nl fn_print_error_eol_nl
fn_script_log_error "Checking ${remotereponame} module ${modulefile}" fn_script_log_error "Checking ${remotereponame} module ${modulefile}"
echo -en "removing module ${modulefile}...\c" echo -en "removing module ${modulefile}...\c"
@ -225,11 +232,11 @@ if [ -n "${modulesdir}" ]; then
# results # results
if [ "${module_file_diff}" != "" ]; then if [ "${module_file_diff}" != "" ]; then
fn_print_update_eol_nl fn_print_update_eol_nl
fn_script_log_update "Checking ${remotereponame} module ${modulefile}" fn_script_log "Checking ${remotereponame} module ${modulefile}"
rm -rf "${modulesdir:?}/${modulefile}" rm -rf "${modulesdir:?}/${modulefile}"
fn_update_module fn_update_module
else else
fn_print_ok_eol_nl fn_print_skip_eol_nl
fn_script_log_pass "Checking ${remotereponame} module ${modulefile}" fn_script_log_pass "Checking ${remotereponame} module ${modulefile}"
fi fi
fi fi

6
lgsm/modules/command_validate.sh

@ -11,18 +11,18 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
fn_validate() { fn_validate() {
fn_print_warn "Validate might overwrite some customised files" fn_print_warn ": SteamCMD: Validate might overwrite some customised files"
fn_script_log_warn "${commandaction} server: Validate might overwrite some customised files" fn_script_log_warn "${commandaction} server: Validate might overwrite some customised files"
totalseconds=3 totalseconds=3
for seconds in {3..1}; do for seconds in {3..1}; do
fn_print_warn "Validate might overwrite some customised files: ${totalseconds}" fn_print_warn ": SteamCMD: Validate might overwrite some customised files: ${totalseconds}"
totalseconds=$((totalseconds - 1)) totalseconds=$((totalseconds - 1))
fn_sleep_time_1 fn_sleep_time_1
if [ "${seconds}" == "0" ]; then if [ "${seconds}" == "0" ]; then
break break
fi fi
done done
fn_print_warn_nl "Validate might overwrite some customised files" fn_print_warn_nl ": SteamCMD: Validate might overwrite some customised files"
date '+%s' > "${lockdir:?}/update.lock" date '+%s' > "${lockdir:?}/update.lock"
fn_dl_steamcmd fn_dl_steamcmd
} }

31
lgsm/modules/command_wipe.sh

@ -13,7 +13,7 @@ fn_firstcommand_set
# Provides an exit code upon error. # Provides an exit code upon error.
fn_wipe_exit_code() { fn_wipe_exit_code() {
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
else else
@ -29,14 +29,14 @@ fn_wipe_files() {
# Remove Map files # Remove Map files
if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then
if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]; then if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]; then
echo -en "removing .map file(s)..." fn_print "removing .map file(s)..."
fn_script_log_info "Removing *.map file(s)" fn_script_log_info "Removing *.map file(s)"
fn_sleep_time fn_sleep_time
find "${serveridentitydir:?}" -type f -name "*.map" -printf "%f\n" >> "${lgsmlog}" find "${serveridentitydir:?}" -type f -name "*.map" -printf "%f\n" >> "${lgsmlog}"
find "${serveridentitydir:?}" -type f -name "*.map" -delete | tee -a "${lgsmlog}" find "${serveridentitydir:?}" -type f -name "*.map" -delete | tee -a "${lgsmlog}"
fn_wipe_exit_code fn_wipe_exit_code
else else
echo -e "no .map file(s) to remove" fn_print_nl "no .map file(s) to remove"
fn_sleep_time fn_sleep_time
fn_script_log_pass "no .map file(s) to remove" fn_script_log_pass "no .map file(s) to remove"
fi fi
@ -44,14 +44,14 @@ fn_wipe_files() {
# Remove Save files. # Remove Save files.
if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then
if [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]; then if [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]; then
echo -en "removing .sav file(s)..." fn_print "removing .sav file(s)..."
fn_script_log_info "Removing .sav file(s)" fn_script_log_info "Removing .sav file(s)"
fn_sleep_time fn_sleep_time
find "${serveridentitydir:?}" -type f -name "*.sav*" -printf "%f\n" >> "${lgsmlog}" find "${serveridentitydir:?}" -type f -name "*.sav*" -printf "%f\n" >> "${lgsmlog}"
find "${serveridentitydir:?}" -type f -name "*.sav*" -delete find "${serveridentitydir:?}" -type f -name "*.sav*" -delete
fn_wipe_exit_code fn_wipe_exit_code
else else
echo -e "no .sav file(s) to remove" fn_print_nl "no .sav file(s) to remove"
fn_script_log_pass "no .sav file(s) to remove" fn_script_log_pass "no .sav file(s) to remove"
fn_sleep_time fn_sleep_time
fi fi
@ -60,14 +60,14 @@ fn_wipe_files() {
# Excluding player.tokens.db for Rust+. # Excluding player.tokens.db for Rust+.
if [ -n "${serverwipe}" ]; then if [ -n "${serverwipe}" ]; then
if [ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then if [ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then
echo -en "removing .db file(s)..." fn_print "removing .db file(s)..."
fn_script_log_info "Removing .db file(s)" fn_script_log_info "Removing .db file(s)"
fn_sleep_time fn_sleep_time
find "${serveridentitydir:?}" -type f ! -name 'player.tokens.db' -name "*.db" -printf "%f\n" >> "${lgsmlog}" find "${serveridentitydir:?}" -type f ! -name 'player.tokens.db' -name "*.db" -printf "%f\n" >> "${lgsmlog}"
find "${serveridentitydir:?}" -type f ! -name 'player.tokens.db' -name "*.db" -delete find "${serveridentitydir:?}" -type f ! -name 'player.tokens.db' -name "*.db" -delete
fn_wipe_exit_code fn_wipe_exit_code
else else
echo -e "no .db file(s) to remove" fn_print_nl "no .db file(s) to remove"
fn_sleep_time fn_sleep_time
fn_script_log_pass "no .db file(s) to remove" fn_script_log_pass "no .db file(s) to remove"
fi fi
@ -104,13 +104,13 @@ fn_full_wipe_warning() {
fn_print_warn_nl "Server wipe will reset the map data and remove blueprint data" fn_print_warn_nl "Server wipe will reset the map data and remove blueprint data"
} }
# Will change the seed if the seed is not defined by the user. # If the seed is not defined by the user, generate a seed file.
fn_wipe_random_seed() { fn_wipe_random_seed() {
if [ -f "${datadir}/${selfname}-seed.txt" ] && [ -n "${randomseed}" ]; then if [ -f "${datadir}/${selfname}-seed.txt" ] && [ -n "${randomseed}" ]; then
shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt" shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt"
seed=$(cat "${datadir}/${selfname}-seed.txt") seed=$(cat "${datadir}/${selfname}-seed.txt")
randomseed=1 randomseed=1
echo -en "generating new random seed (${cyan}${seed}${default})..." fn_print "generating new random seed (${cyan}${seed}${default})..."
fn_script_log_pass "Generating new random seed (${cyan}${seed}${default})" fn_script_log_pass "Generating new random seed (${cyan}${seed}${default})"
fn_sleep_time fn_sleep_time
fn_print_ok_eol_nl fn_print_ok_eol_nl
@ -120,21 +120,21 @@ fn_wipe_random_seed() {
# A summary of what wipe is going to do. # A summary of what wipe is going to do.
fn_wipe_details() { fn_wipe_details() {
fn_print_information_nl "Wipe does not remove Rust+ data." fn_print_information_nl "Wipe does not remove Rust+ data."
echo -en "* Wipe map data: " fn_print "* Wipe map data "
if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then
fn_print_yes_eol_nl fn_print_yes_eol_nl
else else
fn_print_no_eol_nl fn_print_no_eol_nl
fi fi
echo -en "* Wipe blueprint data: " fn_print "* Wipe blueprint data "
if [ -n "${serverwipe}" ]; then if [ -n "${serverwipe}" ]; then
fn_print_yes_eol_nl fn_print_yes_eol_nl
else else
fn_print_no_eol_nl fn_print_no_eol_nl
fi fi
echo -en "* Change Procedural Map seed: " fn_print "* Change Procedural Map seed "
if [ -n "${randomseed}" ]; then if [ -n "${randomseed}" ]; then
fn_print_yes_eol_nl fn_print_yes_eol_nl
else else
@ -142,10 +142,9 @@ fn_wipe_details() {
fi fi
} }
fn_print_dots ""
check.sh check.sh
fix_rust.sh fix_rust.sh
fn_print_dots ""
# Check if there is something to wipe. # Check if there is something to wipe.
if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ] || [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ] && [ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ] || [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ] && [ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then
if [ -n "${serverwipe}" ]; then if [ -n "${serverwipe}" ]; then
@ -165,7 +164,7 @@ if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ] || [ -n "$(find
fn_firstcommand_reset fn_firstcommand_reset
fn_wipe_files fn_wipe_files
fn_wipe_random_seed fn_wipe_random_seed
fn_print_complete_nl "${wipetype}" fn_print_success_nl "${wipetype}"
fn_script_log_pass "${wipetype}" fn_script_log_pass "${wipetype}"
alert="wipe" alert="wipe"
alert.sh alert.sh
@ -175,7 +174,7 @@ if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ] || [ -n "$(find
else else
fn_wipe_files fn_wipe_files
fn_wipe_random_seed fn_wipe_random_seed
fn_print_complete_nl "${wipetype}" fn_print_success_nl "${wipetype}"
fn_script_log_pass "${wipetype}" fn_script_log_pass "${wipetype}"
alert="wipe" alert="wipe"
alert.sh alert.sh

2
lgsm/modules/compress_unreal2_maps.sh

@ -6,7 +6,7 @@
# Description: Compresses unreal maps. # Description: Compresses unreal maps.
commandname="MAP-COMPRESSOR" commandname="MAP-COMPRESSOR"
commandaction="Compressing maps" commandaction="Compressing Maps"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set

2
lgsm/modules/compress_ut99_maps.sh

@ -6,7 +6,7 @@
# Description: Compresses unreal maps. # Description: Compresses unreal maps.
commandname="MAP-COMPRESSOR" commandname="MAP-COMPRESSOR"
commandaction="Compressing maps" commandaction="Compressing Maps"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set

49
lgsm/modules/core_dl.sh

@ -20,6 +20,7 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_dl_steamcmd() { fn_dl_steamcmd() {
remotelocation="SteamCMD"
fn_print_start_nl "${remotelocation}" fn_print_start_nl "${remotelocation}"
fn_script_log_info "${commandaction} ${selfname}: ${remotelocation}" fn_script_log_info "${commandaction} ${selfname}: ${remotelocation}"
if [ -n "${branch}" ]; then if [ -n "${branch}" ]; then
@ -53,7 +54,7 @@ fn_dl_steamcmd() {
rm -f "${steamcmdlog:?}" rm -f "${steamcmdlog:?}"
fi fi
counter=0 counter=0
while [ "${counter}" == "0" ] || [ "${exitcode}" != "0" ]; do while [ "${counter}" -eq 0 ] || [ "${exitcode}" -ne 0 ]; do
counter=$((counter + 1)) counter=$((counter + 1))
# Select SteamCMD parameters # Select SteamCMD parameters
# If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands.
@ -127,16 +128,19 @@ fn_dl_steamcmd() {
elif [ -n "$(grep "0x626" "${steamcmdlog}" | tail -1)" ] || [ -n "$(grep "0x626" "${steamcmdlog}" | tail -1)" ]; then elif [ -n "$(grep "0x626" "${steamcmdlog}" | tail -1)" ] || [ -n "$(grep "0x626" "${steamcmdlog}" | tail -1)" ]; then
fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Missing update files" fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Missing update files"
fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Missing update files" fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Missing update files"
elif [ -n "$(grep "0x6A6" "${steamcmdlog}" | tail -1)" ]; then
fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Corrupt update files"
fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Corrupt update files"
else else
fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured" fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured"
echo -en "Please provide content log to LinuxGSM developers https://linuxgsm.com/steamcmd-error" fn_print_nl "Please provide content log to LinuxGSM developers https://linuxgsm.com/steamcmd-error"
fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured" fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured"
fi fi
elif [ "${exitcode}" != 0 ]; then elif [ "${exitcode}" -ne 0 ]; then
fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}" fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}"
fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}" fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}"
else else
fn_print_complete_nl "${commandaction} ${selfname}: ${remotelocation}" fn_print_success_nl "${commandaction} ${selfname}: ${remotelocation}"
fn_script_log_pass "${commandaction} ${selfname}: ${remotelocation}" fn_script_log_pass "${commandaction} ${selfname}: ${remotelocation}"
fi fi
@ -150,16 +154,16 @@ fn_dl_steamcmd() {
# Emptys contents of the LinuxGSM tmpdir. # Emptys contents of the LinuxGSM tmpdir.
fn_clear_tmp() { fn_clear_tmp() {
echo -en "clearing LinuxGSM tmp directory..." echo -en "clearing tmp directory [ ${italic}${tmpdir}${default} ]"
if [ -d "${tmpdir}" ]; then if [ -d "${tmpdir}" ]; then
rm -rf "${tmpdir:?}/"* rm -rf "${tmpdir:?}/"*
local exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_error_eol_nl fn_print_error_eol_nl
fn_script_log_error "clearing LinuxGSM tmp directory" fn_script_log_error "clearing tmp directory ${tmpdir}"
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "clearing LinuxGSM tmp directory" fn_script_log_pass "clearing tmp directory ${tmpdir}"
fi fi
fi fi
} }
@ -259,8 +263,8 @@ fn_dl_extract() {
extractcmd=$(unzip -qo -d "${extractdest}" "${local_filedir}/${local_filename}") extractcmd=$(unzip -qo -d "${extractdest}" "${local_filedir}/${local_filename}")
fi fi
fi fi
local exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Extracting ${local_filename}" fn_script_log_fail "Extracting ${local_filename}"
if [ -f "${lgsmlog}" ]; then if [ -f "${lgsmlog}" ]; then
@ -277,11 +281,11 @@ fn_dl_extract() {
# Trap to remove file download if canceled before completed. # Trap to remove file download if canceled before completed.
fn_fetch_trap() { fn_fetch_trap() {
echo -e "" echo -e ""
echo -en "downloading ${local_filename}..." echo -en "downloading ${local_filename}"
fn_print_canceled_eol_nl fn_print_canceled_eol_nl
fn_script_log_info "Downloading ${local_filename}...CANCELED" fn_script_log_info "Downloading ${local_filename}...CANCELED"
rm -f "${local_filedir:?}/${local_filename}" rm -f "${local_filedir:?}/${local_filename}"
echo -en "downloading ${local_filename}..." echo -en "downloading ${local_filename}"
fn_print_removed_eol_nl fn_print_removed_eol_nl
fn_script_log_info "Downloading ${local_filename}...REMOVED" fn_script_log_info "Downloading ${local_filename}...REMOVED"
core_exit.sh core_exit.sh
@ -313,12 +317,12 @@ fn_check_file() {
fileurl_name="${remote_fileurl_backup_name}" fileurl_name="${remote_fileurl_backup_name}"
fi fi
counter=$((counter + 1)) counter=$((counter + 1))
echo -en "checking ${fileurl_name} ${remote_filename}...\c" echo -e "checking ${fileurl_name} ${remote_filename}\c"
curlcmd=$(curl --output /dev/null --silent --head --fail "${fileurl}" 2>&1) curlcmd=$(curl --output /dev/null --silent --head --fail "${fileurl}" 2>&1)
local exitcode=$? exitcode=$?
# On first try will error. On second try will fail. # On first try will error. On second try will fail.
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
if [ ${counter} -ge 2 ]; then if [ ${counter} -ge 2 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
if [ -f "${lgsmlog}" ]; then if [ -f "${lgsmlog}" ]; then
@ -379,6 +383,7 @@ fn_fetch_file() {
counter=1 counter=1
remote_fileurls_array=(remote_fileurl) remote_fileurls_array=(remote_fileurl)
fi fi
for remote_fileurl_array in "${remote_fileurls_array[@]}"; do for remote_fileurl_array in "${remote_fileurls_array[@]}"; do
if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then
fileurl="${remote_fileurl}" fileurl="${remote_fileurl}"
@ -399,15 +404,15 @@ fn_fetch_file() {
local exitcode="" local exitcode=""
large_files=("bz2" "gz" "zip" "jar" "xz") large_files=("bz2" "gz" "zip" "jar" "xz")
if grep -qE "(^|\s)${local_filename##*.}(\s|$)" <<< "${large_files[@]}"; then if grep -qE "(^|\s)${local_filename##*.}(\s|$)" <<< "${large_files[@]}"; then
echo -en "downloading ${local_filename}..." echo -e "downloading file [ ${italic}${local_filename}${default} ]"
fn_sleep_time fn_sleep_time
echo -en "\033[1K"
"${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1 "${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1
exitcode="$?" exitcode=$?
echo -en "downloading file [ ${italic}${local_filename}${default} ]"
else else
echo -en "fetching ${fileurl_name} ${local_filename}...\c" echo -en "fetching ${fileurl_name} [ ${italic}${local_filename}${default} ]\c"
"${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1 "${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1
exitcode="$?" exitcode=$?
fi fi
# Download will fail if downloads a html file. # Download will fail if downloads a html file.
@ -419,7 +424,7 @@ fn_fetch_file() {
fi fi
# On first try will error. On second try will fail. # On first try will error. On second try will fail.
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
if [ ${counter} -ge 2 ]; then if [ ${counter} -ge 2 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
if [ -f "${lgsmlog}" ]; then if [ -f "${lgsmlog}" ]; then

10
lgsm/modules/core_exit.sh

@ -27,14 +27,14 @@ fi
if [ "${exitbypass}" ]; then if [ "${exitbypass}" ]; then
unset exitbypass unset exitbypass
elif [ "${exitcode}" != "0" ]; then elif [ "${exitcode}" -ne 0 ]; then
# List LinuxGSM version in logs # List LinuxGSM version in logs
fn_script_log_info "LinuxGSM version: ${version}" fn_script_log_info "LinuxGSM version: ${version}"
if [ "${exitcode}" == "1" ]; then if [ "${exitcode}" -eq 1 ]; then
fn_script_log_fail "${moduleselfname} exiting with code: ${exitcode}" fn_script_log_fail "${moduleselfname} exiting with code: ${exitcode}"
elif [ "${exitcode}" == "2" ]; then elif [ "${exitcode}" -eq 2 ]; then
fn_script_log_error "${moduleselfname} exiting with code: ${exitcode}" fn_script_log_error "${moduleselfname} exiting with code: ${exitcode}"
elif [ "${exitcode}" == "3" ]; then elif [ "${exitcode}" -eq 3 ]; then
fn_script_log_warn "${moduleselfname} exiting with code: ${exitcode}" fn_script_log_warn "${moduleselfname} exiting with code: ${exitcode}"
else else
# if exit code is not set assume error. # if exit code is not set assume error.
@ -45,7 +45,7 @@ elif [ "${exitcode}" != "0" ]; then
# remove trap. # remove trap.
trap - INT trap - INT
exit "${exitcode}" exit "${exitcode}"
elif [ "${exitcode}" ] && [ "${exitcode}" == "0" ]; then elif [ "${exitcode}" ] && [ "${exitcode}" -eq 0 ]; then
# List LinuxGSM version in logs # List LinuxGSM version in logs
fn_script_log_info "LinuxGSM version: ${version}" fn_script_log_info "LinuxGSM version: ${version}"
fn_script_log_pass "${moduleselfname} exiting with code: ${exitcode}" fn_script_log_pass "${moduleselfname} exiting with code: ${exitcode}"

17
lgsm/modules/core_getopt.sh

@ -56,6 +56,7 @@ cmd_dev_detect_deps=("dd;detect-deps" "command_dev_detect_deps.sh" "Detect requi
cmd_dev_detect_glibc=("dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc.") cmd_dev_detect_glibc=("dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc.")
cmd_dev_detect_ldd=("dl;detect-ldd" "command_dev_detect_ldd.sh" "Detect required dynamic dependencies.") cmd_dev_detect_ldd=("dl;detect-ldd" "command_dev_detect_ldd.sh" "Detect required dynamic dependencies.")
cmd_dev_query_raw=("qr;query-raw" "command_dev_query_raw.sh" "The raw output of gamedig and gsquery.") cmd_dev_query_raw=("qr;query-raw" "command_dev_query_raw.sh" "The raw output of gamedig and gsquery.")
cmd_dev_ui=("ui;ui" "command_dev_ui.sh" "Assist with UI development.")
cmd_dev_clear_modules=("cm;clear-modules" "command_dev_clear_modules.sh" "Delete the contents of the modules dir.") cmd_dev_clear_modules=("cm;clear-modules" "command_dev_clear_modules.sh" "Delete the contents of the modules dir.")
### Set specific opt here. ### Set specific opt here.
@ -147,7 +148,7 @@ currentopt+=("${cmd_install[@]}" "${cmd_auto_install[@]}")
## Developer commands. ## Developer commands.
currentopt+=("${cmd_dev_debug[@]}") currentopt+=("${cmd_dev_debug[@]}")
if [ -f ".dev-debug" ]; then if [ -f ".dev-debug" ]; then
currentopt+=("${cmd_dev_parse_game_details[@]}" "${cmd_dev_parse_distro_details[@]}" "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_modules[@]}") currentopt+=("${cmd_dev_parse_game_details[@]}" "${cmd_dev_parse_distro_details[@]}" "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_ui[@]}" "${cmd_dev_clear_modules[@]}")
fi fi
## Sponsor. ## Sponsor.
@ -165,19 +166,19 @@ done
# Shows LinuxGSM usage. # Shows LinuxGSM usage.
fn_opt_usage() { fn_opt_usage() {
echo -e "Usage: $0 [option]" fn_print_nl "Usage: $0 [option]"
echo -e "" fn_print_nl ""
echo -e "LinuxGSM - ${gamename} - Version ${version}" fn_print_nl "LinuxGSM - ${gamename} - Version ${version}"
echo -e "https://linuxgsm.com/${gameservername}" fn_print_nl "https://linuxgsm.com/${gameservername}"
echo -e "" fn_print_nl ""
echo -e "${lightyellow}Commands${default}" fn_print_nl "${bold}${lightyellow}Commands${default}"
# Display available commands. # Display available commands.
index="0" index="0"
{ {
for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
# Hide developer commands. # Hide developer commands.
if [ "${currentopt[index + 2]}" != "DEVCOMMAND" ]; then if [ "${currentopt[index + 2]}" != "DEVCOMMAND" ]; then
echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}" fn_print_nl "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}"
fi fi
done done
} | column -s $'\t' -t } | column -s $'\t' -t

6
lgsm/modules/core_legacy.sh

@ -35,6 +35,12 @@ if [ -n "${autosaveinterval}" ]; then
saveinterval="${autosaveinterval}" saveinterval="${autosaveinterval}"
fi fi
if [ "${shortname}" == "st" ]; then
if [ -n "${worldname}" ]; then
worldsave="${worldname}"
fi
fi
# Added as part of migrating functions dir to modules dir. # Added as part of migrating functions dir to modules dir.
# Will remove functions dir if files in modules dir older than 14 days # Will remove functions dir if files in modules dir older than 14 days
functionsdir="${lgsmdir}/modules" functionsdir="${lgsmdir}/modules"

306
lgsm/modules/core_messages.sh

@ -34,6 +34,14 @@ fn_ansi_loader() {
# erase to end of line. # erase to end of line.
creeol+="\033[K" creeol+="\033[K"
fi fi
# carriage return & erase to end of line.
creeol="\r\033[K"
bold="\e[1m"
dim="\e[2m"
italic="\e[3m"
underline="\e[4m"
reverse="\e[7m"
} }
fn_sleep_time() { fn_sleep_time() {
@ -71,216 +79,141 @@ fn_script_log() {
## Feb 28 14:56:58 ut99-server: Monitor: PASS: ## Feb 28 14:56:58 ut99-server: Monitor: PASS:
fn_script_log_pass() { fn_script_log_pass() {
if [ -d "${lgsmlogdir}" ]; then fn_script_log "PASS: ${1}"
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: PASS: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: PASS: ${1}" >> "${lgsmlog}"
fi
fi
exitcode=0 exitcode=0
} }
## Feb 28 14:56:58 ut99-server: Monitor: FATAL: ## Feb 28 14:56:58 ut99-server: Monitor: FATAL:
fn_script_log_fail() { fn_script_log_fail() {
if [ -d "${lgsmlogdir}" ]; then fn_script_log "FAIL: ${1}"
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: FATAL: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: FATAL: ${1}" >> "${lgsmlog}"
fi
fi
exitcode=1 exitcode=1
} }
## Feb 28 14:56:58 ut99-server: Monitor: ERROR: ## Feb 28 14:56:58 ut99-server: Monitor: ERROR:
fn_script_log_error() { fn_script_log_error() {
if [ -d "${lgsmlogdir}" ]; then fn_script_log "ERROR: ${1}"
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ERROR: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ERROR: ${1}" >> "${lgsmlog}"
fi
fi
exitcode=2 exitcode=2
} }
## Feb 28 14:56:58 ut99-server: Monitor: WARN: ## Feb 28 14:56:58 ut99-server: Monitor: WARN:
fn_script_log_warn() { fn_script_log_warn() {
if [ -d "${lgsmlogdir}" ]; then fn_script_log "WARN: ${1}"
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: WARN: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: WARN: ${1}" >> "${lgsmlog}"
fi
fi
exitcode=3 exitcode=3
} }
## Feb 28 14:56:58 ut99-server: Monitor: INFO: ## Feb 28 14:56:58 ut99-server: Monitor: INFO:
fn_script_log_info() { fn_script_log_info() {
if [ -d "${lgsmlogdir}" ]; then fn_script_log "INFO: ${1}"
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: INFO: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: INFO: ${1}" >> "${lgsmlog}"
fi
fi
}
## Feb 28 14:56:58 ut99-server: Monitor: UPDATE:
fn_script_log_update() {
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: UPDATE: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: UPDATE: ${1}" >> "${lgsmlog}"
fi
fi
} }
# On-Screen - Automated functions # On-Screen - Automated functions
################################## ##################################
# [ .... ] fn_print() {
fn_print_dots() { echo -en "$*${default}"
}
fn_print_nl() {
echo -e "$*${default}"
}
# Helper function to print messages with a specific format and color
fn_print_message() {
local type="$1"
local color="$2"
local message="$3"
if [ "${commandaction}" ]; then if [ "${commandaction}" ]; then
echo -en "${creeol}[ .... ] ${commandaction} ${selfname}: $*" echo -en "${bold}${creeol}[${color} ${type} ${default}]${default} ${commandaction} ${selfname}: ${message}${default}"
else else
echo -en "${creeol}[ .... ] $*" echo -en "${bold}${cree}[${color} ${type} ${default}]${default} ${message}${default}"
fi fi
fn_sleep_time_05 fn_sleep_time
} }
fn_print_dots_nl() { fn_print_message_nl() {
local type="$1"
local color="$2"
local message="$3"
if [ "${commandaction}" ]; then if [ "${commandaction}" ]; then
echo -e "${creeol}[ .... ] ${commandaction} ${selfname}: $*" echo -e "${bold}${creeol}[${color} ${type} ${default}]${default} ${commandaction} ${selfname}: ${message}${default}"
else else
echo -e "${creeol}[ .... ] $*" echo -e "${bold}${creeol}[${color} ${type} ${default}]${default} ${message}${default}"
fi fi
fn_sleep_time
}
# [ .... ]
fn_print_dots() {
fn_print_message "...." "${default}" "$*"
fn_sleep_time_05
}
fn_print_dots_nl() {
fn_print_message_nl "...." "${default}" "$*"
fn_sleep_time_05 fn_sleep_time_05
echo -en "\n"
} }
# [ OK ] # [ OK ]
fn_print_ok() { fn_print_ok() {
if [ "${commandaction}" ]; then fn_print_message " OK " "${green}" "$*"
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${green} OK ${default}] $*"
fi
fn_sleep_time
} }
fn_print_ok_nl() { fn_print_ok_nl() {
if [ "${commandaction}" ]; then fn_print_message_nl " OK " "${green}" "$*"
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${green} OK ${default}] $*"
fi
fn_sleep_time
echo -en "\n"
} }
# [ FAIL ] # [ FAIL ]
fn_print_fail() { fn_print_fail() {
if [ "${commandaction}" ]; then fn_print_message "FAIL" "${red}" "$*"
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${red} FAIL ${default}] $*"
fi
fn_sleep_time
} }
fn_print_fail_nl() { fn_print_fail_nl() {
if [ "${commandaction}" ]; then fn_print_message_nl "FAIL" "${red}" "$*"
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${red} FAIL ${default}] $*"
fi
fn_sleep_time
echo -en "\n"
} }
# [ ERROR ] # [ ERROR ]
fn_print_error() { fn_print_error() {
if [ "${commandaction}" ]; then fn_print_message "ERROR" "${red}" "$*"
echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${red} ERROR ${default}] $*"
fi
fn_sleep_time
} }
fn_print_error_nl() { fn_print_error_nl() {
if [ "${commandaction}" ]; then fn_print_message_nl "ERROR" "${red}" "$*"
echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${red} ERROR ${default}] $*"
fi
fn_sleep_time
echo -en "\n"
} }
# [ WARN ] # [ WARN ]
fn_print_warn() { fn_print_warn() {
if [ "${commandaction}" ]; then fn_print_message "WARN" "${lightyellow}" "$*"
echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${lightyellow} WARN ${default}] $*"
fi
fn_sleep_time
} }
fn_print_warn_nl() { fn_print_warn_nl() {
if [ "${commandaction}" ]; then fn_print_message_nl "WARN" "${lightyellow}" "$*"
echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${lightyellow} WARN ${default}] $*"
fi
fn_sleep_time
echo -en "\n"
} }
# [ INFO ] # [ INFO ]
fn_print_info() { fn_print_info() {
if [ "${commandaction}" ]; then fn_print_message "INFO" "${cyan}" "$*"
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${cyan} INFO ${default}] $*"
fi
fn_sleep_time
} }
fn_print_info_nl() { fn_print_info_nl() {
if [ "${commandaction}" ]; then fn_print_message_nl "INFO" "${cyan}" "$*"
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*" }
else
echo -en "${creeol}[${cyan} INFO ${default}] $*" # [ SKIP ]
fi fn_print_skip() {
fn_sleep_time fn_print_message "SKIP" "${cyan}" "$*"
echo -en "\n" }
fn_print_skip_nl() {
fn_print_message_nl "SKIP" "${cyan}" "$*"
} }
# [ START ] # [ START ]
fn_print_start() { fn_print_start() {
if [ "${commandaction}" ]; then fn_print_message "START" "${lightgreen}" "$*"
echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${lightgreen} START ${default}] $*"
fi
fn_sleep_time
} }
fn_print_start_nl() { fn_print_start_nl() {
if [ "${commandaction}" ]; then fn_print_message_nl "START" "${lightgreen}" "$*"
echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${lightgreen} START ${default}] $*"
fi
fn_sleep_time
echo -en "\n"
} }
# On-Screen - Interactive messages # On-Screen - Interactive messages
@ -304,63 +237,75 @@ fn_print_header() {
fn_messages_separator fn_messages_separator
} }
# Complete! # Success!
fn_print_complete() { fn_print_success() {
echo -en "${green}Complete!${default} $*" echo -en "${green}Success!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_complete_nl() { fn_print_success_nl() {
echo -e "${green}Complete!${default} $*" echo -e "${green}Success!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
# Failure! # Failure!
fn_print_failure() { fn_print_failure() {
echo -en "${red}Failure!${default} $*" echo -en "${red}Failure!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_failure_nl() { fn_print_failure_nl() {
echo -e "${red}Failure!${default} $*" echo -e "${red}Failure!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
# Error! # Error!
fn_print_error2() { fn_print_error2() {
echo -en "${red}Error!${default} $*" echo -en "${red}Error!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_error2_nl() { fn_print_error2_nl() {
echo -e "${red}Error!${default} $*" echo -e "${red}Error!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
# Warning! # Warning!
fn_print_warning() { fn_print_warning() {
echo -en "${lightyellow}Warning!${default} $*" echo -en "${lightyellow}Warning!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_warning_nl() { fn_print_warning_nl() {
echo -e "${lightyellow}Warning!${default} $*" echo -e "${lightyellow}Warning!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
# Information! # Information!
fn_print_information() { fn_print_information() {
echo -en "${cyan}Information!${default} $*" echo -en "${cyan}Information!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_information_nl() { fn_print_information_nl() {
echo -e "${cyan}Information!${default} $*" echo -e "${cyan}Information!${default} $*${default}"
fn_sleep_time
}
# Skip!
fn_print_skip2() {
echo -en "${cyan}Skip!${default} $*${default}"
fn_sleep_time
}
fn_print_skip2_nl() {
echo -e "${cyan}Skip!${default} $*${default}"
fn_sleep_time fn_sleep_time
} }
# Y/N Prompt # Y/N Prompt
fn_prompt_yn() { fn_prompt_yn() {
echo -e ""
local prompt="$1" local prompt="$1"
local initial="$2" local initial="$2"
@ -400,155 +345,166 @@ fn_prompt_message() {
# YES # YES
fn_print_yes_eol() { fn_print_yes_eol() {
echo -en "${cyan}YES${default}" echo -en " ... ${cyan}YES${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_yes_eol_nl() { fn_print_yes_eol_nl() {
echo -e "${cyan}YES${default}" echo -e " ... ${cyan}YES${default}"
fn_sleep_time fn_sleep_time
} }
# NO # NO
fn_print_no_eol() { fn_print_no_eol() {
echo -en "${red}NO${default}" echo -en " ... ${red}NO${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_no_eol_nl() { fn_print_no_eol_nl() {
echo -e "${red}NO${default}" echo -e " ... ${red}NO${default}"
fn_sleep_time fn_sleep_time
} }
# OK # OK
fn_print_ok_eol() { fn_print_ok_eol() {
echo -en "${green}OK${default}" echo -en " ... ${green}OK${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_ok_eol_nl() { fn_print_ok_eol_nl() {
echo -e "${green}OK${default}" echo -e " ... ${green}OK${default}"
fn_sleep_time fn_sleep_time
} }
# FAIL # FAIL
fn_print_fail_eol() { fn_print_fail_eol() {
echo -en "${red}FAIL${default}" echo -en " ... ${red}FAIL${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_fail_eol_nl() { fn_print_fail_eol_nl() {
echo -e "${red}FAIL${default}" echo -e " ... ${red}FAIL${default}"
fn_sleep_time fn_sleep_time
} }
# ERROR # ERROR
fn_print_error_eol() { fn_print_error_eol() {
echo -en "${red}ERROR${default}" echo -en " ... ${red}ERROR${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_error_eol_nl() { fn_print_error_eol_nl() {
echo -e "${red}ERROR${default}" echo -e " ... ${red}ERROR${default}"
fn_sleep_time fn_sleep_time
} }
# WAIT # WAIT
fn_print_wait_eol() { fn_print_wait_eol() {
echo -en "${cyan}WAIT${default}" echo -en " ... ${cyan}WAIT${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_wait_eol_nl() { fn_print_wait_eol_nl() {
echo -e "${cyan}WAIT${default}" echo -e " ... ${cyan}WAIT${default}"
fn_sleep_time fn_sleep_time
} }
# WARN # WARN
fn_print_warn_eol() { fn_print_warn_eol() {
echo -en "${lightyellow}WARN${default}" echo -en " ... ${lightyellow}WARN${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_warn_eol_nl() { fn_print_warn_eol_nl() {
echo -e "${lightyellow}WARN${default}" echo -e " ... ${lightyellow}WARN${default}"
fn_sleep_time fn_sleep_time
} }
# INFO # INFO
fn_print_info_eol() { fn_print_info_eol() {
echo -en "${cyan}INFO${default}" echo -en " ... ${cyan}INFO${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_info_eol_nl() { fn_print_info_eol_nl() {
echo -e "${cyan}INFO${default}" echo -e " ... ${cyan}INFO${default}"
fn_sleep_time fn_sleep_time
} }
# QUERYING # QUERYING
fn_print_querying_eol() { fn_print_querying_eol() {
echo -en "${cyan}QUERYING${default}" echo -en " ... ${cyan}QUERYING${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
fn_print_querying_eol_nl() { fn_print_querying_eol_nl() {
echo -e "${cyan}QUERYING${default}" echo -e " ... ${cyan}QUERYING${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
# CHECKING # CHECKING
fn_print_checking_eol() { fn_print_checking_eol() {
echo -en "${cyan}CHECKING${default}" echo -en " ... ${cyan}CHECKING${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
fn_print_checking_eol_nl() { fn_print_checking_eol_nl() {
echo -e "${cyan}CHECKING${default}" echo -e " ... ${cyan}CHECKING${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
# DELAY # DELAY
fn_print_delay_eol() { fn_print_delay_eol() {
echo -en "${green}DELAY${default}" echo -en " ... ${green}DELAY${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
fn_print_delay_eol_nl() { fn_print_delay_eol_nl() {
echo -e "${green}DELAY${default}" echo -e " ... ${green}DELAY${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
# CANCELED # CANCELED
fn_print_canceled_eol() { fn_print_canceled_eol() {
echo -en "${lightyellow}CANCELED${default}" echo -en " ... ${lightyellow}CANCELED${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
fn_print_canceled_eol_nl() { fn_print_canceled_eol_nl() {
echo -e "${lightyellow}CANCELED${default}" echo -e " ... ${lightyellow}CANCELED${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
# REMOVED # REMOVED
fn_print_removed_eol() { fn_print_removed_eol() {
echo -en "${red}REMOVED${default}" echo -en " ... ${red}REMOVED${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
fn_print_removed_eol_nl() { fn_print_removed_eol_nl() {
echo -e "${red}REMOVED${default}" echo -e " ... ${red}REMOVED${default}"
fn_sleep_time_1 fn_sleep_time_1
} }
# UPDATE # UPDATE
fn_print_update_eol() { fn_print_update_eol() {
echo -en "${cyan}UPDATE${default}" echo -en " ... ${lightblue}UPDATE${default}"
fn_sleep_time fn_sleep_time
} }
fn_print_update_eol_nl() { fn_print_update_eol_nl() {
echo -e "${cyan}UPDATE${default}" echo -e " ... ${lightblue}UPDATE${default}"
fn_sleep_time
}
# SKIP
fn_print_skip_eol() {
echo -en " ... ${cyan}SKIP${default}"
fn_sleep_time
}
fn_print_skip_eol_nl() {
echo -e " ... ${cyan}SKIP${default}"
fn_sleep_time fn_sleep_time
} }

12
lgsm/modules/core_modules.sh

@ -8,7 +8,7 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
modulesversion="v24.3.4" modulesversion="v25.1.0"
# Core # Core
@ -42,6 +42,11 @@ core_legacy.sh() {
core_exit.sh() { core_exit.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
echo "fn_fetch_module failed, using fn_bootstrap_fetch_module instead."
fn_bootstrap_fetch_module
fi
} }
core_getopt.sh() { core_getopt.sh() {
@ -324,6 +329,11 @@ command_dev_detect_ldd.sh() {
fn_fetch_module fn_fetch_module
} }
command_dev_ui.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
}
command_dev_query_raw.sh() { command_dev_query_raw.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module

139
lgsm/modules/core_steamcmd.sh

@ -23,7 +23,7 @@ fn_check_steamcmd_user() {
# Checks if steamuser is setup. # Checks if steamuser is setup.
if [ "${steamuser}" == "username" ]; then if [ "${steamuser}" == "username" ]; then
fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}" fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}"
echo -e " * Change steamuser=\"username\" to a valid steam login." fn_print_nl " * Change steamuser=\"username\" to a valid steam login."
if [ -d "${lgsmlogdir}" ]; then if [ -d "${lgsmlogdir}" ]; then
fn_script_log_fail "Steam login not set. Update steamuser in ${configdirserver}" fn_script_log_fail "Steam login not set. Update steamuser in ${configdirserver}"
fi fi
@ -44,15 +44,16 @@ fn_check_steamcmd() {
# Only install if steamcmd package is missing or steamcmd dir is missing. # Only install if steamcmd package is missing or steamcmd dir is missing.
if [ ! -f "${steamcmddir}/steamcmd.sh" ] && [ -z "$(command -v steamcmd 2> /dev/null)" ]; then if [ ! -f "${steamcmddir}/steamcmd.sh" ] && [ -z "$(command -v steamcmd 2> /dev/null)" ]; then
if [ "${commandname}" == "INSTALL" ]; then if [ "${commandname}" == "INSTALL" ]; then
fn_print_nl "install SteamCMD"
fn_install_steamcmd fn_install_steamcmd
else else
fn_print_warn_nl "SteamCMD is missing" fn_print_warn_nl "SteamCMD is not installed"
fn_script_log_warn "SteamCMD is missing" fn_script_log_warn "SteamCMD is not installed"
fn_install_steamcmd fn_install_steamcmd
fi fi
elif [ "${commandname}" == "INSTALL" ]; then elif [ "${commandname}" == "INSTALL" ]; then
fn_print_information "SteamCMD is already installed..." fn_print "install SteamCMD"
fn_print_ok_eol_nl fn_print_skip_eol_nl
fi fi
} }
@ -128,7 +129,7 @@ fn_check_steamcmd_clear() {
if [ "$(command -v steamcmd 2> /dev/null)" ] && [ -d "${rootdir}/steamcmd" ]; then if [ "$(command -v steamcmd 2> /dev/null)" ] && [ -d "${rootdir}/steamcmd" ]; then
rm -rf "${steamcmddir:?}" rm -rf "${steamcmddir:?}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "Removing ${rootdir}/steamcmd" fn_script_log_fail "Removing ${rootdir}/steamcmd"
else else
fn_script_log_pass "Removing ${rootdir}/steamcmd" fn_script_log_pass "Removing ${rootdir}/steamcmd"
@ -214,18 +215,18 @@ fn_update_steamcmd_compare() {
# Create update lockfile. # Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock" date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n" fn_print "\n"
echo -e "Update available" fn_print_nl "${bold}${underline}Update${default} available"
echo -e "* Local build: ${red}${localbuild}${default}" fn_print_nl "* Local build: ${red}${localbuild}${default}"
echo -e "* Remote build: ${green}${remotebuildversion}${default}" fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
if [ -n "${branch}" ]; then if [ -n "${branch}" ]; then
echo -e "* Branch: ${branch}" fn_print_nl "* Branch: ${branch}"
fi fi
if [ -n "${betapassword}" ]; then if [ -n "${betapassword}" ]; then
echo -e "* Branch password: ${betapassword}" fn_print_nl "* Branch password: ${betapassword}"
fi fi
echo -e "https://steamdb.info/app/${appid}/" fn_print_nl "${italic}https://steamdb.info/app/${appid}/history"
echo -en "\n" fn_print "\n"
fn_script_log_info "Update available" fn_script_log_info "Update available"
fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}" fn_script_log_info "Remote build: ${remotebuildversion}"
@ -264,18 +265,18 @@ fn_update_steamcmd_compare() {
alert.sh alert.sh
else else
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n" fn_print "\n"
echo -e "No update available" fn_print_nl "${bold}${underline}No update${default} available"
echo -e "* Local build: ${green}${localbuild}${default}" fn_print_nl "* Local build: ${green}${localbuild}${default}"
echo -e "* Remote build: ${green}${remotebuildversion}${default}" fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
if [ -n "${branch}" ]; then if [ -n "${branch}" ]; then
echo -e "* Branch: ${branch}" fn_print_nl "* Branch: ${branch}"
fi fi
if [ -n "${betapassword}" ]; then if [ -n "${betapassword}" ]; then
echo -e "* Branch password: ${betapassword}" fn_print_nl "* Branch password: ${betapassword}"
fi fi
echo -e "https://steamdb.info/app/${appid}/" fn_print_nl "https://steamdb.info/app/${appid}/history"
echo -en "\n" fn_print "\n"
fn_script_log_info "No update available" fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}" fn_script_log_info "Remote build: ${remotebuildversion}"
@ -309,9 +310,9 @@ fn_check_steamcmd_appmanifest() {
if [ "${appmanifestfilewc}" -ge "2" ]; then if [ "${appmanifestfilewc}" -ge "2" ]; then
fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
fn_script_log_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" fn_script_log_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
echo -e "* Check user permissions" fn_print_nl "* Check user permissions"
for appfile in ${appmanifestfile}; do for appfile in ${appmanifestfile}; do
echo -e " ${appfile}" fn_print_nl " ${appfile}"
done done
core_exit.sh core_exit.sh
else else
@ -365,63 +366,63 @@ fn_check_steamcmd_appmanifest() {
fn_print_info_nl "Forcing update to correct issue" fn_print_info_nl "Forcing update to correct issue"
fn_script_log_info "Forcing update to correct issue" fn_script_log_info "Forcing update to correct issue"
if [ "${shortname}" == "ahl" ]; then if [ "${shortname}" == "ahl" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "bb" ]; then elif [ "${shortname}" == "bb" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "cscz" ]; then elif [ "${shortname}" == "cscz" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_80.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_80.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "css" ]; then elif [ "${shortname}" == "css" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "dmc" ]; then elif [ "${shortname}" == "dmc" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_40.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_40.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "dod" ]; then elif [ "${shortname}" == "dod" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_30.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_30.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "hldm" ]; then elif [ "${shortname}" == "hldm" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "ns" ]; then elif [ "${shortname}" == "ns" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "opfor" ]; then elif [ "${shortname}" == "opfor" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_50.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_50.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "ricochet" ]; then elif [ "${shortname}" == "ricochet" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_60.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_60.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "tfc" ]; then elif [ "${shortname}" == "tfc" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_20.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_20.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "ts" ]; then elif [ "${shortname}" == "ts" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
elif [ "${shortname}" == "vs" ]; then elif [ "${shortname}" == "vs" ]; then
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_90.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_10.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash" fn_fetch_file_github "${datadir}/appmanifest/${shortname}" "appmanifest_70.acf" "${serverfiles}/steamapps" "nochmodx" "norun" "noforce" "nohash"
fi fi
fn_dl_steamcmd fn_dl_steamcmd
fi fi

5
lgsm/modules/fix.sh

@ -22,7 +22,8 @@ fn_fix_msg_start_nl() {
} }
fn_fix_msg_end() { fn_fix_msg_end() {
if [ $? != 0 ]; then exirtcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_error_nl "Applying ${fixname} fix: ${gamename}" fn_print_error_nl "Applying ${fixname} fix: ${gamename}"
fn_script_log_error "Applying ${fixname} fix: ${gamename}" fn_script_log_error "Applying ${fixname} fix: ${gamename}"
else else
@ -79,7 +80,7 @@ fi
if [ "${commandname}" == "INSTALL" ]; then if [ "${commandname}" == "INSTALL" ]; then
if grep -qEe "(^|\s)${shortname}(\s|$)" <<< "${apply_post_install_fix[@]}"; then if grep -qEe "(^|\s)${shortname}(\s|$)" <<< "${apply_post_install_fix[@]}"; then
echo -e "" echo -e ""
echo -e "${lightyellow}Applying Post-Install Fixes${default}" echo -e "${bold}${lightyellow}Applying Post-Install Fixes${default}"
fn_messages_separator fn_messages_separator
postinstall=1 postinstall=1
fn_apply_fix "post install" "${shortname}" fn_apply_fix "post install" "${shortname}"

2
lgsm/modules/fix_bt.sh

@ -5,7 +5,7 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Resolves issues with Barotrauma. # Description: Resolves issues with Barotrauma.
module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Fixes: Missing user data directory error. # Fixes: Missing user data directory error.
if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Daedalic Entertainment GmbH/Barotrauma" ]; then if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Daedalic Entertainment GmbH/Barotrauma" ]; then

2
lgsm/modules/fix_rust.sh

@ -11,7 +11,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/RustDedicated_Data/Plugins/x86_64" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/RustDedicated_Data/Plugins/x86_64"
# Part of random seed feature. # Part of random seed feature.
# If seed is not defined by user generate a seed file. # If the seed is not defined by the user, generate a seed file.
if [ -z "${seed}" ] || [ "${seed}" == "0" ]; then if [ -z "${seed}" ] || [ "${seed}" == "0" ]; then
if [ ! -f "${datadir}/${selfname}-seed.txt" ]; then if [ ! -f "${datadir}/${selfname}-seed.txt" ]; then
shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt" shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt"

9
lgsm/modules/info_distro.sh

@ -188,13 +188,10 @@ if [ "$(command -v numfmt 2> /dev/null)" ]; then
else else
# Older distros will need to use free. # Older distros will need to use free.
# Older versions of free do not support -h option. # Older versions of free do not support -h option.
if [ "$( if free -h > /dev/null 2>&1; then
free -h > /dev/null 2>&1
echo $?
)" -ne "0" ]; then
humanreadable="-m"
else
humanreadable="-h" humanreadable="-h"
else
humanreadable="-m"
fi fi
physmemtotalmb="$(free -m | awk '/Mem:/ {print $2}')" # integer physmemtotalmb="$(free -m | awk '/Mem:/ {print $2}')" # integer
physmemtotalgb="$(free -m | awk '/Mem:/ {print $2}')" # integer physmemtotalgb="$(free -m | awk '/Mem:/ {print $2}')" # integer

12
lgsm/modules/info_game.sh

@ -673,7 +673,7 @@ fn_info_game_st() {
saveinterval="${saveinterval:-"0"}" saveinterval="${saveinterval:-"0"}"
servername="${servername:-"NOT SET"}" servername="${servername:-"NOT SET"}"
serverpassword="${serverpassword:-"NOT SET"}" serverpassword="${serverpassword:-"NOT SET"}"
worldname="${worldname:-"NOT SET"}" worldsave="${worldsave:-"NOT SET"}"
worldtype="${worldtype:-"NOT SET"}" worldtype="${worldtype:-"NOT SET"}"
} }
@ -936,6 +936,8 @@ fn_info_game_armar() {
fn_info_game_json "queryport" ".a2s.port" fn_info_game_json "queryport" ".a2s.port"
fn_info_game_json "servername" ".game.name" fn_info_game_json "servername" ".game.name"
fn_info_game_json "serverpassword" ".game.password" fn_info_game_json "serverpassword" ".game.password"
fn_info_game_json "rconpassword" ".rcon.password"
fn_info_game_json "rconport" ".rcon.port"
fi fi
adminpassword="${adminpassword:-"NOT SET"}" adminpassword="${adminpassword:-"NOT SET"}"
battleeyeport="$((port + 4))" battleeyeport="$((port + 4))"
@ -957,13 +959,14 @@ fn_info_game_bf1942() {
fn_info_game_keyvalue_pairs_space "configip" "game.serverIP" fn_info_game_keyvalue_pairs_space "configip" "game.serverIP"
fn_info_game_keyvalue_pairs_space "maxplayers" "game.serverMaxPlayers" fn_info_game_keyvalue_pairs_space "maxplayers" "game.serverMaxPlayers"
fn_info_game_keyvalue_pairs_space "port" "game.serverPort" fn_info_game_keyvalue_pairs_space "port" "game.serverPort"
fn_info_game_keyvalue_pairs_space "queryport" "game.gameSpyPort"
fn_info_game_keyvalue_pairs_space "servername" "game.serverName" fn_info_game_keyvalue_pairs_space "servername" "game.serverName"
fn_info_game_keyvalue_pairs_space "serverpassword" "game.serverPassword" fn_info_game_keyvalue_pairs_space "serverpassword" "game.serverPassword"
fi fi
configip="${configip:-"0.0.0.0"}" configip="${configip:-"0.0.0.0"}"
maxplayers="${maxplayers:-"0"}" maxplayers="${maxplayers:-"0"}"
port="${port:-"0"}" port="${port:-"0"}"
queryport="22000" queryport="${queryport:-"0"}"
servername="${servername:-"NOT SET"}" servername="${servername:-"NOT SET"}"
serverpassword="${serverpassword:-"NOT SET"}" serverpassword="${serverpassword:-"NOT SET"}"
} }
@ -980,11 +983,12 @@ fn_info_game_bfv() {
fn_info_game_keyvalue_pairs_space "port" "game.serverPort" fn_info_game_keyvalue_pairs_space "port" "game.serverPort"
fn_info_game_keyvalue_pairs_space "servername" "game.serverName" fn_info_game_keyvalue_pairs_space "servername" "game.serverName"
fn_info_game_keyvalue_pairs_space "serverpassword" "game.serverPassword" fn_info_game_keyvalue_pairs_space "serverpassword" "game.serverPassword"
fn_info_game_keyvalue_pairs_space "queryport" "game.gameSpyPort"
fi fi
configip="${configip:-"0.0.0.0"}" configip="${configip:-"0.0.0.0"}"
maxplayers="${maxplayers:-"0"}" maxplayers="${maxplayers:-"0"}"
port="${port:-"0"}" port="${port:-"0"}"
queryport="22000" queryport="${queryport:-"0"}"
servername="${servername:-"NOT SET"}" servername="${servername:-"NOT SET"}"
serverpassword="${serverpassword:-"NOT SET"}" serverpassword="${serverpassword:-"NOT SET"}"
} }
@ -2402,7 +2406,7 @@ elif [ "${shortname}" == "pc" ]; then
fn_info_game_pc fn_info_game_pc
elif [ "${shortname}" == "pc2" ]; then elif [ "${shortname}" == "pc2" ]; then
fn_info_game_pc2 fn_info_game_pc2
elif [ "${shortname}" == "ps" ]; then elif [ "${shortname}" == "squad44" ]; then
fn_info_game_ps fn_info_game_ps
elif [ "${shortname}" == "pvr" ]; then elif [ "${shortname}" == "pvr" ]; then
fn_info_game_pvr fn_info_game_pvr

80
lgsm/modules/info_messages.sh

@ -7,6 +7,29 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Converts querytype to imgsoquerytype for use with ismygameserver.online urls
if [ -n "${querytype}" ]; then
if [ "${querytype}" == "protocol-valve" ]; then
imgsoquerytype="valve"
elif [ "${querytype}" == "protocol-gamespy1" ]; then
imgsoquerytype="gamespy"
elif [ "${querytype}" == "protocol-gamespy2" ]; then
imgsoquerytype="gamespy"
elif [ "${querytype}" == "protocol-gamespy3" ]; then
imgsoquerytype="gamespy"
elif [ "${querytype}" == "protocol-quake1" ]; then
imgsoquerytype="quake"
elif [ "${querytype}" == "protocol-quake2" ]; then
imgsoquerytype="quake"
elif [ "${querytype}" == "protocol-quake3" ]; then
imgsoquerytype="quake"
elif [ "${querytype}" == "protocol-unreal2" ]; then
imgsoquerytype="unrealtournament2004"
else
imgsoquerytype="${querytype}"
fi
fi
# Removes the passwords form all but details. # Removes the passwords form all but details.
fn_info_messages_password_strip() { fn_info_messages_password_strip() {
if [ "${commandname}" != "DETAILS" ]; then if [ "${commandname}" != "DETAILS" ]; then
@ -66,6 +89,11 @@ fn_info_messages_head() {
echo -e "Hostname" echo -e "Hostname"
echo -e "${HOSTNAME}" echo -e "${HOSTNAME}"
echo -e "" echo -e ""
if [ -n "${querytype}" ]; then
echo -e "Is my Game Server Online?"
echo -e "https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}"
echo -e ""
fi
echo -e "Server Time" echo -e "Server Time"
echo -e "$(date)" echo -e "$(date)"
} }
@ -132,7 +160,7 @@ fn_info_messages_server_resource() {
echo -e "${bold}${lightyellow}Server Resource${default}" echo -e "${bold}${lightyellow}Server Resource${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${lightyellow}CPU\t${default}" echo -e "${bold}${lightyellow}CPU\t${default}"
echo -e "${lightblue}Model:\t${default}${cpumodel}" echo -e "${lightblue}Model:\t${default}${cpumodel}"
echo -e "${lightblue}Cores:\t${default}${cpucores}" echo -e "${lightblue}Cores:\t${default}${cpucores}"
echo -e "${lightblue}Frequency:\t${default}${cpufreqency}MHz" echo -e "${lightblue}Frequency:\t${default}${cpufreqency}MHz"
@ -140,14 +168,14 @@ fn_info_messages_server_resource() {
} | column -s $'\t' -t } | column -s $'\t' -t
echo -e "" echo -e ""
{ {
echo -e "${lightyellow}Memory\t${default}" echo -e "${bold}${lightyellow}Memory\t${default}"
echo -e "${lightblue}Mem:\t${lightblue}total\tused\tfree\tcached\tavailable${default}" echo -e "${lightblue}Mem:\t${lightblue}total\tused\tfree\tcached\tavailable${default}"
echo -e "${lightblue}Physical:\t${default}${physmemtotal}\t${physmemused}\t${physmemfree}\t${physmemcached}\t${physmemavailable}${default}" echo -e "${lightblue}Physical:\t${default}${physmemtotal}\t${physmemused}\t${physmemfree}\t${physmemcached}\t${physmemavailable}${default}"
echo -e "${lightblue}Swap:\t${default}${swaptotal}\t${swapused}\t${swapfree}${default}" echo -e "${lightblue}Swap:\t${default}${swaptotal}\t${swapused}\t${swapfree}${default}"
} | column -s $'\t' -t } | column -s $'\t' -t
echo -e "" echo -e ""
{ {
echo -e "${lightyellow}Storage${default}" echo -e "${bold}${lightyellow}Storage${default}"
echo -e "${lightblue}Filesystem:\t${default}${filesystem}" echo -e "${lightblue}Filesystem:\t${default}${filesystem}"
echo -e "${lightblue}Total:\t${default}${totalspace}" echo -e "${lightblue}Total:\t${default}${totalspace}"
echo -e "${lightblue}Used:\t${default}${usedspace}" echo -e "${lightblue}Used:\t${default}${usedspace}"
@ -155,7 +183,7 @@ fn_info_messages_server_resource() {
} | column -s $'\t' -t } | column -s $'\t' -t
echo -e "" echo -e ""
{ {
echo -e "${lightyellow}Network${default}" echo -e "${bold}${lightyellow}Network${default}"
if [ -n "${netint}" ]; then if [ -n "${netint}" ]; then
echo -e "${lightblue}Interface:\t${default}${netint}" echo -e "${lightblue}Interface:\t${default}${netint}"
fi fi
@ -203,7 +231,7 @@ fn_info_messages_gameserver_resource() {
} | column -s $'\t' -t } | column -s $'\t' -t
echo -e "" echo -e ""
{ {
echo -e "${lightyellow}Storage${default}" echo -e "${bold}${lightyellow}Storage${default}"
echo -e "${lightblue}Total:\t${default}${rootdirdu}" echo -e "${lightblue}Total:\t${default}${rootdirdu}"
echo -e "${lightblue}Serverfiles:\t${default}${serverfilesdu}" echo -e "${lightblue}Serverfiles:\t${default}${serverfilesdu}"
if [ -d "${backupdir}" ]; then if [ -d "${backupdir}" ]; then
@ -292,7 +320,7 @@ fn_info_messages_gameserver() {
echo -e "${lightblue}Server password:\t${default}${serverpassword}" echo -e "${lightblue}Server password:\t${default}${serverpassword}"
fi fi
# Query enabled (Starbound) # Query enabled (Starbound, Minecraft)
if [ -n "${queryenabled}" ]; then if [ -n "${queryenabled}" ]; then
echo -e "${lightblue}Query enabled:\t${default}${queryenabled}" echo -e "${lightblue}Query enabled:\t${default}${queryenabled}"
fi fi
@ -503,6 +531,11 @@ fn_info_messages_gameserver() {
else else
echo -e "${lightblue}Status:\t${green}STARTED${default}" echo -e "${lightblue}Status:\t${green}STARTED${default}"
fi fi
# ismygameserver.online
if [ -n "${querytype}" ]; then
echo -e "${lightblue}Query Check:\t${default}https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}"
fi
} | column -s $'\t' -t } | column -s $'\t' -t
echo -e "" echo -e ""
} }
@ -553,23 +586,39 @@ fn_info_messages_script() {
fi fi
# Discord alert # Discord alert
echo -e "${lightblue}Discord alert:\t${default}${discordalert}" if [ "${discordalert}" == "on" ]; then
echo -e "${lightblue}Discord alert:\t${default}${discordalert}"
fi
# Email alert # Email alert
echo -e "${lightblue}Email alert:\t${default}${emailalert}" if [ "${emailalert}" == "on" ]; then
echo -e "${lightblue}Email alert:\t${default}${emailalert}"
fi
# Gotify alert # Gotify alert
echo -e "${lightblue}Gotify alert:\t${default}${gotifyalert}" if [ "${gotifyalert}" == "on" ]; then
echo -e "${lightblue}Gotify alert:\t${default}${gotifyalert}"
fi
# IFTTT alert # IFTTT alert
echo -e "${lightblue}IFTTT alert:\t${default}${iftttalert}" echo -e "${lightblue}IFTTT alert:\t${default}${iftttalert}"
# Pushbullet alert # Pushbullet alert
echo -e "${lightblue}Pushbullet alert:\t${default}${pushbulletalert}" if [ "${pushbulletalert}" == "on" ]; then
echo -e "${lightblue}Pushbullet alert:\t${default}${pushbulletalert}"
fi
# Pushover alert # Pushover alert
echo -e "${lightblue}Pushover alert:\t${default}${pushoveralert}" if [ "${pushoveralert}" == "on" ]; then
echo -e "${lightblue}Pushover alert:\t${default}${pushoveralert}"
fi
# Rocketchat alert # Rocketchat alert
echo -e "${lightblue}Rocketchat alert:\t${default}${rocketchatalert}" if [ "${rocketchatalert}" == "on" ]; then
echo -e "${lightblue}Rocketchat alert:\t${default}${rocketchatalert}"
fi
# Slack alert # Slack alert
echo -e "${lightblue}Slack alert:\t${default}${slackalert}" if [ "${slackalert}" == "on" ]; then
echo -e "${lightblue}Slack alert:\t${default}${slackalert}"
fi
# Telegram alert # Telegram alert
echo -e "${lightblue}Telegram alert:\t${default}${telegramalert}" if [ "${telegramalert}" == "on" ]; then
echo -e "${lightblue}Telegram alert:\t${default}${telegramalert}"
fi
# Update on start # Update on start
if [ -n "${updateonstart}" ]; then if [ -n "${updateonstart}" ]; then
@ -1461,6 +1510,7 @@ fn_info_messages_sm() {
{ {
fn_port "header" fn_port "header"
fn_port "Game" port udp fn_port "Game" port udp
fn_port "Game" port tcp
fn_port "Query" queryport udp fn_port "Query" queryport udp
fn_port "Telnet" telnetport tcp fn_port "Telnet" telnetport tcp
} | column -s $'\t' -t } | column -s $'\t' -t
@ -1841,7 +1891,7 @@ fn_info_messages_select_engine() {
fn_info_messages_pc fn_info_messages_pc
elif [ "${shortname}" == "pc2" ]; then elif [ "${shortname}" == "pc2" ]; then
fn_info_messages_pc2 fn_info_messages_pc2
elif [ "${shortname}" == "ps" ]; then elif [ "${shortname}" == "squad44" ]; then
fn_info_messages_ps fn_info_messages_ps
elif [ "${shortname}" == "pvr" ]; then elif [ "${shortname}" == "pvr" ]; then
fn_info_messages_pvr fn_info_messages_pvr

15
lgsm/modules/install_complete.sh

@ -8,25 +8,24 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
echo -e "" echo -e ""
fn_messages_separator
if [ "${exitcode}" == "1" ]; then if [ "${exitcode}" -eq 1 ]; then
echo -e "${bold}${red}Install Failed!${default}" echo -e "${bold}${red}Install Failed!${default}"
fn_script_log_fail "Install Failed!" fn_script_log_fail "Install Failed!"
elif [ "${exitcode}" == "2" ]; then elif [ "${exitcode}" -eq 2 ]; then
echo -e "${bold}${red}Install Completed with Errors!${default}}" echo -e "${bold}${red}Install Completed with Errors!${default}}"
fn_script_log_error "Install Completed with Errors!" fn_script_log_error "Install Completed with Errors!"
elif [ "${exitcode}" == "3" ]; then elif [ "${exitcode}" -eq 3 ]; then
echo -e "${bold}${lightyellow}Install Completed with Warnings!${default}}" echo -e "${bold}${lightyellow}Install Completed with Warnings!${default}}"
fn_script_log_warn "Install Completed with Warnings!" fn_script_log_warn "Install Completed with Warnings!"
elif [ -z "${exitcode}" ] || [ "${exitcode}" == "0" ]; then elif [ -z "${exitcode}" ] || [ "${exitcode}" -eq 0 ]; then
echo -e "${bold}${green}Install Complete!${default}" echo -e "${bold}${green}Install Complete!${default}"
fn_script_log_pass "Install Complete!" fn_script_log_pass "Install Complete!"
fi fi
fn_messages_separator
fn_script_log_info "Install Complete!"
echo -e "" echo -e ""
echo -e "To start server type:" echo -e "To start the ${gamename} server type:"
echo -e "./${selfname} start" echo -e "${italic}./${selfname} start${default}"
echo -e "" echo -e ""
core_exit.sh core_exit.sh

260
lgsm/modules/install_config.sh

@ -16,43 +16,76 @@ fn_check_cfgdir() {
fi fi
} }
# Downloads default configs from Game-Server-Configs repo to lgsm/config-default. # Copys default configs from Game-Server-Configs repo to server config location.
fn_fetch_default_config() { fn_default_config_remote() {
echo -e "" echo -e ""
echo -e "${bold}${lightyellow}Downloading ${gamename} Configs${default}" echo -e "${bold}${lightyellow}Downloading ${gamename} Configs${default}"
fn_messages_separator fn_messages_separator
echo -e "Downloading default configs from:" echo -e "Downloading default configs from: ${italic}https://github.com/GameServerManagers/Game-Server-Configs${default}"
echo -e ""
echo -e "${italic}https://github.com/GameServerManagers/Game-Server-Configs${default}"
echo -e "" echo -e ""
fn_sleep_time_1 fn_sleep_time_1
mkdir -p "${lgsmdir}/config-default/config-game" mkdir -p "${lgsmdir}/config-default/config-game"
githuburl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/main" githuburl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/main"
for config in "${array_configs[@]}"; do for config in "${array_configs[@]}"; do
# Downloads default configs from Game-Server-Configs repo to lgsm/config-default.
fn_fetch_file "${githuburl}/${shortname}/${config}" "${remote_fileurl_backup}" "GitHub" "Bitbucket" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "forcedl" "nohash" fn_fetch_file "${githuburl}/${shortname}/${config}" "${remote_fileurl_backup}" "GitHub" "Bitbucket" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "forcedl" "nohash"
done
}
# Copys default configs from Game-Server-Configs repo to server config location. # Every config is copied.
fn_default_config_remote() {
for config in "${array_configs[@]}"; do
# every config is copied
echo -e "copying ${config} config file."
fn_script_log_info "Copying ${servercfg} config file."
if [ "${config}" == "${servercfgdefault}" ]; then if [ "${config}" == "${servercfgdefault}" ]; then
mkdir -p "${servercfgdir}" mkdir -p "${servercfgdir}"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}" echo -en "copying config file [ ${italic}${servercfgfullpath}${default} ]"
changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}")
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fail "copying config file ${servercfgfullpath}"
elif [ "${changes}" != "" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "copying config file ${servercfgfullpath}"
else
fn_print_skip_eol_nl
fi
elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then
mkdir -p "${servercfgdir}" mkdir -p "${servercfgdir}"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}" echo -en "copying config file [ ${italic}${networkcfgfullpath}${default} ]"
changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}")
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fail "copying config file ${networkcfgdefault}"
elif [ "${changes}" != "" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "copying config file ${networkcfgdefault}"
else
fn_print_skip_eol_nl
fi
elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then
cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}" echo -en "copying config file [ ${italic}${clustercfgfullpath}${default} ]"
changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}")
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fail "copying config file ${clustercfgfullpath}"
elif [ "${changes}" != "" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "copying config file ${clustercfgfullpath}"
else
fn_print_skip_eol_nl
fi
else else
mkdir -p "${servercfgdir}" echo -en "copying config file [ ${italic}${servercfgdir}/${config}${default} ]"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}" changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}")
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fail "copying config file ${servercfgdir}/${config}"
elif [ "${changes}" != "" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "copying config file ${servercfgdir}/${config}"
else
fn_print_skip_eol_nl
fi
fi fi
unset changes
done done
fn_sleep_time
} }
# Copys local default config to server config location. # Copys local default config to server config location.
@ -71,7 +104,7 @@ fn_default_config_local() {
echo -en "copying config file [ ${italic}${servercfgdefault}${default} ]: " echo -en "copying config file [ ${italic}${servercfgdefault}${default} ]: "
cp --update=none "${servercfgdir}/${servercfgdefault}" "${servercfgfullpath}" cp --update=none "${servercfgdir}/${servercfgdefault}" "${servercfgfullpath}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol fn_print_fail_eol
fn_script_log_fail "copying config file [ ${servercfgdefault} ]: " fn_script_log_fail "copying config file [ ${servercfgdefault} ]: "
else else
@ -87,30 +120,48 @@ fn_set_config_vars() {
if [ -f "${servercfgfullpath}" ]; then if [ -f "${servercfgfullpath}" ]; then
randomstring=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2> /dev/null | head -c 8 | xargs) randomstring=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2> /dev/null | head -c 8 | xargs)
servername="LinuxGSM" servername="LinuxGSM"
rconpass="admin${randomstring}" adminpass="admin${randomstring}"
echo -e "changing hostname." echo -en "setting hostname\c"
fn_script_log_info "Changing hostname." fn_script_log_info "setting hostname"
fn_sleep_time fn_sleep_time
# prevents var from being overwritten with the servername. # prevents var from being overwritten with the servername.
if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then
sed -i "s/SERVERNAME=SERVERNAME/SERVERNAME=${servername}/g" "${servercfgfullpath}" changes+=$(sed -i "s/SERVERNAME=SERVERNAME/SERVERNAME=${servername}/g w /dev/stdout" "${servercfgfullpath}")
elif grep -q "SERVERNAME=\"SERVERNAME\"" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then elif grep -q "SERVERNAME=\"SERVERNAME\"" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then
sed -i "s/SERVERNAME=\"SERVERNAME\"/SERVERNAME=\"${servername}\"/g" "${servercfgfullpath}" changes+=$(sed -i "s/SERVERNAME=\"SERVERNAME\"/SERVERNAME=\"${servername}\"/g w /dev/stdout" "${servercfgfullpath}")
else else
sed -i "s/SERVERNAME/${servername}/g" "${servercfgfullpath}" changes+=$(sed -i "s/SERVERNAME/${servername}/g w /dev/stdout" "${servercfgfullpath}")
fi fi
echo -e "changing rcon/admin password." exitcode=$?
fn_script_log_info "Changing rcon/admin password." if [ "${exitcode}" -ne 0 ]; then
if [ "${shortname}" == "squad" ]; then fn_print_fail_eol
sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgdir}/Rcon.cfg" fn_script_log_fail "setting hostname"
elif [ "${changes}" != "" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "setting hostname"
else else
sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}" fn_print_skip_eol_nl
fi fi
echo -en "generating admin/rcon password\c"
fn_script_log_info "generating admin/rcon password"
fn_sleep_time fn_sleep_time
else if [ "${shortname}" == "squad" ]; then
fn_script_log_warn "Config file not found, cannot alter it." changes+=$(sed -i "s/ADMINPASSWORD/${adminpass}/g w /dev/stdout" "${servercfgdir}/Rcon.cfg")
echo -e "Config file not found, cannot alter it." else
fn_sleep_time changes+=$(sed -i "s/ADMINPASSWORD/${adminpass}/g w /dev/stdout" "${servercfgfullpath}")
fi
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol
fn_script_log_fail "generating admin/rcon password"
elif [ "${changes}" != "" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "generating admin/rcon password"
else
fn_print_skip_eol_nl
fi
unset changes
fi fi
} }
@ -164,22 +215,22 @@ fn_set_dst_config_vars() {
echo -e "" echo -e ""
} }
# Lists local config file locations # Lists local config locations
fn_list_config_locations() { fn_list_config_locations() {
echo -e "" echo -e ""
echo -e "${bold}${lightyellow}Config Locations${default}" echo -e "${bold}${lightyellow}Config Locations${default}"
fn_messages_separator fn_messages_separator
if [ -n "${servercfgfullpath}" ]; then if [ -n "${servercfgfullpath}" ]; then
if [ -f "${servercfgfullpath}" ]; then if [ -f "${servercfgfullpath}" ]; then
echo -e "Game Server Config File: ${servercfgfullpath}" echo -e "${gamename} config file: ${italic}${servercfgfullpath}${default}"
elif [ -d "${servercfgfullpath}" ]; then elif [ -d "${servercfgfullpath}" ]; then
echo -e "Game Server Config Dir: ${servercfgfullpath}" echo -e "${gamename} config directory: ${italic}${servercfgfullpath}"
else else
echo -e "Config file: ${red}${servercfgfullpath}${default} (${red}FILE MISSING${default})" echo -e "${gamename} config: ${italic}${red}${servercfgfullpath}${default} (${red}CONFIG IS MISSING${default})"
fi fi
fi fi
echo -e "LinuxGSM Config: ${lgsmdir}/config-lgsm/${gameservername}" echo -e "LinuxGSM config: ${italic}${lgsmdir}/config-lgsm/${gameservername}${default}"
echo -e "Documentation: https://docs.linuxgsm.com/configuration/game-server-config" echo -e "Config documentation: ${italic}https://docs.linuxgsm.com/configuration${default}"
} }
if [ "${shortname}" == "sdtd" ]; then if [ "${shortname}" == "sdtd" ]; then
@ -187,66 +238,51 @@ if [ "${shortname}" == "sdtd" ]; then
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ac" ]; then elif [ "${shortname}" == "ac" ]; then
array_configs+=(server_cfg.ini) array_configs+=(server_cfg.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ahl" ]; then elif [ "${shortname}" == "ahl" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ahl2" ]; then elif [ "${shortname}" == "ahl2" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ark" ]; then elif [ "${shortname}" == "ark" ]; then
fn_check_cfgdir
array_configs+=(GameUserSettings.ini) array_configs+=(GameUserSettings.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "arma3" ]; then elif [ "${shortname}" == "arma3" ]; then
fn_check_cfgdir
array_configs+=(server.cfg network.cfg) array_configs+=(server.cfg network.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "armar" ]; then elif [ "${shortname}" == "armar" ]; then
fn_check_cfgdir
array_configs+=(server.json) array_configs+=(server.json)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ats" ]; then elif [ "${shortname}" == "ats" ]; then
fn_check_cfgdir
array_configs+=(server_config.sii) array_configs+=(server_config.sii)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bo" ]; then elif [ "${shortname}" == "bo" ]; then
array_configs+=(config.txt) array_configs+=(config.txt)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bd" ]; then elif [ "${shortname}" == "bd" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bt" ]; then elif [ "${shortname}" == "bt" ]; then
fn_check_cfgdir
array_configs+=(serversettings.xml) array_configs+=(serversettings.xml)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -259,91 +295,76 @@ elif [ "${shortname}" == "btl" ]; then
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bf1942" ]; then elif [ "${shortname}" == "bf1942" ]; then
array_configs+=(serversettings.con) array_configs+=(serversettings.con)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bfv" ]; then elif [ "${shortname}" == "bfv" ]; then
array_configs+=(serversettings.con) array_configs+=(serversettings.con)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bs" ]; then elif [ "${shortname}" == "bs" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bb" ]; then elif [ "${shortname}" == "bb" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bb2" ]; then elif [ "${shortname}" == "bb2" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bmdm" ]; then elif [ "${shortname}" == "bmdm" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ck" ]; then elif [ "${shortname}" == "ck" ]; then
array_configs+=(ServerConfig.json) array_configs+=(ServerConfig.json)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "cod" ]; then elif [ "${shortname}" == "cod" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "coduo" ]; then elif [ "${shortname}" == "coduo" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "cod2" ]; then elif [ "${shortname}" == "cod2" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "cod4" ]; then elif [ "${shortname}" == "cod4" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "codwaw" ]; then elif [ "${shortname}" == "codwaw" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "cc" ]; then elif [ "${shortname}" == "cc" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "col" ]; then elif [ "${shortname}" == "col" ]; then
array_configs+=(colserver.json) array_configs+=(colserver.json)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "cs" ]; then elif [ "${shortname}" == "cs" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -355,86 +376,70 @@ elif [ "${shortname}" == "cs2" ]; then
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "cscz" ]; then elif [ "${shortname}" == "cscz" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "csgo" ]; then elif [ "${shortname}" == "csgo" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "css" ]; then elif [ "${shortname}" == "css" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ct" ]; then elif [ "${shortname}" == "ct" ]; then
array_configs+=(ServerSetting.ini) array_configs+=(ServerSetting.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dayz" ]; then elif [ "${shortname}" == "dayz" ]; then
fn_check_cfgdir
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dod" ]; then elif [ "${shortname}" == "dod" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dodr" ]; then elif [ "${shortname}" == "dodr" ]; then
array_configs+=(Game.ini) array_configs+=(Game.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dods" ]; then elif [ "${shortname}" == "dods" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "doi" ]; then elif [ "${shortname}" == "doi" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dmc" ]; then elif [ "${shortname}" == "dmc" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dst" ]; then elif [ "${shortname}" == "dst" ]; then
fn_check_cfgdir
array_configs+=(cluster.ini server.ini) array_configs+=(cluster.ini server.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_dst_config_vars fn_set_dst_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dab" ]; then elif [ "${shortname}" == "dab" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dys" ]; then elif [ "${shortname}" == "dys" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "eco" ]; then elif [ "${shortname}" == "eco" ]; then
array_configs+=(Network.eco) array_configs+=(Network.eco)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -443,44 +448,36 @@ elif [ "${shortname}" == "em" ]; then
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "etl" ]; then elif [ "${shortname}" == "etl" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ets2" ]; then elif [ "${shortname}" == "ets2" ]; then
fn_check_cfgdir
array_configs+=(server_config.sii) array_configs+=(server_config.sii)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "fctr" ]; then elif [ "${shortname}" == "fctr" ]; then
array_configs+=(server-settings.json) array_configs+=(server-settings.json)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "fof" ]; then elif [ "${shortname}" == "fof" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "gmod" ]; then elif [ "${shortname}" == "gmod" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "hldm" ]; then elif [ "${shortname}" == "hldm" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "hldms" ]; then elif [ "${shortname}" == "hldms" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -492,13 +489,11 @@ elif [ "${shortname}" == "ohd" ]; then
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "opfor" ]; then elif [ "${shortname}" == "opfor" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "hl2dm" ]; then elif [ "${shortname}" == "hl2dm" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -507,104 +502,84 @@ elif [ "${shortname}" == "hz" ]; then
: :
elif [ "${shortname}" == "ins" ]; then elif [ "${shortname}" == "ins" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ios" ]; then elif [ "${shortname}" == "ios" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "jc2" ]; then elif [ "${shortname}" == "jc2" ]; then
array_configs+=(config.lua) array_configs+=(config.lua)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "jc3" ]; then elif [ "${shortname}" == "jc3" ]; then
array_configs+=(config.json) array_configs+=(config.json)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "kf" ]; then elif [ "${shortname}" == "kf" ]; then
array_configs+=(Default.ini) array_configs+=(Default.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "l4d" ]; then elif [ "${shortname}" == "l4d" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "l4d2" ]; then elif [ "${shortname}" == "l4d2" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then
array_configs+=(server.properties) array_configs+=(server.properties)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "mcb" ]; then elif [ "${shortname}" == "mcb" ]; then
array_configs+=(server.properties) array_configs+=(server.properties)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "mohaa" ]; then elif [ "${shortname}" == "mohaa" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "mh" ]; then elif [ "${shortname}" == "mh" ]; then
fn_check_cfgdir
array_configs+=(Game.ini) array_configs+=(Game.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ns" ]; then elif [ "${shortname}" == "ns" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "nmrih" ]; then elif [ "${shortname}" == "nmrih" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "nd" ]; then elif [ "${shortname}" == "nd" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "mta" ]; then elif [ "${shortname}" == "mta" ]; then
fn_check_cfgdir
array_configs+=(acl.xml mtaserver.conf vehiclecolors.conf) array_configs+=(acl.xml mtaserver.conf vehiclecolors.conf)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "pvr" ]; then elif [ "${shortname}" == "pvr" ]; then
fn_check_cfgdir
array_configs+=(Game.ini) array_configs+=(Game.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
elif [ "${shortname}" == "pvkii" ]; then elif [ "${shortname}" == "pvkii" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -615,22 +590,17 @@ elif [ "${shortname}" == "pw" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "pz" ]; then elif [ "${shortname}" == "pz" ]; then
fn_check_cfgdir
array_configs+=(server.ini) array_configs+=(server.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "nec" ]; then elif [ "${shortname}" == "nec" ]; then
fn_check_cfgdir
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "pc" ]; then elif [ "${shortname}" == "pc" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -639,13 +609,12 @@ elif [ "${shortname}" == "pc2" ]; then
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "q2" ]; then elif [ "${shortname}" == "q2" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "q3" ]; then elif [ "${shortname}" == "q3" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_configs fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -657,159 +626,133 @@ elif [ "${shortname}" == "q4" ]; then
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ql" ]; then elif [ "${shortname}" == "ql" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "jk2" ]; then elif [ "${shortname}" == "jk2" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
elif [ "${shortname}" == "qw" ]; then elif [ "${shortname}" == "qw" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ricochet" ]; then elif [ "${shortname}" == "ricochet" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "rtcw" ]; then elif [ "${shortname}" == "rtcw" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "rust" ]; then elif [ "${shortname}" == "rust" ]; then
fn_check_cfgdir
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "scpsl" ] || [ "${shortname}" == "scpslsm" ]; then elif [ "${shortname}" == "scpsl" ] || [ "${shortname}" == "scpslsm" ]; then
array_configs+=(config_gameplay.txt config_localadmin.txt) array_configs+=(config_gameplay.txt config_localadmin.txt)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "sf" ]; then elif [ "${shortname}" == "sf" ]; then
array_configs+=(GameUserSettings.ini) array_configs+=(GameUserSettings.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "sm" ]; then
fn_default_config_local
fn_list_config_locations
elif [ "${shortname}" == "sol" ]; then elif [ "${shortname}" == "sol" ]; then
array_configs+=(soldat.ini) array_configs+=(soldat.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "sof2" ]; then elif [ "${shortname}" == "sof2" ]; then
array_configs+=(server.cfg mapcycle.txt) array_configs+=(server.cfg mapcycle.txt)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "sfc" ]; then elif [ "${shortname}" == "sfc" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "squad" ]; then elif [ "${shortname}" == "squad" ]; then
array_configs+=(Admins.cfg Bans.cfg License.cfg Server.cfg Rcon.cfg) array_configs+=(Admins.cfg Bans.cfg License.cfg Server.cfg Rcon.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "sb" ]; then elif [ "${shortname}" == "sb" ]; then
array_configs+=(starbound_server.config) array_configs+=(starbound_server.config)
fn_fetch_default_config fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "st" ]; then
array_configs+=(setting.xml)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "stn" ]; then elif [ "${shortname}" == "stn" ]; then
array_configs+=(ServerConfig.txt ServerUsers.txt TpPresets.json UserPermissions.json) array_configs+=(ServerConfig.txt ServerUsers.txt TpPresets.json UserPermissions.json)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "sven" ]; then elif [ "${shortname}" == "sven" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "tf2" ]; then elif [ "${shortname}" == "tf2" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "tfc" ]; then elif [ "${shortname}" == "tfc" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ti" ]; then elif [ "${shortname}" == "ti" ]; then
array_configs+=(Game.ini Engine.ini) array_configs+=(Game.ini Engine.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ts" ]; then elif [ "${shortname}" == "ts" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ts3" ]; then elif [ "${shortname}" == "ts3" ]; then
array_configs+=(ts3server.ini) array_configs+=(ts3server.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "tw" ]; then elif [ "${shortname}" == "tw" ]; then
array_configs+=(server.cfg ctf.cfg dm.cfg duel.cfg tdm.cfg) array_configs+=(server.cfg ctf.cfg dm.cfg duel.cfg tdm.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "terraria" ]; then elif [ "${shortname}" == "terraria" ]; then
array_configs+=(serverconfig.txt) array_configs+=(serverconfig.txt)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "tu" ]; then elif [ "${shortname}" == "tu" ]; then
fn_check_cfgdir
array_configs+=(TowerServer.ini) array_configs+=(TowerServer.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ut" ]; then elif [ "${shortname}" == "ut" ]; then
array_configs+=(Game.ini Engine.ini) array_configs+=(Game.ini Engine.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ut2k4" ]; then elif [ "${shortname}" == "ut2k4" ]; then
array_configs+=(UT2004.ini) array_configs+=(UT2004.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ut99" ]; then elif [ "${shortname}" == "ut99" ]; then
array_configs+=(Default.ini) array_configs+=(Default.ini)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -821,25 +764,21 @@ elif [ "${shortname}" == "vints" ]; then
: :
elif [ "${shortname}" == "vs" ]; then elif [ "${shortname}" == "vs" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "wet" ]; then elif [ "${shortname}" == "wet" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "wf" ]; then elif [ "${shortname}" == "wf" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "wmc" ]; then elif [ "${shortname}" == "wmc" ]; then
array_configs+=(config.yml) array_configs+=(config.yml)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
@ -851,19 +790,16 @@ elif [ "${shortname}" == "xnt" ]; then
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "wurm" ]; then elif [ "${shortname}" == "wurm" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "zmr" ]; then elif [ "${shortname}" == "zmr" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "zps" ]; then elif [ "${shortname}" == "zps" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations

2
lgsm/modules/install_dst_token.sh

@ -12,7 +12,7 @@ echo -e "${bold}${lightyellow}Enter ${gamename} Cluster Token${default}"
fn_messages_separator fn_messages_separator
echo -e "A cluster token is required to run this server!" echo -e "A cluster token is required to run this server!"
echo -e "Follow the instructions in this link to obtain this key:" echo -e "Follow the instructions in this link to obtain this key:"
echo -e "https://linuxgsm.com/dst-auth-token" echo -e "${italic}https://linuxgsm.com/dst-auth-token"
echo -e "" echo -e ""
if [ -z "${autoinstall}" ]; then if [ -z "${autoinstall}" ]; then
overwritetoken="true" overwritetoken="true"

4
lgsm/modules/install_eula.sh

@ -19,11 +19,11 @@ echo -e ""
echo -e "${bold}${lightyellow}Accept ${gamename} EULA${default}" echo -e "${bold}${lightyellow}Accept ${gamename} EULA${default}"
fn_messages_separator fn_messages_separator
echo -e "You are required to accept the EULA:" echo -e "You are required to accept the EULA:"
echo -e "${eulaurl}" echo -e ""
echo -e "${italic}${eulaurl}${default}"
echo -e "" echo -e ""
if [ -z "${autoinstall}" ]; then if [ -z "${autoinstall}" ]; then
echo -e "By continuing you are indicating your agreement to the EULA." echo -e "By continuing you are indicating your agreement to the EULA."
echo -e ""
if ! fn_prompt_yn "Continue?" Y; then if ! fn_prompt_yn "Continue?" Y; then
exitcode=0 exitcode=0
core_exit.sh core_exit.sh

20
lgsm/modules/install_gslt.sh

@ -11,17 +11,16 @@ echo -e ""
echo -e "${bold}${lightyellow}Game Server Login Token${default}" echo -e "${bold}${lightyellow}Game Server Login Token${default}"
fn_messages_separator fn_messages_separator
if [ "${shortname}" == "csgo" ] || [ "${shortname}" == "css" ] || [ "${shortname}" == "nmrih" ] || [ "${shortname}" == "bs" ]; then if [ "${shortname}" == "csgo" ] || [ "${shortname}" == "css" ] || [ "${shortname}" == "nmrih" ] || [ "${shortname}" == "bs" ]; then
echo -e "GSLT is required to run a public ${gamename} server" echo -e "GSLT is required to run a public ${gamename} server."
fn_script_log_info "GSLT is required to run a public ${gamename} server" fn_script_log_info "GSLT is required to run a public ${gamename} server"
else else
echo -e "GSLT is an optional feature for ${gamename} server" echo -e "GSLT is an optional feature for ${gamename} server."
fn_script_log_info "GSLT is an optional feature for ${gamename} server" fn_script_log_info "GSLT is an optional feature for ${gamename} server"
fi fi
echo -e "Get more info and a token here:" echo -e ""
echo -e "https://docs.linuxgsm.com/steamcmd/gslt" echo -e "More info: ${italic}https://docs.linuxgsm.com/steamcmd/gslt${default}"
fn_script_log_info "Get more info and a token here:" fn_script_log_info "More info: https://docs.linuxgsm.com/steamcmd/gslt"
fn_script_log_info "https://docs.linuxgsm.com/steamcmd/gslt"
echo -e "" echo -e ""
if [ -z "${autoinstall}" ]; then if [ -z "${autoinstall}" ]; then
if [ "${shortname}" != "tu" ]; then if [ "${shortname}" != "tu" ]; then
@ -37,11 +36,10 @@ if [ -z "${autoinstall}" ]; then
fi fi
if [ "${shortname}" == "tu" ]; then if [ "${shortname}" == "tu" ]; then
echo -e "The GSLT can be changed by editing ${servercfgdir}/${servercfg}." echo -e "The GSLT can be changed by editing: ${italic}${servercfgdir}/${servercfg}${default}"
fn_script_log_info "The GSLT can be changed by editing ${servercfgdir}/${servercfg}." fn_script_log_info "The GSLT can be changed by editing: ${servercfgdir}/${servercfg}."
else else
echo -e "The GSLT can be changed by editing ${configdirserver}/${selfname}.cfg." echo -e "The GSLT can be changed by editing: ${italic}${configdirserver}/${selfname}.cfg${default}"
fn_script_log_info "The GSLT can be changed by editing ${configdirserver}/${selfname}.cfg." fn_script_log_info "The GSLT can be changed by editing: ${configdirserver}/${selfname}.cfg."
fi fi
fn_sleep_time_1 fn_sleep_time_1
echo -e ""

98
lgsm/modules/install_logs.sh

@ -7,93 +7,117 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ "${checklogs}" != "1" ]; then if [ -z "${checklogs}" ]; then
echo -e "" echo -e ""
echo -e "${bold}${lightyellow}Creating Log Directories${default}" echo -e "${bold}${lightyellow}Creating Log Directories${default}"
fn_messages_separator fn_messages_separator
fi fi
# Create LinuxGSM logs.
echo -en "installing log dir: ${logdir}..."
mkdir -p "${logdir}"
if [ $? != 0 ]; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
echo -en "installing LinuxGSM log dir: ${lgsmlogdir}..." echo -en "creating log directory [ ${italic}${logdir}${default} ]"
mkdir -p "${lgsmlogdir}" if [ ! -d "${logdir}" ]; then
if [ $? != 0 ]; then if ! mkdir -p "${logdir}"; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
else
fn_print_ok_eol_nl
fi
else else
fn_print_ok_eol_nl fn_print_skip_eol_nl
fi fi
echo -en "creating LinuxGSM log: ${lgsmlog}..."
touch "${lgsmlog}" echo -en "creating script log directory [ ${italic}${lgsmlogdir}${default} ]"
if [ $? != 0 ]; then if [ ! -d "${lgsmlogdir}" ]; then
fn_print_fail_eol_nl if ! mkdir -p "${lgsmlogdir}"; then
core_exit.sh fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
else else
fn_print_ok_eol_nl fn_print_skip_eol_nl
fi fi
# Create Console logs.
if [ "${consolelogdir}" ]; then echo -en "creating script log [ ${italic}${lgsmlog}${default} ]"
echo -en "installing console log dir: ${consolelogdir}..." if [ ! -f "${lgsmlog}" ]; then
mkdir -p "${consolelogdir}" if ! touch "${lgsmlog}"; then
if [ $? != 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
echo -en "creating console log: ${consolelog}..." else
if ! touch "${consolelog}"; then fn_print_skip_eol_nl
fi
echo -en "creating console log directory [ ${italic}${consolelogdir}${default} ]"
if [ ! -d "${consolelogdir}" ]; then
if ! mkdir -p "${consolelogdir}"; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
else
fn_print_skip_eol_nl
fi fi
# Create Game logs. echo -en "creating console log [ ${italic}${consolelog}${default} ]"
if [ "${gamelogdir}" ] && [ ! -d "${gamelogdir}" ]; then if [ ! -f "${consolelog}" ]; then
echo -en "installing game log dir: ${gamelogdir}..." if ! touch "${consolelog}"; then
if ! mkdir -p "${gamelogdir}"; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
else
fn_print_skip_eol_nl
fi
if [ -n "${gamelogdir}" ]; then
echo -en "creating game log directory [ ${italic}${gamelogdir}${default} ]"
if [ ! -d "${gamelogdir}" ]; then
if ! mkdir -p "${gamelogdir}"; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
else
fn_print_skip_eol_nl
fi
fi fi
# Symlink to gamelogdir # Symlink to gamelogdir
# unless gamelogdir is within logdir. # unless gamelogdir is within logdir.
# e.g serverfiles/log is not within log/: symlink created # e.g serverfiles/log is not within log/: symlink created
# log/server is in log/: symlink not created # log/server is in log/: symlink not created
if [ "${gamelogdir}" ]; then if [ -n "${gamelogdir}" ] && [ "${gamelogdir:0:${#logdir}}" != "${logdir}" ]; then
if [ "${gamelogdir:0:${#logdir}}" != "${logdir}" ]; then echo -en "creating symlink to game log directory [ ${italic}${logdir}/server -> ${gamelogdir}${default} ]"
echo -en "creating symlink to game log dir: ${logdir}/server -> ${gamelogdir}..." # if path does not exist or does not match gamelogdir
if [ ! -h "${logdir}/server" ] || [ "$(readlink -f "${logdir}/server")" != "${gamelogdir}" ]; then
if ! ln -nfs "${gamelogdir}" "${logdir}/server"; then if ! ln -nfs "${gamelogdir}" "${logdir}/server"; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
else
fn_print_skip_eol_nl
fi fi
fi fi
# If server uses SteamCMD create a symbolic link to the Steam logs. # If server uses SteamCMD create a symbolic link to the Steam logs.
if [ -d "${HOME}/.steam/steam/logs" ]; then if [ -d "${HOME}/.steam/steam/logs" ]; then
echo -en "creating symlink to steam log directory [ ${italic}${logdir}/steam -> ${HOME}/.steam/steam/logs${default} ]"
if [ ! -L "${logdir}/steam" ]; then if [ ! -L "${logdir}/steam" ]; then
echo -en "creating symlink to steam log dir: ${logdir}/steam -> ${HOME}/.steam/steam/logs..."
if ! ln -nfs "${HOME}/.steam/steam/logs" "${logdir}/steam"; then if ! ln -nfs "${HOME}/.steam/steam/logs" "${logdir}/steam"; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
else
fn_print_skip_eol_nl
fi fi
fi fi
fn_script_log_info "Logs installed" fn_script_log_info "Logs installed"

12
lgsm/modules/install_server_dir.sh

@ -10,10 +10,16 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
echo -e "" echo -e ""
echo -e "${bold}${lightyellow}Server Directory${default}" echo -e "${bold}${lightyellow}Server Directory${default}"
fn_messages_separator fn_messages_separator
echo -en "creating serverfiles directory [ ${italic}${serverfiles}${default} ]"
if [ -d "${serverfiles}" ]; then if [ -d "${serverfiles}" ]; then
fn_print_warning_nl "A server is already installed here." fn_print_skip_eol_nl
echo -e ""
echo -e "${italic}A game server is already exists at this location.${default}"
else
fn_print_ok_eol_nl
fi fi
pwd
if [ -z "${autoinstall}" ]; then if [ -z "${autoinstall}" ]; then
if ! fn_prompt_yn "Continue?" Y; then if ! fn_prompt_yn "Continue?" Y; then
exitcode=0 exitcode=0
@ -21,5 +27,5 @@ if [ -z "${autoinstall}" ]; then
fi fi
fi fi
if [ ! -d "${serverfiles}" ]; then if [ ! -d "${serverfiles}" ]; then
mkdir -v "${serverfiles}" mkdir "${serverfiles}"
fi fi

7
lgsm/modules/install_server_files.sh

@ -241,6 +241,10 @@ fn_install_server_files() {
fn_clear_tmp fn_clear_tmp
} }
if [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "ut" ]; then
install_eula.sh
fi
echo -e "" echo -e ""
echo -e "${bold}${lightyellow}Installing ${gamename} Server${default}" echo -e "${bold}${lightyellow}Installing ${gamename} Server${default}"
fn_messages_separator fn_messages_separator
@ -255,12 +259,10 @@ fi
if [ "${shortname}" == "ts3" ]; then if [ "${shortname}" == "ts3" ]; then
update_ts3.sh update_ts3.sh
elif [ "${shortname}" == "mc" ]; then elif [ "${shortname}" == "mc" ]; then
install_eula.sh
update_mc.sh update_mc.sh
elif [ "${shortname}" == "mcb" ]; then elif [ "${shortname}" == "mcb" ]; then
update_mcb.sh update_mcb.sh
elif [ "${shortname}" == "pmc" ]; then elif [ "${shortname}" == "pmc" ]; then
install_eula.sh
update_pmc.sh update_pmc.sh
elif [ "${shortname}" == "wmc" ] || [ "${shortname}" == "vpmc" ]; then elif [ "${shortname}" == "wmc" ] || [ "${shortname}" == "vpmc" ]; then
update_pmc.sh update_pmc.sh
@ -287,7 +289,6 @@ fi
if [ -z "${autoinstall}" ]; then if [ -z "${autoinstall}" ]; then
echo -e "" echo -e ""
fn_messages_separator
if ! fn_prompt_yn "Was the install successful?" Y; then if ! fn_prompt_yn "Was the install successful?" Y; then
install_retry.sh install_retry.sh
fi fi

2
lgsm/modules/install_squad_license.sh

@ -14,7 +14,7 @@ echo -e "Server license is an optional feature for ${gamename} server"
fn_script_log_info "Server license is an optional feature for ${gamename} server" fn_script_log_info "Server license is an optional feature for ${gamename} server"
echo -e "Get more info and a server license here:" echo -e "Get more info and a server license here:"
echo -e "https://squad.fandom.com/wiki/Server_licensing" echo -e "${italic}https://squad.fandom.com/wiki/Server_licensing"
fn_script_log_info "Get more info and a server license here:" fn_script_log_info "Get more info and a server license here:"
fn_script_log_info "https://squad.fandom.com/wiki/Server_licensing" fn_script_log_info "https://squad.fandom.com/wiki/Server_licensing"
echo -e "" echo -e ""

4
lgsm/modules/install_stats.sh

@ -13,6 +13,7 @@ fn_messages_separator
echo -e "Assist LinuxGSM development by sending anonymous stats to developers." echo -e "Assist LinuxGSM development by sending anonymous stats to developers."
echo -e "Collected data is publicly available: ${italic}https://linuxgsm.com/data/usage${default}" echo -e "Collected data is publicly available: ${italic}https://linuxgsm.com/data/usage${default}"
echo -e "More info: ${italic}https://docs.linuxgsm.com/configuration/linuxgsm-stats${default}" echo -e "More info: ${italic}https://docs.linuxgsm.com/configuration/linuxgsm-stats${default}"
echo -e ""
echo -e "The following info will be sent: " echo -e "The following info will be sent: "
echo -e "* game server" echo -e "* game server"
echo -e "* distro" echo -e "* distro"
@ -24,5 +25,6 @@ if [ -z "${autoinstall}" ]; then
fn_print_information_nl "Stats setting is now enabled in common.cfg." fn_print_information_nl "Stats setting is now enabled in common.cfg."
fi fi
else else
fn_print_information_nl "auto-install leaves stats off by default. Stats can be enabled in common.cfg" echo -e ""
echo -e "auto-install leaves stats off by default. Stats can be enabled in ${italic}common.cfg${default}"
fi fi

4
lgsm/modules/install_ts3db.sh

@ -11,8 +11,8 @@ fn_install_ts3db_mariadb() {
if [ ! -f "${serverfiles}/libts3db_mariadb.so" ]; then if [ ! -f "${serverfiles}/libts3db_mariadb.so" ]; then
echo -e "copying libmariadb.so.2...\c" echo -e "copying libmariadb.so.2...\c"
cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}" cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}"
local exitcode=$? exitcode=$?
if [ "${exitcode}" != "0" ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "copying libmariadb.so.2" fn_script_log_fail "copying libmariadb.so.2"
core_exit.sh core_exit.sh

2
lgsm/modules/install_ut2k4_key.sh

@ -12,7 +12,7 @@ echo -e "${bold}${lightyellow}Enter ${gamename} CD Key${default}"
fn_messages_separator fn_messages_separator
echo -e "To get your server listed on the Master Server list" echo -e "To get your server listed on the Master Server list"
echo -e "you must get a free CD key. Get a key here:" echo -e "you must get a free CD key. Get a key here:"
echo -e "https://www.epicgames.com/unrealtournament/forums/cdkey.php?2004" echo -e "${italic}https://www.epicgames.com/unrealtournament/forums/cdkey.php?2004"
echo -e "" echo -e ""
if [ -z "${autoinstall}" ]; then if [ -z "${autoinstall}" ]; then
echo -e "Once you have the key enter it below" echo -e "Once you have the key enter it below"

62
lgsm/modules/mods_core.sh

@ -57,8 +57,8 @@ fn_mod_lowercase() {
# Finally we can rename the file # Finally we can rename the file
mv "${src}" "${dst}" mv "${src}" "${dst}"
# Exit if it fails for any reason # Exit if it fails for any reason
local exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
fi fi
@ -74,8 +74,8 @@ fn_mod_create_filelist() {
fn_sleep_time fn_sleep_time
# ${modsdir}/${modcommand}-files.txt. # ${modsdir}/${modcommand}-files.txt.
find "${extractdest}" -mindepth 1 -printf '%P\n' > "${modsdir}/${modcommand}-files.txt" find "${extractdest}" -mindepth 1 -printf '%P\n' > "${modsdir}/${modcommand}-files.txt"
local exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Building ${modsdir}/${modcommand}-files.txt" fn_script_log_fail "Building ${modsdir}/${modcommand}-files.txt"
core_exit.sh core_exit.sh
@ -94,8 +94,8 @@ fn_mod_copy_destination() {
echo -en "copying ${modprettyname} to ${modinstalldir}..." echo -en "copying ${modprettyname} to ${modinstalldir}..."
fn_sleep_time fn_sleep_time
cp -Rf "${extractdest}/." "${modinstalldir}/" cp -Rf "${extractdest}/." "${modinstalldir}/"
local exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Copying ${modprettyname} to ${modinstalldir}" fn_script_log_fail "Copying ${modprettyname} to ${modinstalldir}"
else else
@ -132,8 +132,8 @@ fn_mod_tidy_files_list() {
# Delete line(s) matching exactly. # Delete line(s) matching exactly.
sed -i "/^${removefilevar}$/d" "${modsdir}/${modcommand}-files.txt" sed -i "/^${removefilevar}$/d" "${modsdir}/${modcommand}-files.txt"
# Exit on error. # Exit on error.
local exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Error while tidying line: ${removefilevar} from: ${modsdir}/${modcommand}-files.txt" fn_script_log_fail "Error while tidying line: ${removefilevar} from: ${modsdir}/${modcommand}-files.txt"
core_exit.sh core_exit.sh
@ -388,7 +388,7 @@ fn_create_mods_dir() {
echo -en "creating LinuxGSM mods data directory ${modsdir}..." echo -en "creating LinuxGSM mods data directory ${modsdir}..."
mkdir -p "${modsdir}" mkdir -p "${modsdir}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Creating mod download dir ${modsdir}" fn_script_log_fail "Creating mod download dir ${modsdir}"
core_exit.sh core_exit.sh
@ -402,7 +402,7 @@ fn_create_mods_dir() {
echo -en "creating mods install directory ${modinstalldir}..." echo -en "creating mods install directory ${modinstalldir}..."
mkdir -p "${modinstalldir}" mkdir -p "${modinstalldir}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Creating mod install directory ${modinstalldir}" fn_script_log_fail "Creating mod install directory ${modinstalldir}"
core_exit.sh core_exit.sh
@ -412,7 +412,7 @@ fn_create_mods_dir() {
fi fi
fi fi
# Create lgsm/data/${modsinstalledlist}. # Create ${datadir}/${modsinstalledlist}.
if [ ! -f "${modsinstalledlistfullpath}" ]; then if [ ! -f "${modsinstalledlistfullpath}" ]; then
touch "${modsinstalledlistfullpath}" touch "${modsinstalledlistfullpath}"
fn_script_log_info "Created ${modsinstalledlistfullpath}" fn_script_log_info "Created ${modsinstalledlistfullpath}"
@ -425,7 +425,7 @@ fn_mods_create_tmp_dir() {
mkdir -p "${modstmpdir}" mkdir -p "${modstmpdir}"
exitcode=$? exitcode=$?
echo -en "creating mod download directory ${modstmpdir}..." echo -en "creating mod download directory ${modstmpdir}..."
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Creating mod download directory ${modstmpdir}" fn_script_log_fail "Creating mod download directory ${modstmpdir}"
core_exit.sh core_exit.sh
@ -442,7 +442,7 @@ fn_mods_clear_tmp_dir() {
echo -en "clearing mod download directory ${modstmpdir}..." echo -en "clearing mod download directory ${modstmpdir}..."
rm -rf "${modstmpdir:?}" rm -rf "${modstmpdir:?}"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fail "Clearing mod download directory ${modstmpdir}" fn_script_log_fail "Clearing mod download directory ${modstmpdir}"
core_exit.sh core_exit.sh
@ -580,7 +580,7 @@ fn_mod_install_liblist_gam_file() {
grep -q "addons/metamod/dlls/metamod.dll" "${modinstalldir}/liblist.gam" grep -q "addons/metamod/dlls/metamod.dll" "${modinstalldir}/liblist.gam"
exitcode=$? exitcode=$?
# if replacement back didn't happen, error out. # if replacement back didn't happen, error out.
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "${logentry}" fn_script_log_fail "${logentry}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
else else
@ -596,7 +596,7 @@ fn_mod_install_liblist_gam_file() {
grep -q "addons/metamod/dlls/metamod.so" "${modinstalldir}/liblist.gam" grep -q "addons/metamod/dlls/metamod.so" "${modinstalldir}/liblist.gam"
exitcode=$? exitcode=$?
# if replacement back didn't happen, error out # if replacement back didn't happen, error out
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "${logentry}" fn_script_log_fail "${logentry}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
else else
@ -614,11 +614,11 @@ fn_mod_install_liblist_gam_file() {
grep -q "addons/metamod/dlls/metamod.dylib" "${modinstalldir}/liblist.gam" grep -q "addons/metamod/dlls/metamod.dylib" "${modinstalldir}/liblist.gam"
exitcode=$? exitcode=$?
# if replacement back didn't happen, error out. # if replacement back didn't happen, error out.
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "${logentry}" fn_script_log_fail "${logentry}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
else else
fn_script_log_pass ${logentry} fn_script_log_pass "${logentry}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
fi fi
@ -638,11 +638,11 @@ fn_mod_remove_liblist_gam_file() {
grep -q "${moddll}" "${modinstalldir}/liblist.gam" grep -q "${moddll}" "${modinstalldir}/liblist.gam"
exitcode=$? exitcode=$?
# if replacement back didn't happen, error out. # if replacement back didn't happen, error out.
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "${logentry}" fn_script_log_fail "${logentry}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
else else
fn_script_log_pass ${logentry} fn_script_log_pass "${logentry}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
@ -654,11 +654,11 @@ fn_mod_remove_liblist_gam_file() {
grep -q "${modso}" "${modinstalldir}/liblist.gam" grep -q "${modso}" "${modinstalldir}/liblist.gam"
exitcode=$? exitcode=$?
# if replacement back didn't happen, error out # if replacement back didn't happen, error out
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "${logentry}" fn_script_log_fail "${logentry}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
else else
fn_script_log_pass ${logentry} fn_script_log_pass "${logentry}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
@ -672,11 +672,11 @@ fn_mod_remove_liblist_gam_file() {
grep -q "${moddylib}" "${modinstalldir}/liblist.gam" grep -q "${moddylib}" "${modinstalldir}/liblist.gam"
# if replacement back didn't happen, error out. # if replacement back didn't happen, error out.
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "${logentry}" fn_script_log_fail "${logentry}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
else else
fn_script_log_pass ${logentry} fn_script_log_pass "${logentry}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
fi fi
@ -691,15 +691,15 @@ fn_mod_install_amxmodx_file() {
echo -en "adding amxmodx_mm_i386.so in plugins.ini..." echo -en "adding amxmodx_mm_i386.so in plugins.ini..."
grep -q "amxmodx_mm_i386.so" "${modinstalldir}/addons/metamod/plugins.ini" grep -q "amxmodx_mm_i386.so" "${modinstalldir}/addons/metamod/plugins.ini"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
# file exists but the entry does not, let's add it # file exists but the entry does not, let's add it
echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" >> "${modinstalldir}/addons/metamod/plugins.ini" echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" >> "${modinstalldir}/addons/metamod/plugins.ini"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "${logentry}" fn_script_log_fail "${logentry}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
else else
fn_script_log_pass ${logentry} fn_script_log_pass "${logentry}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
fi fi
@ -707,12 +707,12 @@ fn_mod_install_amxmodx_file() {
# create new file and add the mod to it # create new file and add the mod to it
echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" > "${modinstalldir}/addons/metamod/plugins.ini" echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" > "${modinstalldir}/addons/metamod/plugins.ini"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "${logentry}" fn_script_log_fail "${logentry}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
core_exit.sh core_exit.sh
else else
fn_script_log_pass ${logentry} fn_script_log_pass "${logentry}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi
fi fi
@ -726,17 +726,17 @@ fn_mod_remove_amxmodx_file() {
grep -q "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" "${modinstalldir}/addons/metamod/plugins.ini" grep -q "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" "${modinstalldir}/addons/metamod/plugins.ini"
# iIs it found? If so remove it and clean up # iIs it found? If so remove it and clean up
exitcode=$? exitcode=$?
if [ "${exitcode}" == 0 ]; then if [ "${exitcode}" -eq 0 ]; then
# delete the line we inserted # delete the line we inserted
sed -i '/linux addons\/amxmodx\/dlls\/amxmodx_mm_i386.so/d' "${modinstalldir}/addons/metamod/plugins.ini" sed -i '/linux addons\/amxmodx\/dlls\/amxmodx_mm_i386.so/d' "${modinstalldir}/addons/metamod/plugins.ini"
# remove empty lines # remove empty lines
sed -i '/^$/d' "${modinstalldir}/addons/metamod/plugins.ini" sed -i '/^$/d' "${modinstalldir}/addons/metamod/plugins.ini"
exitcode=$? exitcode=$?
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" -ne 0 ]; then
fn_script_log_fail "${logentry}" fn_script_log_fail "${logentry}"
fn_print_fail_eol_nl fn_print_fail_eol_nl
else else
fn_script_log_pass ${logentry} fn_script_log_pass "${logentry}"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fi fi

4
lgsm/modules/query_gamedig.sh

@ -42,9 +42,7 @@ if [ "$(command -v "${gamedigbinary}" 2> /dev/null)" ] && [ "$(command -v jq 2>
fi fi
# numplayers. # numplayers.
if [ "${querytype}" == "minecraft" ]; then if [ "${querytype}" == "teamspeak3" ]; then
gdplayers=$(echo "${gamedigraw}" | jq -re '.players | length-1')
elif [ "${querytype}" == "teamspeak3" ]; then
gdplayers=$(echo "${gamedigraw}" | jq -re '.raw.virtualserver_clientsonline') gdplayers=$(echo "${gamedigraw}" | jq -re '.raw.virtualserver_clientsonline')
else else
gdplayers=$(echo "${gamedigraw}" | jq -re '.players | length') gdplayers=$(echo "${gamedigraw}" | jq -re '.players | length')

14
lgsm/modules/query_gsquery.py

@ -11,7 +11,7 @@ import socket
import sys import sys
engine_types = ('protocol-valve', 'protocol-quake2', 'protocol-quake3', 'protocol-gamespy1', engine_types = ('protocol-valve', 'protocol-quake2', 'protocol-quake3', 'protocol-gamespy1',
'protocol-unreal2', 'ut3', 'minecraft', 'minecraftbe', 'jc2m', 'mumbleping', 'soldat', 'teeworlds') 'protocol-unreal2', 'ut3', 'minecraft', 'minecraftbe', 'jc2mp', 'mumbleping', 'soldat', 'teeworlds')
class gsquery: class gsquery:
@ -22,11 +22,11 @@ class gsquery:
idtech2query = ('protocol-quake2', 'idtech2', 'quake', 'iw2.0') idtech2query = ('protocol-quake2', 'idtech2', 'quake', 'iw2.0')
idtech3query = ('protocol-quake3', 'iw3.0', 'ioquake3', 'qfusion') idtech3query = ('protocol-quake3', 'iw3.0', 'ioquake3', 'qfusion')
minecraftquery = ('minecraft', 'lwjgl2') minecraftquery = ('minecraft', 'lwjgl2')
minecraftbequery = ('minecraftbe',) minecraftbequery = ('minecraftbe')
jc2mquery = ('jc2m',) jc2mpquery = ('jc2mp')
mumblequery = ('mumbleping',) mumblequery = ('mumbleping')
soldatquery = ('soldat',) soldatquery = ('soldat')
twquery = ('teeworlds',) twquery = ('teeworlds')
unrealquery = ('protocol-gamespy1', 'unreal') unrealquery = ('protocol-gamespy1', 'unreal')
unreal2query = ('protocol-unreal2', 'unreal2') unreal2query = ('protocol-unreal2', 'unreal2')
unreal3query = ('ut3', 'unreal3') unreal3query = ('ut3', 'unreal3')
@ -40,7 +40,7 @@ class gsquery:
self.query_prompt_string = b'\xff\xff\xff\xffstatus\x00' self.query_prompt_string = b'\xff\xff\xff\xffstatus\x00'
elif self.argument.engine in self.idtech3query: elif self.argument.engine in self.idtech3query:
self.query_prompt_string = b'\xff\xff\xff\xffgetstatus' self.query_prompt_string = b'\xff\xff\xff\xffgetstatus'
elif self.argument.engine in self.jc2mquery: elif self.argument.engine in self.jc2mpquery:
self.query_prompt_string = b'\xFE\xFD\x09\x10\x20\x30\x40' self.query_prompt_string = b'\xFE\xFD\x09\x10\x20\x30\x40'
elif self.argument.engine in self.minecraftquery: elif self.argument.engine in self.minecraftquery:
self.query_prompt_string = b'\xFE\xFD\x09\x3d\x54\x1f\x93' self.query_prompt_string = b'\xFE\xFD\x09\x3d\x54\x1f\x93'

6
lgsm/modules/update_jk2.sh

@ -152,6 +152,12 @@ fn_update_compare() {
# The location where the builds are checked and downloaded. # The location where the builds are checked and downloaded.
remotelocation="github.com" remotelocation="github.com"
if [ "$(command -v jq 2> /dev/null)" ]; then
fn_print_fail_nl "jq is not installed"
fn_script_log_fatal "jq is not installed"
core_exit.sh
fi
if [ "${firstcommandname}" == "INSTALL" ]; then if [ "${firstcommandname}" == "INSTALL" ]; then
fn_update_remotebuild fn_update_remotebuild
fn_update_dl fn_update_dl

6
lgsm/modules/update_mc.sh

@ -167,6 +167,12 @@ fn_update_compare() {
# The location where the builds are checked and downloaded. # The location where the builds are checked and downloaded.
remotelocation="mojang.com" remotelocation="mojang.com"
if [ "$(command -v jq 2> /dev/null)" ]; then
fn_print_fail_nl "jq is not installed"
fn_script_log_fatal "jq is not installed"
core_exit.sh
fi
if [ "${firstcommandname}" == "INSTALL" ]; then if [ "${firstcommandname}" == "INSTALL" ]; then
fn_update_remotebuild fn_update_remotebuild
fn_update_dl fn_update_dl

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save