Browse Source

Merged release/170128 into master

pull/1283/head 170128
Daniel Gibbs 8 years ago
parent
commit
5732ed1b88
  1. 2
      .travis.yml
  2. 3
      7DaysToDie/sdtdserver
  3. 15
      ARKSurvivalEvolved/arkserver
  4. 3
      Arma3/arma3server
  5. 4
      Battlefield1942/bf1942server
  6. 3
      BlackMesa/bmdmserver
  7. 3
      BladeSymphony/bsserver
  8. 3
      BrainBread2/bb2server
  9. 42
      CONTRIBUTING.md
  10. 2
      CallOfDuty/codserver
  11. 3
      CallOfDuty2/cod2server
  12. 3
      CallOfDuty4/cod4server
  13. 3
      CallOfDutyUnitedOffensive/coduoserver
  14. 3
      CallOfDutyWorldAtWar/codwawserver
  15. 5
      CodenameCURE/ccserver
  16. 3
      CounterStrike/csserver
  17. 3
      CounterStrikeConditionZero/csczserver
  18. 3
      CounterStrikeGlobalOffensive/csgoserver
  19. 3
      CounterStrikeSource/cssserver
  20. 3
      DayOfDefeat/dodserver
  21. 3
      DayOfDefeatSource/dodsserver
  22. 3
      DayOfInfamy/doiserver
  23. 3
      DeathmatchClassic/dmcserver
  24. 2
      DontStarveTogether/dstserver
  25. 3
      DoubleActionBoogaloo/dabserver
  26. 3
      EmpiresMod/emserver
  27. 5
      Factorio/fctrserver
  28. 3
      FistfulOfFrags/fofserver
  29. 3
      GarrysMod/gmodserver
  30. 5
      GoldenEyeSource/gesserver
  31. 3
      HalfLife2Deathmatch/hl2dmserver
  32. 3
      HalfLifeDeathmatch/hldmserver
  33. 3
      HalfLifeDeathmatchSource/hldmsserver
  34. 2
      Hurtworld/hwserver
  35. 3
      Insurgency/insserver
  36. 6
      JustCause2/jc2server
  37. 5
      KillingFloor/kfserver
  38. 3
      Left4Dead/l4dserver
  39. 3
      Left4Dead2/l4d2server
  40. 3
      Minecraft/mcserver
  41. 180
      MultiTheftAuto/mtaserver
  42. 3
      Mumble/mumbleserver
  43. 3
      NS2Combat/ns2cserver
  44. 3
      NaturalSelection2/ns2server
  45. 3
      NoMoreRoomInHell/nmrihserver
  46. 3
      OpposingForce/opforserver
  47. 3
      PiratesVikingandKnightsII/pvkiiserver
  48. 2
      ProjectZomboid/pzserver
  49. 2
      Quake2/q2server
  50. 2
      Quake3/q3server
  51. 2
      QuakeLive/qlserver
  52. 3
      QuakeWorld/qwserver
  53. 3
      RedOrchestra/roserver
  54. 6
      Ricochet/ricochetserver
  55. 5
      Rust/rustserver
  56. 2
      SeriousSam3BFE/ss3sserver
  57. 3
      Starbound/sbserver
  58. 3
      SvenCoop/svenserver
  59. 3
      TeamFortress2/tf2server
  60. 3
      TeamFortressClassic/tfcserver
  61. 2
      TeamSpeak3/ts3server
  62. 3
      Teeworlds/twserver
  63. 3
      Terraria/terrariaserver
  64. 3
      UnrealTournament/utserver
  65. 3
      UnrealTournament2004/ut2k4server
  66. 2
      UnrealTournament3/ut3server
  67. 3
      UnrealTournament99/ut99server
  68. 6
      WolfensteinEnemyTerritory/wetserver
  69. 26
      lgsm/functions/check.sh
  70. 20
      lgsm/functions/check_deps.sh
  71. 18
      lgsm/functions/check_executable.sh
  72. 86
      lgsm/functions/check_permissions.sh
  73. 4
      lgsm/functions/command_backup.sh
  74. 29
      lgsm/functions/command_details.sh
  75. 1
      lgsm/functions/command_dev_debug.sh
  76. 4
      lgsm/functions/command_dev_detect_ldd.sh
  77. 4
      lgsm/functions/command_install.sh
  78. 31
      lgsm/functions/command_install_resources_mta.sh
  79. 117
      lgsm/functions/command_mods_install.sh
  80. 137
      lgsm/functions/command_mods_remove.sh
  81. 110
      lgsm/functions/command_mods_update.sh
  82. 32
      lgsm/functions/command_stop.sh
  83. 4
      lgsm/functions/command_update.sh
  84. 1
      lgsm/functions/command_update_functions.sh
  85. 5
      lgsm/functions/command_validate.sh
  86. 134
      lgsm/functions/command_wipe.sh
  87. 12
      lgsm/functions/core_dl.sh
  88. 54
      lgsm/functions/core_functions.sh
  89. 193
      lgsm/functions/core_getopt.sh
  90. 4
      lgsm/functions/core_messages.sh
  91. 10
      lgsm/functions/fix.sh
  92. 6
      lgsm/functions/fix_glibc.sh
  93. 20
      lgsm/functions/fix_mta.sh
  94. 54
      lgsm/functions/info_config.sh
  95. 3
      lgsm/functions/info_glibc.sh
  96. 86
      lgsm/functions/install_config.sh
  97. 37
      lgsm/functions/install_mta_resources.sh
  98. 4
      lgsm/functions/install_server_files.sh
  99. 470
      lgsm/functions/mods_core.sh
  100. 73
      lgsm/functions/mods_list.sh

2
.travis.yml

@ -1,5 +1,5 @@
language: bash
sudo: false
sudo: required
env:
- DISTRO=ubuntu-trusty

3
7DaysToDie/sdtdserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ steampass='password'
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | http://7daystodie.gamepedia.com/Server
fn_parms(){
parms="-logfile ${gamelogdir}/output_log__`date +%Y-%m-%d__%H-%M-%S`.txt -quit -batchmode -nographics -dedicated -configfile=${servercfgfullpath}"
}

15
ARKSurvivalEvolved/arkserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -23,18 +23,15 @@ version="170110"
#### Server Settings ####
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
servername="ark-server"
port="7778"
port="7777"
queryport="27015"
rconport="32330"
rconpassword="" # Set to enable rcon
maxplayers="50"
rconport="27020"
maxplayers="70"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="\"TheIsland?listen?MultiHome=${ip}?SessionName=${servername}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port}?ServerAdminPassword=${rconpassword}\""
parms="\"TheIsland?listen?MultiHome=${ip}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port}?\""
}
#### LinuxGSM Settings ####
@ -82,7 +79,7 @@ githubbranch="master"
## LinuxGSM Server Details
# Do not edit
gamename="ARK: Survivial Evolved"
gamename="ARK: Survival Evolved"
engine="unreal4"
## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers

3
Arma3/arma3server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -46,7 +46,6 @@ servermods=""
bepath=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="-netlog -ip=${ip} -port=${port} -cfg=${networkcfgfullpath} -config=${servercfgfullpath} -mod=${mods} -servermod=${servermods} -bepath=${bepath} -autoinit -loadmissiontomemory"
}

4
Battlefield1942/bf1942server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -22,7 +22,7 @@ version="170110"
#### Server Settings ####
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
fn_parms(){
parms="+hostServer 1 +dedicated 1"
}

3
BlackMesa/bmdmserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -36,7 +36,6 @@ ip="0.0.0.0"
gslt=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game bms -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
BladeSymphony/bsserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -35,7 +35,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-autoupdate -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
BrainBread2/bb2server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -39,7 +39,6 @@ ip="0.0.0.0"
gslt=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game brainbread2 -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

42
CONTRIBUTING.md

@ -0,0 +1,42 @@
# How to contribute to LinuxGSM
We are really glad you're reading this, because if you are then you have shown an interest in helping make LinuxGSM great.
If you haven't already, come find us on [Discord](https://gameservermanagers.com/discord). From there you will have contact with other contributers of the project. We want you working on things you're excited about.
Before working on a project we recommend that you create a issue in regards to the issue/feature. This will prevent duplicates while you work on the feature. If an issue already exists, make note that you are working on it so nobody else wastes their time working on the same project at the same time!
Here are some important resources:
* [Issues Page](https://github.com/GameServerManagers/LinuxGSM/issues) provides a list of areas that could use some work,
* [Developing LGSM](https://github.com/GameServerManagers/LinuxGSM/wiki/Developing-LGSM) gives a detailed guide on developing LGSM,
* [LGSM Exit Codes](https://github.com/GameServerManagers/LinuxGSM/wiki/LGSM-Exit-Codes) describes and gives an explanation for exit codes,
* [gsquery](https://github.com/GameServerManagers/LinuxGSM/wiki/gsquery.py) describes the uses of the gsquery.py file, and
* [Branching](https://github.com/GameServerManagers/LinuxGSM/wiki/Branching) is our final guide to submitting changes.
## Testing
Please make sure all the code you write is working properly **before** you create a pull request. Information on debugging can be found in the following document:
[Developer Commands](https://github.com/GameServerManagers/LinuxGSM/wiki/Developer-Commands)
[Debugging your code](https://github.com/GameServerManagers/LinuxGSM/wiki/Developing-LGSM#testing-and-debugging-your-code)
## Submitting changes
Please send a [GitHub Pull Request to LinuxGSM](https://github.com/GameServerManagers/LinuxGSM/pull/new/develop) with a clear list of what you've done (read more about [pull requests](https://help.github.com/articles/about-pull-requests/)). Please follow our coding conventions (below) and make sure all of your commits are atomic (one feature per commit).
Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:
$ git commit -m "A brief summary of the commit
>
> A paragraph describing what changed and its impact."
This will help us in understanding your code and determining where problems may arise.
## Coding conventions
Start reading our code and you'll get the hang of it. Explore how functions are organized and you'll see how we strive for readable code.
Please give the following document a read and adjust your code according to its specifications.
[Syntax & Coding Conventions](https://github.com/GameServerManagers/LinuxGSM/wiki/Syntax-&-Conventions)

2
CallOfDuty/codserver

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

3
CallOfDuty2/cod2server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -23,7 +23,6 @@ version="170110"
#### Server Settings ####
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
defaultmap="mp_leningrad"
maxclients="20"
port="28960"

3
CallOfDuty4/cod4server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -23,7 +23,6 @@ version="170110"
#### Server Settings ####
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
defaultmap="mp_crossfire"
maxclients="32"
port="28960"

3
CallOfDutyUnitedOffensive/coduoserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -23,7 +23,6 @@ version="170110"
#### Server Settings ####
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
defaultmap="mp_cassino"
maxclients="20"
port="28960"

3
CallOfDutyWorldAtWar/codwawserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -23,7 +23,6 @@ version="170110"
#### Server Settings ####
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
defaultmap="mp_castle"
maxclients="20"
port="28960"

5
CodenameCURE/ccserver

@ -14,12 +14,14 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
##########################
#### Server Settings ####
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
defaultmap="cbe_bunker"
maxplayers="6"
@ -29,7 +31,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game cure -insecure -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
CounterStrike/csserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
fn_parms(){
parms="-game cstrike -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}

3
CounterStrikeConditionZero/csczserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
fn_parms(){
parms="-game czero -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}

3
CounterStrikeGlobalOffensive/csgoserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -54,7 +54,6 @@ gslt=""
# ws_start_map=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game csgo -usercon -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} -tickrate ${tickrate} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers_override ${maxplayers} +mapgroup ${mapgroup} +game_mode ${gamemode} +game_type ${gametype} +host_workshop_collection ${ws_collection_id} +workshop_start_map ${ws_start_map} -authkey ${authkey}"
}

3
CounterStrikeSource/cssserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -37,7 +37,6 @@ updateonstart="off"
gslt=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game cstrike -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
DayOfDefeat/dodserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -31,7 +31,6 @@ ip="0.0.0.0"
updateonstart="off"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
fn_parms(){
parms="-game dod -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}

3
DayOfDefeatSource/dodsserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -31,7 +31,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | ttps://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game dod -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
DayOfInfamy/doiserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -33,7 +33,6 @@ ip="0.0.0.0"
workshop="0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game doi -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} -tickrate ${tickrate} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers} +sv_workshop_enabled ${workshop}"
}

3
DeathmatchClassic/dmcserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
fn_parms(){
parms="-game dmc -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}

2
DontStarveTogether/dstserver

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

3
DoubleActionBoogaloo/dabserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -31,7 +31,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
EmpiresMod/emserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -36,7 +36,6 @@ ip="0.0.0.0"
gslt=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game empires -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

5
Factorio/fctrserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -29,7 +29,6 @@ rconpassword="CHANGE_ME"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="--start-server ${filesdir}/save1.zip --server-settings ${servercfgfullpath} --port ${port} --rcon-port ${rconport} --rcon-password ${rconpassword}"
}
@ -72,7 +71,7 @@ githubbranch="master"
## LinuxGSM Server Details
# Do not edit
gamename="Factorio"
engine=""
engine="factorio"
## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
servicename="fctr-server"

3
FistfulOfFrags/fofserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -31,7 +31,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game fof -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
GarrysMod/gmodserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -46,7 +46,6 @@ customparms="+r_hunkalloclightmaps 0"
gslt=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game garrysmod -strictportbind -ip ${ip} -port ${port} -tickrate ${tickrate} +host_workshop_collection ${workshopcollectionid} -authkey ${workshopauth} +clientport ${clientport} +tv_port ${sourcetvport} +gamemode ${gamemode} +map ${defaultmap} +sv_setsteamaccount ${gslt} +servercfgfile ${servercfg} -maxplayers ${maxplayers} ${customparms}"
}

5
GoldenEyeSource/gesserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -22,7 +22,7 @@ version="170110"
#### Server Settings ####
# Start Variables
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
defaultmap="ge_archives"
maxplayers="16"
port="27015"
@ -31,7 +31,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game gesource -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
HalfLife2Deathmatch/hl2dmserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -31,7 +31,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game hl2mp -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
HalfLifeDeathmatch/hldmserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
fn_parms(){
parms="-game valve -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}

3
HalfLifeDeathmatchSource/hldmsserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -31,7 +31,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game hl1mp -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

2
Hurtworld/hwserver

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

3
Insurgency/insserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -33,7 +33,6 @@ ip="0.0.0.0"
workshop="0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game insurgency -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} -tickrate ${tickrate} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers} +sv_workshop_enabled ${workshop} -norestart"
}

6
JustCause2/jc2server

@ -14,17 +14,13 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
##########################
#### Server Settings ####
# No settings available for Just Cause 2
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms=""
}

5
KillingFloor/kfserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,10 +30,11 @@ steampass='password'
defaultmap="KF-BioticsLab.rom"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
fn_parms(){
parms="server ${defaultmap}?game=KFmod.KFGameType?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}"
# Start Variables for Objective mode
# Server Start Command for Objective mode
#defaultmap="KFO-Steamland"
#parms="server ${defaultmap}?Game=KFStoryGame.KFStoryGame?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}"
}

3
Left4Dead/l4dserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game left4dead -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}

3
Left4Dead2/l4d2server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game left4dead2 -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
Minecraft/mcserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -26,7 +26,6 @@ version="170110"
javaram="1024" # -Xmx$1024M
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="nogui"
}

180
MultiTheftAuto/mtaserver

@ -0,0 +1,180 @@
#!/bin/bash
# Multi Theft Auto
# Server Management Script
# Author: Daniel Gibbs
# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
version="170103"
##########################
######## Settings ########
##########################
#### Server Settings ####
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
# None Available
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms=" "
}
#### LinuxGSM Settings ####
## Notification Alerts
# (on|off)
# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
emailalert="off"
email="[email protected]"
emailfrom=""
# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
pushbulletalert="off"
pushbullettoken="accesstoken"
channeltag=""
## 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 ####
# Github Branch Select
# Allows for the use of different function files
# from a different repo and/or branch.
githubuser="dgibbs64"
githubrepo="linuxgsm"
githubbranch="master"
## LinuxGSM Server Details
# Do not edit
gamename="Multi Theft Auto"
engine="renderware"
## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
servicename="mta-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}"
resourcesdir="${systemdir}/mods/deathmatch/resources"
executabledir="${systemdir}"
executable="./mta-server64"
servercfg="mtaserver.conf"
servercfgdir="${systemdir}/mods/deathmatch"
servercfgfullpath="${servercfgdir}/${servercfg}"
## Backup Directory
backupdir="${rootdir}/backups"
## Logging Directories
gamelogdir="${filesdir}/mods/deathmatch/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 '+%d-%m-%Y-%H-%M-%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%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

3
Mumble/mumbleserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -24,7 +24,6 @@ version="170110"
# Use .ini config file for Mumble (Murmur) server.
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="-fg -ini ${servercfgfullpath}"
}

3
NS2Combat/ns2cserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -42,7 +42,6 @@ password=""
# -password \"${password}\"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | http://wiki.unknownworlds.com/ns2/Dedicated_Server
fn_parms(){
parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser ${webadminuser} -webpassword \"${webadminpass}\" -webport ${webadminport} -map ${defaultmap} -limit ${maxplayers} -config_path \"${servercfgdir}\" -modstorage \"${modstoragedir}\" -mods \"${mods}\""
}

3
NaturalSelection2/ns2server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -42,7 +42,6 @@ password=""
# -password \"${password}\"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | http://wiki.unknownworlds.com/ns2/Dedicated_Server
fn_parms(){
parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser ${webadminuser} -webpassword \"${webadminpass}\" -webport ${webadminport} -map ${defaultmap} -limit ${maxplayers} -config_path \"${servercfgdir}\" -logdir \"${gamelogdir}\" -modstorage \"${modstoragedir}\" -mods \"${mods}\""
}

3
NoMoreRoomInHell/nmrihserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -36,7 +36,6 @@ ip="0.0.0.0"
gslt=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game nmrih -insecure -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +sv_setsteamaccount ${gslt} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
OpposingForce/opforserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
fn_parms(){
parms="-game gearbox -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}

3
PiratesVikingandKnightsII/pvkiiserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -31,7 +31,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game pvkii -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

2
ProjectZomboid/pzserver

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

2
Quake2/q2server

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

2
Quake3/q3server

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

2
QuakeLive/qlserver

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

3
QuakeWorld/qwserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -27,7 +27,6 @@ port="27500"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-port ${port} -game ktx +exec ${servercfg}"
}

3
RedOrchestra/roserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -31,7 +31,6 @@ defaultmap="RO-Arad.rom"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="server ${defaultmap}?game=ROGame.ROTeamGame?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}"
}

6
Ricochet/ricochetserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -22,7 +22,7 @@ version="170110"
#### Server Settings ####
# Start Variables
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
defaultmap="rc_arena"
maxplayers="16"
port="27015"
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
fn_parms(){
parms="-game ricochet -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}
@ -50,7 +49,6 @@ ip="0.0.0.0"
gslt=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms=""
}

5
Rust/rustserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -29,7 +29,7 @@ ip="0.0.0.0"
port="28015"
rconport="28016"
rconpassword="CHANGE_ME"
rconweb="1"
rconweb="1" # Value is: 1 for Facepunch's web panel; 0 for RCON tools like Rusty or Rustadmin
maxplayers="50"
# Advanced Start Settings
seed="" # default random; range : 1 to 2147483647 ; used to change or reproduce a procedural map
@ -38,7 +38,6 @@ saveinterval="300" # Auto-save in seconds
tickrate="30" # default 30; range : 15 to 100
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Rust_Dedicated_Server
fn_parms(){
parms="-batchmode +server.ip ${ip} +server.port ${port} +server.tickrate ${tickrate} +server.hostname \"${servername}\" +server.identity \"${servicename}\" ${conditionalseed} +server.maxplayers ${maxplayers} +server.worldsize ${worldsize} +server.saveinterval ${saveinterval} +rcon.web ${rconweb} +rcon.ip ${ip} +rcon.port ${rconport} +rcon.password \"${rconpassword}\" -logfile ${gamelogfile}"
}

2
SeriousSam3BFE/ss3sserver

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

3
Starbound/sbserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ steampass='password'
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms=""
}

3
SvenCoop/svenserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
fn_parms(){
parms="-game svencoop -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}

3
TeamFortress2/tf2server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -36,7 +36,6 @@ ip="0.0.0.0"
gslt=""
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
fn_parms(){
parms="-game tf -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +sv_setsteamaccount ${gslt} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

3
TeamFortressClassic/tfcserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ clientport="27005"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
fn_parms(){
parms="-game tfc -strictportbind _ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
}

2
TeamSpeak3/ts3server

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

3
Teeworlds/twserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ steampass='password'
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="-f ${servercfgfullpath}"
}

3
Terraria/terrariaserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -30,7 +30,6 @@ steampass='password'
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="-config ${servercfgfullpath}"
}

3
UnrealTournament/utserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -31,7 +31,6 @@ ip="0.0.0.0"
port="7777"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="UnrealTournament ${defaultmap}?Game=${gametype}?TimeLimit=${timelimit} -port=${port}"
}

3
UnrealTournament2004/ut2k4server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -27,7 +27,6 @@ defaultmap="DM-Rankin"
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care |
fn_parms(){
parms="server ${defaultmap}?game=XGame.xDeathMatch -nohomedir ini=${servercfg} log=${gamelog}"
}

2
UnrealTournament3/ut3server

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

3
UnrealTournament99/ut99server

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -27,7 +27,6 @@ defaultmap="DM-Deck16]["
ip="0.0.0.0"
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="server ${defaultmap}.unr ini=${servercfgfullpath}"
}

6
WolfensteinEnemyTerritory/wetserver

@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="170110"
version="170128"
##########################
######## Settings ########
@ -22,11 +22,7 @@ version="170110"
#### Server Settings ####
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
# Please use Enemy Territory config file.
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="+set net_strict 1 +set fs_homepath ${filesdir} +exec ${servercfg}"
}

26
lgsm/functions/check.sh

@ -18,6 +18,14 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ "${function_selfname}"
check_system_dir.sh
fi
local allowed_commands_array=( command_start.sh )
for allowed_command in "${allowed_commands_array[@]}"
do
if [ "${allowed_command}" == "${function_selfname}" ]; then
check_executable.sh
fi
done
local allowed_commands_array=( command_debug.sh command_start.sh command_install.sh )
for allowed_command in "${allowed_commands_array[@]}"
do
@ -26,7 +34,7 @@ do
fi
done
local allowed_commands_array=( command_backup.sh command_console.sh command_debug.sh command_details.sh command_unreal2_maps.sh command_ut99_maps.sh command_monitor.sh command_start.sh command_stop.sh command_update.sh command_validate.sh command_update_functions.sh command_email_test.sh )
local allowed_commands_array=( command_backup.sh command_console.sh command_debug.sh command_details.sh command_unreal2_maps.sh command_ut99_maps.sh command_monitor.sh command_start.sh command_stop.sh command_update.sh command_validate.sh command_update_functions.sh command_email_test.sh command_mods_install.sh command_mods_update.sh command_mods_remove.sh command_wipe.sh )
for allowed_command in "${allowed_commands_array[@]}"
do
if [ "${allowed_command}" == "${function_selfname}" ]; then
@ -42,6 +50,14 @@ do
fi
done
local allowed_commands_array=( command_console.sh command_debug.sh command_details.sh command_monitor.sh command_start.sh command_stop.sh )
for allowed_command in "${allowed_commands_array[@]}"
do
if [ "${allowed_command}" == "${function_selfname}" ]; then
check_config.sh
fi
done
local allowed_commands_array=( command_debug.sh command_details.sh command_monitor.sh command_start.sh command_stop.sh )
for allowed_command in "${allowed_commands_array[@]}"
do
@ -60,13 +76,7 @@ do
fi
done
local allowed_commands_array=( command_console.sh command_debug.sh command_details.sh command_monitor.sh command_start.sh command_stop.sh )
for allowed_command in "${allowed_commands_array[@]}"
do
if [ "${allowed_command}" == "${function_selfname}" ]; then
check_config.sh
fi
done
local allowed_commands_array=( command_details.sh command_monitor.sh command_start.sh command_stop.sh command_ts3_server_pass.sh command_update.sh command_details.sh command_validate.sh )
for allowed_command in "${allowed_commands_array[@]}"

20
lgsm/functions/check_deps.sh

@ -6,8 +6,6 @@
local commandname="CHECK"
fn_deps_detector(){
# Checks if dependency is missing
if [ "${tmuxcheck}" == "1" ]; then
@ -78,7 +76,7 @@ fn_found_missing_deps(){
fn_print_dots "Checking dependencies"
sleep 0.5
fn_print_error_nl "Checking dependencies: missing: ${red}${array_deps_missing[@]}${default}"
fn_script_log_error "Checking dependencies: missing: ${red}${array_deps_missing[@]}${default}"
fn_script_log_error "Checking dependencies: missing: ${array_deps_missing[@]}"
sleep 1
sudo -v > /dev/null 2>&1
if [ $? -eq 0 ]; then
@ -147,7 +145,7 @@ if [ -n "$(command -v dpkg-query)" ]; then
array_deps_missing=()
# LGSM requirements
array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip )
array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip )
# All servers except ts3 require tmux
if [ "${gamename}" != "TeamSpeak 3" ]; then
@ -158,8 +156,8 @@ if [ -n "$(command -v dpkg-query)" ]; then
fi
fi
# All servers except ts3,mumble and minecraft servers require libstdc++6 and lib32gcc1
if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${engine}" != "lwjgl2" ]; then
# All servers except ts3,mumble,multitheftauto and minecraft servers require libstdc++6 and lib32gcc1
if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${engine}" != "lwjgl2" ]&&[ "${engine}" != "renderware" ]; then
if [ "${arch}" == "x86_64" ]; then
array_deps_required+=( lib32gcc1 libstdc++6:i386 )
else
@ -204,7 +202,7 @@ if [ -n "$(command -v dpkg-query)" ]; then
array_deps_required+=( zlib1g:i386 libldap-2.4-2:i386 )
# Serious Sam 3: BFE
elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
array_deps_required+=( libxrandr2:i386 libglu1-mesa:i386 libxtst6:i386 libusb-1.0-0-dev:i386 libxxf86vm1:i386 libopenal1:i386 libssl1.0.0:i386 libgtk2.0-0:i386 libdbus-glib-1-2:i386 libnm-glib-dev:i386 )
array_deps_required+=( libxrandr2:i386 libglu1-mesa:i386 libxtst6:i386 libusb-1.0-0-dev:i386 libxxf86vm1:i386 libopenal1:i386 libssl1.0.0:i386 libgtk2.0-0:i386 libdbus-glib-1-2:i386 libnm-glib-dev:i386 )
# Unreal Engine
elif [ "${executable}" == "./ucc-bin" ]; then
#UT2K4
@ -227,9 +225,9 @@ elif [ -n "$(command -v yum)" ]; then
# LGSM requirements
if [ "${distroversion}" == "6" ]; then
array_deps_required=( curl wget util-linux-ng python file gzip bzip2 )
array_deps_required=( curl wget util-linux-ng python file gzip bzip2 unzip )
else
array_deps_required=( curl wget util-linux python file gzip bzip2 )
array_deps_required=( curl wget util-linux python file gzip bzip2 unzip )
fi
# All servers except ts3 require tmux
@ -241,8 +239,8 @@ elif [ -n "$(command -v yum)" ]; then
fi
fi
# All servers except ts3,mumble and minecraft servers require glibc.i686 and libstdc++.i686
if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${engine}" != "lwjgl2" ]; then
# All servers except ts3,mumble,multitheftauto and minecraft servers require glibc.i686 and libstdc++.i686
if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${engine}" != "lwjgl2" ]&&[ "${engine}" != "renderware" ]; then
array_deps_required+=( glibc.i686 libstdc++.i686 )
fi

18
lgsm/functions/check_executable.sh

@ -0,0 +1,18 @@
#!/bin/bash
# LGSM check_system_dir.sh function
# Author: Daniel Gibbs
# Website: https://gameservermanagers.com
# Description: Checks if systemdir is accessible.
local commandname="CHECK"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
# Check if executable exists
if [ ! -f "${executabledir}/${execname}" ]; then
fn_script_log_warn "Expected executable not found: ${executabledir}/${execname}"
if [ -d "${scriptlogdir}" ]; then
fn_print_fail_nl "Executable ${execname} was not found"
fi
exitcode="1"
core_exit.sh
fi

86
lgsm/functions/check_permissions.sh

@ -126,5 +126,91 @@ fn_check_permissions(){
fi
}
## The following fn_sys_perm_* functions checks for permission errors in /sys directory
# Checks for permission errors in /sys directory
fn_sys_perm_errors_detect(){
# Reset test variables
sysdirpermerror="0"
classdirpermerror="0"
netdirpermerror="0"
# Check permissions
# /sys, /sys/class and /sys/class/net should be readable & executable
if [ ! -r "/sys" ]||[ ! -x "/sys" ]; then
sysdirpermerror="1"
fi
if [ ! -r "/sys/class" ]||[ ! -x "/sys/class" ]; then
classdirpermerror="1"
fi
if [ ! -r "/sys/class/net" ]||[ ! -x "/sys/class/net" ]; then
netdirpermerror="1"
fi
}
# Display a message on how to fix the issue manually
fn_sys_perm_fix_manually_msg(){
echo ""
fn_print_information_nl "This error causes servers to fail starting properly"
fn_script_log_info "This error causes servers to fail starting properly."
echo " * To fix this issue, run the following command as root:"
fn_script_log_info "To fix this issue, run the following command as root:"
echo " chmod a+rx /sys /sys/class /sys/class/net"
fn_script_log "chmod a+rx /sys /sys/class /sys/class/net"
sleep 1
core_exit.sh
}
# Attempt to fix /sys related permission errors if sudo is available, exits otherwise
fn_sys_perm_errors_fix(){
sudo -v > /dev/null 2>&1
if [ $? -eq 0 ]; then
fn_print_dots "Automatically fixing /sys permissions"
sleep 2
fn_script_log_info "Automatically fixing /sys permissions."
if [ "${sysdirpermerror}" == "1" ]; then
sudo chmod a+rx "/sys"
fi
if [ "${classdirpermerror}" == "1" ]; then
sudo chmod a+rx "/sys/class"
fi
if [ "${netdirpermerror}" == "1" ]; then
sudo chmod a+rx "/sys/class/net"
fi
# Run check again to see if it's fixed
fn_sys_perm_errors_detect
if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then
fn_print_error "Could not fix /sys permissions"
fn_script_log_error "Could not fix /sys permissions."
sleep 1
# Show the user how to fix
fn_sys_perm_fix_manually_msg
else
fn_print_ok_nl "Automatically fixing /sys permissions"
fn_script_log_pass "Permissions in /sys fixed"
sleep 1
fi
else
# Show the user how to fix
fn_sys_perm_fix_manually_msg
fi
}
# Processes to the /sys related permission errors check & fix/info
fn_sys_perm_error_process(){
fn_sys_perm_errors_detect
# If any error was found
if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then
fn_print_error_nl "Permission error(s) found in /sys"
fn_script_log_error "Permission error(s) found in /sys"
sleep 1
# Run the fix
fn_sys_perm_errors_fix
fi
}
# Run perm error detect & fix/alert functions on /sys directories
## Run checks
fn_check_ownership
fn_check_permissions
fn_sys_perm_error_process

4
lgsm/functions/command_backup.sh

@ -16,12 +16,12 @@ fn_backup_trap(){
echo ""
echo -ne "backup ${backupname}.tar.gz..."
fn_print_canceled_eol_nl
fn_script_log_info "backup ${backupname}.tar.gz: CANCELED"
fn_script_log_info "Backup ${backupname}.tar.gz: CANCELED"
sleep 1
rm -f "${backupdir}/${backupname}.tar.gz" | tee -a "${scriptlog}"
echo -ne "backup ${backupname}.tar.gz..."
fn_print_removed_eol_nl
fn_script_log_info "backup ${backupname}.tar.gz: REMOVED"
fn_script_log_info "Backup ${backupname}.tar.gz: REMOVED"
# Remove lock file
rm -f "${tmpdir}/.backup.lock"
core_exit.sh

29
lgsm/functions/command_details.sh

@ -168,6 +168,11 @@ fn_details_gameserver(){
echo -e "${blue}dbplugin:\t${default}${dbplugin}"
fi
# ASE (Multi Theft Auto)
if [ -n "${ase}" ]; then
echo -e "${blue}ASE:\t${default}${ase}"
fi
# Online status
if [ "${status}" == "0" ]; then
echo -e "${blue}Status:\t${red}OFFLINE${default}"
@ -310,7 +315,7 @@ fn_details_ports(){
parmslocation="${red}UNKNOWN${default}"
# engines/games that require editing in the config file
local ports_edit_array=( "avalanche" "dontstarve" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "projectzomboid" "quake" "refractor" "seriousengine35" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" )
local ports_edit_array=( "avalanche" "dontstarve" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "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[@]}"
do
if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
@ -726,6 +731,18 @@ fn_details_wolfensteinenemyterritory(){
} | column -s $'\t' -t
}
fn_details_mta(){
echo -e "netstat -atunp | grep mta-server64"
echo -e ""
{
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Game\tOUTBOUND\t${port}\tudp"
echo -e "> HTTP Server\tINBOUND\t${httpport}\ttcp"
if [ "${ase}" == "Enabled" ]; then
echo -e "> ASE Game_Monitor\tOUTBOUND\t$((${port} + 123))\tudp"
fi
} | column -s $'\t' -t
}
# Run checks and gathers details to display.
@ -742,7 +759,7 @@ fn_display_details() {
fn_details_script
fn_details_backup
# Some game servers do not have parms.
if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then
if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]&&[ "${engine}" != "renderware" ]; then
fn_parms
fn_details_commandlineparms
fi
@ -781,7 +798,7 @@ fn_display_details() {
fn_details_ut3
elif [ "${gamename}" == "7 Days To Die" ]; then
fn_details_sdtd
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
elif [ "${gamename}" == "ARK: Survival Evolved" ]; then
fn_details_ark
elif [ "${gamename}" == "Call of Duty" ]; then
fn_details_cod
@ -793,6 +810,8 @@ fn_display_details() {
fn_details_cod4
elif [ "${gamename}" == "Call of Duty: World at War" ]; then
fn_details_codwaw
elif [ "${gamename}" == "Factorio" ]; then
fn_details_factorio
elif [ "${gamename}" == "Hurtworld" ]; then
fn_details_hurtworld
elif [ "${gamename}" == "QuakeWorld" ]; then
@ -805,14 +824,14 @@ fn_display_details() {
fn_details_quakelive
elif [ "${gamename}" == "TeamSpeak 3" ]; then
fn_details_teamspeak3
elif [ "${gamename}" == "Multi Theft Auto" ]; then
fn_details_mta
elif [ "${gamename}" == "Mumble" ]; then
fn_details_mumble
elif [ "${gamename}" == "Rust" ]; then
fn_details_rust
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
fn_details_wolfensteinenemyterritory
elif [ "${gamename}" == "Factorio" ]; then
fn_details_factorio
else
fn_print_error_nl "Unable to detect server engine."
fi

1
lgsm/functions/command_dev_debug.sh

@ -8,7 +8,6 @@ local commandname="DEV-DEBUG"
local commandaction="Dev-Debug"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
if [ -f "${rootdir}/.dev-debug" ]; then
rm "${rootdir}/.dev-debug"
fn_print_ok_nl "Disabled dev-debug"

4
lgsm/functions/command_dev_detect_ldd.sh

@ -22,8 +22,8 @@ elif [ -f "${filesdir}" ]; then
fi
echo ""
files=$(find ${filesdir} | wc -l)
find ${filesdir} -type f -print0 |
files=$(find "${filesdir}" | wc -l)
find "${filesdir}" -type f -print0 |
while IFS= read -r -d $'\0' line; do
#ldd -v $line 2>/dev/null|grep "=>" >>"${tmpdir}/detect_ldd.tmp"
if [ -n "$(ldd $line 2>/dev/null |grep -v "not a dynamic executable")" ]; then

4
lgsm/functions/command_install.sh

@ -18,7 +18,7 @@ check_deps.sh
if [ "${gamename}" == "Unreal Tournament 2004" ]; then
install_server_files.sh
install_ut2k4_key.sh
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}" == "Factorio" ]||[ "${gamename}" == "Minecraft" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament" ]||[ "${gamename}" == "Unreal Tournament 3" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
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}" == "Factorio" ]||[ "${gamename}" == "Minecraft" ]||[ "${gamename}" == "Multi Theft Auto" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament" ]||[ "${gamename}" == "Unreal Tournament 3" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
installer=1
install_server_files.sh
elif [ -n "${appid}" ]; then
@ -34,6 +34,8 @@ elif [ "${gamename}" == "Don't Starve Together" ]; then
install_dst_token.sh
elif [ "${gamename}" == "TeamSpeak 3" ]; then
install_ts3db.sh
elif [ "${gamename}" == "Multi Theft Auto" ]; then
command_install_resources_mta.sh
fi
fix.sh

31
lgsm/functions/command_install_resources_mta.sh

@ -0,0 +1,31 @@
#!/bin/bash
# LGSM command_install_resources_mta.sh function
# Author: Daniel Gibbs
# Website: https://gameservermanagers.com
# Description: Installs the default resources for Multi Theft Auto.
local commandname="DEFAULT_RESOURCES"
local commandaction="Default Resources"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_install_resources(){
echo ""
echo "Installing Default Resources"
echo "================================="
fileurl="http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip"; filedir="${tmpdir}"; filename="multitheftauto_resources.zip"; executecmd="noexecute" run="norun"; force="noforce"; md5="nomd5"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
fn_dl_extract "${filedir}" "${filename}" "${resourcesdir}"
echo "Default Resources Installed."
}
fn_print_header
fn_print_warning_nl "Installing the default resources with existing resources may cause issues."
while true; do
read -e -i "y" -p "Do you want to install MTA default resources? [Y/n]" yn
case $yn in
[Yy]* ) fn_install_resources && break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done

117
lgsm/functions/command_mods_install.sh

@ -0,0 +1,117 @@
#!/bin/bash
# LGSM command_mods_install.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: List and installs available mods along with mods_list.sh and mods_core.sh.
local commandname="MODS"
local commandaction="addons/mods"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
mods_core.sh
fn_print_header
# Displays a list of installed mods
fn_mods_installed_list
if [ ${installedmodscount} -gt 0 ]; then
echo "Installed addons/mods"
echo "================================="
# Go through all available commands, get details and display them to the user
for ((llindex=0; llindex < ${#installedmodslist[@]}; llindex++)); do
# Current mod is the "llindex" value of the array we're going through
currentmod="${installedmodslist[llindex]}"
fn_mod_get_info
# Display mod info to the user
echo -e " * ${green}${modcommand}${default}${default}"
done
echo ""
fi
echo "Available addons/mods"
echo "================================="
# Display available mods from mods_list.sh
# Set and reset vars
compatiblemodslistindex=0
# As long as we're within index values
while [ "${compatiblemodslistindex}" -lt "${#compatiblemodslist[@]}" ]; do
# Set values for convenience
displayedmodname="${compatiblemodslist[compatiblemodslistindex]}"
displayedmodcommand="${compatiblemodslist[compatiblemodslistindex+1]}"
displayedmodsite="${compatiblemodslist[compatiblemodslistindex+2]}"
displayedmoddescription="${compatiblemodslist[compatiblemodslistindex+3]}"
# Output mods to the user
echo -e "${displayedmodname} - ${displayedmoddescription} - ${displayedmodsite}"
echo -e " * ${cyan}${displayedmodcommand}${default}"
# Increment index from the amount of values we just displayed
let "compatiblemodslistindex+=4"
((totalmodsavailable++))
done
# If no mods are available for a specific game
if [ -z "${compatiblemodslist}" ]; then
fn_print_fail "No mods are currently available for ${gamename}."
fn_script_log_info "No mods are currently available for ${gamename}."
core_exit.sh
fi
fn_script_log_info "${totalmodsavailable} addons/mods are available for install"
## User selects a mod
echo ""
while [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; do
echo -en "Enter an ${cyan}addon/mod${default} to ${green}install${default} (or exit to abort): "
read -r usermodselect
# Exit if user says exit or abort
if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
core_exit.sh
# Supplementary output upon invalid user input
elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
fi
done
# Get mod info
currentmod="${usermodselect}"
fn_mod_get_info
echo ""
echo "Installing ${modprettyname}"
echo "================================="
fn_script_log_info "${modprettyname} selected for install"
# Check if the mod is already installed and warn the user
if [ -f "${modsinstalledlistfullpath}" ]; then
if [ -n "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
fn_print_warning_nl "${modprettyname} is already installed"
fn_script_log_warn "${modprettyname} is already installed"
sleep 1
echo " * Any configs may be overwritten."
while true; do
read -e -i "y" -p "Continue? [Y/n]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; core_exit.sh;;
* ) echo "Please answer yes or no.";;
esac
done
fn_script_log_info "User selected to continue"
fi
fi
## Installation
fn_create_mods_dir
fn_mods_clear_tmp_dir
fn_mods_create_tmp_dir
fn_mod_install_files
fn_mod_lowercase
fn_mod_create_filelist
fn_mod_copy_destination
fn_mod_add_list
fn_mod_tidy_files_list
fn_mods_clear_tmp_dir
echo "${modprettyname} installed"
fn_script_log_pass "${modprettyname} installed."
core_exit.sh

137
lgsm/functions/command_mods_remove.sh

@ -0,0 +1,137 @@
#!/bin/bash
# LGSM command_mods_uninstall.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Uninstall mods along with mods_list.sh and mods_core.sh.
local commandname="MODS"
local commandaction="addons/mods"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
mods_core.sh
fn_mods_check_installed
fn_print_header
echo "Remove addons/mods"
echo "================================="
## Displays list of installed mods
# Generates list to display to user
fn_mods_installed_list
for ((mlindex=0; mlindex < ${#installedmodslist[@]}; mlindex++)); do
# Current mod is the "mlindex" value of the array we are going through
currentmod="${installedmodslist[mlindex]}"
# Get mod info
fn_mod_get_info
# Display mod info to the user
echo -e "${red}${modcommand}${default} - ${modprettyname} - ${moddescription}"
done
echo ""
# Keep prompting as long as the user input doesn't correspond to an available mod
while [[ ! " ${installedmodslist[@]} " =~ " ${usermodselect} " ]]; do
echo -en "Enter an ${cyan}addon/mod${default} to ${green}install${default} (or exit to abort): "
read -r usermodselect
# Exit if user says exit or abort
if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
core_exit.sh
# Supplementary output upon invalid user input
elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
fi
done
fn_print_warning_nl "You are about to remove ${cyan}${usermodselect}${default}."
echo " * Any custom files/configuration will be removed."
while true; do
read -e -i "y" -p "Continue? [Y/n]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; exit;;
* ) echo "Please answer yes or no.";;
esac
done
currentmod="${usermodselect}"
fn_mod_get_info
fn_check_mod_files_list
# Uninstall the mod
fn_script_log_info "Removing ${modsfilelistsize} files from ${modprettyname}"
echo -e "removing ${modprettyname}"
echo -e "* ${modsfilelistsize} files to be removed"
echo -e "* location: ${modinstalldir}"
sleep 1
# Go through every file and remove it
modfileline="1"
tput sc
while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
# Current line defines current file to remove
currentfileremove="$(sed "${modfileline}q;d" "${modsdir}/${modcommand}-files.txt")"
# If file or directory exists, then remove it
if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then
rm -rf "${modinstalldir}/${currentfileremove}"
((exitcode=$?))
if [ ${exitcode} -ne 0 ]; then
fn_script_log_fatal "Removing ${modinstalldir}/${currentfileremove}"
break
else
fn_script_log_pass "Removing ${modinstalldir}/${currentfileremove}"
fi
fi
tput rc; tput el
printf "removing ${modprettyname} ${modfileline} / ${modsfilelistsize} : ${currentfileremove}..."
((modfileline++))
done
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
sleep 0.5
# Remove file list
echo -en "removing ${modcommand}-files.txt..."
sleep 0.5
rm -rf "${modsdir}/${modcommand}-files.txt"
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_script_log_fatal "Removing ${modsdir}/${modcommand}-files.txt"
fn_print_fail_eol_nl
core_exit.sh
else
fn_script_log_pass "Removing ${modsdir}/${modcommand}-files.txt"
fn_print_ok_eol_nl
fi
# Remove mods from installed mods list
echo -en "removing ${modcommand} from ${modsinstalledlist}..."
sleep 0.5
sed -i "/^${modcommand}$/d" "${modsinstalledlistfullpath}"
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_script_log_fatal "Removing ${modcommand} from ${modsinstalledlist}"
fn_print_fail_eol_nl
core_exit.sh
else
fn_script_log_pass "Removing ${modcommand} from ${modsinstalledlist}"
fn_print_ok_eol_nl
fi
# Oxide fix
# Oxide replaces server files, so a validate is required after uninstall
if [ "${engine}" == "unity3d" ]&&[[ "${modprettyname}" == *"Oxide"* ]]; then
fn_print_information_nl "Validating to restore original ${gamename} files replaced by Oxide"
fn_script_log "Validating to restore original ${gamename} files replaced by Oxide"
exitbypass="1"
command_validate.sh
unset exitbypass
fi
echo "${modprettyname} removed"
fn_script_log "${modprettyname} removed"
core_exit.sh

110
lgsm/functions/command_mods_update.sh

@ -0,0 +1,110 @@
#!/bin/bash
# LGSM command_mods_update.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Updates installed mods along with mods_list.sh and mods_core.sh.
local commandname="MODS"
local commandaction="Mods Update"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
mods_core.sh
# Prevents specific files being overwritten upon update (set by ${modkeepfiles})
# For that matter, remove cfg files after extraction before copying them to destination
fn_remove_cfg_files(){
if [ "${modkeepfiles}" != "OVERWRITE" ]&&[ "${modkeepfiles}" != "NOUPDATE" ]; then
echo -e "the following files/directories will be preserved:"
sleep 0.5
# Count how many files there are to remove
filestopreserve="$(echo "${modkeepfiles}" | awk -F ';' '{ print NF }')"
# Test all subvalues of "modkeepfiles" using the ";" separator
for ((preservefilesindex=1; preservefilesindex < ${filestopreserve}; preservefilesindex++)); do
# Put the current file we are looking for into a variable
filetopreserve="$(echo "${modkeepfiles}" | awk -F ';' -v x=${preservefilesindex} '{ print $x }' )"
echo -e " * serverfiles/${filetopreserve}"
# If it matches an existing file that have been extracted delete the file
if [ -f "${extractdir}/${filetopreserve}" ]||[ -d "${extractdir}/${filetopreserve}" ]; then
rm -r "${extractdir}/${filetopreserve}"
# Write the file path in a tmp file, to rebuild a full file list as it is rebuilt upon update
if [ ! -f "${modsdir}/.removedfiles.tmp" ]; then
touch "${modsdir}/.removedfiles.tmp"
fi
echo "${filetopreserve}" >> "${modsdir}/.removedfiles.tmp"
fi
done
fi
}
fn_print_dots "Update addons/mods"
sleep 0.5
fn_mods_check_installed
fn_print_info_nl "Update addons/mods: ${installedmodscount} addons/mods will be updated"
fn_script_log_info "${installedmodscount} mods or addons will be updated"
fn_mods_installed_list
# Go through all available commands, get details and display them to the user
for ((ulindex=0; ulindex < ${#installedmodslist[@]}; ulindex++)); do
# Current mod is the "ulindex" value of the array we're going through
currentmod="${installedmodslist[ulindex]}"
fn_mod_get_info
# Display installed mods and the update policy
if [ -z "${modkeepfiles}" ]; then
# If modkeepfiles is not set for some reason, that's a problem
fn_script_log_error "Could not find update policy for ${modprettyname}"
fn_print_error_nl "Could not find update policy for ${modprettyname}"
exitcode="1"
core_exit.sh
# If the mod won't get updated
elif [ "${modkeepfiles}" == "NOUPDATE" ]; then
echo -e " * ${red}{modprettyname}${default} (won't be updated)"
# If the mode is just overwritten
elif [ "${modkeepfiles}" == "OVERWRITE" ]; then
echo -e " * ${modprettyname} (overwrite)"
else
echo -e " * ${yellow}${modprettyname}${default} (retain common custom files)"
fi
done
sleep 1
## Update
# List all installed mods and apply update
# Reset line value
installedmodsline="1"
while [ ${installedmodsline} -le ${installedmodscount} ]; do
currentmod="$(sed "${installedmodsline}q;d" "${modsinstalledlistfullpath}")"
if [ -n "${currentmod}" ]; then
fn_mod_get_info
# Don not update mod if the policy is set to "NOUPDATE"
if [ "${modkeepfiles}" == "NOUPDATE" ]; then
fn_print_info "${modprettyname} will not be updated to preserve custom files"
fn_script_log_info "${modprettyname} will not be updated to preserve custom files"
else
echo ""
echo "==> Updating ${modprettyname}"
fn_create_mods_dir
fn_mods_clear_tmp_dir
fn_mods_create_tmp_dir
fn_mod_install_files
fn_mod_lowercase
fn_remove_cfg_files
fn_mod_create_filelist
fn_mod_copy_destination
fn_mod_add_list
fn_mod_tidy_files_list
fn_mods_clear_tmp_dir
fi
((installedmodsline++))
else
fn_print_fail "No mod was selected"
fn_script_log_fatal "No mod was selected"
exitcode="1"
core_exit.sh
fi
done
echo ""
fn_print_ok_nl "Mods update complete"
fn_script_log_info "Mods update complete"
core_exit.sh

32
lgsm/functions/command_stop.sh

@ -190,6 +190,34 @@ fn_stop_graceful_minecraft(){
fn_stop_tmux
}
# Attempts graceful of mta using rcon 'quit' command.
fn_stop_graceful_mta(){
fn_print_dots "Graceful: console quit"
fn_script_log_info "Graceful: console quit"
# sends quit
tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
# waits up to 120 seconds giving the server time to shutdown gracefuly, we need a long wait time here as resources are stopped individually and process their own shutdowns
for seconds in {1..120}; do
check_status.sh
if [ "${status}" == "0" ]; then
fn_print_ok "Graceful: console quit: ${seconds}: "
fn_print_ok_eol_nl
fn_script_log_pass "Graceful: console quit: OK: ${seconds} seconds"
break
fi
sleep 1
fn_print_dots "Graceful: console quit: ${seconds}"
done
check_status.sh
if [ "${status}" != "0" ]; then
fn_print_error "Graceful: console quit: "
fn_print_fail_eol_nl
fn_script_log_error "Graceful: console quit: FAIL"
fi
sleep 1
fn_stop_tmux
}
fn_stop_graceful_select(){
if [ "${gamename}" == "7 Days To Die" ]; then
fn_stop_graceful_sdtd
@ -201,6 +229,8 @@ fn_stop_graceful_select(){
fn_stop_graceful_goldsource
elif [ "${engine}" == "lwjgl2" ]; then
fn_stop_graceful_minecraft
elif [ "${engine}" == "renderware" ]; then
fn_stop_graceful_mta
else
fn_stop_tmux
fi
@ -296,7 +326,7 @@ fn_stop_tmux(){
rm -f "${rootdir}/${lockselfname}"
# ARK doesn't clean up immediately after tmux is killed.
# Make certain the ports are cleared before continuing.
if [ "${gamename}" == "ARK: Survivial Evolved" ]; then
if [ "${gamename}" == "ARK: Survival Evolved" ]; then
fn_stop_ark
echo -en "\n"
fi

4
lgsm/functions/command_update.sh

@ -20,7 +20,9 @@ elif [ "${engine}" == "lwjgl2" ]; then
elif [ "${gamename}" == "Mumble" ]; then
update_mumble.sh
elif [ "${gamename}" == "Factorio" ]; then
update_factorio.sh
update_factorio.sh
elif [ "${gamename}" == "Multi Theft Auto" ]; then
update_mta.sh
else
update_steamcmd.sh
fi

1
lgsm/functions/command_update_functions.sh

@ -4,6 +4,7 @@
# Website: https://gameservermanagers.com
# Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
local commandname="UPDATE LGSM"
local commandaction="Update LGSM"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"

5
lgsm/functions/command_validate.sh

@ -9,6 +9,7 @@ local commandaction="Validate"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_validation(){
echo ""
echo -e " * Validating may overwrite some customised files."
echo -en " * https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
sleep 3
@ -19,7 +20,9 @@ fn_validation(){
cd "${rootdir}/steamcmd"
if [ $(command -v stdbuf) ]; then
# Detects if unbuffer command is available for 32 bit distributions only.
info_distro.sh
if [ $(command -v stdbuf) ]&&[ "${arch}" != "x86_64" ]; then
unbuffer="stdbuf -i0 -o0 -e0"
fi

134
lgsm/functions/command_wipe.sh

@ -0,0 +1,134 @@
#!/bin/bash
# LGSM command_backup.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Wipes server data, useful after updates for some games like Rust
local commandname="WIPE"
local commandaction="data wipe"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
fn_print_header
fn_script_log "Entering ${gamename} ${commandaction}"
# Process to server wipe
fn_wipe_server_process(){
check_status.sh
if [ "${status}" != "0" ]; then
exitbypass=1
command_stop.sh
fn_wipe_server_remove_files
exitbypass=1
command_start.sh
else
fn_wipe_server_remove_files
fi
echo "server data wiped"
fn_script_log "server data wiped."
}
# Provides an exit code upon error
fn_wipe_exit_code(){
((exitcode=$?))
if [ ${exitcode} -ne 0 ]; then
fn_script_log_fatal "${currentaction}"
core_exit.sh
else
fn_print_ok_eol_nl
fi
}
# Removes files to wipe server
fn_wipe_server_remove_files(){
# Rust Wipe
if [ "${gamename}" == "Rust" ]; 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)..."
sleep 1
fn_script_log "${currentaction}"
find "${serveridentitydir}" -type f -name "proceduralmap.*.sav" -delete
fn_wipe_exit_code
sleep 0.5
else
fn_print_information_nl "No map file to remove"
fn_script_log_info "No map file to remove."
sleep 0.5
fi
if [ -d "${serveridentitydir}/user" ]; then
currentaction="Removing user directory: ${serveridentitydir}/user"
echo -en "Removing user directory..."
sleep 1
fn_script_log "${currentaction}"
rm -rf "${serveridentitydir}/user"
fn_wipe_exit_code
sleep 0.5
else
fn_print_information_nl "No user directory to remove"
fn_script_log_info "No user directory to remove."
sleep 0.5
fi
if [ -d "${serveridentitydir}/storage" ]; then
currentaction="Removing storage directory: ${serveridentitydir}/storage"
echo -en "Removing storage directory..."
sleep 1
fn_script_log "${currentaction}"
rm -rf "${serveridentitydir}/storage"
fn_wipe_exit_code
sleep 0.5
else
fn_print_information_nl "No storage directory to remove"
fn_script_log_info "No storage directory to remove."
sleep 0.5
fi
if [ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
currentaction="Removing log files: ${serveridentitydir}/Log.*.txt"
echo -en "Removing Log files..."
sleep 1
fn_script_log "${currentaction}"
find "${serveridentitydir}" -type f -name "Log.*.txt" -delete
fn_wipe_exit_code
sleep 0.5
else
fn_print_information_nl "No log files to remove"
fn_script_log_info "No log files to remove."
sleep 0.5
fi
# You can add an "elif" here to add another game or engine
fi
}
# Check if there is something to wipe, prompt the user, and call appropriate functions
# Rust Wipe
if [ "${gamename}" == "Rust" ]; then
if [ -d "${serveridentitydir}/storage" ]||[ -d "${serveridentitydir}/user" ]||[ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
fn_print_warning_nl "Any user, storage, log and map data from ${serveridentitydir} will be erased."
while true; do
read -e -i "y" -p "Continue? [Y/n]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; core_exit.sh;;
* ) echo "Please answer yes or no.";;
esac
done
fn_script_log_info "User selects to erase any user, storage, log and map data from ${serveridentitydir}"
sleep 1
fn_wipe_server_process
else
fn_print_information_nl "No data to wipe was found"
fn_script_log_info "No data to wipe was found."
sleep 1
core_exit.sh
fi
# You can add an "elif" here to add another game or engine
else
# Game not listed
fn_print_information_nl "Wipe is not available for this game"
fn_script_log_info "Wipe is not available for this game."
sleep 1
core_exit.sh
fi
core_exit.sh

12
lgsm/functions/core_dl.sh

@ -54,7 +54,6 @@ fn_dl_extract(){
extractdir="${3}"
# extracts archives
echo -ne "extracting ${filename}..."
fn_script_log_info "Extracting download"
mime=$(file -b --mime-type "${filedir}/${filename}")
if [ "${mime}" == "application/gzip" ]||[ "${mime}" == "application/x-gzip" ]; then
@ -72,6 +71,7 @@ fn_dl_extract(){
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Extracting download: OK"
fi
}
@ -80,12 +80,12 @@ fn_fetch_trap(){
echo ""
echo -ne "downloading ${filename}..."
fn_print_canceled_eol_nl
fn_script_log_info "downloading ${filename}...CANCELED"
fn_script_log_info "Downloading ${filename}...CANCELED"
sleep 1
rm -f "${filedir}/${filename}" | tee -a "${scriptlog}"
echo -ne "downloading ${filename}..."
fn_print_removed_eol_nl
fn_script_log_info "downloading ${filename}...REMOVED"
fn_script_log_info "Downloading ${filename}...REMOVED"
core_exit.sh
}
@ -117,7 +117,7 @@ fn_fetch_file(){
# trap to remove part downloaded files
trap fn_fetch_trap INT
# if larger file shows progress bar
if [ ${filename##*.} == "bz2" ]||[ ${filename##*.} == "gz" ]||[ ${filename##*.} == "zip" ]||[ ${filename##*.} == "jar" ]; then
if [ "${filename##*.}" == "bz2" ]||[ "${filename##*.}" == "gz" ]||[ "${filename##*.}" == "zip" ]||[ "${filename##*.}" == "jar" ]; then
echo -ne "downloading ${filename}..."
sleep 1
curlcmd=$(${curlcmd} --progress-bar --fail -L -o "${filedir}/${filename}" "${fileurl}")
@ -130,7 +130,7 @@ fn_fetch_file(){
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
if [ -f "${scriptlog}" ]; then
fn_script_log_fatal "downloading ${filename}: FAIL"
fn_script_log_fatal "Downloading ${filename}: FAIL"
fi
echo -e "${fileurl}" | tee -a "${scriptlog}"
echo "${curlcmd}" | tee -a "${scriptlog}"
@ -138,7 +138,7 @@ fn_fetch_file(){
else
fn_print_ok_eol_nl
if [ -f "${scriptlog}" ]; then
fn_script_log_pass "downloading ${filename}: OK"
fn_script_log_pass "Downloading ${filename}: OK"
fi
fi
# remove trap

54
lgsm/functions/core_functions.sh

@ -6,7 +6,9 @@
# This function is called first before any other function. Without this file other functions will not load.
# Fixes for legacy code
if [ "${gamename}" == "Teamspeak 3" ]; then
if [ "${gamename}" == "ARK: Survivial Evolved" ]; then
gamename="ARK: Survival Evolved"
elif [ "${gamename}" == "Teamspeak 3" ]; then
gamename="TeamSpeak 3"
elif [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
gamename="Counter-Strike: Global Offensive"
@ -180,6 +182,26 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
command_install_resources_mta.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
command_mods_install.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
command_mods_update.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
command_mods_remove.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
command_fastdl.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
@ -195,6 +217,10 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
command_wipe.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
# Checks
@ -213,6 +239,11 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
check_executable.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
check_glibc.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
@ -276,6 +307,17 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
# Mods
mods_list.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
mods_core.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
# Dev
@ -367,6 +409,11 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
fix_mta.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
# Info
info_config.sh(){
@ -450,6 +497,11 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
update_mta.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
update_factorio.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function

193
lgsm/functions/core_getopt.sh

@ -43,6 +43,12 @@ case "${getopt}" in
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)
@ -76,6 +82,9 @@ case "${getopt}" in
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
}
@ -342,6 +351,80 @@ case "${getopt}" in
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
}
fn_getopt_mumble(){
case "${getopt}" in
st|start)
@ -517,14 +600,20 @@ case "${getopt}" in
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;;
fd|fastdl)
command_fastdl.sh;;
*)
if [ -n "${getopt}" ]; then
echo -e "${red}Unknown command${default}: $0 ${getopt}"
@ -552,6 +641,95 @@ case "${getopt}" in
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
}
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
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
}
@ -772,12 +950,17 @@ elif [ "${gamename}" == "Garry's Mod" ]; then
# 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
# 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
@ -785,14 +968,14 @@ elif [ "${engine}" == "unreal2" ]; then
else
fn_getopt_unreal2
fi
# Unreal Engine
# 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
fn_getopt_generic_update_no_steam
else
fn_getopt_generic
fi

4
lgsm/functions/core_messages.sh

@ -165,9 +165,9 @@ fn_print_error(){
fn_print_error_nl(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${servicename}: $@"
echo -en "${creeol}[${red}ERROR!${default}] ${commandaction} ${servicename}: $@"
else
echo -en "${creeol}[${red}ERROR ${default}] $@"
echo -en "${creeol}[${red}ERROR!${default}] $@"
fi
sleep 0.5
echo -en "\n"

10
lgsm/functions/fix.sh

@ -17,6 +17,14 @@ fn_fix_msg_start(){
sleep 1
}
fn_fix_msg_start_nl(){
fn_print_dots "Applying ${fixname} fix: ${gamename}"
sleep 1
fn_print_info "Applying ${fixname} fix: ${gamename}"
fn_script_log_info "Applying ${fixname} fix: ${gamename}"
sleep 1
}
fn_fix_msg_end(){
if [ $? -ne 0 ]; then
fn_print_error_nl "Applying ${fixname} fix: ${gamename}"
@ -47,6 +55,8 @@ if [ "${function_selfname}" != "command_install.sh" ]; then
fix_ins.sh
elif [ "${gamename}" == "Rust" ]; then
fix_rust.sh
elif [ "${gamename}" == "Multi Theft Auto" ]; then
fix_mta.sh
fi
fi

6
lgsm/functions/fix_glibc.sh

@ -46,8 +46,6 @@ do
fi
done
export LD_LIBRARY_PATH=:"${libdir}"
## amd64
# libm.so.6
@ -66,4 +64,6 @@ do
if [ "${gamename}" == "${libc_server}" ]; then
fn_fetch_file_github "lgsm/lib/ubuntu12.04/amd64" "libc.so.6" "${lgsmdir}/lib" "noexecutecmd" "norun" "noforce" "nomd5"
fi
done
done
export LD_LIBRARY_PATH=:"${libdir}"

20
lgsm/functions/fix_mta.sh

@ -0,0 +1,20 @@
#!/bin/bash
# LGSM fix_mta.sh function
# Author: Daniel Gibbs
# Contributor: ChaosMTA
# Website: https://gameservermanagers.com
# Description: Installs the libmysqlclient for database functions on the server
local commandname="FIX"
local commandaction="Fix"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
if [ ! -f "${lgsmdir}/lib/libmysqlclient.so.16" ]; then
fixname="libmysqlclient16"
fn_fix_msg_start_nl
sleep 1
fileurl="https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16"; filedir="${lgsmdir}/lib"; filename="libmysqlclient.so.16"; executecmd="executecmd" run="norun"; force="noforce"; md5="6c188e0f8fb5d7a29f4bc413b9fed6c2"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
fn_fix_msg_end
fi
export LD_LIBRARY_PATH=:"${libdir}"

54
lgsm/functions/info_config.sh

@ -39,6 +39,16 @@ fn_info_config_avalanche(){
fi
}
fn_info_config_ark(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
else
servername=$(grep "SessionName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/SessionName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
# Not Set
servername=${servername:-"NOT SET"}
fi
}
fn_info_config_bf1942(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -593,9 +603,49 @@ fn_info_config_sdtd(){
fi
}
fn_info_config_mta(){
if [ ! -f "${servercfgfullpath}" ]; then
ip="${zero}"
port="${unavailable}"
httpport="${unavailable}"
ase="${unavailable}"
servername="${unavailable}"
serverpassword="${unavailable}"
maxplayers="${zero}"
else
port=$(grep -m 1 "serverport" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<serverport>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]')
httpport=$(grep -m 1 "httpport" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<httpport>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]')
ase=$(grep -m 1 "ase" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<ase>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]')
servername=$(grep -m 1 "servername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<servername>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<")
serverpassword=$(grep -m 1 "password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<password>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<")
maxplayers=$(grep -m 1 "maxplayers" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<maxplayers>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]')
if [ "${ase}" == "1" ]; then
ase="Enabled"
else
ase="Disabled"
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:]')
ipsetinconfig=1
ipinconfigvar="serverip"
# Not Set
port=${port:-"22003"}
httpport=${httpport:-"22005"}
ase=${ase:-"Disabled"}
servername=${servername:-"NOT SET"}
serverpassword=${serverpassword:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
fi
}
# Just Cause 2
if [ "${engine}" == "avalanche" ]; then
fn_info_config_avalanche
# ARK: Survival Evolved
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
fn_info_config_ark
# Battlefield: 1942
elif [ "${gamename}" == "Battlefield: 1942" ]; then
fn_info_config_bf1942
@ -663,4 +713,6 @@ elif [ "${gamename}" == "7 Days To Die" ]; then
fn_info_config_sdtd
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
fn_info_config_wolfensteinenemyterritory
fi
elif [ "${gamename}" == "Multi Theft Auto" ]; then
fn_info_config_mta
fi

3
lgsm/functions/info_glibc.sh

@ -134,6 +134,9 @@ elif [ "${engine}" == "refractor" ]; then
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
glibcrequired="2.2.4"
glibcfix="no"
elif [ "${gamename}" == "Multi Theft Auto" ]; then
glibcrequired="NOT REQUIRED"
glibcfix="no"
else
glibcrequired="UNKNOWN"
glibcfix="no"

86
lgsm/functions/install_config.sh

@ -8,35 +8,7 @@ local commandname="INSTALL"
local commandaction="Install"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_fetch_default_config(){
mkdir -pv "${lgsmdir}/default-configs"
githuburl="https://github.com/GameServerManagers/Game-Server-Configs/master"
for config in "${array_configs[@]}"
do
fileurl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master/${gamedirname}/${config}"; filedir="${lgsmdir}/default-configs"; filename="${config}"; executecmd="noexecute" run="norun"; force="noforce"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
done
}
# Changes some variables within the default configs
# SERVERNAME to LinuxGSM
# PASSWORD to random password
fn_set_config_vars(){
random=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 8 | tr -d '\n'; echo)
servername="LinuxGSM"
rconpass="admin$random"
echo "changing hostname."
fn_script_log_info "changing hostname."
sleep 1
sed -i "s/SERVERNAME/${servername}/g" "${servercfgfullpath}"
echo "changing rcon/admin password."
fn_script_log_info "changing rcon/admin password."
sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}"
sleep 1
}
# Checks if cfg dir exists, creates it if it doesn't
# Checks if server cfg dir exists, creates it if it doesn't
fn_check_cfgdir(){
if [ ! -d "${servercfgdir}" ]; then
echo "creating ${servercfgdir} config directory."
@ -45,27 +17,58 @@ fn_check_cfgdir(){
fi
}
# Copys the default configs from Game-Server-Configs repo to the
# correct location
# Downloads default configs from Game-Server-Configs repo to lgsm/default-configs
fn_fetch_default_config(){
mkdir -pv "${lgsmdir}/default-configs"
githuburl="https://github.com/GameServerManagers/Game-Server-Configs/master"
for config in "${array_configs[@]}"; do
fileurl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master/${gamedirname}/${config}"; filedir="${lgsmdir}/default-configs"; filename="${config}"; executecmd="noexecute" run="norun"; force="noforce"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
done
}
# Copys default configs from Game-Server-Configs repo to server config location
fn_default_config_remote(){
for config in "${array_configs[@]}"
do
for config in "${array_configs[@]}"; do
# every config is copied
echo "copying ${config} config file."
fn_script_log_info "copying ${servercfg} config file."
if [ "${config}" == "${servercfgdefault}" ]; then
cp -v "${lgsmdir}/default-configs/${config}" "${servercfgfullpath}"
cp -nv "${lgsmdir}/default-configs/${config}" "${servercfgfullpath}"
elif [ "${gamename}" == "ARMA 3" ]&&[ "${config}" == "${networkcfgdefault}" ]; then
cp -v "${lgsmdir}/default-configs/${config}" "${networkcfgfullpath}"
cp -nv "${lgsmdir}/default-configs/${config}" "${networkcfgfullpath}"
elif [ "${gamename}" == "Don't Starve Together" ]&&[ "${config}" == "${clustercfgdefault}" ]; then
cp -nv "${lgsmdir}/default-configs/${clustercfgdefault}" "${clustercfgfullpath}"
else
cp -v "${lgsmdir}/default-configs/${config}" "${servercfgdir}/${config}"
cp -nv "${lgsmdir}/default-configs/${config}" "${servercfgdir}/${config}"
fi
done
sleep 1
}
# Changes some variables within the default configs
# SERVERNAME to LinuxGSM
# PASSWORD to random password
fn_set_config_vars(){
if [ -f "${servercfgfullpath}" ]; then
random=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 8 | tr -d '\n'; echo)
servername="LinuxGSM"
rconpass="admin$random"
echo "changing hostname."
fn_script_log_info "changing hostname."
sleep 1
sed -i "s/SERVERNAME/${servername}/g" "${servercfgfullpath}"
echo "changing rcon/admin password."
fn_script_log_info "changing rcon/admin password."
sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}"
sleep 1
else
fn_script_log_warn "Config file not found, cannot alter it."
echo "Config file not found, cannot alter it."
sleep 1
fi
}
# Changes some variables within the default Don't Starve Together configs
fn_set_dst_config_vars(){
## cluster.ini
@ -127,8 +130,9 @@ if [ "${gamename}" == "7 Days To Die" ]; then
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
elif [ "${gamename}" == "ARK: Survival Evolved" ]; then
gamedirname="ARKSurvivalEvolved"
fn_check_cfgdir
array_configs+=( GameUserSettings.ini )
fn_fetch_default_config
fn_default_config_remote
@ -357,6 +361,12 @@ elif [ "${gamename}" == "No More Room in Hell" ]; then
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Multi Theft Auto" ]; then
gamedirname="MultiTheftAuto"
fn_check_cfgdir
array_configs+=( acl.xml mtaserver.conf vehiclecolors.conf )
fn_fetch_default_config
fn_default_config_remote
elif [ "${gamename}" == "Mumble" ]; then
gamedirname="Mumble"
array_configs+=( murmur.ini )
@ -494,4 +504,4 @@ elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fi
fi

37
lgsm/functions/install_mta_resources.sh

@ -0,0 +1,37 @@
#!/bin/bash
# LGSM install_mta_resources.sh function
# Author: Daniel Gibbs
# Contributor: ChaosMTA
# Website: https://gameservermanagers.com
# Description: Installs the libmysqlclient for database functions on the server and optionally installs default resources required to run the server
local commandname="INSTALL"
local commandaction="Install"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_install_libmysqlclient16(){
echo ""
echo "Checking if libmysqlclient16 is installed"
echo "================================="
sleep 1
if [ ! -f /usr/lib/libmysqlclient.so.16 ]; then
fn_print_warn_nl "libmysqlclient16 not installed. Installing.."
sleep 1
sudo -v > /dev/null 2>&1
if [ $? -eq 0 ]; then
fileurl="https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16"; filedir="${tmpdir}"; filename="libmysqlclient.so.16"; executecmd="executecmd" run="norun"; force="noforce"; md5="6c188e0f8fb5d7a29f4bc413b9fed6c2"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
sudo mv ${tmpdir}/${filename} /usr/lib/${filename}
else
fn_print_fail_nl "Failed to install libmysqlclient16, $(whoami) does not have sudo access. Download it manually and place it in /usr/lib"
sleep 1
fi
else
echo "libmysqlclient16 already installed."
fi
}
fn_install_libmysqlclient16
fn_print_information_nl "Server is inoperable by default without resources, you can install default ones by running the command install-default-resources"
echo ""

4
lgsm/functions/install_server_files.sh

@ -34,7 +34,7 @@ fn_install_server_files(){
elif [ "${gamename}" == "Unreal Tournament 99" ]; then
fileurl="http://files.gameservermanagers.com/UnrealTournament99/ut99-server-451-ultimate-linux.tar.bz2"; filedir="${tmpdir}"; filename="ut99-server-451-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="49cb24d0550ff6ddeaba6007045c6edd"
elif [ "${gamename}" == "Unreal Tournament" ]; then
fileurl="http://files.gameservermanagers.com/UnrealTournament/UnrealTournament-Server-XAN-3193528-Linux.zip"; filedir="${tmpdir}"; filename="UnrealTournament-Server-XAN-3193528-Linux.zip"; executecmd="noexecute" run="norun"; force="noforce"; md5="e3dd5853c4eb193674d5c832f60040d8"
fileurl="https://s3.amazonaws.com/unrealtournament/UnrealTournament-Server-XAN-3270765-Linux.zip"; filedir="${tmpdir}"; filename="UnrealTournament-Server-XAN-3270765-Linux.zip"; executecmd="noexecute" run="norun"; force="noforce"; md5="8791dc087383061d7f7f9f523237b8b3"
elif [ "${gamename}" == "Unreal Tournament 3" ]; then
fileurl="http://files.gameservermanagers.com/UnrealTournament3/UT3-linux-server-2.1.tar.bz2"; filedir="${tmpdir}"; filename="UT3-linux-server-2.1.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="2527437b46f1b47f20228d27d72395a6"
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
@ -129,6 +129,8 @@ elif [ "${gamename}" == "Minecraft" ]; then
update_minecraft.sh
elif [ "${gamename}" == "Mumble" ]; then
update_mumble.sh
elif [ "${gamename}" == "Multi Theft Auto" ]; then
update_mta.sh
elif [ "${gamename}" == "Factorio" ]; then
update_factorio.sh
install_factorio_save.sh

470
lgsm/functions/mods_core.sh

@ -0,0 +1,470 @@
#!/bin/bash
# LGSM command_mods_install.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Core functions for mods list/install/update/remove
local commandname="MODS"
local commandaction="addons/mods"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
# Files and Directories
modsdir="${lgsmdir}/mods"
modstmpdir="${modsdir}/tmp"
extractdir="${modstmpdir}/extract"
modsinstalledlist="installed-mods.txt"
modsinstalledlistfullpath="${modsdir}/${modsinstalledlist}"
## Installation
# Download management
fn_mod_install_files(){
fn_fetch_file "${modurl}" "${modstmpdir}" "${modfilename}"
# Check if variable is valid checking if file has been downloaded and exists
if [ ! -f "${modstmpdir}/${modfilename}" ]; then
fn_print_failure "An issue occurred downloading ${modprettyname}"
fn_script_log_fatal "An issue occurred downloading ${modprettyname}"
core_exit.sh
fi
if [ ! -d "${extractdir}" ]; then
mkdir -p "${extractdir}"
fi
fn_dl_extract "${modstmpdir}" "${filename}" "${extractdir}"
}
# Convert mod files to lowercase if needed
fn_mod_lowercase(){
if [ "${modlowercase}" == "LowercaseOn" ]; then
echo -ne "converting ${modprettyname} files to lowercase..."
sleep 0.5
fn_script_log_info "Converting ${modprettyname} files to lowercase"
files=$(find "${extractdir}" -depth | wc -l)
echo -en "\r"
while read -r src; do
dst=`dirname "${src}"`/`basename "${src}" | tr '[A-Z]' '[a-z]'`
if [ "${src}" != "${dst}" ]
then
[ ! -e "${dst}" ] && mv -T "${src}" "${dst}" || echo "${src} was not renamed"
local exitcode=$?
((renamedwc++))
fi
echo -ne "${renamedwc} / ${totalfileswc} / $files converting ${modprettyname} files to lowercase..." $'\r'
((totalfileswc++))
done < <(find "${extractdir}" -depth)
echo -ne "${renamedwc} / ${totalfileswc} / $files converting ${modprettyname} files to lowercase..."
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
sleep 0.5
fi
}
# Create ${modcommand}-files.txt containing the full extracted file/directory list
fn_mod_create_filelist(){
echo -ne "building ${modcommand}-files.txt..."
sleep 0.5
# ${modsdir}/${modcommand}-files.txt
find "${extractdir}" -mindepth 1 -printf '%P\n' > "${modsdir}/${modcommand}-files.txt"
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Building ${modsdir}/${modcommand}-files.txt"
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Building ${modsdir}/${modcommand}-files.txt"
fi
# Adding removed files if needed
if [ -f "${modsdir}/.removedfiles.tmp" ]; then
cat "${modsdir}/.removedfiles.tmp" >> "${modsdir}/${modcommand}-files.txt"
fi
sleep 0.5
}
# Copy the mod into serverfiles
fn_mod_copy_destination(){
echo -ne "copying ${modprettyname} to ${modinstalldir}..."
sleep 0.5
cp -Rf "${extractdir}/." "${modinstalldir}/"
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Copying ${modprettyname} to ${modinstalldir}"
else
fn_print_ok_eol_nl
fn_script_log_pass "Copying ${modprettyname} to ${modinstalldir}"
fi
}
# Add the mod to the installed-mods.txt
fn_mod_add_list(){
if [ ! -n "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
echo "${modcommand}" >> "${modsinstalledlistfullpath}"
fn_script_log_info "${modcommand} added to ${modsinstalledlist}"
fi
}
# Prevent sensitive directories from being erased upon uninstall by removing them from: ${modcommand}-files.txt
fn_mod_tidy_files_list(){
# Check file list validity
fn_check_mod_files_list
# Output to the user
echo -ne "tidy up ${modcommand}-files.txt..."
sleep 0.5
fn_script_log_info "Tidy up ${modcommand}-files.txt"
# Lines/files to remove from file list (end with ";" separator)
removefromlist="cfg;addons;RustDedicated_Data;RustDedicated_Data\/Managed;RustDedicated_Data\/Managed\/x86;RustDedicated_Data\/Managed\/x64;"
# Loop through files to remove from file list,
# generate elements to remove from list
removefromlistamount="$(echo "${removefromlist}" | awk -F ';' '{ print NF }')"
# Test all subvalue of "removefromlist" using the ";" separator
for ((filesindex=1; filesindex < removefromlistamount; filesindex++)); do
# Put current file into test variable
removefilevar="$(echo "${removefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }')"
# Delete line(s) matching exactly
sed -i "/^${removefilevar}$/d" "${modsdir}/${modcommand}-files.txt"
# Exit on error
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Error while tidying line: ${removefilevar} from: ${modsdir}/${modcommand}-files.txt"
core_exit.sh
break
fi
done
fn_print_ok_eol_nl
# Sourcemod fix
# Remove metamod from sourcemod fileslist
if [ "${modcommand}" == "sourcemod" ]; then
# Remove addons/metamod & addons/metamod/sourcemod.vdf from ${modcommand}-files.txt
sed -i "/^addons\/metamod$/d" "${modsdir}/${modcommand}-files.txt"
sed -i "/^addons\/metamod\/sourcemod.vdf$/d" "${modsdir}/${modcommand}-files.txt"
fi
}
## Information Gathering
# Get details of a mod any (relevant and unique, such as full mod name or install command) value
fn_mod_get_info(){
# Variable to know when job is done
modinfocommand="0"
# Find entry in global array
for ((index=0; index <= ${#mods_global_array[@]}; index++)); do
# When entry is found
if [ "${mods_global_array[index]}" == "${currentmod}" ]; then
# Go back to the previous "MOD" separator
for ((index=index; index <= ${#mods_global_array[@]}; index--)); do
# When "MOD" is found
if [ "${mods_global_array[index]}" == "MOD" ]; then
# Get info
fn_mods_define
modinfocommand="1"
break
fi
done
fi
# Exit the loop if job is done
if [ "${modinfocommand}" == "1" ]; then
break
fi
done
# What happens if mod is not found
if [ "${modinfocommand}" == "0" ]; then
fn_script_log_error "Could not find information for ${currentmod}"
fn_print_error_nl "Could not find information for ${currentmod}"
exitcode="1"
core_exit.sh
fi
}
# Define all variables for a mod at once when index is set to a separator
fn_mods_define(){
if [ -z "$index" ]; then
fn_script_log_fatal "index variable not set. Please report an issue."
fn_print_error "index variable not set. Please report an issue."
echo "* https://github.com/GameServerManagers/LinuxGSM/issues"
core_exit.sh
fi
modcommand="${mods_global_array[index+1]}"
modprettyname="${mods_global_array[index+2]}"
modurl="${mods_global_array[index+3]}"
modfilename="${mods_global_array[index+4]}"
modsubdirs="${mods_global_array[index+5]}"
modlowercase="${mods_global_array[index+6]}"
modinstalldir="${mods_global_array[index+7]}"
modkeepfiles="${mods_global_array[index+8]}"
modengines="${mods_global_array[index+9]}"
modgames="${mods_global_array[index+10]}"
modexcludegames="${mods_global_array[index+11]}"
modsite="${mods_global_array[index+12]}"
moddescription="${mods_global_array[index+13]}"
}
# Builds list of installed mods
# using installed-mods.txt grabing mod info from mods_list.sh
fn_mods_installed_list(){
fn_mods_count_installed
# Set/reset variables
installedmodsline="1"
installedmodslist=()
modprettynamemaxlength="0"
modsitemaxlength="0"
moddescriptionmaxlength="0"
modcommandmaxlength="0"
# Loop through every line of the installed mods list ${modsinstalledlistfullpath}
while [ ${installedmodsline} -le ${installedmodscount} ]; do
currentmod="$(sed "${installedmodsline}q;d" "${modsinstalledlistfullpath}")"
# Get mod info to make sure mod exists
fn_mod_get_info
# Add the mod to available commands
installedmodslist+=( "${modcommand}" )
# Increment line check
((installedmodsline++))
done
if [ -n "${installedmodscount}" ] ;then
fn_script_log_info "${installedmodscount} addons/mods are currently installed"
fi
}
# Loops through mods_global_array to define available mods & provide available commands for mods installation
fn_mods_available(){
# First, reset variables
compatiblemodslist=()
availablemodscommands=()
# Find compatible games
# Find separators through the global array
for ((index="0"; index <= ${#mods_global_array[@]}; index++)); do
# If current value is a separator; then
if [ "${mods_global_array[index]}" == "${modseparator}" ]; then
# Set mod variables
fn_mods_define
# Test if game is compatible
fn_mod_compatible_test
# If game is compatible
if [ "${modcompatibility}" == "1" ]; then
# Put it into an array to prepare user output
compatiblemodslist+=( "${modprettyname}" "${modcommand}" "${modsite}" "${moddescription}" )
# Keep available commands in an array to make life easier
availablemodscommands+=( "${modcommand}" )
fi
fi
done
}
## Mod compatibility check
# Find out if a game is compatible with a mod from a modgames (list of games supported by a mod) variable
fn_compatible_mod_games(){
# Reset test value
modcompatiblegame="0"
# If value is set to GAMES (ignore)
if [ "${modgames}" != "GAMES" ]; then
# How many games we need to test
gamesamount="$(echo "${modgames}" | awk -F ';' '{ print NF }')"
# Test all subvalue of "modgames" using the ";" separator
for ((gamevarindex=1; gamevarindex < gamesamount; gamevarindex++)); do
# Put current game name into modtest variable
gamemodtest="$( echo "${modgames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )"
# If game name matches
if [ "${gamemodtest}" == "${gamename}" ]; then
# Mod is compatible !
modcompatiblegame="1"
fi
done
fi
}
# Find out if an engine is compatible with a mod from a modengines (list of engines supported by a mod) variable
fn_compatible_mod_engines(){
# Reset test value
modcompatibleengine="0"
# If value is set to ENGINES (ignore)
if [ "${modengines}" != "ENGINES" ]; then
# How many engines we need to test
enginesamount="$(echo "${modengines}" | awk -F ';' '{ print NF }')"
# Test all subvalue of "modengines" using the ";" separator
for ((gamevarindex=1; gamevarindex < ${enginesamount}; gamevarindex++)); do
# Put current engine name into modtest variable
enginemodtest="$( echo "${modengines}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )"
# If engine name matches
if [ "${enginemodtest}" == "${engine}" ]; then
# Mod is compatible!
modcompatibleengine="1"
fi
done
fi
}
# Find out if a game is not compatible with a mod from a modnotgames (list of games not supported by a mod) variable
fn_not_compatible_mod_games(){
# Reset test value
modeincompatiblegame="0"
# If value is set to NOTGAMES (ignore)
if [ "${modexcludegames}" != "NOTGAMES" ]; then
# How many engines we need to test
excludegamesamount="$(echo "${modexcludegames}" | awk -F ';' '{ print NF }')"
# Test all subvalue of "modexcludegames" using the ";" separator
for ((gamevarindex=1; gamevarindex < excludegamesamount; gamevarindex++)); do
# Put current engine name into modtest variable
excludegamemodtest="$( echo "${modexcludegames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )"
# If engine name matches
if [ "${excludegamemodtest}" == "${gamename}" ]; then
# Mod is compatible!
modeincompatiblegame="1"
fi
done
fi
}
# Sums up if a mod is compatible or not with modcompatibility=0/1
fn_mod_compatible_test(){
# Test game and engine compatibility
fn_compatible_mod_games
fn_compatible_mod_engines
fn_not_compatible_mod_games
if [ "${modeincompatiblegame}" == "1" ]; then
modcompatibility="0"
elif [ "${modcompatibleengine}" == "1" ]||[ "${modcompatiblegame}" == "1" ]; then
modcompatibility="1"
else
modcompatibility="0"
fi
}
## Directory management
# Create mods files and directories if it doesn't exist
fn_create_mods_dir(){
# Create lgsm data modsdir
if [ ! -d "${modsdir}" ];then
echo "creating lgsm mods data directory ${modsdir}..."
mkdir -p "${modsdir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Creating mod download dir ${modsdir}"
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Creating mod download dir ${modsdir}"
fi
sleep 0.5
fi
# Create mod install directory
if [ ! -d "${modinstalldir}" ]; then
echo "creating mods install directory ${modinstalldir}..."
mkdir -p "${modinstalldir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Creating mod install directory ${modinstalldir}"
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Creating mod install directory ${modinstalldir}"
fi
sleep 0.5
fi
# Create lgsm/data/${modsinstalledlist}
if [ ! -f "${modsinstalledlistfullpath}" ]; then
touch "${modsinstalledlistfullpath}"
fn_script_log_info "Created ${modsinstalledlistfullpath}"
fi
}
# Create tmp download mod directory
fn_mods_create_tmp_dir(){
if [ ! -d "${modstmpdir}" ]; then
mkdir -p "${modstmpdir}"
exitcode=$?
echo -ne "creating mod download directory ${modstmpdir}..."
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Creating mod download directory ${modstmpdir}"
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Creating mod download directory ${modstmpdir}"
fi
fi
}
# Remove the tmp mod download directory when finished
fn_mods_clear_tmp_dir(){
if [ -d "${modstmpdir}" ]; then
echo -ne "clearing mod download directory ${modstmpdir}..."
rm -r "${modstmpdir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Clearing mod download directory ${modstmpdir}"
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Clearing mod download directory ${modstmpdir}"
fi
fi
# Clear temp file list as well
if [ -f "${modsdir}/.removedfiles.tmp" ]; then
rm "${modsdir}/.removedfiles.tmp"
fi
}
# Counts how many mods were installed
fn_mods_count_installed(){
if [ -f "${modsinstalledlistfullpath}" ]; then
installedmodscount="$(wc -l < "${modsinstalledlistfullpath}")"
else
installedmodscount=0
fi
}
# Exits if no mods were installed
fn_mods_check_installed(){
# Count installed mods
fn_mods_count_installed
# If no mods are found
if [ ${installedmodscount} -eq 0 ]; then
echo ""
fn_print_failure_nl "No installed mods or addons were found"
echo " * Install mods using LGSM first with: ./${selfname} mods-install"
fn_script_log_error "No installed mods or addons were found."
core_exit.sh
fi
}
# Checks that mod files list exists and isn't empty
fn_check_mod_files_list(){
# File list must exist and be valid before any operation on it
if [ -f "${modsdir}/${modcommand}-files.txt" ]; then
# How many lines is the file list
modsfilelistsize="$(wc -l < "${modsdir}/${modcommand}-files.txt")"
# If file list is empty
if [ "${modsfilelistsize}" -eq 0 ]; then
fn_print_failure "${modcommand}-files.txt is empty"
echo "* Unable to remove ${modprettyname}"
fn_script_log_fatal "${modcommand}-files.txt is empty: Unable to remove ${modprettyname}."
core_exit.sh
fi
else
fn_print_failure "${modsdir}/${modcommand}-files.txt does not exist"
fn_script_log_fatal "${modsdir}/${modcommand}-files.txt does not exist: Unable to remove ${modprettyname}."
core_exit.sh
fi
}
## Database initialisation
mods_list.sh
fn_mods_available

73
lgsm/functions/mods_list.sh

@ -0,0 +1,73 @@
#!/bin/bash
# LGSM mods_list.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Lists and defines available mods for LGSM supported servers; works along with mods_core.sh.
# Usage: To add a mod, you need to add an array variable following the guide to set proper values;
# Usage: Then add this array to the mods_global_array.
# Usage: If needed, you can scrape the download URL first.
local commandname="MODS"
local commandaction="List Mods"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
# Get a proper URL for mods that don't provide a good one (optional)
fn_script_log_info "Retrieving latest mods URLs"
# Metamod
metamodscrapeurl="http://www.gsptalk.com/mirror/sourcemod"
metamodlatestfile="$(wget "${metamodscrapeurl}/?MD" -q -O -| grep "mmsource" | grep "\-linux" | head -n1 | awk -F '>' '{ print $3 }' | awk -F '<' '{ print $1}')"
metamoddownloadurl="http://cdn.probablyaserver.com/sourcemod/"
metamodurl="${metamoddownloadurl}/${metamodlatestfile}"
# Sourcemod
sourcemodmversion="1.8"
sourcemodscrapeurl="https://sm.alliedmods.net/smdrop/${sourcemodmversion}/sourcemod-latest-linux"
sourcemodlatestfile="$(wget "${sourcemodscrapeurl}" -q -O -)"
sourcemoddownloadurl="https://sm.alliedmods.net/smdrop/${sourcemodmversion}"
sourcemodurl="${sourcemoddownloadurl}/${sourcemodlatestfile}"
# Define mods information (required)
# Separator name
modseparator="MOD"
# REQUIRED: mod_info_name=( MOD "modcommand" "Pretty Name" "URL" "filename" "modsubdirs" "LowercaseOn/Off" "/files/to/keep;" "/install/path" "ENGINES" "GAMES" "NOTGAMES" "AUTHOR_URL" "Short Description" )
# Example 1) Well made mod: mod_info_name=( MOD "awesomemod" "This is an Awesome Mod" "https://awesomemod.com/latest.zip" "awesomemod.zip" "0" "LowercaseOff" "OVERWRITE" "${systemdir}/addons" "source;unity3d;" "GAMES" "NOTGAMES" "https://awesomemod.com/" "This mod knows that 42 is the answer" )
# Example 2) Poorly made mod: mod_info_name=( MOD "stupidmod" "This is a stupid mod" "${crappymodurl}" "StupidMod.zip" "2" "LowercaseOn" "cfg;data/crappymod;" "${systemdir}" "source;" "GAMES" "Garry's mod;Counter-Strike: Source;" "This mod is dumber than dumb" )
# None of those values can be empty
# index | Usage
# [0] | MOD: separator, all mods must begin with it
# [1] | "modcommand": the LGSM name and command to install the mod (must be unique and lowercase)
# [2] | "Pretty Name": the common name people use to call the mod that will be displayed to the user
# [3] | "URL": link to the mod archive file; can be a variable previously defined while scraping a URL
# [4] | "filename": the output filename
# [5] | "modsubdirs": in how many subdirectories is the mod (none is 0) (not used at release, but could be in the future)
# [6] | "LowercaseOn/Off": LowercaseOff or LowercaseOn: enable/disable converting extracted files and directories to lowercase (some games require it)
# [7] | "modinstalldir": the directory in which to install the mode ( use LGSM dir variables such as ${systemdir})
# [8] | "/files/to/keep;", files & directories that should not be overwritten upon update, separated and ended with a semicolon; you can also use "OVERWRITE" value to ignore the value or "NOUPDATE" to disallow updating; for files to keep upon uninstall, see fn_mod_tidy_files_list from mods_core.sh
# [9] | "Supported Engines;": list them according to LGSM ${engine} variables, separated and ended with a semicolon, or use ENGINES to ignore the value
# [10] | "Supported Games;": list them according to LGSM ${gamename} variables, separated and ended with a semicolon, or use GAMES to ignore the value
# [11] | "Unsupported Games;": list them according to LGSM ${gamename} variables, separated and ended with a semicolon, or use NOTGAMES to ignore the value (useful to exclude a game when using Supported Engines)
# [12] | "AUTHOR_URL" is the author's website, displayed to the user when chosing mods to install
# [13] | "Short Description" a description showed to the user upon installation/removal
# Source mods
mod_info_metamod=( MOD "metamod" "MetaMod" "${metamodurl}" "${metamodlatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/metamod/metaplugins.ini;" "source;" "GAMES" "NOTGAMES" "https://www.sourcemm.net" "Plugins Framework" )
mod_info_sourcemod=( MOD "sourcemod" "SourceMod" "${sourcemodurl}" "${sourcemodlatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "source;" "GAMES" "NOTGAMES" "http://www.sourcemod.net" "Admin Features (requires MetaMod)" )
# Garry's Mod Addons
mod_info_ulib=( MOD "ulib" "ULib" "https://codeload.github.com/TeamUlysses/ulib/zip/master" "ulib-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Complete Framework" )
mod_info_ulx=( MOD "ulx" "ULX" "https://codeload.github.com/TeamUlysses/ulx/zip/master" "ulx-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Admin Panel (requires ULib)" )
mod_info_utime=( MOD "utime" "UTime" "https://github.com/TeamUlysses/utime/archive/master.zip" "utime-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Keep track of players play time" )
mod_info_uclip=( MOD "uclip" "UClip" "https://github.com/TeamUlysses/uclip/archive/master.zip" "uclip-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "An alternative to noclip" )
mod_info_acf=( MOD "acf" "Armoured Combat Framework" "https://github.com/nrlulz/ACF/archive/master.zip" "acf-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "acf-master/lua/acf/shared/guns;" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/nrlulz/ACF" "Realistic Wepons & Engines" )
mod_info_acf_missiles=( MOD "acfmissiles" "ACF Missiles" "https://github.com/Bubbus/ACF-Missiles/archive/master.zip" "acf-missiles-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Bubbus/ACF-Missiles" "More missiles for ACF" )
mod_info_advdupe2=( MOD "advdupe2" "Advanced Duplicator 2" "https://github.com/wiremod/advdupe2/archive/master.zip" "advdupe2-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://www.wiremod.com" "Save your constructions" )
mod_info_darkrp=( MOD "darkrp" "DarkRP" "https://github.com/FPtje/DarkRP/archive/master.zip" "darkrp-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Most popular gamemode" )
mod_info_darkrpmodification=( MOD "darkrpmodification" "DarkRP Modification" "https://github.com/FPtje/darkrpmodification/archive/master.zip" "darkrpmodification-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "NOUPDATE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Customize DarkRP settings" )
# Oxidemod
mod_info_rustoxide=( MOD "rustoxide" "Oxide for Rust" "https://raw.githubusercontent.com/OxideMod/Snapshots/master/Oxide-Rust.zip" "Oxide-Rust_Linux.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Rust;" "NOTGAMES" "http://oxidemod.org/downloads/oxide-for-rust.1659" "Allows for the use of plugins" )
mod_info_hwoxide=( MOD "hwoxide" "Oxide for Hurtworld" "https://raw.githubusercontent.com/OxideMod/Snapshots/master/Oxide-Hurtworld.zip" "Oxide-Hurtworld_Linux.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Hurtworld;" "NOTGAMES" "http://oxidemod.org/downloads/oxide-for-hurtworld.1332" "Allows for the use of plugins" )
mod_info_sdtdoxide=( MOD "sdtdoxide" "Oxide for 7 Days To Die" "https://raw.githubusercontent.com/OxideMod/Snapshots/master/Oxide-7DaysToDie.zip" "Oxide-7DaysToDie_Linux.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "7 Days To Die;" "NOTGAMES" "http://oxidemod.org/downloads/oxide-for-7-days-to-die.813" "Allows for the use of plugins" )
# REQUIRED: Set all mods info into the global array
mods_global_array=( "${mod_info_metamod[@]}" "${mod_info_sourcemod[@]}" "${mod_info_ulib[@]}" "${mod_info_ulx[@]}" "${mod_info_utime[@]}" "${mod_info_uclip[@]}" "${mod_info_acf[@]}" "${mod_info_acf_missiles[@]}" "${mod_info_acf_sweps[@]}" "${mod_info_advdupe2[@]}" "${mod_info_darkrp[@]}" "${mod_info_darkrpmodification[@]}" "${mod_info_rustoxide[@]}" "${mod_info_hwoxide[@]}" "${mod_info_sdtdoxide[@]}" )

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

Loading…
Cancel
Save