4
0
Эх сурвалжийг харах

Merged release/170205 into master

Daniel Gibbs 9 жил өмнө
parent
commit
fea406c3aa
89 өөрчлөгдсөн 953 нэмэгдсэн , 1403 устгасан
  1. 1 1
      7DaysToDie/sdtdserver
  2. 1 1
      ARKSurvivalEvolved/arkserver
  3. 1 1
      Arma3/arma3server
  4. 1 1
      BallisticOverkill/boserver
  5. 1 1
      Battlefield1942/bf1942server
  6. 1 1
      BlackMesa/bmdmserver
  7. 8 1
      BladeSymphony/bsserver
  8. 1 6
      BrainBread2/bb2server
  9. 1 1
      CallOfDuty/codserver
  10. 1 1
      CallOfDuty2/cod2server
  11. 1 1
      CallOfDuty4/cod4server
  12. 1 1
      CallOfDutyUnitedOffensive/coduoserver
  13. 1 1
      CallOfDutyWorldAtWar/codwawserver
  14. 2 2
      CodenameCURE/ccserver
  15. 1 1
      CounterStrike/csserver
  16. 1 1
      CounterStrikeConditionZero/csczserver
  17. 1 1
      CounterStrikeGlobalOffensive/csgoserver
  18. 1 1
      CounterStrikeSource/cssserver
  19. 1 1
      DayOfDefeat/dodserver
  20. 1 1
      DayOfDefeatSource/dodsserver
  21. 1 1
      DayOfInfamy/doiserver
  22. 1 1
      DeathmatchClassic/dmcserver
  23. 1 1
      DontStarveTogether/dstserver
  24. 1 1
      DoubleActionBoogaloo/dabserver
  25. 1 1
      EmpiresMod/emserver
  26. 1 1
      Factorio/fctrserver
  27. 1 1
      FistfulOfFrags/fofserver
  28. 1 1
      GarrysMod/gmodserver
  29. 1 1
      GoldenEyeSource/gesserver
  30. 1 1
      HalfLife2Deathmatch/hl2dmserver
  31. 1 1
      HalfLifeDeathmatch/hldmserver
  32. 1 1
      HalfLifeDeathmatchSource/hldmsserver
  33. 1 1
      Hurtworld/hwserver
  34. 1 1
      Insurgency/insserver
  35. 1 1
      JustCause2/jc2server
  36. 1 1
      KillingFloor/kfserver
  37. 1 1
      Left4Dead/l4dserver
  38. 1 1
      Left4Dead2/l4d2server
  39. 1 1
      Minecraft/mcserver
  40. 1 1
      MultiTheftAuto/mtaserver
  41. 1 1
      Mumble/mumbleserver
  42. 1 1
      NS2Combat/ns2cserver
  43. 1 1
      NaturalSelection2/ns2server
  44. 1 1
      NoMoreRoomInHell/nmrihserver
  45. 1 1
      OpposingForce/opforserver
  46. 1 1
      PiratesVikingandKnightsII/pvkiiserver
  47. 193 0
      ProjectCars/pcserver
  48. 1 1
      ProjectZomboid/pzserver
  49. 1 1
      Quake2/q2server
  50. 1 1
      Quake3/q3server
  51. 1 1
      QuakeLive/qlserver
  52. 1 1
      QuakeWorld/qwserver
  53. 1 1
      RedOrchestra/roserver
  54. 1 1
      Ricochet/ricochetserver
  55. 1 1
      Rust/rustserver
  56. 1 1
      SeriousSam3BFE/ss3sserver
  57. 1 1
      Starbound/sbserver
  58. 1 1
      SvenCoop/svenserver
  59. 1 1
      TeamFortress2/tf2server
  60. 1 1
      TeamFortressClassic/tfcserver
  61. 1 1
      TeamSpeak3/ts3server
  62. 1 1
      Teeworlds/twserver
  63. 1 1
      Terraria/terrariaserver
  64. 1 1
      TowerUnite/tuserver
  65. 1 1
      UnrealTournament/utserver
  66. 1 1
      UnrealTournament2004/ut2k4server
  67. 1 1
      UnrealTournament3/ut3server
  68. 1 1
      UnrealTournament99/ut99server
  69. 1 1
      WolfensteinEnemyTerritory/wetserver
  70. 4 4
      lgsm/functions/check_deps.sh
  71. 14 1
      lgsm/functions/command_details.sh
  72. 3 1
      lgsm/functions/command_dev_detect_deps.sh
  73. 3 1
      lgsm/functions/command_dev_detect_glibc.sh
  74. 3 1
      lgsm/functions/command_dev_detect_ldd.sh
  75. 367 255
      lgsm/functions/command_fastdl.sh
  76. 6 6
      lgsm/functions/command_start.sh
  77. 7 33
      lgsm/functions/command_stop.sh
  78. 2 5
      lgsm/functions/command_ts3_server_pass.sh
  79. 19 6
      lgsm/functions/command_wipe.sh
  80. 1 3
      lgsm/functions/compress_unreal2_maps.sh
  81. 1 3
      lgsm/functions/compress_ut99_maps.sh
  82. 155 948
      lgsm/functions/core_getopt.sh
  83. 80 51
      lgsm/functions/info_config.sh
  84. 3 0
      lgsm/functions/info_glibc.sh
  85. 6 0
      lgsm/functions/install_config.sh
  86. 2 3
      lgsm/functions/install_server_dir.sh
  87. 6 6
      lgsm/functions/mods_core.sh
  88. 1 1
      tests/tests_jc2server.sh
  89. 1 1
      tests/tests_ts3server.sh

+ 1 - 1
7DaysToDie/sdtdserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
ARKSurvivalEvolved/arkserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Arma3/arma3server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
BallisticOverkill/boserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Battlefield1942/bf1942server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
BlackMesa/bmdmserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 8 - 1
BladeSymphony/bsserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########
@@ -75,6 +75,13 @@ appid="228780"
 # Example: "-beta latest_experimental"
 # Example: "-beta latest_experimental"
 branch=""
 branch=""
 
 
+## Github Branch Select
+# Allows for the use of different function files
+# from a different repo and/or branch.
+githubuser="GameServerManagers"
+githubrepo="LinuxGSM"
+githubbranch="master"
+
 ## LinuxGSM Server Details
 ## LinuxGSM Server Details
 # Do not edit
 # Do not edit
 gamename="Blade Symphony"
 gamename="Blade Symphony"

+ 1 - 6
BrainBread2/bb2server

@@ -14,17 +14,12 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########
 ##########################
 ##########################
 
 
-## SteamCMD Login | https://github.com/GameServerManagers/LinuxGSM/wiki/SteamCMD#steamcmd-login
-# Steam login
-steamuser="username"
-steampass='password'
-
 ## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
 ## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
 defaultmap="bba_barracks"
 defaultmap="bba_barracks"
 maxplayers="20"
 maxplayers="20"

+ 1 - 1
CallOfDuty/codserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
CallOfDuty2/cod2server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
CallOfDuty4/cod4server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
CallOfDutyUnitedOffensive/coduoserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
CallOfDutyWorldAtWar/codwawserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 2 - 2
CodenameCURE/ccserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########
@@ -32,7 +32,7 @@ ip="0.0.0.0"
 
 
 ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
 ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
 fn_parms(){
 fn_parms(){
-parms="-game cure -insecure -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
+parms="-game cure -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
 }
 }
 
 
 #### LinuxGSM Settings ####
 #### LinuxGSM Settings ####

+ 1 - 1
CounterStrike/csserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
CounterStrikeConditionZero/csczserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
CounterStrikeGlobalOffensive/csgoserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
CounterStrikeSource/cssserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
DayOfDefeat/dodserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
DayOfDefeatSource/dodsserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
DayOfInfamy/doiserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
DeathmatchClassic/dmcserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
DontStarveTogether/dstserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
DoubleActionBoogaloo/dabserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
EmpiresMod/emserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Factorio/fctrserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
FistfulOfFrags/fofserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
GarrysMod/gmodserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
GoldenEyeSource/gesserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
HalfLife2Deathmatch/hl2dmserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
HalfLifeDeathmatch/hldmserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
HalfLifeDeathmatchSource/hldmsserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Hurtworld/hwserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Insurgency/insserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
JustCause2/jc2server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
KillingFloor/kfserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Left4Dead/l4dserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Left4Dead2/l4d2server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Minecraft/mcserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
MultiTheftAuto/mtaserver

@@ -12,7 +12,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Mumble/mumbleserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
NS2Combat/ns2cserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
NaturalSelection2/ns2server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
NoMoreRoomInHell/nmrihserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
OpposingForce/opforserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
PiratesVikingandKnightsII/pvkiiserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 193 - 0
ProjectCars/pcserver

@@ -0,0 +1,193 @@
+#!/bin/bash
+# Project: Game Server Managers - LinuxGSM
+# Author: Daniel Gibbs
+# License: MIT License, Copyright (c) 2017 Daniel Gibbs
+# Purpose: Project Cars | Server Management Script
+# Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
+# Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
+# Website: https://gameservermanagers.com
+
+# Debugging
+if [ -f ".dev-debug" ]; then
+	exec 5>dev-debug.log
+	BASH_XTRACEFD="5"
+	set -x
+fi
+
+version="170305"
+
+##########################
+######## Settings ########
+##########################
+
+#### Server Settings ####
+
+# Notification Alerts
+## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
+fn_parms(){
+parms="--config ${servercfg}"
+}
+
+#### LinuxGSM Settings ####
+
+## Notification Alerts
+# (on|off)
+# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+## Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update
+updateonstart="off"
+
+## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
+consolelogging="on"
+logdays="7"
+
+#### LinuxGSM Advanced Settings ####
+
+## SteamCMD Settings
+# Server appid
+appid="332670"
+# Steam App Branch Select
+# Allows to opt into the various Steam app branches. Default branch is "".
+# Example: "-beta latest_experimental"
+branch=""
+
+## Github Branch Select
+# Allows for the use of different function files
+# from a different repo and/or branch.
+githubuser="GameServerManagers"
+githubrepo="LinuxGSM"
+githubbranch="master"
+
+## LinuxGSM Server Details
+# Do not edit
+gamename="Project Cars"
+engine="madness"
+
+## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
+servicename="pc-server"
+
+#### Directories ####
+# Edit with care
+
+## Work Directories
+rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
+libdir="${lgsmdir}/lib"
+tmpdir="${lgsmdir}/tmp"
+filesdir="${rootdir}/serverfiles"
+
+## Server Specific Directories
+systemdir="${filesdir}"
+executabledir="${filesdir}"
+executable="./DedicatedServerCmd"
+servercfg="${servicename}.cfg"
+servercfgdefault="server.cfg"
+servercfgdir="${systemdir}"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${rootdir}/backups"
+
+## Logging Directories
+gamelogdir="${systemdir}/logs"
+scriptlogdir="${rootdir}/log/script"
+consolelogdir="${rootdir}/log/console"
+scriptlog="${scriptlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+emaillog="${scriptlogdir}/${servicename}-email.log"
+
+## Logs Naming
+scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
+
+########################
+######## Script ########
+###### Do not edit #####
+########################
+
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
+	if [ ! -d "${filedir}" ]; then
+		mkdir -p "${filedir}"
+	fi
+	echo -e "    fetching ${filename}...\c"
+	# Check curl exists and use available path
+	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+	for curlcmd in ${curlpaths}
+	do
+		if [ -x "${curlcmd}" ]; then
+			break
+		fi
+	done
+	# If curl exists download file
+	if [ "$(basename ${curlcmd})" == "curl" ]; then
+		curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+		if [ $? -ne 0 ]; then
+			echo -e "\e[0;31mFAIL\e[0m\n"
+			echo "${curlfetch}"
+			echo -e "${githuburl}\n"
+			exit 1
+		else
+			echo -e "\e[0;32mOK\e[0m"
+		fi
+	else
+		echo -e "\e[0;31mFAIL\e[0m\n"
+		echo "Curl is not installed!"
+		echo -e ""
+		exit 1
+	fi
+	chmod +x "${filedir}/${filename}"
+fi
+source "${filedir}/${filename}"
+}
+
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_functions.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+# Prevent from running this script as root.
+if [ "$(whoami)" = "root" ]; then
+	if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]||[ ! -f "${functionsdir}/core_exit.sh" ]; then
+		echo "[ FAIL ] Do NOT run this script as root!"
+		exit 1
+	else
+		core_functions.sh
+		check_root.sh
+	fi
+fi
+
+core_dl.sh
+core_functions.sh
+getopt=$1
+core_getopt.sh

+ 1 - 1
ProjectZomboid/pzserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Quake2/q2server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Quake3/q3server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
QuakeLive/qlserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
QuakeWorld/qwserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
RedOrchestra/roserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Ricochet/ricochetserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Rust/rustserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
SeriousSam3BFE/ss3sserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Starbound/sbserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
SvenCoop/svenserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
TeamFortress2/tf2server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
TeamFortressClassic/tfcserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
TeamSpeak3/ts3server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Teeworlds/twserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
Terraria/terrariaserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
TowerUnite/tuserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
UnrealTournament/utserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
UnrealTournament2004/ut2k4server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
UnrealTournament3/ut3server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
UnrealTournament99/ut99server

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
WolfensteinEnemyTerritory/wetserver

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 4 - 4
lgsm/functions/check_deps.sh

@@ -180,8 +180,8 @@ if [ -n "$(command -v dpkg-query)" ]; then
 		else
 		else
 			array_deps_required+=( libtinfo5 )
 			array_deps_required+=( libtinfo5 )
 		fi
 		fi
-	# Brainbread 2 and Don't Starve Together
-	elif [ "${gamename}" == "Brainbread 2" ]||[ "${gamename}" == "Don't Starve Together" ]; then
+	# Brainbread 2 ,Don't Starve Together & Team Fortress 2
+	elif [ "${gamename}" == "Brainbread 2" ]||[ "${gamename}" == "Don't Starve Together" ]||[ "${gamename}" == "Team Fortress 2" ]; then
 		array_deps_required+=( libcurl4-gnutls-dev:i386 )
 		array_deps_required+=( libcurl4-gnutls-dev:i386 )
 	# Battlefield: 1942
 	# Battlefield: 1942
 	elif [ "${gamename}" == "Battlefield: 1942" ]; then
 	elif [ "${gamename}" == "Battlefield: 1942" ]; then
@@ -255,8 +255,8 @@ elif [ -n "$(command -v yum)" ]; then
 	# No More Room in Hell, Counter-Strike: Source and Garry's Mod
 	# No More Room in Hell, Counter-Strike: Source and Garry's Mod
 	elif [ "${gamename}" == "No More Room in Hell" ]||[ "${gamename}" == "Counter-Strike: Source" ]||[ "${gamename}" == "Garry's Mod" ]; then
 	elif [ "${gamename}" == "No More Room in Hell" ]||[ "${gamename}" == "Counter-Strike: Source" ]||[ "${gamename}" == "Garry's Mod" ]; then
 		array_deps_required+=( ncurses-libs.i686 )
 		array_deps_required+=( ncurses-libs.i686 )
-	# Brainbread 2 and Don't Starve Together
-	elif [ "${gamename}" == "Brainbread 2" ]||[ "${gamename}" == "Don't Starve Together" ]; then
+	# Brainbread 2, Don't Starve Together & Team Fortress 2
+	elif [ "${gamename}" == "Brainbread 2" ]||[ "${gamename}" == "Don't Starve Together" ]||[ "${gamename}" == "Team Fortress 2" ]; then
 		array_deps_required+=( libcurl.i686 )
 		array_deps_required+=( libcurl.i686 )
 	# Battlefield: 1942
 	# Battlefield: 1942
 	elif [ "${gamename}" == "Battlefield: 1942" ]; then
 	elif [ "${gamename}" == "Battlefield: 1942" ]; then

+ 14 - 1
lgsm/functions/command_details.sh

@@ -315,7 +315,7 @@ fn_details_ports(){
 
 
 	parmslocation="${red}UNKNOWN${default}"
 	parmslocation="${red}UNKNOWN${default}"
 	# engines/games that require editing in the config file
 	# engines/games that require editing in the config file
-	local ports_edit_array=( "avalanche" "Ballistic Overkill" "dontstarve" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" )
+	local ports_edit_array=( "avalanche" "Ballistic Overkill" "dontstarve" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" )
 	for port_edit in "${ports_edit_array[@]}"
 	for port_edit in "${ports_edit_array[@]}"
 	do
 	do
 		if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
 		if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
@@ -487,6 +487,17 @@ fn_details_mumble(){
 	} | column -s $'\t' -t
 	} | column -s $'\t' -t
 }
 }
 
 
+fn_details_projectcars(){
+	echo -e "netstat -atunp | grep DedicatedS"
+	echo -e ""
+	{
+		echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+		echo -e "> Game\tINBOUND\t${port}\tudp"
+		echo -e "> Query\tINBOUND\t${queryport}\tudp"
+		echo -e "> Steam\tINBOUND\t${queryport}\tudp"
+	} | column -s $'\t' -t
+}
+
 fn_details_projectzomboid(){
 fn_details_projectzomboid(){
 	echo -e "netstat -atunp | grep java"
 	echo -e "netstat -atunp | grep java"
 	echo -e ""
 	echo -e ""
@@ -840,6 +851,8 @@ fn_display_details() {
 		fn_details_factorio
 		fn_details_factorio
 	elif [ "${gamename}" == "Hurtworld" ]; then
 	elif [ "${gamename}" == "Hurtworld" ]; then
 		fn_details_hurtworld
 		fn_details_hurtworld
+	elif [ "${gamename}" == "Project Cars" ]; then
+		fn_details_projectcars
 	elif [ "${gamename}" == "QuakeWorld" ]; then
 	elif [ "${gamename}" == "QuakeWorld" ]; then
 		fn_details_quake
 		fn_details_quake
 	elif [ "${gamename}" == "Quake 2" ]; then
 	elif [ "${gamename}" == "Quake 2" ]; then

+ 3 - 1
lgsm/functions/command_dev_detect_deps.sh

@@ -148,4 +148,6 @@ rm -f "${tmpdir}/.depdetect_ubuntu_list_uniq"
 rm -f "${tmpdir}/.depdetect_readelf"
 rm -f "${tmpdir}/.depdetect_readelf"
 
 
 rm -f "${tmpdir}/.depdetect_unknown"
 rm -f "${tmpdir}/.depdetect_unknown"
-rm -f "${tmpdir}/.depdetect_unknown_uniq"
+rm -f "${tmpdir}/.depdetect_unknown_uniq"
+
+core_exit.sh

+ 3 - 1
lgsm/functions/command_dev_detect_glibc.sh

@@ -37,4 +37,6 @@ while IFS= read -r -d $'\0' line; do
 done
 done
 echo ""
 echo ""
 cat "${tmpdir}/detect_glibc.tmp"|sort|uniq|sort -r --version-sort
 cat "${tmpdir}/detect_glibc.tmp"|sort|uniq|sort -r --version-sort
-rm "${tmpdir}/detect_glibc.tmp"
+rm "${tmpdir}/detect_glibc.tmp"
+
+core_exit.sh

+ 3 - 1
lgsm/functions/command_dev_detect_ldd.sh

@@ -50,4 +50,6 @@ echo "================================="
 cat "${tmpdir}/detect_ldd_not_found.tmp"
 cat "${tmpdir}/detect_ldd_not_found.tmp"
 
 
 rm "${tmpdir}/detect_ldd.tmp"
 rm "${tmpdir}/detect_ldd.tmp"
-rm "${tmpdir}/detect_ldd_not_found.tmp"
+rm "${tmpdir}/detect_ldd_not_found.tmp"
+
+core_exit.sh

+ 367 - 255
lgsm/functions/command_fastdl.sh

@@ -12,7 +12,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 check.sh
 check.sh
 
 
 # Directories
 # Directories
-webdir="${rootdir}/public_html"
+if [ -z "${webdir}" ]; then
+	webdir="${rootdir}/public_html"
+fi
 fastdldir="${webdir}/fastdl"
 fastdldir="${webdir}/fastdl"
 addonsdir="${systemdir}/addons"
 addonsdir="${systemdir}/addons"
 # Server lua autorun dir, used to autorun lua on client connect to the server
 # Server lua autorun dir, used to autorun lua on client connect to the server
@@ -20,302 +22,412 @@ luasvautorundir="${systemdir}/lua/autorun/server"
 luafastdlfile="lgsm_cl_force_fastdl.lua"
 luafastdlfile="lgsm_cl_force_fastdl.lua"
 luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
 luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
 
 
-fn_check_bzip2(){
-	# Returns true if not installed
-	if [ -z "$(command -v bzip2)" ]; then
-		bzip2installed="0"
-		fn_print_info "bzip2 is not installed !"
-		fn_script_log_info "bzip2 is not installed"
-		echo -en "\n"
-		sleep 1
-		echo "We advise using it"
-		echo "For more information, see https://github.com/GameServerManagers/LinuxGSM/wiki/FastDL#bzip2-compression"
-		sleep 2
+# Check if bzip2 is installed
+if [ -z "$(command -v bzip2)" ]; then
+	fn_print_fail "bzip2 is not installed"
+	fn_script_log_fatal "bzip2 is not installed"
+	core_exit.sh
+fi
+
+# Header
+fn_print_header
+echo "More info: https://git.io/vyk9a"
+echo ""
+
+# Prompts user for FastDL creation settings
+echo "${commandaction} setup"
+echo "================================="
+
+# Prompt for clearing old files if directory was already here
+if [ -d "${fastdldir}" ]; then
+	fn_print_warning_nl "FastDL directory already exists."
+	echo "${fastdldir}"
+	echo ""
+	if fn_prompt_yn "Overwrite existing directory?" Y; then
+		fn_script_log_info "Overwrite existing directory: YES"
 	else
 	else
-		bzip2installed="1"
+		core_exit.sh
 	fi
 	fi
-}
+fi
 
 
-fn_fastdl_init(){
-	# User confirmation
-	fn_print_ok "Welcome to LGSM's FastDL generator"
-	sleep 1
-	echo -en "\n"
-	fn_script_log "Started FastDL creation"
-	if ! fn_prompt_yn "Continue?" Y; then
-		exit
+# Garry's Mod Specific
+if [ "${gamename}" == "Garry's Mod" ]; then
+	# Prompt for download enforcer, which is using a .lua addfile resource generator
+	if fn_prompt_yn "Force clients to download files?" Y; then
+		luaresource="on"
+		fn_script_log_info "Force clients to download files: YES"
+	else
+		luaresource="off"
+		fn_script_log_info "Force clients to download filesr: NO"
 	fi
 	fi
-	fn_script_log "Initiating FastDL creation"
+fi
 
 
-	# Check and create directories
-	if [ ! -d "${webdir}" ]; then
-		echo ""
-		fn_print_info "Creating FastDL directories"
-		echo -en "\n"
-		sleep 1
-		fn_print_dots "Creating ${webdir} directory"
+# Clears any fastdl directory content
+fn_clear_old_fastdl(){
+	# Clearing old FastDL
+	if [ -d "${fastdldir}" ]; then
+		echo -en "clearing existing FastDL directory ${fastdldir}..."
+		rm -R "${fastdldir:?}"
+		exitcode=$?
+		if [ "${exitcode}" -ne 0 ]; then
+			fn_print_fail_eol_nl
+			fn_script_log_fatal "Clearing existing FastDL directory ${fastdldir}"
+			core_exit.sh
+		else
+			fn_print_ok_eol_nl
+			fn_script_log_pass "Clearing existing FastDL directory ${fastdldir}"
+		fi
 		sleep 0.5
 		sleep 0.5
-		mkdir "${webdir}"
-		fn_print_ok "Created ${webdir} directory"
-		fn_script_log "FastDL created ${webdir} directory"
-		sleep 1
-		echo -en "\n"
-	fi
-	if [ ! -d "${fastdldir}" ]; then
-		# No directory, won't ask for removing old ones
-		newfastdl=1
-		fn_print_dots "Creating fastdl directory"
-		sleep 0.5
-		mkdir "${fastdldir}"
-		fn_print_ok "Created fastdl directory"
-		fn_script_log "FastDL created fastdl directory"
-		sleep 1
-		echo -en "\n"
-		clearoldfastdl="off" # Nothing to clear
-	elif  [ "$(ls -A "${fastdldir}")" ]; then
-		newfastdl=0
 	fi
 	fi
 }
 }
 
 
-fn_fastdl_config(){
-	# Global settings for FastDL creation
-	fn_print_info "Entering configuration"
-	fn_script_log "Configuration"
-	sleep 2
-	echo -en "\n"
-	# Prompt for clearing old files if directory was already here
-	if [ -n "${newfastdl}" ] && [ "${newfastdl}" == "0" ]; then
-		fn_print_dots
-		if fn_prompt_yn "Clear old FastDL files?" Y; then
-			clearoldfastdl="on"; fn_script_log "clearoldfastdl enabled"; fn_print_ok "Clearing Enabled"
+fn_fastdl_dirs(){
+	# Check and create directories
+	if [ ! -d "${webdir}" ]; then
+		echo -en "creating web directory ${webdir}..."
+		mkdir -p "${webdir}"
+		exitcode=$?
+		if [ ${exitcode} -ne 0 ]; then
+			fn_print_fail_eol_nl
+			fn_script_log_fatal "Creating web directory ${webdir}"
+			core_exit.sh
 		else
 		else
-			clearoldfastdl="off"; fn_script_log "clearoldfastdl disabled"; fn_print_ok "Clearing Disabled"
+			fn_print_ok_eol_nl
+			fn_script_log_pass "Creating web directory ${webdir}"
 		fi
 		fi
-		echo -en "\n"
+		sleep 0.5
 	fi
 	fi
-	# Prompt for using bzip2 if it's installed
-	if [ ${bzip2installed} == 1 ]; then
-		fn_print_dots
-		if fn_prompt_yn "Enable file compression using bzip2?" Y; then
-			bzip2enable="on"; fn_script_log "bzip2 enabled"; fn_print_ok "bzip2 Enabled"
+	if [ ! -d "${fastdldir}" ]; then
+		echo -en "creating fastdl directory ${fastdldir}..."
+		mkdir -p "${fastdldir}"
+		exitcode=$?
+		if [ ${exitcode} -ne 0 ]; then
+			fn_print_fail_eol_nl
+			fn_script_log_fatal "Creating fastdl directory ${fastdldir}"
+			core_exit.sh
 		else
 		else
-			bzip2enable="off"; fn_script_log "bzip2 disabled"; fn_print_ok "bzip2 Disabled"
+			fn_print_ok_eol_nl
+			fn_script_log_pass "Creating fastdl directory ${fastdldir}"
 		fi
 		fi
-		echo -en "\n"
+		sleep 0.5
 	fi
 	fi
 }
 }
 
 
-fn_fastdl_gmod_config(){
-	# Prompt for download enforcer, that is using a .lua addfile resource generator
-	fn_print_dots
-	if fn_prompt_yn "Use client download enforcer?" Y; then
-		luaressource="on"; fn_script_log "DL enforcer Enabled"; fn_print_ok "Enforcer Enabled"
-	else
-		luaressource="off"; fn_script_log "DL enforcer Disabled"; fn_print_ok "Enforcer Disabled"
-	fi
-	echo -en "\n"
+# Using this gist https://gist.github.com/agunnerson-ibm/efca449565a3e7356906
+fn_human_readable_file_size(){
+    local abbrevs=(
+        $((1 << 60)):ZB
+        $((1 << 50)):EB
+        $((1 << 40)):TB
+        $((1 << 30)):GB
+        $((1 << 20)):MB
+        $((1 << 10)):KB
+        $((1)):bytes
+    )
+
+    local bytes="${1}"
+    local precision="${2}"
+
+    if [[ "${bytes}" == "1" ]]; then
+        echo "1 byte"
+    else
+        for item in "${abbrevs[@]}"; do
+            local factor="${item%:*}"
+            local abbrev="${item#*:}"
+            if [[ "${bytes}" -ge "${factor}" ]]; then
+                local size="$(bc -l <<< "${bytes} / ${factor}")"
+                printf "%.*f %s\n" "${precision}" "${size}" "${abbrev}"
+                break
+            fi
+        done
+    fi
 }
 }
 
 
-fn_clear_old_fastdl(){
-	# Clearing old FastDL if user answered yes
-	if [ "${clearoldfastdl}" == "on" ]; then
-		fn_print_info "Clearing existing FastDL directory"
-		fn_script_log "Clearing existing FastDL directory"
+# Provides info about the fastdl directory content and prompts for confirmation
+fn_fastdl_preview(){
+	# Remove any file list
+	if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then
+		rm -f "${tmpdir}/fastdl_files_to_compress.txt"
+	fi
+	echo -e "analysing required files"
+	fn_script_log_info "Analysing required files"
+	# Garry's Mod
+	if [ "${gamename}" == "Garry's Mod" ]; then
+		cd "${systemdir}" || exit
+		allowed_extentions_array=( "*.ain" "*.bsp" "*.mdl" "*.mp3" "*.ogg" "*.otf" "*.pcf" "*.phy" "*.png" "*.vtf" "*.vmt" "*.vtx" "*.vvd" "*.ttf" "*.wav" )
+		for allowed_extention in "${allowed_extentions_array[@]}"; do
+			fileswc=0
+			tput sc
+			while read -r ext; do
+				((fileswc++))
+				tput rc; tput el
+				printf "gathering ${allowed_extention} : ${fileswc}..."
+				echo "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
+			done < <(find . -type f -iname ${allowed_extention})
+			if [ ${fileswc} != 0 ]; then
+				fn_print_ok_eol_nl
+			fi
+		done
+	# Source engine
+	else
+		fastdl_directories_array=( "maps" "materials" "models" "particles" "sounds" "resources" )
+		for directory in "${fastdl_directories_array[@]}"; do
+			if [ -d "${systemdir}/${directory}" ]; then
+				if [ "${directory}" == "maps" ]; then
+					local allowed_extentions_array=( "*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt" )
+				elif [ "${directory}" == "materials" ]; then
+					local allowed_extentions_array=( "*.vtf" "*.vmt" "*.vbf" )
+				elif [ "${directory}" == "models" ]; then
+					local allowed_extentions_array=( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" )
+				elif [ "${directory}" == "particles" ]; then
+					local allowed_extentions_array=( "*.pcf" )
+				elif [ "${directory}" == "sounds" ]; then
+					local allowed_extentions_array=( "*.wav" "*.mp3" "*.ogg" )
+				fi
+				for allowed_extention in "${allowed_extentions_array[@]}"; do
+					fileswc=0
+					tput sc
+					while read -r ext; do
+						((fileswc++))
+						tput rc; tput el
+						printf "gathering ${directory} ${allowed_extention} : ${fileswc}..."
+						echo "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
+					done < <(find "${systemdir}/${directory}" -type f -iname ${allowed_extention})
+					tput rc; tput el
+					printf "gathering ${directory} ${allowed_extention} : ${fileswc}..."
+					if [ ${fileswc} != 0 ]; then
+						fn_print_ok_eol_nl
+					fi
+				done
+			fi
+		done
+	fi
+	if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then
+		echo "calculating total file size..."
 		sleep 0.5
 		sleep 0.5
-		rm -R "${fastdldir:?}"/*
-		fn_print_ok "Old FastDL directory cleared"
-		fn_script_log "Old FastDL directory cleared"
-		sleep 1
-		echo -en "\n"
+		totalfiles=$(wc -l < "${tmpdir}/fastdl_files_to_compress.txt")
+		# Calculates total file size
+		while read dufile; do
+			filesize=$(stat -c %s "${dufile}")
+			filesizetotal=$(( ${filesizetotal} + ${filesize} ))
+			exitcode=$?
+			if [ "${exitcode}" != 0 ]; then
+				fn_print_fail_eol_nl
+				fn_script_log_fatal "Calculating total file size."
+				core_exit.sh
+			fi
+		done <"${tmpdir}/fastdl_files_to_compress.txt"
+	else
+		fn_print_fail_eol_nl "generating file list"
+		fn_script_log_fatal "Generating file list."
+		core_exit.sh
+	fi
+	echo "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)"
+	rm "${tmpdir}/fastdl_files_to_compress.txt"
+	if ! fn_prompt_yn "Continue?" Y; then
+		fn_script_log "User exited"
+		core_exit.sh
 	fi
 	fi
 }
 }
 
 
-fn_gmod_fastdl(){
-	# Copy all needed files for FastDL
-	echo ""
-	fn_print_dots "Starting gathering all needed files"
-	fn_script_log "Starting gathering all needed files"
-	sleep 1
-	echo -en "\n"
-
-	# No choice to cd to the directory, as find can't then display relative directory
-	cd "${systemdir}"
-
-	# Map Files
-	fn_print_dots "Copying map files..."
-	fn_script_log "Copying map files"
-	sleep 0.5
-	find . -name '*.bsp' | cpio --quiet -updm "${fastdldir}"
-	find . -name '*.ain' | cpio --quiet -updm "${fastdldir}"
-	fn_print_ok "Map files copied"
-	sleep 0.5
-	echo -en "\n"
-
-	# Materials
-	fn_print_dots "Copying materials..."
-	fn_script_log "Copying materials"
-	sleep 0.5
-	find . -name '*.vtf' | cpio --quiet -updm "${fastdldir}"
-	find . -name '*.vmt' | cpio --quiet -updm "${fastdldir}"
-	fn_print_ok "Materials copied"
-	sleep 0.5
-	echo -en "\n"
-
-	# Models
-	fn_print_dots "Copying models..."
-	fn_script_log "Copying models"
-	sleep 1
-	find . -name '*.vtx' | cpio --quiet -updm "${fastdldir}"
-	find . -name '*.vvd' | cpio --quiet -updm "${fastdldir}"
-	find . -name '*.mdl' | cpio --quiet -updm "${fastdldir}"
-	find . -name '*.phy' | cpio --quiet -updm "${fastdldir}"
-	fn_print_ok "Models copied"
-	sleep 0.5
-	echo -en "\n"
-
-	# Particles
-	fn_print_dots "Copying particles..."
-	fn_script_log "Copying particles"
-	sleep 0.5
-	find . -name '*.pcf' | cpio --quiet -updm "${fastdldir}"
-	fn_print_ok "Particles copied"
-	sleep 0.5
-	echo -en "\n"
-
-	# Sounds
-	fn_print_dots "Copying sounds..."
-	fn_script_log "Copying sounds"
-	sleep 0.5
-	find . -name '*.wav' | cpio --quiet -updm "${fastdldir}"
-	find . -name '*.mp3' | cpio --quiet -updm "${fastdldir}"
-	find . -name '*.ogg' | cpio --quiet -updm "${fastdldir}"
-	fn_print_ok "Sounds copied"
-	sleep 0.5
-	echo -en "\n"
-
-	# Resources (mostly fonts)
-	fn_print_dots "Copying fonts and png..."
-	fn_script_log "Copying fonts and png"
-	sleep 1
-	find . -name '*.otf' | cpio --quiet -updm "${fastdldir}"
-	find . -name '*.ttf' | cpio --quiet -updm "${fastdldir}"
-	find . -name '*.png' | cpio --quiet -updm "${fastdldir}"
-	fn_print_ok "Fonts and png copied"
-	sleep 0.5
-	echo -en "\n"
-
-	# Going back to rootdir in order to prevent mistakes
-	cd "${rootdir}"
-
+# Builds Garry's Mod fastdl directory content
+fn_fastdl_gmod(){
+	cd "${systemdir}" || exit
+	for allowed_extention in "${allowed_extentions_array[@]}"
+	do
+		fileswc=0
+		tput sc
+		while read -r fastdlfile; do
+			((fileswc++))
+			tput rc; tput el
+			printf "copying ${allowed_extention} : ${fileswc}..."
+			cp --parents "${fastdlfile}" "${fastdldir}"
+			exitcode=$?
+			if [ ${exitcode} -ne 0 ]; then
+				fn_print_fail_eol_nl
+				fn_script_log_fatal "Copying ${fastdlfile} > ${fastdldir}"
+				core_exit.sh
+			else
+				fn_script_log_pass "Copying ${fastdlfile} > ${fastdldir}"
+			fi
+		done < <(find . -type f -iname ${allowed_extention})
+		if [ ${fileswc} != 0 ]; then
+			fn_print_ok_eol_nl
+		fi
+	done
 	# Correct addons directory structure for FastDL
 	# Correct addons directory structure for FastDL
 	if [ -d "${fastdldir}/addons" ]; then
 	if [ -d "${fastdldir}/addons" ]; then
-		fn_print_info "Adjusting addons' file structure"
-		fn_script_log "Adjusting addon's file structure"
-		sleep 1
+		echo -en "updating addons file structure..."
 		cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}"
 		cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}"
-	#Don't remove yet	rm -R "${fastdldir:?}/addons"
-		fn_print_ok "Adjusted addon's file structure"
+		exitcode=$?
+		if [ ${exitcode} -ne 0 ]; then
+			fn_print_fail_eol_nl
+			fn_script_log_fatal "Updating addons file structure"
+			core_exit.sh
+		else
+			fn_print_ok_eol_nl
+			fn_script_log_pass "Updating addons file structure"
+		fi
+		# Clear addons directory in fastdl
+		echo -en "clearing addons dir from fastdl dir..."
 		sleep 1
 		sleep 1
-		echo -en "\n"
+		rm -R "${fastdldir:?}/addons"
+		exitcode=$?
+		if [ ${exitcode} -ne 0 ]; then
+			fn_print_fail_eol_nl
+			fn_script_log_fatal "Clearing addons dir from fastdl dir"
+			core_exit.sh
+		else
+			fn_print_ok_eol_nl
+			fn_script_log_pass "Clearing addons dir from fastdl dir"
+		fi
 	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
-		fn_print_dots "Typical DarkRP shit detected, fixing"
+		echo -en "correcting DarkRP files..."
 		sleep 2
 		sleep 2
 		cp -Rf "${fastdldir}/lua/"* "${fastdldir}"
 		cp -Rf "${fastdldir}/lua/"* "${fastdldir}"
-		fn_print_ok "Stupid DarkRP file structure fixed"
-		sleep 2
-		echo -en "\n"
+		exitcode=$?
+		if [ ${exitcode} -ne 0 ]; then
+			fn_print_fail_eol_nl
+			fn_script_log_fatal "Correcting DarkRP files"
+			core_exit.sh
+		else
+			fn_print_ok_eol_nl
+			fn_script_log_pass "Correcting DarkRP files"
+		fi
+	fi
+	if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then
+		totalfiles=$(wc -l < "${tmpdir}/fastdl_files_to_compress.txt")
+		# Calculates total file size
+		while read dufile; do
+			filesize=$(du -b "${dufile}"| awk '{ print $1 }')
+			filesizetotal=$(( ${filesizetotal} + ${filesize} ))
+		done <"${tmpdir}/fastdl_files_to_compress.txt"
 	fi
 	fi
 }
 }
 
 
-# Generate lua file that will force download any file into the FastDL directory
-fn_lua_fastdl(){
-	# Remove lua file if luaressource is turned off and file exists
-	echo ""
-	if [ "${luaressource}" == "off" ]; then
-		if [ -f "${luafastdlfullpath}" ]; then
-			fn_print_dots "Removing download enforcer"
-			sleep 1
-			rm -R "${luafastdlfullpath:?}"
-			fn_print_ok "Removed download enforcer"
-			fn_script_log "Removed old download inforcer"
-			echo -en "\n"
-			sleep 2
+fn_fastdl_source(){
+	for directory in "${fastdl_directories_array[@]}"
+	do
+		if [ -d "${systemdir}/${directory}" ]; then
+			if [ "${directory}" == "maps" ]; then
+				local allowed_extentions_array=( "*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt" )
+			elif [ "${directory}" == "materials" ]; then
+				local allowed_extentions_array=( "*.vtf" "*.vmt" "*.vbf" )
+			elif [ "${directory}" == "models" ]; then
+				local allowed_extentions_array=( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" )
+			elif [ "${directory}" == "particles" ]; then
+				local allowed_extentions_array=( "*.pcf" )
+			elif [ "${directory}" == "sounds" ]; then
+				local allowed_extentions_array=( "*.wav" "*.mp3" "*.ogg" )
+			fi
+			for allowed_extention in "${allowed_extentions_array[@]}"
+			do
+				fileswc=0
+				tput sc
+				while read -r fastdlfile; do
+					((fileswc++))
+					tput rc; tput el
+					printf "copying ${directory} ${allowed_extention} : ${fileswc}..."
+					sleep 0.01
+					if [ ! -d "${fastdldir}/${directory}" ]; then
+						mkdir "${fastdldir}/${directory}"
+					fi
+					cp "${fastdlfile}" "${fastdldir}/${directory}"
+					exitcode=$?
+					if [ "${exitcode}" -ne 0 ]; then
+						fn_print_fail_eol_nl
+						fn_script_log_fatal "Copying ${fastdlfile} > ${fastdldir}/${directory}"
+						core_exit.sh
+					else
+						fn_script_log_pass "Copying ${fastdlfile} > ${fastdldir}/${directory}"
+					fi
+				done < <(find "${systemdir}/${directory}" -type f -iname ${allowed_extention})
+				if [ ${fileswc} != 0 ]; then
+					fn_print_ok_eol_nl
+				fi
+			done
 		fi
 		fi
+	done
+}
+
+# Builds the fastdl directory content
+fn_fastdl_build(){
+	# Copy all needed files for FastDL
+	echo -e "copying files to ${fastdldir}"
+	fn_script_log_info "Copying files to ${fastdldir}"
+	if [ "${gamename}" == "Garry's Mod" ]; then
+		fn_fastdl_gmod
+		fn_fastdl_gmod_dl_enforcer
+	else
+		fn_fastdl_source
 	fi
 	fi
-	# Remove old lua file and generate a new one if user said yes
-	if [ "${luaressource}" == "on" ]; then
-		if [ -f "${luafastdlfullpath}" ]; then
-			fn_print_dots "Removing old download enforcer"
-			sleep 1
-			rm "${luafastdlfullpath}"
-			fn_print_ok "Removed old download enforcer"
-			fn_script_log "Removed old download enforcer"
-			echo -en "\n"
-			sleep 1
+}
+
+# Generate lua file that will force download any file into the FastDL directory
+fn_fastdl_gmod_dl_enforcer(){
+	# Clear old lua file
+	if [ -f "${luafastdlfullpath}" ]; then
+		echo -en "removing existing download enforcer: ${luafastdlfile}..."
+		rm "${luafastdlfullpath:?}"
+		exitcode=$?
+		if [ "${exitcode}" -ne 0 ]; then
+			fn_print_fail_eol_nl
+			fn_script_log_fatal "Removing existing download enforcer ${luafastdlfullpath}"
+			core_exit.sh
+		else
+			fn_print_ok_eol_nl
+			fn_script_log_pass "Removing existing download enforcer ${luafastdlfullpath}"
 		fi
 		fi
-		fn_print_dots "Generating new download enforcer"
-		fn_script_log "Generating new download enforcer"
-		sleep 1
+	fi
+	# Generate new one if user said yes
+	if [ "${luaresource}" == "on" ]; then
+		echo -en "creating new download enforcer: ${luafastdlfile}..."
+		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
-		find "${fastdldir}" \( -type f ! -name "*.bz2" \) -printf '%P\n' | while read line; do
-			echo "resource.AddFile( "\""${line}"\"" )" >> ${luafastdlfullpath}
-		done
-		fn_print_ok "Download enforcer generated"
-		fn_script_log "Download enforcer generated"
-		echo -en "\n"
-		echo ""
-		sleep 2
+		while read line; do
+			echo "resource.AddFile( \"${line}\" )" >> "${luafastdlfullpath}"
+		done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \) -printf '%P\n')
+		exitcode=$?
+		if [ "${exitcode}" -ne 0 ]; then
+			fn_print_fail_eol_nl
+			fn_script_log_fatal "Creating new download enforcer ${luafastdlfullpath}"
+			core_exit.sh
+		else
+			fn_print_ok_eol_nl
+			fn_script_log_pass "Creating new download enforcer ${luafastdlfullpath}"
+		fi
 	fi
 	fi
 }
 }
 
 
+# Compresses FastDL files using bzip2
 fn_fastdl_bzip2(){
 fn_fastdl_bzip2(){
-	# Compressing using bzip2 if user said yes
-	echo ""
-	if [ ${bzip2enable} == "on" ]; then
-		fn_print_info "Have a break, this step could take a while..."
-		echo -en "\n"
-		echo ""
-		fn_print_dots "Compressing files using bzip2..."
-		fn_script_log "Compressing files using bzip2..."
-		# bzip2 all files that are not already compressed (keeping original files)
-		find "${fastdldir}" \( -type f ! -name "*.bz2" \) -exec bzip2 -qk \{\} \;
-		fn_print_ok "bzip2 compression done"
-		fn_script_log "bzip2 compression done"
-		sleep 1
-		echo -en "\n"
-	fi
-}
-
-fn_fastdl_completed(){
-	# Finished message
-	echo ""
-	fn_print_ok "Congratulations, it's done!"
-	fn_script_log "FastDL job done"
-	sleep 2
-	echo -en "\n"
-	echo ""
-	fn_print_info "Need more documentation? See https://github.com/GameServerManagers/LinuxGSM/wiki/FastDL"
-	echo -en "\n"
-	if [ "$bzip2installed" == "0" ]; then
-	echo "By the way, you'd better install bzip2 and re-run this command!"
-	fi
-	echo "Credits : UltimateByte"
+	while read -r filetocompress; do
+		echo -en "\r\033[Kcompressing ${filetocompress}..."
+		bzip2 -f "${filetocompress}"
+		exitcode=$?
+		if [ "${exitcode}" -ne 0 ]; then
+			fn_print_fail_eol_nl
+			fn_script_log_fatal "Compressing ${filetocompress}"
+			core_exit.sh
+		else
+			fn_script_log_pass "Compressing ${filetocompress}"
+		fi
+	done < <(find  "${fastdldir:?}" \( -type f ! -name "*.bz2" \))
+	fn_print_ok_eol_nl
 }
 }
 
 
-# Game checking and functions running
-# Garry's Mod
-if [ "${gamename}" == "Garry's Mod" ]; then
-	fn_check_bzip2
-	fn_fastdl_init
-	fn_fastdl_config
-	fn_fastdl_gmod_config
-	fn_clear_old_fastdl
-	fn_gmod_fastdl
-	fn_lua_fastdl
-	fn_fastdl_bzip2
-	fn_fastdl_completed
-	exit
-fi
+# Run functions
+fn_fastdl_preview
+fn_clear_old_fastdl
+fn_fastdl_dirs
+fn_fastdl_build
+fn_fastdl_bzip2
+# Finished message
+echo "FastDL files are located in:"
+echo "${fastdldir}"
+echo "FastDL completed"
+fn_script_log_info "FastDL completed"
+core_exit.sh

+ 6 - 6
lgsm/functions/command_start.sh

@@ -85,15 +85,15 @@ fn_start_tmux(){
 
 
 	# tmux pipe-pane not supported in tmux versions < 1.6
 	# tmux pipe-pane not supported in tmux versions < 1.6
 	if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then
 	if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then
-		echo "Console logging disabled: Tmux => 1.6 required" >> "${consolelog}"
-		echo "https://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
-		echo "Currently installed: $(tmux -V)" >> "${consolelog}"
+		echo "Console logging disabled: Tmux => 1.6 required
+		https://gameservermanagers.com/tmux-upgrade
+		Currently installed: $(tmux -V)" > "${consolelog}"
 
 
 	# Console logging disabled: Bug in tmux 1.8 breaks logging
 	# Console logging disabled: Bug in tmux 1.8 breaks logging
 	elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ]; then
 	elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ]; then
-		echo "Console logging disabled: Bug in tmux 1.8 breaks logging" >> "${consolelog}"
-		echo "https://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
-		echo "Currently installed: $(tmux -V)" >> "${consolelog}"
+		echo "Console logging disabled: Bug in tmux 1.8 breaks logging
+		https://gameservermanagers.com/tmux-upgrade
+		Currently installed: $(tmux -V)" > "${consolelog}"
 
 
 	# Console logging enable or not set
 	# Console logging enable or not set
 	elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
 	elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then

+ 7 - 33
lgsm/functions/command_stop.sh

@@ -231,9 +231,9 @@ fn_stop_graceful_mta(){
 fn_stop_graceful_select(){
 fn_stop_graceful_select(){
 	if [ "${gamename}" == "7 Days To Die" ]; then
 	if [ "${gamename}" == "7 Days To Die" ]; then
 		fn_stop_graceful_sdtd
 		fn_stop_graceful_sdtd
-	elif [ "${gamename}" == "Factorio" ]||[ "${engine}" == "unreal4" ]||[ "${engine}" == "unreal3" ]||[ "${engine}" == "unreal2" ]||[ "${engine}" == "unreal" ]; then
+	elif [ "${gamename}" == "Factorio" ]||[ "${gamename}" == "Minecraft" ]||[ "${gamename}" == "Multi Theft Auto" ]||[ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal4" ]||[ "${engine}" == "unreal3" ]||[ "${engine}" == "unreal2" ]||[ "${engine}" == "unreal" ]||[ "${gamename}" == "Mumble" ]; then
 		fn_stop_graceful_ctrlc
 		fn_stop_graceful_ctrlc
-	elif  [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]; then
+	elif  [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${engine}" == "Just Cause 2" ]; then
 		fn_stop_graceful_quit
 		fn_stop_graceful_quit
 	elif [ "${engine}" == "goldsource" ]; then
 	elif [ "${engine}" == "goldsource" ]; then
 		fn_stop_graceful_goldsource
 		fn_stop_graceful_goldsource
@@ -272,7 +272,7 @@ fn_stop_ark(){
 			pid=${pid//[!0-9]/}
 			pid=${pid//[!0-9]/}
 			let pid+=0 # turns an empty string into a valid number, '0',
 			let pid+=0 # turns an empty string into a valid number, '0',
 			# and a valid numeric pid remains unchanged.
 			# and a valid numeric pid remains unchanged.
-			if [ "${pid}" -gt 1 && "${pid}" -le $(cat /proc/sys/kernel/pid_max) ]; then
+			if [ "${pid}" -gt 1 ]&&[ "${pid}" -le $(cat /proc/sys/kernel/pid_max) ]; then
 			fn_print_dots "Process still bound. Awaiting graceful exit: ${pidcheck}"
 			fn_print_dots "Process still bound. Awaiting graceful exit: ${pidcheck}"
 				sleep 1
 				sleep 1
 			else
 			else
@@ -290,8 +290,8 @@ fn_stop_ark(){
 
 
 fn_stop_teamspeak3(){
 fn_stop_teamspeak3(){
 	fn_print_dots "${servername}"
 	fn_print_dots "${servername}"
-	sleep 1
-	${filesdir}/ts3server_startscript.sh stop > /dev/null 2>&1
+	sleep 0.5
+	"${filesdir}"/ts3server_startscript.sh stop > /dev/null 2>&1
 	check_status.sh
 	check_status.sh
 	if [ "${status}" == "0" ]; then
 	if [ "${status}" == "0" ]; then
 		# Remove lockfile
 		# Remove lockfile
@@ -304,29 +304,10 @@ fn_stop_teamspeak3(){
 	fi
 	fi
 }
 }
 
 
-fn_stop_mumble(){
-	# Get needed port info
-	info_config.sh
-	fn_print_dots "Stopping ${servername}"
-	mumblepid=$(netstat -nap  2>/dev/null | grep udp | grep "${port}" | grep murmur | awk '{ print $6 }' | awk -F'/' '{ print $1 }')
-	kill ${mumblepid}
-	sleep 1
-	check_status.sh
-	if [ "${status}" == "0" ]; then
-		# Remove lockfile
-		rm -f "${rootdir}/${lockselfname}"
-		fn_stop_tmux
-		fn_script_log_pass "Stopped ${servername}"
-	else
-		fn_print_fail_nl "Unable to stop ${servername}"
-		fn_script_log_error "Unable to stop ${servername}"
-	fi
-}
-
 fn_stop_tmux(){
 fn_stop_tmux(){
 	fn_print_dots "${servername}"
 	fn_print_dots "${servername}"
 	fn_script_log_info "tmux kill-session: ${servername}"
 	fn_script_log_info "tmux kill-session: ${servername}"
-	sleep 1
+	sleep 0.5
 	# Kill tmux session
 	# Kill tmux session
 	tmux kill-session -t "${servicename}" > /dev/null 2>&1
 	tmux kill-session -t "${servicename}" > /dev/null 2>&1
 	sleep 0.5
 	sleep 0.5
@@ -357,13 +338,6 @@ fn_stop_pre_check(){
 		else
 		else
 			fn_stop_teamspeak3
 			fn_stop_teamspeak3
 		fi
 		fi
-	elif [ "${gamename}" == "Mumble" ]; then
-		if [ "${status}" == "0" ]; then
-			fn_print_info_nl "${servername} is already stopped"
-			fn_script_log_error "${servername} is already stopped"
-		else
-		fn_stop_mumble
-		fi
 	else
 	else
 		if [ "${status}" == "0" ]; then
 		if [ "${status}" == "0" ]; then
 			fn_print_info_nl "${servername} is already stopped"
 			fn_print_info_nl "${servername} is already stopped"
@@ -375,7 +349,7 @@ fn_stop_pre_check(){
 }
 }
 
 
 fn_print_dots "${servername}"
 fn_print_dots "${servername}"
-sleep 1
+sleep 0.5
 check.sh
 check.sh
 info_config.sh
 info_config.sh
 fn_stop_pre_check
 fn_stop_pre_check

+ 2 - 5
lgsm/functions/command_ts3_server_pass.sh

@@ -6,15 +6,12 @@
 # Description: Changes TS3 serveradmin password.
 # Description: Changes TS3 serveradmin password.
 
 
 local commandname="TS3-CHANGE-PASS"
 local commandname="TS3-CHANGE-PASS"
-local commandaction="TS3 Change Password"
+local commandaction="ServerAdmin Password Change"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
 
 
 fn_serveradmin_password_prompt(){
 fn_serveradmin_password_prompt(){
-	echo ""
-	echo "${gamename} ServerAdmin Password Change"
-	echo "================================="
-	echo ""
+	fn_print_header
 	echo "Press \"CTRL+b d\" to exit console."
 	echo "Press \"CTRL+b d\" to exit console."
 	fn_print_information_nl "You are about to change the ${gamename} ServerAdmin password."
 	fn_print_information_nl "You are about to change the ${gamename} ServerAdmin password."
 	fn_print_warning_nl "${gamename} will restart during this process."
 	fn_print_warning_nl "${gamename} will restart during this process."

+ 19 - 6
lgsm/functions/command_wipe.sh

@@ -45,11 +45,24 @@ fn_wipe_server_remove_files(){
 	# Rust Wipe
 	# Rust Wipe
 	if [ "${gamename}" == "Rust" ]; then
 	if [ "${gamename}" == "Rust" ]; then
 		if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then
 		if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then
-			currentaction="Removing map file(s): ${serveridentitydir}/proceduralmap.*.sav"
-			echo -en "Removing map proceduralmap.*.sav file(s)..."
+			currentaction="Removing map save(s): ${serveridentitydir}/proceduralmap.*.sav"
+			echo -en "Removing map saves proceduralmap.*.sav file(s)..."
 			sleep 1
 			sleep 1
 			fn_script_log "${currentaction}"
 			fn_script_log "${currentaction}"
-			find "${serveridentitydir}" -type f -name "proceduralmap.*.sav" -delete
+			find "${serveridentitydir:?}" -type f -name "proceduralmap.*.sav" -delete
+			fn_wipe_exit_code
+			sleep 0.5
+		else
+			fn_print_information_nl "No map save to remove"
+			fn_script_log_info "No map save to remove."
+			sleep 0.5
+		fi
+		if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then
+			currentaction="Removing map file(s): ${serveridentitydir}/proceduralmap.*.map"
+			echo -en "Removing map proceduralmap.*.map file(s)..."
+			sleep 1
+			fn_script_log "${currentaction}"
+			find "${serveridentitydir:?}" -type f -name "proceduralmap.*.map" -delete
 			fn_wipe_exit_code
 			fn_wipe_exit_code
 			sleep 0.5
 			sleep 0.5
 		else
 		else
@@ -62,7 +75,7 @@ fn_wipe_server_remove_files(){
 			echo -en "Removing user directory..."
 			echo -en "Removing user directory..."
 			sleep 1
 			sleep 1
 			fn_script_log "${currentaction}"
 			fn_script_log "${currentaction}"
-			rm -rf "${serveridentitydir}/user"
+			rm -rf "${serveridentitydir:?}/user"
 			fn_wipe_exit_code
 			fn_wipe_exit_code
 			sleep 0.5
 			sleep 0.5
 		else
 		else
@@ -75,7 +88,7 @@ fn_wipe_server_remove_files(){
 			echo -en "Removing storage directory..."
 			echo -en "Removing storage directory..."
 			sleep 1
 			sleep 1
 			fn_script_log "${currentaction}"
 			fn_script_log "${currentaction}"
-			rm -rf "${serveridentitydir}/storage"
+			rm -rf "${serveridentitydir:?}/storage"
 			fn_wipe_exit_code
 			fn_wipe_exit_code
 			sleep 0.5
 			sleep 0.5
 		else
 		else
@@ -88,7 +101,7 @@ fn_wipe_server_remove_files(){
 			echo -en "Removing Log files..."
 			echo -en "Removing Log files..."
 			sleep 1
 			sleep 1
 			fn_script_log "${currentaction}"
 			fn_script_log "${currentaction}"
-			find "${serveridentitydir}" -type f -name "Log.*.txt" -delete
+			find "${serveridentitydir:?}" -type f -name "Log.*.txt" -delete
 			fn_wipe_exit_code
 			fn_wipe_exit_code
 			sleep 0.5
 			sleep 0.5
 		else
 		else

+ 1 - 3
lgsm/functions/compress_unreal2_maps.sh

@@ -8,9 +8,7 @@ local commandaction="Unreal Map Compressor"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
 check.sh
 check.sh
-clear
-echo "${gamename} Map Compressor"
-echo "================================="
+fn_print_header
 echo "Will compress all maps in:"
 echo "Will compress all maps in:"
 echo ""
 echo ""
 pwd
 pwd

+ 1 - 3
lgsm/functions/compress_ut99_maps.sh

@@ -8,9 +8,7 @@ local commandaction="Unreal Map Compressor"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
 check.sh
 check.sh
-clear
-echo "${gamename} Map Compressor"
-echo "================================="
+fn_print_header
 echo "Will compress all maps in:"
 echo "Will compress all maps in:"
 echo ""
 echo ""
 pwd
 pwd

+ 155 - 948
lgsm/functions/core_getopt.sh

@@ -6,977 +6,184 @@
 
 
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
-fn_getopt_generic(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	fu|force-update|update-restart)
-		forceupdate=1;
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	v|validate)
-		command_validate.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	mi|mods-install)
-		command_mods_install.sh;;
-	mu|mods-update)
-		command_mods_update.sh;;
-	mr|mods-remove)
-		command_mods_remove.sh;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
+### Define all commands here ###
+## User commands | Trigger commands | Description
+# Standard commands
+cmd_install=( "i;install" "command_install.sh" "Install the server." )
+cmd_auto_install=( "ai;auto-install" "fn_autoinstall" "Install the server without prompts." )
+cmd_start=( "st;start" "command_start.sh" "Start the server." )
+cmd_stop=( "sp;stop" "command_stop.sh" "Stop the server." )
+cmd_restart=( "r;restart" "command_restart.sh" "Restart the server." )
+cmd_details=( "dt;details" "command_details.sh" "Display server information." )
+cmd_postdetails=( "pd;postdetails" "command_postdetails.sh" "Post details to hastebin (removing passwords)." )
+cmd_backup=( "b;backup" "command_backup.sh" "Create backup archives of the server." )
+cmd_update_functions=( "ul;update-lgsm;uf;update-functions" "command_update_functions.sh" "Update LinuxGSM functions." )
+cmd_test_alert=( "ta;test-alert" "command_test_alert.sh" "Send a test alert." )
+cmd_monitor=( "m;monitor" "command_monitor.sh" "Check server status and restart if crashed." )
+# Console servers only
+cmd_console=( "c;console" "command_console.sh" "Access server console." )
+cmd_debug=( "d;debug" "command_debug.sh" "Start server directly in your terminal." )
+# Update servers only
+cmd_update=( "u;update" "command_update.sh" "Check and apply any updates." )
+cmd_force_update=( "fu;force-update;update-restart;ur" "forceupdate=1; command_update.sh" "Bypass update check and apply any updates." )
+# SteamCMD servers only
+cmd_validate=( "v;validate" "command_validate.sh" "Validate server files with SteamCMD." )
+# Server with mods-install
+cmd_mods_install=( "mi;mods-install" "command_mods_install.sh" "View and install available mods/addons." )
+cmd_mods_remove=( "mr;mods-remove" "command_mods_remove.sh" "View and remove an installed mod/addon." )
+cmd_mods_update=( "mu;mods-update" "command_mods_update.sh" "Update installed mods/addons." )
+# Server specific
+cmd_change_password=( "pw;change-password" "command_ts3_server_pass.sh" "Change TS3 serveradmin password." )
+cmd_install_default_resources=( "ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources." )
+cmd_wipe=( "wi;wipe" "command_wipe.sh" "Wipe your server data." )
+cmd_map_compressor_u99=( "mc;map-compressor" "compress_ut99_maps.sh" "Compresses all ${gamename} server maps." )
+cmd_map_compressor_u2=( "mc;map-compressor" "compress_unreal2_maps.sh" "Compresses all ${gamename} server maps." )
+cmd_install_cdkey=( "cd;server-cd-key" "install_ut2k4_key.sh" "Add your server cd key." )
+cmd_install_dst_token=( "ct;cluster-token" "install_dst_token.sh" "Configure cluster token." )
+cmd_fastdl=( "fd;fastdl" "command_fastdl.sh" "Build a FastDL directory." )
+# Dev commands
+cmd_dev_debug=( "dev;developer" "command_dev_debug.sh" "Enable developer Mode." )
+cmd_dev_detect_deps=( "dd;detect-deps" "command_dev_detect_deps.sh" "Detect required dependencies." )
+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." )
+
+### Set specific opt here ###
+
+currentopt=( "${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monitor[@]}" "${cmd_test_alert[@]}" "${cmd_details[@]}" "${cmd_postdetails[@]}" )
+
+# Exclude noupdate games here
+if [ "${gamename}" != "Battlefield: 1942" ]&&[ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]; then
+	currentopt+=( "${cmd_update[@]}" )
+	# force update for SteamCMD only
+	if [ -n "${appid}" ]; then
+		currentopt+=( "${cmd_force_update[@]}" )
 	fi
 	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}u  |Checks and applies updates from SteamCMD."
-		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}validate\t${default}v  |Validate server files with SteamCMD."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-		echo -e "${blue}mods-install\t${default}mi |View and install available mods/addons."
-		echo -e "${blue}mods-update\t${default}mu |Update installed mods/addons."
-		echo -e "${blue}mods-remove\t${default}mr |Remove installed mods/addons."
-	} | column -s $'\t' -t
-	esac
-}
+fi
 
 
-fn_getopt_generic_update_no_steam(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}u  |Checks and applies updates."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-	} | column -s $'\t' -t
-	esac
-}
+# Validate command
+if [ -n "${appid}" ]; then
+	currentopt+=( "${cmd_validate[@]}" )
+fi
 
 
-fn_getopt_generic_no_update(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
-		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-	} | column -s $'\t' -t
-	esac
-}
+# Update LGSM
+currentopt+=( "${cmd_update_functions[@]}" )
 
 
-fn_getopt_teamspeak3(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	pw|change-password)
-		command_ts3_server_pass.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}u  |Checks and applies updates from teamspeak.com."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
-		echo -e "${blue}change-password\t${default}pw |Changes TS3 serveradmin password."
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-	} | column -s $'\t' -t
-	esac
-}
+#Backup
+currentopt+=( "${cmd_backup[@]}" )
 
 
-fn_getopt_minecraft(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}u  |Checks and applies updates from mojang.com."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
-		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-	} | column -s $'\t' -t
-	esac
-}
 
 
-fn_getopt_mta(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	fu|force-update|update-restart)
-		forceupdate=1;
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ir|install-default-resources)
-		command_install_resources_mta.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}u  |Checks and applies updates from linux.mtasa.com."
-		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from linux.mtasa.com."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
-		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-		echo -e "${blue}install-default-resources\t${default}ir |Install the MTA default resources."
-	} | column -s $'\t' -t
-	esac
-}
+# Exclude games without a console
+if [ "${gamename}" != "TeamSpeak 3" ]; then
+	currentopt+=( "${cmd_console[@]}" "${cmd_debug[@]}" )
+fi
 
 
-fn_getopt_mumble(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	c|console)
-		command_console.sh;;
-	i|install)
-		command_install.sh;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}u  |Checks and applies updates from GitHub."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-	} | column -s $'\t' -t
-	esac
-}
+## Game server exclusive commands
 
 
-fn_getopt_dstserver(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	fu|force-update|update-restart)
-		forceupdate=1;
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	v|validate)
-		command_validate.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	ct|cluster-token)
-		install_dst_token.sh;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}u  |Checks and applies updates from SteamCMD."
-		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}validate\t${default}v  |Validate server files with SteamCMD."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-		echo -e "${blue}cluster-token\t${default}ct |Configure cluster token."
-	} | column -s $'\t' -t
-	esac
-}
+# FastDL command
+if [ "${engine}" == "source" ]; then
+	currentopt+=( "${cmd_fastdl[@]}" )
+fi
 
 
-fn_getopt_gmodserver(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	fu|force-update|update-restart)
-		forceupdate=1;
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	v|validate)
-		command_validate.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	fd|fastdl)
-		command_fastdl.sh;;
-	mi|mods-install)
-		command_mods_install.sh;;
-	mu|mods-update)
-		command_mods_update.sh;;
-	mr|mods-remove)
-		command_mods_remove.sh;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}u  |Checks and applies updates from SteamCMD."
-		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}validate\t${default}v  |Validate server files with SteamCMD."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-		echo -e "${blue}fastdl\t${default}fd |Generates or update a FastDL directory for your server."
-		echo -e "${blue}mods-install\t${default}mi |View and install available mods/addons."
-		echo -e "${blue}mods-update\t${default}mu |Update installed mods/addons."
-		echo -e "${blue}mods-remove\t${default}mr |Remove installed mods/addons."
-	} | column -s $'\t' -t
-	esac
-}
+# TeamSpeak exclusive
+if [ "${gamename}" == "TeamSpeak 3" ]; then
+	currentopt+=( "${cmd_change_password[@]}" )
+fi
 
 
-fn_getopt_rustserver(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	fu|force-update|update-restart)
-		forceupdate=1;
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	v|validate)
-		command_validate.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	mi|mods-install)
-		command_mods_install.sh;;
-	mu|mods-update)
-		command_mods_update.sh;;
-	mr|mods-remove)
-		command_mods_remove.sh;;
-	wi|wipe)
-		command_wipe.sh;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
+# Unreal exclusive
+if [ "${gamename}" == "Rust" ]; then
+	currentopt+=( "${cmd_wipe[@]}" )
+fi
+if [ "${engine}" == "unreal2" ]; then
+	if [ "${gamename}" == "Unreal Tournament 2004" ]; then
+		currentopt+=( "${cmd_install_cdkey[@]}" "${cmd_map_compressor_u2[@]}" )
+	else
+		currentopt+=( "${cmd_map_compressor_u2[@]}" )
 	fi
 	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}u  |Checks and applies updates from SteamCMD."
-		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}validate\t${default}v  |Validate server files with SteamCMD."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-		echo -e "${blue}mods-install\t${default}mi |View and install available mods/addons."
-		echo -e "${blue}mods-update\t${default}mu |Update installed mods/addons."
-		echo -e "${blue}mods-remove\t${default}mr |Remove installed mods/addons."
-		echo -e "${blue}wipe\t${default}wi |Wipe your Rust server."
-	} | column -s $'\t' -t
-	esac
-}
+fi
+if [ "${engine}" == "unreal" ]; then
+	currentopt+=( "${cmd_map_compressor_u99[@]}" )
+fi
 
 
-fn_getopt_unreal(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	mc|map-compressor)
-		compress_ut99_maps.sh;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-		echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
-	} | column -s $'\t' -t
-	esac
-}
+# DST exclusive
+if [ "${gamename}" == "Don't Starve Together" ]; then
+	currentopt+=( "${cmd_install_dst_token[@]}" )
+fi
 
 
+# MTA exclusive
+if [ "${gamename}" == "Multi Theft Auto" ]; then
+	currentopt+=( "${cmd_install_default_resources[@]}" )
+fi
 
 
-fn_getopt_unreal2(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	u|update)
-		command_update.sh;;
-	fu|force-update|update-restart)
-		forceupdate=1;
-		command_update.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	v|validate)
-		command_validate.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	mc|map-compressor)
-		compress_unreal2_maps.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
-	echo "Usage: $0 [option]"
-	echo "${gamename} - Linux Game Server Manager - Version ${version}"
-	echo "https://gameservermanagers.com/${selfname}"
-	echo -e ""
-	echo -e "${lightyellow}Commands${default}"
-	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update\t${default}Checks and applies updates from SteamCMD."
-		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}validate\t${default}v  |Validate server files with SteamCMD."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-		echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
-	} | column -s $'\t' -t
-	esac
-}
+## Mods commands
+if [ "${engine}" == "source" ]||[ "${gamename}" == "Rust" ]||[ "${gamename}" == "Hurtworld" ]||[ "${gamename}" == "7 Days To Die" ]; then
+	currentopt+=( "${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}" )
+fi
 
 
+## Installer
+currentopt+=( "${cmd_install[@]}" "${cmd_auto_install[@]}" )
 
 
-fn_getopt_ut2k4(){
-case "${getopt}" in
-	st|start)
-		command_start.sh;;
-	sp|stop)
-		command_stop.sh;;
-	r|restart)
-		command_restart.sh;;
-	uf|update-functions)
-		command_update_functions.sh;;
-	m|monitor)
-		command_monitor.sh;;
-	ta|test-alert)
-		command_test_alert.sh;;
-	dt|details)
-		command_details.sh;;
-	b|backup)
-		command_backup.sh;;
-	c|console)
-		command_console.sh;;
-	d|debug)
-		command_debug.sh;;
-	dev|dev-debug)
-		command_dev_debug.sh;;
-	i|install)
-		command_install.sh;;
-	ai|auto-install)
-		fn_autoinstall;;
-	cd|server-cd-key)
-		install_ut2k4_key.sh;;
-	mc|map-compressor)
-		compress_unreal2_maps.sh;;
-	dd|detect-deps)
-		command_dev_detect_deps.sh;;
-	dg|detect-glibc)
-		command_dev_detect_glibc.sh;;
-	dl|detect-ldd)
-		command_dev_detect_ldd.sh;;
-	*)
-	if [ -n "${getopt}" ]; then
-		echo -e "${red}Unknown command${default}: $0 ${getopt}"
-		exitcode=2
-	fi
+## Developer commands
+currentopt+=( "${cmd_dev_debug[@]}" )
+if [ -f ".dev-debug" ]; then
+	currentopt+=(  "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" )
+fi
+
+### Build list of available commands
+optcommands=()
+index="0"
+for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
+	cmdamount="$(echo "${currentopt[index]}"| awk -F ';' '{ print NF }')"
+	for ((cmdindex=1; cmdindex <= ${cmdamount}; cmdindex++)); do
+		optcommands+=( "$(echo "${currentopt[index]}"| awk -F ';' -v x=${cmdindex} '{ print $x }')" )
+	done
+done
+
+# Shows LinuxGSM usage
+fn_opt_usage(){
 	echo "Usage: $0 [option]"
 	echo "Usage: $0 [option]"
+	echo -e ""
 	echo "${gamename} - Linux Game Server Manager - Version ${version}"
 	echo "${gamename} - Linux Game Server Manager - Version ${version}"
 	echo "https://gameservermanagers.com/${selfname}"
 	echo "https://gameservermanagers.com/${selfname}"
 	echo -e ""
 	echo -e ""
 	echo -e "${lightyellow}Commands${default}"
 	echo -e "${lightyellow}Commands${default}"
+	# Display available commands
+	index="0"
 	{
 	{
-		echo -e "${blue}start\t${default}st |Start the server."
-		echo -e "${blue}stop\t${default}sp |Stop the server."
-		echo -e "${blue}restart\t${default}r  |Restart the server."
-		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
-		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
-		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
-		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}backup\t${default}b  |Create archive of the server."
-		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
-		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
-		echo -e "${blue}install\t${default}i  |Install the server."
-		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
-		echo -e "${blue}server-cd-key\t${default}cd |Add your server cd key"
-		echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
+	for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
+		# Hide developer commands
+		if [ "${currentopt[index+2]}" != "DEVCOMMAND" ]; then
+			echo -e "${cyan}$(echo "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index+2]}"
+		fi
+	done
 	} | column -s $'\t' -t
 	} | column -s $'\t' -t
-	esac
+	core_exit.sh
 }
 }
 
 
-# Don't Starve Together
-if [ "${gamename}" == "Don't Starve Together" ]; then
-	fn_getopt_dstserver
-# Garry's Mod
-elif [ "${gamename}" == "Garry's Mod" ]; then
-	fn_getopt_gmodserver
-# Minecraft
-elif [ "${engine}" == "lwjgl2" ]; then
-	fn_getopt_minecraft
-# Multi Theft Auto
-elif [ "${gamename}" == "Multi Theft Auto" ]; then
-	fn_getopt_mta
-# Mumble
-elif [ "${gamename}" == "Mumble" ]; then
-	fn_getopt_mumble
-# Teamspeak 3
-elif [ "${gamename}" == "TeamSpeak 3" ]; then
-	fn_getopt_teamspeak3
-elif [ "${gamename}" == "Rust" ]; then
-	fn_getopt_rustserver
-# Unreal 2 Engine
-elif [ "${engine}" == "unreal2" ]; then
-	if [ "${gamename}" == "Unreal Tournament 2004" ]; then
-		fn_getopt_ut2k4
-	else
-		fn_getopt_unreal2
-	fi
-# Unreal Engine
-elif [ "${engine}" == "unreal" ]; then
-	fn_getopt_unreal
-# Generic
-elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty 4" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
-	fn_getopt_generic_no_update
-elif  [ "${gamename}" == "Factorio" ]; then
-	fn_getopt_generic_update_no_steam
-else
-	fn_getopt_generic
+### Check if user commands exist and run corresponding scripts, or display script usage
+if [ -z "${getopt}" ]; then
+	fn_opt_usage
 fi
 fi
-core_exit.sh
+# Command exists
+for i in "${optcommands[@]}"; do
+	if [ "${i}" == "${getopt}" ] ; then
+		# Seek and run command
+		index="0"
+		for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
+			currcmdamount="$(echo "${currentopt[index]}"| awk -F ';' '{ print NF }')"
+			for ((currcmdindex=1; currcmdindex <= ${currcmdamount}; currcmdindex++)); do
+				if [ "$(echo "${currentopt[index]}"| awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
+					# Run command
+					${currentopt[index+1]}
+					core_exit.sh
+					break
+				fi
+			done
+		done
+	fi
+done
+
+# If we're executing this, it means command was not found
+echo -e "${red}Unknown command${default}: $0 ${getopt}"
+exitcode=2
+fn_opt_usage
+core_exit.sh

+ 80 - 51
lgsm/functions/info_config.sh

@@ -49,6 +49,29 @@ fn_info_config_ark(){
 	fi
 	fi
 }
 }
 
 
+fn_info_config_ballistic_overkill(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		servername="${unavailable}"
+		serverpassword="${unavailable}"
+		port="${zero}"
+		queryport="${zero}"
+		maxplayers="${unavailable}"
+	else
+		servername=$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		serverpassword=$(grep "Password=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		port=$(grep "ServerPort=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+		queryport=$((port + 1))
+		maxplayers=$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+		# Not Set
+		servername=${servername:-"NOT SET"}
+		serverpassword=${serverpassword:-"NOT SET"}
+		port=${port:-"0"}
+		queryport=${queryport:-"0"}
+		maxplayers=${maxplayers:-"NOT SET"}
+	fi
+}
+
 fn_info_config_bf1942(){
 fn_info_config_bf1942(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
 		servername="${unavailable}"
@@ -227,6 +250,32 @@ fn_info_config_minecraft(){
 	fi
 	fi
 }
 }
 
 
+fn_info_config_projectcars(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		servername="${unavailable}"
+		serverpassword="${unavailable}"
+		maxplayers="${zero}"
+		port="${zero}"
+		queryport="${zero}"
+		steamport="${zero}"
+	else
+		servername=$(grep "name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		serverpassword=$(grep "password " "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		maxplayers=$(grep "MaxPlayers" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+		port=$(grep "hostPort" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+		queryport=$(grep "queryPort" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+		steamport=$(grep "steamPort" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+
+		# Not Set
+		servername=${servername:-"NOT SET"}
+		serverpassword=${serverpassword:-"NOT SET"}
+		maxplayers=${maxplayers:-"NOT SET"}
+		port=${port:-"NOT SET"}
+		queryport=${queryport:-"NOT SET"}
+		steamport=${steamport:-"NOT SET"}
+	fi
+}
+
 fn_info_config_projectzomboid(){
 fn_info_config_projectzomboid(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
 		servername="${unavailable}"
@@ -315,33 +364,6 @@ fn_info_config_quakelive(){
 	fi
 	fi
 }
 }
 
 
-fn_info_config_wolfensteinenemyterritory(){
-	if [ ! -f "${servercfgfullpath}" ]; then
-		rconpassword="${unavailable}"
-		servername="${unavailable}"
-		serverpassword="${unavailable}"
-		maxplayers="${zero}"
-		port="${zero}"
-	else
-		port=$(grep "set net_port" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
-		rconpassword=$(grep "set zmq_rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set zmq_rcon_password //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//g' -e '/^\//d' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
-		servername=$(grep "set sv_hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
-		serverpassword=$(grep "set g_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set g_password //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
-		maxplayers=$(grep "set sv_maxclients" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
-
-		ip=$(grep "set net_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set net_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
-		ipsetinconfig=1
-		ipinconfigvar="set net_ip"
-
-		# Not Set
-		rconpassword=${rconpassword:-"NOT SET"}
-		servername=${servername:-"NOT SET"}
-		serverpassword=${serverpassword:-"NOT SET"}
-		maxplayers=${maxplayers:-"0"}
-		port=${port:-"27960"}
-	fi
-}
-
 fn_info_config_realvirtuality(){
 fn_info_config_realvirtuality(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
 		servername="${unavailable}"
@@ -568,29 +590,6 @@ fn_info_config_unreal(){
 	fi
 	fi
 }
 }
 
 
-fn_info_config_ballistic_overkill(){
-	if [ ! -f "${servercfgfullpath}" ]; then
-		servername="${unavailable}"
-		serverpassword="${unavailable}"
-		port="${zero}"
-		queryport="${zero}"
-		maxplayers="${unavailable}"
-	else
-		servername=$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
-		serverpassword=$(grep "Password=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
-		port=$(grep "ServerPort=" "${servercfgfullpath}" | tr -cd '[:digit:]')
-		queryport=$((port + 1))
-		maxplayers=$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')
-
-		# Not Set
-		servername=${servername:-"NOT SET"}
-		serverpassword=${serverpassword:-"NOT SET"}
-		port=${port:-"0"}
-		queryport=${queryport:-"0"}
-		maxplayers=${maxplayers:-"NOT SET"}
-	fi
-}
-
 fn_info_config_sdtd(){
 fn_info_config_sdtd(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
 		servername="${unavailable}"
@@ -663,7 +662,7 @@ fn_info_config_mta(){
 			ase="Disabled"
 			ase="Disabled"
 		fi
 		fi
 
 
-		ip=$(grep -m 1 "serverip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<serverip>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]')
+		ip=$(grep -m 1 "serverip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<serverip>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<")
 		ipsetinconfig=1
 		ipsetinconfig=1
 		ipinconfigvar="serverip"
 		ipinconfigvar="serverip"
 
 
@@ -677,6 +676,33 @@ fn_info_config_mta(){
 	fi
 	fi
 }
 }
 
 
+fn_info_config_wolfensteinenemyterritory(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		rconpassword="${unavailable}"
+		servername="${unavailable}"
+		serverpassword="${unavailable}"
+		maxplayers="${zero}"
+		port="${zero}"
+	else
+		port=$(grep "set net_port" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+		rconpassword=$(grep "set zmq_rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set zmq_rcon_password //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//g' -e '/^\//d' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		servername=$(grep "set sv_hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		serverpassword=$(grep "set g_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set g_password //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		maxplayers=$(grep "set sv_maxclients" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+
+		ip=$(grep "set net_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set net_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		ipsetinconfig=1
+		ipinconfigvar="set net_ip"
+
+		# Not Set
+		rconpassword=${rconpassword:-"NOT SET"}
+		servername=${servername:-"NOT SET"}
+		serverpassword=${serverpassword:-"NOT SET"}
+		maxplayers=${maxplayers:-"0"}
+		port=${port:-"27960"}
+	fi
+}
+
 # Just Cause 2
 # Just Cause 2
 if [ "${engine}" == "avalanche" ]; then
 if [ "${engine}" == "avalanche" ]; then
 	fn_info_config_avalanche
 	fn_info_config_avalanche
@@ -719,6 +745,9 @@ elif [ "${gamename}" == "Quake Live" ]; then
 # Minecraft
 # Minecraft
 elif [ "${engine}" == "lwjgl2" ]; then
 elif [ "${engine}" == "lwjgl2" ]; then
 	fn_info_config_minecraft
 	fn_info_config_minecraft
+# Project Cars
+elif [ "${gamename}" == "Project Cars" ]; then
+	fn_info_config_projectcars
 # Project Zomboid
 # Project Zomboid
 elif [ "${engine}" == "projectzomboid" ]; then
 elif [ "${engine}" == "projectzomboid" ]; then
 	fn_info_config_projectzomboid
 	fn_info_config_projectzomboid

+ 3 - 0
lgsm/functions/info_glibc.sh

@@ -65,6 +65,9 @@ elif [ "${gamename}" == "Mumble" ]; then
 elif [ "${gamename}" == "No More Room in Hell" ]; then
 elif [ "${gamename}" == "No More Room in Hell" ]; then
 	glibcrequired="2.15"
 	glibcrequired="2.15"
 	glibcfix="yes"
 	glibcfix="yes"
+elif [ "${gamename}" == "Project Cars" ]; then
+	glibcrequired="2.4"
+	glibcfix="no"
 elif [ "${gamename}" == "Quake 2" ]; then
 elif [ "${gamename}" == "Quake 2" ]; then
 	glibcrequired="NOT REQUIRED"
 	glibcrequired="NOT REQUIRED"
 	glibcfix="no"
 	glibcfix="no"

+ 6 - 0
lgsm/functions/install_config.sh

@@ -395,6 +395,12 @@ elif [ "${gamename}" == "Project Zomboid" ]; then
 	fn_fetch_default_config
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_default_config_remote
 	fn_set_config_vars
 	fn_set_config_vars
+elif [ "${gamename}" == "Project Cars" ]; then
+	gamedirname="ProjectCars"
+	array_configs+=( server.cfg )
+	fn_fetch_default_config
+	fn_default_config_remote
+	fn_set_config_vars
 elif [ "${gamename}" == "Quake 2" ]; then
 elif [ "${gamename}" == "Quake 2" ]; then
 	gamedirname="Quake2"
 	gamedirname="Quake2"
 	array_configs+=( server.cfg )
 	array_configs+=( server.cfg )

+ 2 - 3
lgsm/functions/install_server_dir.sh

@@ -12,12 +12,11 @@ echo ""
 echo "Server Directory"
 echo "Server Directory"
 echo "================================="
 echo "================================="
 sleep 1
 sleep 1
-echo ""
-pwd
-echo ""
 if [ -d "${filesdir}" ]; then
 if [ -d "${filesdir}" ]; then
 	fn_print_warning_nl "A server is already installed here."
 	fn_print_warning_nl "A server is already installed here."
 fi
 fi
+pwd
+echo ""
 if [ -z "${autoinstall}" ]; then
 if [ -z "${autoinstall}" ]; then
 	if ! fn_prompt_yn "Continue?" Y; then
 	if ! fn_prompt_yn "Continue?" Y; then
 		exit
 		exit

+ 6 - 6
lgsm/functions/mods_core.sh

@@ -42,7 +42,7 @@ fn_mod_lowercase(){
 		echo -ne "converting ${modprettyname} files to lowercase..."
 		echo -ne "converting ${modprettyname} files to lowercase..."
 		sleep 0.5
 		sleep 0.5
 		fn_script_log_info "Converting ${modprettyname} files to lowercase"
 		fn_script_log_info "Converting ${modprettyname} files to lowercase"
-		files=$(find "${extractdir}" -depth | wc -l)
+		fileswc=$(find "${extractdir}" -depth | wc -l)
 		echo -en "\r"
 		echo -en "\r"
 		while read -r src; do
 		while read -r src; do
 			dst=`dirname "${src}"`/`basename "${src}" | tr '[A-Z]' '[a-z]'`
 			dst=`dirname "${src}"`/`basename "${src}" | tr '[A-Z]' '[a-z]'`
@@ -52,10 +52,10 @@ fn_mod_lowercase(){
 				local exitcode=$?
 				local exitcode=$?
 				((renamedwc++))
 				((renamedwc++))
 			fi
 			fi
-			echo -ne "${renamedwc} / ${totalfileswc} / $files converting ${modprettyname} files to lowercase..." $'\r'
+			echo -ne "${renamedwc} / ${totalfileswc} / ${fileswc} converting ${modprettyname} files to lowercase..." $'\r'
 			((totalfileswc++))
 			((totalfileswc++))
 		done < <(find "${extractdir}" -depth)
 		done < <(find "${extractdir}" -depth)
-		echo -ne "${renamedwc} / ${totalfileswc} / $files converting ${modprettyname} files to lowercase..."
+		echo -ne "${renamedwc} / ${totalfileswc} / ${fileswc} converting ${modprettyname} files to lowercase..."
 
 
 		if [ ${exitcode} -ne 0 ]; then
 		if [ ${exitcode} -ne 0 ]; then
 			fn_print_fail_eol_nl
 			fn_print_fail_eol_nl
@@ -346,7 +346,7 @@ fn_mod_compatible_test(){
 fn_create_mods_dir(){
 fn_create_mods_dir(){
 	# Create lgsm data modsdir
 	# Create lgsm data modsdir
 	if [ ! -d "${modsdir}" ];then
 	if [ ! -d "${modsdir}" ];then
-		echo "creating lgsm mods data directory ${modsdir}..."
+		echo -en "creating LinuxGSM mods data directory ${modsdir}..."
 		mkdir -p "${modsdir}"
 		mkdir -p "${modsdir}"
 		exitcode=$?
 		exitcode=$?
 		if [ ${exitcode} -ne 0 ]; then
 		if [ ${exitcode} -ne 0 ]; then
@@ -361,7 +361,7 @@ fn_create_mods_dir(){
 	fi
 	fi
 	# Create mod install directory
 	# Create mod install directory
 	if [ ! -d "${modinstalldir}" ]; then
 	if [ ! -d "${modinstalldir}" ]; then
-		echo "creating mods install directory ${modinstalldir}..."
+		echo -en "creating mods install directory ${modinstalldir}..."
 		mkdir -p "${modinstalldir}"
 		mkdir -p "${modinstalldir}"
 		exitcode=$?
 		exitcode=$?
 		if [ ${exitcode} -ne 0 ]; then
 		if [ ${exitcode} -ne 0 ]; then
@@ -438,7 +438,7 @@ fn_mods_check_installed(){
 	if [ ${installedmodscount} -eq 0 ]; then
 	if [ ${installedmodscount} -eq 0 ]; then
 		echo ""
 		echo ""
 		fn_print_failure_nl "No installed mods or addons were found"
 		fn_print_failure_nl "No installed mods or addons were found"
-		echo " * Install mods using LGSM first with: ./${selfname} mods-install"
+		echo " * Install mods using LinuxGSM first with: ./${selfname} mods-install"
 		fn_script_log_error "No installed mods or addons were found."
 		fn_script_log_error "No installed mods or addons were found."
 		core_exit.sh
 		core_exit.sh
 	fi
 	fi

+ 1 - 1
tests/tests_jc2server.sh

@@ -17,7 +17,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########

+ 1 - 1
tests/tests_ts3server.sh

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170219"
+version="170305"
 
 
 ##########################
 ##########################
 ######## Settings ########
 ######## Settings ########