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

Merge branch 'release/v20.3.0'

Daniel Gibbs 6 жил өмнө
parent
commit
983924fbbc
100 өөрчлөгдсөн 1357 нэмэгдсэн , 674 устгасан
  1. 0 5
      .github/pr_labels.yml
  2. 0 17
      .github/request-info.yml
  3. 0 15
      .github/support.yml
  4. 0 21
      .github/welcome.yml
  5. 2 3
      lgsm/config-default/config-lgsm/avserver/_default.cfg
  6. 175 0
      lgsm/config-default/config-lgsm/cmwserver/_default.cfg
  7. 4 3
      lgsm/config-default/config-lgsm/pstbsserver/_default.cfg
  8. 10 5
      lgsm/config-default/config-lgsm/ut3server/_default.cfg
  9. 108 0
      lgsm/data/name-left.csv
  10. 237 0
      lgsm/data/name-right.csv
  11. 1 0
      lgsm/data/serverlist.csv
  12. 21 22
      lgsm/functions/alert.sh
  13. 1 3
      lgsm/functions/alert_discord.sh
  14. 1 3
      lgsm/functions/alert_email.sh
  15. 1 3
      lgsm/functions/alert_ifttt.sh
  16. 1 3
      lgsm/functions/alert_mailgun.sh
  17. 1 3
      lgsm/functions/alert_pushbullet.sh
  18. 1 3
      lgsm/functions/alert_pushover.sh
  19. 1 3
      lgsm/functions/alert_slack.sh
  20. 1 3
      lgsm/functions/alert_telegram.sh
  21. 26 22
      lgsm/functions/check.sh
  22. 1 2
      lgsm/functions/check_config.sh
  23. 31 37
      lgsm/functions/check_deps.sh
  24. 1 2
      lgsm/functions/check_executable.sh
  25. 1 1
      lgsm/functions/check_glibc.sh
  26. 7 7
      lgsm/functions/check_ip.sh
  27. 2 0
      lgsm/functions/check_last_update.sh
  28. 1 2
      lgsm/functions/check_logs.sh
  29. 2 2
      lgsm/functions/check_permissions.sh
  30. 2 3
      lgsm/functions/check_root.sh
  31. 2 3
      lgsm/functions/check_status.sh
  32. 16 6
      lgsm/functions/check_steamcmd.sh
  33. 2 3
      lgsm/functions/check_system_dir.sh
  34. 1 2
      lgsm/functions/check_system_requirements.sh
  35. 1 1
      lgsm/functions/check_tmuxception.sh
  36. 19 0
      lgsm/functions/check_version.sh
  37. 12 12
      lgsm/functions/command_backup.sh
  38. 4 4
      lgsm/functions/command_console.sh
  39. 14 11
      lgsm/functions/command_debug.sh
  40. 3 3
      lgsm/functions/command_details.sh
  41. 6 0
      lgsm/functions/command_dev_clear_functions.sh
  42. 3 3
      lgsm/functions/command_dev_debug.sh
  43. 6 6
      lgsm/functions/command_dev_detect_deps.sh
  44. 4 4
      lgsm/functions/command_dev_detect_glibc.sh
  45. 3 3
      lgsm/functions/command_dev_detect_ldd.sh
  46. 4 4
      lgsm/functions/command_dev_query_raw.sh
  47. 3 3
      lgsm/functions/command_donate.sh
  48. 4 7
      lgsm/functions/command_fastdl.sh
  49. 3 3
      lgsm/functions/command_install.sh
  50. 3 3
      lgsm/functions/command_install_resources_mta.sh
  51. 3 3
      lgsm/functions/command_mods_install.sh
  52. 3 4
      lgsm/functions/command_mods_remove.sh
  53. 3 3
      lgsm/functions/command_mods_update.sh
  54. 17 27
      lgsm/functions/command_monitor.sh
  55. 16 18
      lgsm/functions/command_postdetails.sh
  56. 3 3
      lgsm/functions/command_restart.sh
  57. 15 16
      lgsm/functions/command_start.sh
  58. 11 15
      lgsm/functions/command_stop.sh
  59. 3 3
      lgsm/functions/command_test_alert.sh
  60. 3 3
      lgsm/functions/command_ts3_server_pass.sh
  61. 4 4
      lgsm/functions/command_update.sh
  62. 0 13
      lgsm/functions/command_update_functions.sh
  63. 159 75
      lgsm/functions/command_update_linuxgsm.sh
  64. 5 4
      lgsm/functions/command_validate.sh
  65. 3 3
      lgsm/functions/command_wipe.sh
  66. 3 2
      lgsm/functions/compress_unreal2_maps.sh
  67. 3 2
      lgsm/functions/compress_ut99_maps.sh
  68. 136 66
      lgsm/functions/core_dl.sh
  69. 9 7
      lgsm/functions/core_exit.sh
  70. 20 1
      lgsm/functions/core_functions.sh
  71. 1 1
      lgsm/functions/core_getopt.sh
  72. 2 0
      lgsm/functions/core_legacy.sh
  73. 3 4
      lgsm/functions/core_logs.sh
  74. 62 16
      lgsm/functions/core_messages.sh
  75. 2 0
      lgsm/functions/core_trap.sh
  76. 6 5
      lgsm/functions/fix.sh
  77. 44 34
      lgsm/functions/fix_ark.sh
  78. 1 3
      lgsm/functions/fix_arma3.sh
  79. 1 2
      lgsm/functions/fix_av.sh
  80. 33 0
      lgsm/functions/fix_cmw.sh
  81. 1 3
      lgsm/functions/fix_csgo.sh
  82. 1 3
      lgsm/functions/fix_dst.sh
  83. 1 2
      lgsm/functions/fix_ges.sh
  84. 6 4
      lgsm/functions/fix_hw.sh
  85. 2 3
      lgsm/functions/fix_ins.sh
  86. 1 3
      lgsm/functions/fix_kf.sh
  87. 1 3
      lgsm/functions/fix_kf2.sh
  88. 1 2
      lgsm/functions/fix_mcb.sh
  89. 1 3
      lgsm/functions/fix_mta.sh
  90. 1 2
      lgsm/functions/fix_nmrih.sh
  91. 1 3
      lgsm/functions/fix_onset.sh
  92. 1 3
      lgsm/functions/fix_ro.sh
  93. 1 2
      lgsm/functions/fix_rust.sh
  94. 1 2
      lgsm/functions/fix_rw.sh
  95. 1 2
      lgsm/functions/fix_sdtd.sh
  96. 1 3
      lgsm/functions/fix_sfc.sh
  97. 1 3
      lgsm/functions/fix_sof2.sh
  98. 1 3
      lgsm/functions/fix_ss3.sh
  99. 5 11
      lgsm/functions/fix_steamcmd.sh
  100. 1 3
      lgsm/functions/fix_terraria.sh

+ 0 - 5
.github/pr_labels.yml

@@ -1,5 +0,0 @@
-version: '1'
-invalidStatus: "pending"
-labelRule:
-  startsWith:
-    - "type:"

+ 0 - 17
.github/request-info.yml

@@ -1,17 +0,0 @@
-# Configuration for request-info - https://github.com/behaviorbot/request-info
-
-# *Required* Comment to reply with
-requestInfoReplyComment: >
-  ![More Data required](https://i.imgur.com/yS9cecv.png)
-  More data is required to assist with this issue
-  or issue template was not used correctly.
-  https://linuxgsm.com/support/#guide
-
-# *OPTIONAL* default titles to check against for lack of descriptiveness
-# MUST BE ALL LOWERCASE
-#requestInfoDefaultTitles:
-#  - update readme.md
-#  - updates
-
-# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
-requestInfoLabelToAdd: "needs more info"

+ 0 - 15
.github/support.yml

@@ -1,15 +0,0 @@
-# Configuration for support-requests - https://github.com/dessant/support-requests
-
-# Label used to mark issues as support requests
-supportLabel: "Outcome: wrong forum"
-# Comment to post on issues marked as support requests. Add a link
-# to a support page, or set to `false` to disable
-supportComment: >
-  We use the issue tracker exclusively for bug reports and feature requests.
-  However, this issue appears to be a support request. Please use our
-  support channels to get help with the project.
-  https://linuxgsm.com/support
-# Whether to close issues marked as support requests
-close: true
-# Whether to lock issues marked as support requests
-lock: false

+ 0 - 21
.github/welcome.yml

@@ -1,21 +0,0 @@
-# Configuration for welcome - https://github.com/behaviorbot/welcome
-
-# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
-
-# Comment to be posted to on first time issues
-newIssueWelcomeComment: >
-  Thank you for opening your first issue. Be sure to follow the issue template! and guide for posting. https://linuxgsm.com/support/#guide
-
-# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
-
-# Comment to be posted to on PRs from first time contributors in your repository
-newPRWelcomeComment: >
-  Thank you for opening this pull request! Please check out our contributing guidelines.
-
-# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
-
-# Comment to be posted to on pull requests merged by a first time user
-firstPRMergeComment: >
-  Congratulations on merging your first pull request! Thank you for supporting LinuxGSM!
-
-# It is recommend to include as many gifs and emojis as possible

+ 2 - 3
lgsm/config-default/config-lgsm/avserver/_default.cfg

@@ -11,14 +11,13 @@
 port="27000"
 # https://steamidfinder.com
 adminsteamid=""
-avgalaxy="avgalaxy"
 
 ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
 fn_parms(){
 if [ ! -z "${adminsteamid}" ]; then
 	admincmd="--admin ${adminsteamid}"
 fi
-parms="--galaxy-name ${avgalaxy} --ip ${ip} --datapath ${avdatapath} ${admincmd}"
+parms="--galaxy-name ${selfname} --ip ${ip} --datapath ${avdatapath} ${admincmd}"
 }
 
 #### LinuxGSM Settings ####
@@ -146,7 +145,7 @@ glibc="2.15"
 
 ## Game Server Directories
 avdatapath="${serverfiles}/galaxy"
-avgalaxypath="${avdatapath}/${avgalaxy}"
+avgalaxypath="${avdatapath}/${selfname}"
 systemdir="${serverfiles}"
 executabledir="${systemdir}"
 executable="./server.sh"

+ 175 - 0
lgsm/config-default/config-lgsm/cmwserver/_default.cfg

@@ -0,0 +1,175 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
+# Copy settings from here and use them in either:
+# common.cfg - applies settings to every instance.
+# [instance].cfg - applies settings to a specific instance.
+
+#### Game Server Settings ####
+
+## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters
+ip="0.0.0.0"
+port="7777"
+queryport="7779"
+defaultmap="AOCTD-Frigid_p"
+
+
+## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+fn_parms(){
+
+parms="${defaultmap}?steamsockets -multihome=${ip} -Port=${port} -QueryPort=${queryport} -seekfreeloadingserver -configsubdir=${gamelogdir} -log=${gamelog}"
+
+}
+
+#### LinuxGSM Settings ####
+
+## LinuxGSM Stats
+# Send useful stats to LinuxGSM developers.
+# https://docs.linuxgsm.com/configuration/linuxgsm-stats
+# (on|off)
+stats="off"
+
+## Notification Alerts
+# (on|off)
+
+# Display IP | https://docs.linuxgsm.com/alerts#display-ip
+displayip=""
+
+# More info | https://docs.linuxgsm.com/alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://termbin.com"
+
+# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://docs.linuxgsm.com/alerts/email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun
+mailgunalert="off"
+mailguntoken="accesstoken"
+mailgundomain="example.com"
+mailgunemailfrom="alert@example.com"
+mailgunemail="email@myemail.com"
+
+# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+
+# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
+slackalert="off"
+slackwebhook="webhook"
+
+# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
+# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring".
+# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need
+# any custom string in curl - simple ignore this parameter.
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+curlcustomstring=""
+
+## Updating | https://docs.linuxgsm.com/commands/update
+updateonstart="off"
+
+## Backup | https://docs.linuxgsm.com/commands/backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://docs.linuxgsm.com/features/logging
+consolelogging="on"
+logdays="7"
+
+## Monitor | https://docs.linuxgsm.com/commands/monitor
+# Query delay time
+querydelay="1"
+
+## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
+ansi="on"
+
+#### Advanced Settings ####
+
+## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
+sleeptime="0.5"
+
+## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd
+# Server appid
+appid="220070"
+# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
+branch=""
+# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server
+steammaster="false"
+
+## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
+# 1: tmux kill
+# 2: CTRL+c
+# 3: quit
+# 4: quit 120s
+# 5: stop
+# 6: q
+# 7: exit
+# 8: 7 Days to Die
+# 9: GoldSrc
+# 10: Avorion
+stopmode="2"
+
+## Query mode
+# 1: session only
+# 2: gamedig + gsquery
+# 3: gamedig
+# 4: gsquery
+# 5: tcp
+querymode="2"
+querytype="protocol-valve"
+
+## Game Server Details
+# Do not edit
+gamename="Chivalry: Medieval Warfare"
+engine="unreal3"
+glibc="2.15"
+
+#### Directories ####
+# Edit with care
+## Game Server Directories
+systemdir="${serverfiles}"
+executabledir="${systemdir}/Binaries/Linux"
+executable="./UDKGameServer-Linux"
+servercfgdir="${systemdir}/UDKGame/Config/${selfname}"
+servercfg="PCServer-UDKGame.ini"
+servercfgdefault="PCServer-UDKGame.ini"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${lgsmdir}/backup"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${systemdir}/Saved/Logs"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+gamelog="${gamelogdir}/${selfname}-game.log"
+lgsmlog="${lgsmlogdir}/${selfname}-script.log"
+consolelog="${consolelogdir}/${selfname}-console.log"
+alertlog="${lgsmlogdir}/${selfname}-alert.log"
+postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
+
+## Logs Naming
+lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
+gamelogdate="${gamelogdir}/${selfname}-game-$(date '+%Y-%m-%d-%H:%M:%S').log"

+ 4 - 3
lgsm/config-default/config-lgsm/pstbsserver/_default.cfg

@@ -12,14 +12,15 @@
 ip="0.0.0.0"
 port="10027"
 queryport="10037"
-randommap="ALWAYS"
+rconport="21114"
+randommap="NONE"
 #servername="LinuxGSM Server"
 maxplayers="40"
-reservedslots="2"
+reservedslots="0"
 
 ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
 fn_parms(){
-parms="MULTIHOME=${ip}?RANDOM=${randommap}?Port=${port}?QueryPort=${queryport}?MaxPlayers=${maxplayers}?NumReservedSlots=${reservedslots}"
+parms="MULTIHOME=${ip} RANDOM=${randommap} Port=${port} QueryPort=${queryport} RCONPORT=${rconport} FIXEDMAXPLAYERS=${maxplayers} NumReservedSlots=${reservedslots}"
 }
 
 #### LinuxGSM Settings ####

+ 10 - 5
lgsm/config-default/config-lgsm/ut3server/_default.cfg

@@ -14,18 +14,23 @@ port="7777"
 queryport="6500"
 defaultmap="VCTF-Suspense"
 game="UTGameContent.UTVehicleCTFGame_Content"
-mutators="" #"UTGame.UTMutator_Instagib,UTGame.UTMutator_LowGrav"
+# Example: mutators="UTGame.UTMutator_Instagib,UTGame.UTMutator_LowGrav"
+mutators=""
 isdedicated="true"
 islanmatch="false"
 usesstats="false"
 shouldadvertise="true"
 pureserver="1"
 allowjoininprogress="true"
+# Required: GameSpy Username and password
+# https://docs.linuxgsm.com/game-servers/unreal-tournament-3#server-gamespy-login
+gsusername=""
+gspassword=""
 
 ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
-# Edit with care | List of game types and mutators : https://docs.linuxgsm.com/game-servers/unreal-tournament-3
+# Edit with care | List of game types and mutators: https://docs.linuxgsm.com/game-servers/unreal-tournament-3
 fn_parms(){
-parms="server ${defaultmap}?Game=${game}?bIsDedicated=${isdedicated}?bIsLanMatch=${islanmatch}?bUsesStats=${usesstats}?bShouldAdvertise=${shouldadvertise}?PureServer=${pureserver}?bAllowJoinInProgress=${allowjoininprogress}?Mutator=${mutators}?ConfigSubDir=${selfname} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}"
+parms="server ${defaultmap}?Game=${game}?bIsDedicated=${isdedicated}?bIsLanMatch=${islanmatch}?bUsesStats=${usesstats}?bShouldAdvertise=${shouldadvertise}?PureServer=${pureserver}?bAllowJoinInProgress=${allowjoininprogress}?Mutator=${mutators}?ConfigSubDir=${selfname} -login=${gsusername} -password=${gspassword} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}"
 }
 
 #### LinuxGSM Settings ####
@@ -130,8 +135,8 @@ stopmode="2"
 # 3: gamedig
 # 4: gsquery
 # 5: tcp
-querymode="1"
-querytype=""
+querymode="2"
+querytype="ut3"
 
 ## Game Server Details
 # Do not edit

+ 108 - 0
lgsm/data/name-left.csv

@@ -0,0 +1,108 @@
+admiring
+adoring
+affectionate
+agitated
+amazing
+angry
+awesome
+beautiful
+blissful
+bold
+boring
+brave
+busy
+charming
+clever
+cool
+compassionate
+competent
+condescending
+confident
+cranky
+crazy
+dazzling
+determined
+distracted
+dreamy
+eager
+ecstatic
+elastic
+elated
+elegant
+eloquent
+epic
+exciting
+fervent
+festive
+flamboyant
+focused
+friendly
+frosty
+funny
+gallant
+gifted
+goofy
+gracious
+great
+happy
+hardcore
+heuristic
+hopeful
+hungry
+infallible
+inspiring
+interesting
+intelligent
+jolly
+jovial
+keen
+kind
+laughing
+loving
+lucid
+magical
+mystifying
+modest
+musing
+naughty
+nervous
+nice
+nifty
+nostalgic
+objective
+optimistic
+peaceful
+pedantic
+pensive
+practical
+priceless
+quirky
+quizzical
+recursing
+relaxed
+reverent
+romantic
+sad
+serene
+sharp
+silly
+sleepy
+stoic
+strange
+stupefied
+suspicious
+sweet
+tender
+thirsty
+trusting
+unruffled
+upbeat
+vibrant
+vigilant
+vigorous
+wizardly
+wonderful
+xenodochial
+youthful
+zealous
+zen

+ 237 - 0
lgsm/data/name-right.csv

@@ -0,0 +1,237 @@
+albattani
+allen
+almeida
+antonelli
+agnesi
+archimedes
+ardinghelli
+aryabhata
+austin
+babbage
+banach
+banzai
+bardeen
+bartik
+bassi
+beaver
+bell
+benz
+bhabha
+bhaskara
+black
+blackburn
+blackwell
+bohr
+booth
+borg
+bose
+bouman
+boyd
+brahmagupta
+brattain
+brown
+buck
+burnell
+cannon
+carson
+cartwright
+carver
+cerf
+chandrasekhar
+chaplygin
+chatelet
+chatterjee
+chebyshev
+cohen
+chaum
+clarke
+colden
+cori
+cray
+curran
+curie
+darwin
+davinci
+dewdney
+dhawan
+diffie
+dijkstra
+dirac
+driscoll
+dubinsky
+easley
+edison
+einstein
+elbakyan
+elgamal
+elion
+ellis
+engelbart
+euclid
+euler
+faraday
+feistel
+fermat
+fermi
+feynman
+franklin
+gagarin
+galileo
+galois
+ganguly
+gates
+gauss
+germain
+goldberg
+goldstine
+goldwasser
+golick
+goodall
+gould
+greider
+grothendieck
+haibt
+hamilton
+haslett
+hawking
+hellman
+heisenberg
+hermann
+herschel
+hertz
+heyrovsky
+hodgkin
+hofstadter
+hoover
+hopper
+hugle
+hypatia
+ishizaka
+jackson
+jang
+jemison
+jennings
+jepsen
+johnson
+joliot
+jones
+kalam
+kapitsa
+kare
+keldysh
+keller
+kepler
+khayyam
+khorana
+kilby
+kirch
+knuth
+kowalevski
+lalande
+lamarr
+lamport
+leakey
+leavitt
+lederberg
+lehmann
+lewin
+lichterman
+liskov
+lovelace
+lumiere
+mahavira
+margulis
+matsumoto
+maxwell
+mayer
+mccarthy
+mcclintock
+mclaren
+mclean
+mcnulty
+mendel
+mendeleev
+meitner
+meninsky
+merkle
+mestorf
+mirzakhani
+moore
+morse
+murdock
+moser
+napier
+nash
+neumann
+newton
+nightingale
+nobel
+noether
+northcutt
+noyce
+panini
+pare
+pascal
+pasteur
+payne
+perlman
+pike
+poincare
+poitras
+proskuriakova
+ptolemy
+raman
+ramanujan
+ride
+montalcini
+ritchie
+rhodes
+robinson
+roentgen
+rosalind
+rubin
+saha
+sammet
+sanderson
+satoshi
+shamir
+shannon
+shaw
+shirley
+shockley
+shtern
+sinoussi
+snyder
+solomon
+spence
+stonebraker
+sutherland
+swanson
+swartz
+swirles
+taussig
+tereshkova
+tesla
+tharp
+thompson
+torvalds
+tu
+turing
+varahamihira
+vaughan
+visvesvaraya
+volhard
+villani
+wescoff
+wilbur
+wiles
+williams
+williamson
+wilson
+wing
+wozniak
+wright
+wu
+yalow
+yonath
+zhukovsky

+ 1 - 0
lgsm/data/serverlist.csv

@@ -14,6 +14,7 @@ bs,bsserver,Blade Symphony
 bt,btserver,Barotrauma
 bt1944,bt1944server,Battalion 1944
 cc,ccserver,Codename CURE
+cmw,cmwserver,Chivalry: Medieval Warfare
 cod,codserver,Call of Duty
 cod2,cod2server,Call of Duty 2
 cod4,cod4server,Call of Duty 4

+ 21 - 22
lgsm/functions/alert.sh

@@ -4,8 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Overall function for managing alerts.
 
-local modulename="ALERT"
-local commandaction="Alert"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_alert_log(){
 	info_distro.sh
@@ -100,23 +99,23 @@ fn_alert_log
 if [ "${postalert}" == "on" ]&&[ -n "${postalert}" ]; then
 	exitbypass=1
 	command_postdetails.sh
-elif [ "${postalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ "${postalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "More Info not enabled"
 	fn_script_log_warn "More Info alerts not enabled"
-elif [ -z "${posttarget}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${posttarget}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "posttarget not set"
 	fn_script_error "posttarget not set"
-elif [ -z "${postdays}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${postdays}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "postdays not set"
 	fn_script_error "postdays not set"
 fi
 
 if [ "${discordalert}" == "on" ]&&[ -n "${discordalert}" ]; then
 	alert_discord.sh
-elif [ "${discordalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ "${discordalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "Discord alerts not enabled"
 	fn_script_log_warn "Discord alerts not enabled"
-elif [ -z "${discordtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${discordtoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Discord token not set"
 	echo -e "* https://docs.linuxgsm.com/alerts/discord"
 	fn_script_error "Discord token not set"
@@ -124,20 +123,20 @@ fi
 
 if [ "${emailalert}" == "on" ]&&[ -n "${email}" ]; then
 	alert_email.sh
-elif [ "${emailalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ "${emailalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "Email alerts not enabled"
 	fn_script_log_warn "Email alerts not enabled"
-elif [ -z "${email}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${email}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Email not set"
 	fn_script_log_error "Email not set"
 fi
 
 if [ "${iftttalert}" == "on" ]&&[ -n "${iftttalert}" ]; then
 	alert_ifttt.sh
-elif [ "${iftttalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ "${iftttalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "IFTTT alerts not enabled"
 	fn_script_log_warn "IFTTT alerts not enabled"
-elif [ -z "${ifttttoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${ifttttoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "IFTTT token not set"
 	echo -e "* https://docs.linuxgsm.com/alerts/ifttt"
 	fn_script_error "IFTTT token not set"
@@ -145,10 +144,10 @@ fi
 
 if [ "${mailgunalert}" == "on" ]&&[ -n "${mailgunalert}" ]; then
 	alert_mailgun.sh
-elif [ "${mailgunalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ "${mailgunalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "Mailgun alerts not enabled"
 	fn_script_log_warn "Mailgun alerts not enabled"
-elif [ -z "${mailguntoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${mailguntoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Mailgun token not set"
 	echo -e "* https://docs.linuxgsm.com/alerts/mailgun"
 	fn_script_error "Mailgun token not set"
@@ -156,10 +155,10 @@ fi
 
 if [ "${pushbulletalert}" == "on" ]&&[ -n "${pushbullettoken}" ]; then
 	alert_pushbullet.sh
-elif [ "${pushbulletalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ "${pushbulletalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "Pushbullet alerts not enabled"
 	fn_script_log_warn "Pushbullet alerts not enabled"
-elif [ -z "${pushbullettoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${pushbullettoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Pushbullet token not set"
 	echo -e "* https://docs.linuxgsm.com/alerts/pushbullet"
 	fn_script_error "Pushbullet token not set"
@@ -167,10 +166,10 @@ fi
 
 if [ "${pushoveralert}" == "on" ]&&[ -n "${pushoveralert}" ]; then
 	alert_pushover.sh
-elif [ "${pushoveralert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ "${pushoveralert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "Pushover alerts not enabled"
 	fn_script_log_warn "Pushover alerts not enabled"
-elif [ -z "${pushovertoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${pushovertoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Pushover token not set"
 	echo -e "* https://docs.linuxgsm.com/alerts/pushover"
 	fn_script_error "Pushover token not set"
@@ -178,14 +177,14 @@ fi
 
 if [ "${telegramalert}" == "on" ]&&[ -n "${telegramtoken}" ]; then
 	alert_telegram.sh
-elif [ "${telegramalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ "${telegramalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "Telegram Messages not enabled"
 	fn_script_log_warn "Telegram Messages not enabled"
-elif [ -z "${telegramtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${telegramtoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Telegram token not set."
 	echo -e "* https://docs.linuxgsm.com/alerts/telegram"
 	fn_script_error "Telegram token not set."
-elif [ -z "${telegramchatid}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${telegramchatid}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Telegram chat id not set."
 	echo -e "* https://docs.linuxgsm.com/alerts/telegram"
 	fn_script_error "Telegram chat id not set."
@@ -193,10 +192,10 @@ fi
 
 if [ "${slackalert}" == "on" ]&&[ -n "${slackalert}" ]; then
 	alert_slack.sh
-elif [ "${slackalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ "${slackalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "Slack alerts not enabled"
 	fn_script_log_warn "Slack alerts not enabled"
-elif [ -z "${slacktoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${slacktoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Slack token not set"
 	echo -e "* https://docs.linuxgsm.com/alerts/slack"
 	fn_script_error "Slack token not set"

+ 1 - 3
lgsm/functions/alert_discord.sh

@@ -5,9 +5,7 @@
 # Website: https://linuxgsm.com
 # Description: Sends Discord alert.
 
-local modulename="ALERT"
-local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 if ! command -v jq > /dev/null; then
 	fn_print_fail_nl "Sending Discord alert: jq is missing."

+ 1 - 3
lgsm/functions/alert_email.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Sends email alert.
 
-local modulename="ALERT"
-local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_print_dots "Sending Email alert: ${email}"
 fn_sleep_time

+ 1 - 3
lgsm/functions/alert_ifttt.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Sends IFTTT alert.
 
-local modulename="ALERT"
-local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 json=$(cat <<EOF
 {

+ 1 - 3
lgsm/functions/alert_mailgun.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Sends Mailgun Email alert.
 
-local modulename="ALERT"
-local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_print_dots "Sending Email alert: Mailgun: ${email}"
 

+ 1 - 3
lgsm/functions/alert_pushbullet.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Sends Pushbullet Messenger alert.
 
-local modulename="ALERT"
-local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 json=$(cat <<EOF
 {

+ 1 - 3
lgsm/functions/alert_pushover.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Sends Pushover alert.
 
-local modulename="ALERT"
-local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_print_dots "Sending Pushover alert"
 

+ 1 - 3
lgsm/functions/alert_slack.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Sends Slack alert.
 
-local modulename="ALERT"
-local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 if ! command -v jq > /dev/null; then
 	fn_print_fail_nl "Sending Slack alert: jq is missing."

+ 1 - 3
lgsm/functions/alert_telegram.sh

@@ -4,9 +4,7 @@
 # Website: https://bytegaming.de
 # Description: Sends Telegram Messenger alert.
 
-local modulename="ALERT"
-local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 json=$(cat <<EOF
 {

+ 26 - 22
lgsm/functions/check.sh

@@ -5,101 +5,105 @@
 # Description: Overall function for managing checks.
 # Runs checks that will either halt on or fix an issue.
 
-local modulename="CHECK"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Every command that requires checks just references check.sh.
 # check.sh selects which checks to run by using arrays.
 
-if [ "${userinput}" != "install" ]&&[ "${userinput}" != "auto-install" ]&&[ "${userinput}" != "i" ]&&[ "${userinput}" != "ai" ]; then
+if [ "${commandname}" != "INSTALL" ]; then
 	check_root.sh
 fi
 
+if [ "${commandname}" != "UPDATE-LGSM" ]; then
+	check_version.sh
+fi
+
 check_tmuxception.sh
 
 if [ "$(whoami)" != "root" ]; then
-	if [ "${function_selfname}" != "command_monitor.sh" ]; then
+	if [ "${commandname}" != "MONITOR" ]; then
 		check_permissions.sh
 	fi
 fi
 
-if [ "${function_selfname}" != "command_install.sh" ]&&[ "${function_selfname}" != "command_update_functions.sh" ]&&[ "${function_selfname}" != "command_update_linuxgsm.sh" ]&&[ "${function_selfname}" != "command_details.sh" ]&&[ "${function_selfname}" != "command_postdetails.sh" ]; then
+if [ "${commandname}" != "INSTALL" ]&&[ "${commandname}" != "UPDATE-LGSM" ]&&[ "${commandname}" != "DETAILS" ]&&[ "${commandname}" != "POST-DETAILS" ]; then
 	check_system_dir.sh
 fi
 
-local allowed_commands_array=( command_start.sh command_debug.sh )
+allowed_commands_array=( START DEBUG )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${function_selfname}" ]; then
+	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_executable.sh
 	fi
 done
 
 if [ "$(whoami)" != "root" ]; then
-	local allowed_commands_array=( command_debug.sh command_start.sh command_install.sh )
+	allowed_commands_array=( DEBUG START INSTALL )
 	for allowed_command in "${allowed_commands_array[@]}"
 	do
-		if [ "${allowed_command}" == "${function_selfname}" ]; then
+		if [ "${allowed_command}" == "${commandname}" ]; then
 			check_glibc.sh
 		fi
 	done
 fi
 
-local allowed_commands_array=( command_backup.sh command_console.sh command_debug.sh command_details.sh command_unreal2_maps.sh command_fastdl.sh command_mods_install.sh command_mods_remove.sh command_mods_update.sh command_monitor.sh command_postdetails.sh command_restart.sh command_start.sh command_stop.sh command_test_alert.sh command_ts3_server_pass.sh command_update.sh command_update_functions.sh command_validate.sh command_wipe.sh command_unreal2_maps.sh command_ut99maps.sh)
+allowed_commands_array=( BACKUP CONSOLE DEBUG DETAILS MAP-COMPRESSOR FASTDL MODS-INSTALL MODS-REMOVE MODS-UPDATE MONITOR POST-DETAILS RESTART START STOP TEST-ALERT CHANGE-PASSWORD UPDATE UPDATE-LGSM VALIDATE WIPW )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${function_selfname}" ]; then
+	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_logs.sh
 	fi
 done
 
-local allowed_commands_array=( command_debug.sh command_start.sh command_stop.sh )
+allowed_commands_array=( DEBUG START STOP )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${function_selfname}" ]; then
+	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_deps.sh
 	fi
 done
 
-local allowed_commands_array=( command_console.sh command_debug.sh command_monitor.sh command_start.sh command_stop.sh )
+allowed_commands_array=( CONSOLE DEBUG MONITOR START STOP )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${function_selfname}" ]; then
+	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_config.sh
 	fi
 done
 
-local allowed_commands_array=( command_debug.sh command_details.sh command_postdetails.sh command_monitor.sh command_start.sh command_stop.sh command_dev_query_raw.sh )
+allowed_commands_array=( DEBUG DETAILS POST_DETAILS MONITOR START STOP DEV-QUERY-RAW )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${function_selfname}" ]; then
+	if [ "${allowed_command}" == "${commandname}" ]; then
 		if [ -z "${installflag}" ]; then
 			check_ip.sh
 		fi
 	fi
 done
 
-local allowed_commands_array=( update_steamcmd.sh command_debug.sh command_start.sh command_validate.sh )
+allowed_commands_array=( DEBUG START VALIDATE )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${function_selfname}" ]; then
+	if [ "${allowed_command}" == "${commandname}" ]; then
 		if [ "${appid}" ]; then
 			check_steamcmd.sh
 		fi
 	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 )
+allowed_commands_array=( DETAILS MONITOR START STOP CHANGE-PASSWORD UPDATE VALIDATE )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${function_selfname}" ]; then
+	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_status.sh
 	fi
 done
 
-local allowed_commands_array=( command_debug.sh command_start.sh command_install.sh )
+allowed_commands_array=( DEBUG START INSTALL )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${function_selfname}" ]; then
+	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_system_requirements.sh
 	fi
 done

+ 1 - 2
lgsm/functions/check_config.sh

@@ -4,8 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Checks if the server config is missing and warns the user if needed.
 
-local modulename="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 if [ ! -f "${servercfgfullpath}" ]; then
 	if [ "${shortname}" != "hw" ]&&[ "${shortname}" != "ut3" ]&&[ "${shortname}" != "kf2" ]; then

+ 31 - 37
lgsm/functions/check_deps.sh

@@ -4,7 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Checks if required dependencies are installed for LinuxGSM.
 
-local modulename="CHECK"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_install_mono_repo(){
 	if [ "${monostatus}" != "0" ]; then
@@ -26,13 +26,13 @@ fn_install_mono_repo(){
 			echo -en "   \r"
 			if [ "${distroid}" == "ubuntu" ]; then
 				if [ "${distroversion}" == "18.04" ]; then
-					cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
+					cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
 					eval "${cmd}"
 				elif [ "${distroversion}" == "16.04" ]; then
-					cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt install apt-transport-https;echo 'deb https://download.mono-project.com/repo/ubuntu stable-xenial main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
+					cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt-get install apt-transport-https;echo 'deb https://download.mono-project.com/repo/ubuntu stable-xenial main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
 					eval "${cmd}"
 				elif [ "${distroversion}" == "14.04" ]; then
-					cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt install apt-transport-https;echo 'deb https://download.mono-project.com/repo/ubuntu stable-trusty main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
+					cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt-get install apt-transport-https;echo 'deb https://download.mono-project.com/repo/ubuntu stable-trusty main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
 					eval "${cmd}"
 				else
 					fn_print_warn_nl "Installing Mono repository."
@@ -43,13 +43,13 @@ fn_install_mono_repo(){
 				fi
 			elif [ "${distroid}" == "debian" ]; then
 				if [ "${distroversion}" == "10" ]; then
-					cmd="sudo apt install apt-transport-https dirmngr;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-buster main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
+					cmd="sudo apt-get install apt-transport-https dirmngr;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-buster main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
 					eval "${cmd}"
 				elif [ "${distroversion}" == "9" ]; then
-					cmd="sudo apt install apt-transport-https dirmngr;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-stretch main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
+					cmd="sudo apt-get install apt-transport-https dirmngr;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-stretch main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
 					eval "${cmd}"
 				elif [ "${distroversion}" == "8" ]; then
-					cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt install apt-transport-https;echo 'deb https://download.mono-project.com/repo/debian stable-jessie main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
+					cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt-get install apt-transport-https;echo 'deb https://download.mono-project.com/repo/debian stable-jessie main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
 					eval "${cmd}"
 				else
 					echo -e "Mono auto install not available for ${distroname}"
@@ -171,14 +171,14 @@ if [ "${javacheck}" == "1" ]; then
 	if [ "${depstatus}" == "0" ]; then
 		# If dependency is found.
 		missingdep=0
-		if [ "${function_selfname}" == "command_install.sh" ]; then
+		if [ "${commandname}" == "INSTALL" ]; then
 			echo -e "${green}${deptocheck}${default}"
 			fn_sleep_time
 		fi
 	else
 		# If dependency is not found.
 		missingdep=1
-		if [ "${function_selfname}" == "command_install.sh" ]; then
+		if [ "${commandname}" == "INSTALL" ]; then
 			echo -e "${red}${deptocheck}${default}"
 			fn_sleep_time
 		fi
@@ -220,10 +220,10 @@ fn_deps_email(){
 }
 
 fn_found_missing_deps(){
-	if [ "${#array_deps_missing[@]}" != "0" ]; then
+	if [ "${#array_deps_missing[*]}" != "0" ]; then
 
-		fn_print_warning_nl "Missing dependencies: ${red}${array_deps_missing[@]}${default}"
-		fn_script_log_warn "Missing dependencies: ${array_deps_missing[@]}"
+		fn_print_warning_nl "Missing dependencies: ${red}${array_deps_missing[*]}${default}"
+		fn_script_log_warn "Missing dependencies: ${array_deps_missing[*]}"
 		fn_sleep_time
 		if [ "${monostatus}" ]; then
 			fn_install_mono_repo
@@ -248,13 +248,13 @@ fn_found_missing_deps(){
 			sleep 1
 			echo -en "   \r"
 			if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
-				cmd="echo steamcmd steam/question select \"I AGREE\" | sudo debconf-set-selections; echo steamcmd steam/license note '' | sudo debconf-set-selections; sudo dpkg --add-architecture i386; sudo apt update; sudo apt -y install ${array_deps_missing[@]}"
+				cmd="echo steamcmd steam/question select \"I AGREE\" | sudo debconf-set-selections; echo steamcmd steam/license note '' | sudo debconf-set-selections; sudo dpkg --add-architecture i386; sudo apt-get update; sudo apt-get -y install ${array_deps_missing[*]}"
 				eval "${cmd}"
 			elif [ "$(command -v dnf 2>/dev/null)" ]; then
-				cmd="sudo dnf -y install ${array_deps_missing[@]}"
+				cmd="sudo dnf -y install ${array_deps_missing[*]}"
 				eval "${cmd}"
 			elif [ "$(command -v yum 2>/dev/null)" ]; then
-				cmd="sudo yum -y install ${array_deps_missing[@]}"
+				cmd="sudo yum -y install ${array_deps_missing[*]}"
 				eval "${cmd}"
 			fi
 			if [ $? != 0 ]; then
@@ -264,15 +264,15 @@ fn_found_missing_deps(){
 				fn_print_warning_nl "Manually install dependencies."
 				fn_script_log_warn "Manually install dependencies."
 				if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
-					echo -e "	sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}"
+					echo -e "	sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[*]}"
 				elif [ "$(command -v dnf 2>/dev/null)" ]; then
-					echo -e "	sudo dnf install ${array_deps_missing[@]}"
+					echo -e "	sudo dnf install ${array_deps_missing[*]}"
 				elif [ "$(command -v yum 2>/dev/null)" ]; then
-					echo -e "	sudo yum install ${array_deps_missing[@]}"
+					echo -e "	sudo yum install ${array_deps_missing[*]}"
 				fi
 				if [ "${steamcmdfail}" ]; then
 					echo -e ""
-					if [ "${function_selfname}" == "command_install.sh" ]; then
+					if [ "${commandname}" == "INSTALL" ]; then
 						fn_print_failure_nl "Missing dependencies required to run SteamCMD."
 						fn_script_log_fatal "Missing dependencies required to run SteamCMD."
 						core_exit.sh
@@ -290,15 +290,15 @@ fn_found_missing_deps(){
 			fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies."
 			echo -e ""
 			if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
-				echo -e "sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}"
+				echo -e "sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[*]}"
 			elif [ "$(command -v dnf 2>/dev/null)" ]; then
-				echo -e "sudo dnf install ${array_deps_missing[@]}"
+				echo -e "sudo dnf install ${array_deps_missing[*]}"
 			elif [ "$(command -v yum 2>/dev/null)" ]; then
-				echo -e "sudo yum install ${array_deps_missing[@]}"
+				echo -e "sudo yum install ${array_deps_missing[*]}"
 			fi
 			if [ "${steamcmdfail}" ]; then
 				echo -e ""
-				if [ "${function_selfname}" == "command_install.sh" ]; then
+				if [ "${commandname}" == "INSTALL" ]; then
 					fn_print_failure_nl "Missing dependencies required to run SteamCMD."
 					fn_script_log_fatal "Missing dependencies required to run SteamCMD."
 					core_exit.sh
@@ -309,11 +309,11 @@ fn_found_missing_deps(){
 			fi
 			echo -e ""
 		fi
-		if [ "${function_selfname}" == "command_install.sh" ]; then
+		if [ "${commandname}" == "INSTALL" ]; then
 			sleep 5
 		fi
 	else
-		if [ "${function_selfname}" == "command_install.sh" ]; then
+		if [ "${commandname}" == "INSTALL" ]; then
 			fn_print_information_nl "Required dependencies already installed."
 			fn_script_log_info "Required dependencies already installed."
 		fi
@@ -322,7 +322,7 @@ fn_found_missing_deps(){
 
 fn_check_loop(){
 	# Loop though required depenencies.
-	for deptocheck in "${array_deps_required[@]}"
+	for deptocheck in ${array_deps_required[*]}
 	do
 		fn_deps_detector
 	done
@@ -368,8 +368,8 @@ fn_deps_build_debian(){
 	# 7 Days to Die
 	elif [ "${shortname}" == "sdtd" ]; then
 		array_deps_required+=( telnet expect )
-	# No More Room in Hell, Counter-Strike: Source, Garry's Mod and Zombie Panic: Source
-	elif [ "${shortname}" == "nmrih" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "zps" ]; then
+		# Battlefield 1942, Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source
+	elif [ "${shortname}" == "bf1942" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "zmr" ]||[ "${shortname}" == "zps" ]; then
 		if [ "${arch}" == "x86_64" ]; then
 			array_deps_required+=( libtinfo5:i386 )
 		else
@@ -381,9 +381,6 @@ fn_deps_build_debian(){
 		if [ "${shortname}" == "tf2" ]; then
 			array_deps_required+=( libtcmalloc-minimal4:i386 )
 		fi
-	# Battlefield: 1942
-	elif [ "${shortname}" == "bf1942" ]; then
-		array_deps_required+=( libncurses5:i386 )
 	# Call of Duty & Medal of Honor: Allied Assault
 	elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]||[ "${shortname}" == "mohaa" ]; then
 		array_deps_required+=( libstdc++5:i386 )
@@ -483,8 +480,8 @@ fn_deps_build_redhat(){
 	# 7 Days to Die
 	elif [ "${shortname}" == "sdtd" ]; then
 		array_deps_required+=( telnet expect )
-	# No More Room in Hell, Counter-Strike: Source, Garry's Mod and Zombie Panic: Source
-	elif [ "${shortname}" == "nmrih" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "zps" ]; then
+		# Battlefield 1942, Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source
+	elif [ "${shortname}" == "bf1942" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "zmr" ]||[ "${shortname}" == "zps" ]; then
 		array_deps_required+=( ncurses-libs.i686 )
 	# Brainbread 2, Don't Starve Together & Team Fortress 2
 	elif [ "${shortname}" == "bb2" ]||[ "${shortname}" == "dst" ]||[ "${shortname}" == "tf2" ]; then
@@ -492,9 +489,6 @@ fn_deps_build_redhat(){
 		if [ "${shortname}" == "tf2" ]; then
 			array_deps_required+=( gperftools-libs.i686 )
 		fi
-	# Battlefield: 1942
-	elif [ "${shortname}" == "bf1942" ]; then
-		array_deps_required+=( ncurses-libs.i686 )
 	# Call of Duty & Medal of Honor: Allied Assault
 	elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]||[ "${shortname}" == "mohaa" ]; then
 		array_deps_required+=( compat-libstdc++-33.i686 )
@@ -556,7 +550,7 @@ fn_deps_build_redhat(){
 	fn_check_loop
 }
 
-if [ "${function_selfname}" == "command_install.sh" ]; then
+if [ "${commandname}" == "INSTALL" ]; then
 	if [ "$(whoami)" == "root" ]; then
 		echo -e ""
 		echo -e "${lightyellow}Checking Dependencies as root${default}"

+ 1 - 2
lgsm/functions/check_executable.sh

@@ -4,8 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Checks if server executable exists.
 
-local modulename="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Check if executable exists
 if [ ! -f "${executabledir}/${execname}" ]; then

+ 1 - 1
lgsm/functions/check_glibc.sh

@@ -4,7 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Checks if the server has the correct Glibc version.
 
-local modulename="CHECK"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 info_distro.sh
 

+ 7 - 7
lgsm/functions/check_ip.sh

@@ -5,7 +5,7 @@
 # Description: Automatically identifies the server interface IP.
 # If multiple interfaces are detected the user will need to manually set using ip="0.0.0.0".
 
-local modulename="CHECK"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 if [ "${travistest}" != "1" ]; then
 	if [ ! -f "/bin/ip" ]; then
@@ -23,10 +23,10 @@ if [ "${travistest}" != "1" ]; then
 		fn_print_dots "Check IP"
 		# Multiple interfaces.
 		if [ "${getipwc}" -ge "2" ]; then
-			if [ "${function_selfname}" == "command_details.sh" ]; then
-			    fn_print_warn "Check IP: Multiple IP addresses found."
+			if [ "${commandname}" == "details" ]; then
+				fn_print_warn "Check IP: Multiple IP addresses found."
 			else
-			    fn_print_fail "Check IP: Multiple IP addresses found."
+				fn_print_fail "Check IP: Multiple IP addresses found."
 			fi
 			echo -en "\n"
 			# IP is set within game config.
@@ -55,7 +55,7 @@ if [ "${travistest}" != "1" ]; then
 			echo -en "https://linuxgsm.com/network-interfaces\n"
 			echo -en ""
 			# Do not exit for details and postdetails commands.
-			if [ "${function_selfname}" != "command_details.sh" ]||[ "${function_selfname}" != "command_postdetails.sh" ]; then
+			if [ "${commandname}" != "DETAILS" ]||[ "${commandname}" != "POST-DETAILS" ]; then
 				fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n"
 				core_exit.sh
 			else
@@ -76,8 +76,8 @@ if [ "${travistest}" != "1" ]; then
 			fn_script_log_fatal "IP address not set in game config."
 			fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}."
 			fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n"
-			if [ "${function_selfname}" != "command_details.sh" ]; then
-			    core_exit.sh
+			if [ "${commandname}" != "DETAILS" ]; then
+				core_exit.sh
 			fi
 		else
 			fn_print_info_nl "Check IP: ${getip}"

+ 2 - 0
lgsm/functions/check_last_update.sh

@@ -5,6 +5,8 @@
 # Description: Checks lock file to see when last update happened.
 # Will reboot server if instance not rebooted since update.
 
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
 if [ -f "${lockdir}/${selfname}-laststart.lock" ]; then
 	laststart=$(cat "${lockdir}/${selfname}-laststart.lock")
 fi

+ 1 - 2
lgsm/functions/check_logs.sh

@@ -4,8 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Checks if log files exist.
 
-local modulename="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_check_logs(){
 	fn_print_dots "Checking for log files"

+ 2 - 2
lgsm/functions/check_permissions.sh

@@ -5,7 +5,7 @@
 # Website: https://linuxgsm.com
 # Description: Checks ownership & permissions of scripts, files and directories.
 
-local modulename="CHECK"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_check_ownership(){
 	if [ -f "${rootdir}/${selfname}" ]; then
@@ -229,7 +229,7 @@ fn_sys_perm_error_process(){
 if [ "$(whoami)" != "root" ]; then
 	fn_check_ownership
 	fn_check_permissions
-	if [ "${function_selfname}" == "command_start.sh" ]; then
+	if [ "${commandname}" == "START" ]; then
 		fn_sys_perm_error_process
 	fi
 fi

+ 2 - 3
lgsm/functions/check_root.sh

@@ -4,11 +4,10 @@
 # Website: https://linuxgsm.com
 # Description: Checks if the user tried to run the script as root.
 
-local modulename="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 if [ "$(whoami)" = "root" ]; then
-	if [ "${function_selfname}" != "command_install.sh" ]; then
+	if [ "${commandname}" != "INSTALL" ]; then
 		fn_print_fail_nl "Do NOT run this script as root!"
 		if [ -d "${lgsmlogdir}" ]; then
 			fn_script_log_fatal "${selfname} attempted to run as root."

+ 2 - 3
lgsm/functions/check_status.sh

@@ -5,7 +5,6 @@
 # Website: https://linuxgsm.com
 # Description: Checks the process status of the server. Either online or offline.
 
-local modulename="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-status=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${selfname}")
+status=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${sessionname}")

+ 16 - 6
lgsm/functions/check_steamcmd.sh

@@ -4,7 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Checks if SteamCMD is installed correctly.
 
-local modulename="CHECK"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_install_steamcmd(){
 	if [ ${shortname} == "ark" ]&&[ "${installsteamcmd}" == "1" ]; then
@@ -13,7 +13,17 @@ fn_install_steamcmd(){
 	if [ ! -d "${steamcmddir}" ]; then
 		mkdir -p "${steamcmddir}"
 	fi
-	fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${tmpdir}" "steamcmd_linux.tar.gz"
+	remote_fileurl="${1}"
+	remote_fileurl_backup="${2}"
+	remote_fileurl_name="${3}"
+	remote_fileurl_backup_name="${4}"
+	local_filedir="${5}"
+	local_filename="${6}"
+	chmodx="${7:-0}"
+	run="${8:-0}"
+	forcedl="${9:-0}"
+	md5="${10:-0}"
+	fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "" "" "" "${tmpdir}" "steamcmd_linux.tar.gz" "" "norun" "noforce" "nomd5"
 	fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}"
 	chmod +x "${steamcmddir}/steamcmd.sh"
 }
@@ -50,14 +60,14 @@ fn_check_steamcmd(){
 	# Checks if SteamCMD exists when starting or updating a server.
 	# Only install if steamcmd package is missing or steamcmd dir is missing.
 	if [ ! -f "${steamcmddir}/steamcmd.sh" ]&&[ -z "$(command -v steamcmd 2>/dev/null)" ]; then
-		if [ "${function_selfname}" == "command_install.sh" ]; then
+		if [ "${commandname}" == "INSTALL" ]; then
 			fn_install_steamcmd
 		else
 			fn_print_warn_nl "SteamCMD is missing"
 			fn_script_log_warn "SteamCMD is missing"
 			fn_install_steamcmd
 		fi
-	elif [ "${function_selfname}" == "command_install.sh" ]; then
+	elif [ "${commandname}" == "INSTALL" ]; then
 		fn_print_information "SteamCMD is already installed..."
 		fn_print_ok_eol_nl
 	fi
@@ -110,14 +120,14 @@ fn_check_steamcmd_ark(){
 	# to allow ark mods to work
 	if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then
 		installsteamcmd=1
-		if [ "${function_selfname}" == "command_install.sh" ]; then
+		if [ "${commandname}" == "INSTALL" ]; then
 			fn_install_steamcmd
 		else
 			fn_print_warn_nl "ARK mods SteamCMD is missing"
 			fn_script_log_warn "ARK mods SteamCMD is missing"
 			fn_install_steamcmd
 		fi
-	elif [ "${function_selfname}" == "command_install.sh" ]; then
+	elif [ "${commandname}" == "INSTALL" ]; then
 		fn_print_information "ARK mods SteamCMD is already installed..."
 		fn_print_ok_eol_nl
 	fi

+ 2 - 3
lgsm/functions/check_system_dir.sh

@@ -4,10 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Checks if systemdir/serverfiles is accessible.
 
-local modulename="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-if [ "${function_selfname}" != "command_validate.sh" ]; then
+if [ "${commandname}" != "VALIDATE" ]; then
 	checkdir="${serverfiles}"
 else
 	checkdir="${systemdir}"

+ 1 - 2
lgsm/functions/check_system_requirements.sh

@@ -5,8 +5,7 @@
 # Website: https://linuxgsm.com
 # Description: Checks RAM requirements
 
-local modulename="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 info_distro.sh
 

+ 1 - 1
lgsm/functions/check_tmuxception.sh

@@ -5,7 +5,7 @@
 # Website: https://linuxgsm.com
 # Description: Checks if run from tmux or screen
 
-local modulename="CHECK"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_check_is_in_tmux(){
   if [ "${TMUX}" ]; then

+ 19 - 0
lgsm/functions/check_version.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+# LinuxGSM command_version.sh function
+# Author: Daniel Gibbs
+# Website: https://linuxgsm.com
+# Description: Will run update-lgsm if gameserver.sh and modules version does not match
+# this will allow gameserver.sh to update - useful for multi instance servers.
+
+if [ -n "${modulesversion}" ]&&[ -n "${version}" ]&&[ "${version}" != "${modulesversion}" ]; then
+	exitbypass=1
+	echo -e ""
+	fn_print_error_nl "LinuxGSM version mismatch"
+	echo -e ""
+	echo -e "* ${selfname}: ${version}"
+	echo -e "* modules: ${modulesversion}"
+	echo -e ""
+	fn_sleep_time
+	fn_script_log_error "LinuxGSM Version mismatch: ${selfname}: ${version}: modules: ${modulesversion}"
+	command_update_linuxgsm.sh
+fi

+ 12 - 12
lgsm/functions/command_backup.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Creates a .tar.gz file in the backup directory.
 
-local modulename="BACKUP"
-local commandaction="Backup"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="BACKUP"
+commandaction="Backing up"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 
@@ -22,15 +22,15 @@ fn_backup_trap(){
 	fn_print_removed_eol_nl
 	fn_script_log_info "Backup ${backupname}.tar.gz: REMOVED"
 	# Remove lock file.
-	rm -f "${lockdir:?}/.backup.lock"
+	rm -f "${lockdir:?}/backup.lock"
 	core_exit.sh
 }
 
-# Check if a backup is pending or has been aborted using .backup.lock.
+# Check if a backup is pending or has been aborted using backup.lock.
 fn_backup_check_lockfile(){
-	if [ -f "${lockdir}/.backup.lock" ]; then
+	if [ -f "${lockdir}/backup.lock" ]; then
 		fn_print_info_nl "Lock file found: Backup is currently running"
-		fn_script_log_error "Lock file found: Backup is currently running: ${lockdir}/.backup.lock"
+		fn_script_log_error "Lock file found: Backup is currently running: ${lockdir}/backup.lock"
 		core_exit.sh
 	fi
 }
@@ -115,9 +115,9 @@ fn_backup_migrate_olddir(){
 
 fn_backup_create_lockfile(){
 	# Create lockfile.
-	date '+%s' > "${lockdir}/.backup.lock"
+	date '+%s' > "${lockdir}/backup.lock"
 	fn_script_log_info "Lockfile generated"
-	fn_script_log_info "${lockdir}/.backup.lock"
+	fn_script_log_info "${lockdir}/backup.lock"
 	# trap to remove lockfile on quit.
 	trap fn_backup_trap INT
 }
@@ -138,12 +138,12 @@ fn_backup_compression(){
 		core_exit.sh
 	fi
 
-	tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}/.backup.lock" ./.
+	tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}/backup.lock" ./.
 	local exitcode=$?
 	if [ ${exitcode} -ne 0 ]; then
 		fn_print_fail_eol
 		fn_script_log_fatal "Backup in progress: FAIL"
-		echo -e "${tarcmd}" | tee -a "${lgsmlog}"
+		echo -e "${extractcmd}" | tee -a "${lgsmlog}"
 		fn_print_fail_nl "Starting backup"
 		fn_script_log_fatal "Starting backup"
 	else
@@ -152,7 +152,7 @@ fn_backup_compression(){
 		fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
 	fi
 	# Remove lock file
-	rm -f "${lockdir:?}/.backup.lock"
+	rm -f "${lockdir:?}/backup.lock"
 }
 
 # Clear old backups according to maxbackups and maxbackupdays variables.

+ 4 - 4
lgsm/functions/command_console.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Gives access to the server tmux console.
 
-local modulename="CONSOLE"
-local commandaction="Console"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="CONSOLE"
+commandaction="Access console"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 fn_print_header
@@ -26,7 +26,7 @@ check_status.sh
 if [ "${status}" != "0" ]; then
 	fn_print_ok_nl "Accessing console"
 	fn_script_log_pass "Console accessed"
-	tmux attach-session -t "${selfname}"
+	tmux attach-session -t "${sessionname}"
 	fn_print_ok_nl "Closing console"
 	fn_script_log_pass "Console closed"
 else

+ 14 - 11
lgsm/functions/command_debug.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Runs the server without tmux and directly from the terminal.
 
-local modulename="DEBUG"
-local commandaction="Debug"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="DEBUG"
+commandaction="Debuging"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Trap to remove lockfile on quit.
 fn_lockfile_trap(){
@@ -14,8 +14,11 @@ fn_lockfile_trap(){
 	rm -f "${lockdir:?}/${selfname}.lock"
 	# resets terminal. Servers can sometimes mess up the terminal on exit.
 	reset
-	fn_print_ok_nl "Closing debug"
-	fn_script_log_pass "Debug closed"
+	fn_print_dots "Stopping debug"
+	fn_print_ok_nl "Stopping debug"
+	fn_script_log_pass "Stopping debug"
+	# remove trap.
+	trap - INT
 	core_exit.sh
 }
 
@@ -85,6 +88,7 @@ fn_print_info_nl "Stopping any running servers"
 fn_script_log_info "Stopping any running servers"
 exitbypass=1
 command_stop.sh
+unset exitbypass
 fn_print_dots "Starting debug"
 fn_script_log_info "Starting debug"
 fn_print_ok_nl "Starting debug"
@@ -93,27 +97,26 @@ fn_print_ok_nl "Starting debug"
 date '+%s' > "${lockdir}/${selfname}.lock"
 fn_script_log_info "Lockfile generated"
 fn_script_log_info "${lockdir}/${selfname}.lock"
-# trap to remove lockfile on quit.
-trap fn_lockfile_trap INT
 
 cd "${executabledir}" || exit
 # Note: do not add double quotes to ${executable} ${parms}.
 if [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then
 	${executable} ${parms} -debug
-elif [ "${engine}" == "realvirtuality" ]; then
+elif [ "${shortname}" == "arma3" ]; then
 	# Arma3 requires semicolons in the module list, which need to
 	# be escaped for regular (tmux) loading, but need to be
 	# stripped when loading straight from the console.
 	${executable} ${parms//\\;/;}
 elif [ "${engine}" == "quake" ]; then
-    ${executable} ${parms} -condebug
+		${executable} ${parms} -condebug
 else
 	${executable} ${parms}
 fi
 
+fn_lockfile_trap
+
 fn_print_dots "Stopping debug"
 fn_print_ok_nl "Stopping debug"
-# remove trap.
-trap - INT
+fn_script_log_info "Stopping debug"
 
 core_exit.sh

+ 3 - 3
lgsm/functions/command_details.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Displays server information.
 
-local modulename="DETAILS"
-local commandaction="Details"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="DETAILS"
+commandaction="Viewing details"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Run checks and gathers details to display.
 check.sh

+ 6 - 0
lgsm/functions/command_dev_clear_functions.sh

@@ -4,6 +4,10 @@
 # Website: https://linuxgsm.com
 # Description: Deletes the contents of the functions dir.
 
+commandname="DEV-CLEAR-MODULES"
+commandaction="Clearing modules"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
 echo -e "================================="
 echo -e "Clear Functions"
 echo -e "================================="
@@ -11,6 +15,8 @@ echo -e ""
 if fn_prompt_yn "Do you want to delete all functions?" Y; then
 	rm -rfv "${functionsdir:?}/"*
 	rm -rfv "${configdirdefault:?}/"*
+	fn_script_log_info "Cleared modules directory"
+	fn_script_log_info "Cleared default config directory"
 fi
 
 core_exit.sh

+ 3 - 3
lgsm/functions/command_dev_debug.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Dev only: Enables debugging log to be saved to dev-debug.log.
 
-local modulename="DEV-DEBUG"
-local commandaction="Dev Debug"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="DEV-DEBUG"
+commandaction="Developer debug"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 if [ -f "${rootdir}/.dev-debug" ]; then
 	rm "${rootdir:?}/.dev-debug"

+ 6 - 6
lgsm/functions/command_dev_detect_deps.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Detects dependencies the server binary requires.
 
-local modulename="DETECT-DEPS"
-local commandaction="Detect Deps"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="DEV-DETECT-DEPS"
+commandaction="Developer detect deps"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 echo -e "================================="
 echo -e "Dependencies Checker"
@@ -40,7 +40,7 @@ touch "${tmpdir}/.depdetect_debian_list"
 
 while read -r lib; do
 	echo -e "${lib}"
-	local libs_array=( libm.so.6 libc.so.6 libtcmalloc_minimal.so.4 libpthread.so.0 libdl.so.2 libnsl.so.1 libgcc_s.so.1 librt.so.1 ld-linux.so.2 libdbus-glib-1.so.2 libgio-2.0.so.0 libglib-2.0.so.0 libGL.so.1 libgobject-2.0.so.0 libnm-glib.so.4 libnm-util.so.2 )
+	libs_array=( libm.so.6 libc.so.6 libtcmalloc_minimal.so.4 libpthread.so.0 libdl.so.2 libnsl.so.1 libgcc_s.so.1 librt.so.1 ld-linux.so.2 libdbus-glib-1.so.2 libgio-2.0.so.0 libglib-2.0.so.0 libGL.so.1 libgobject-2.0.so.0 libnm-glib.so.4 libnm-util.so.2 )
 	for lib_file in "${libs_array[@]}"
 	do
 		if [ "${lib}" == "${lib_file}" ]; then
@@ -51,7 +51,7 @@ while read -r lib; do
 		fi
 	done
 
-	local libs_array=( libawt.so libjava.so libjli.so libjvm.so libnet.so libnio.so libverify.so )
+	libs_array=( libawt.so libjava.so libjli.so libjvm.so libnet.so libnio.so libverify.so )
 	for lib_file in "${libs_array[@]}"
 	do
 		if [ "${lib}" == "${lib_file}" ]; then
@@ -62,7 +62,7 @@ while read -r lib; do
 		fi
 	done
 
-	local libs_array=( libtier0.so libtier0_srv.so libvstdlib_srv.so Core.so libvstdlib.so libtier0_s.so Editor.so Engine.so liblua.so libsteam_api.so ld-linux-x86-64.so.2 libPhysX3_x86.so libPhysX3Common_x86.so libPhysX3Cooking_x86.so)
+	libs_array=( libtier0.so libtier0_srv.so libvstdlib_srv.so Core.so libvstdlib.so libtier0_s.so Editor.so Engine.so liblua.so libsteam_api.so ld-linux-x86-64.so.2 libPhysX3_x86.so libPhysX3Common_x86.so libPhysX3Cooking_x86.so)
 	for lib_file in "${libs_array[@]}"
 	do
 		# Known shared libs what dont requires dependencies.

+ 4 - 4
lgsm/functions/command_dev_detect_glibc.sh

@@ -5,9 +5,9 @@
 # Description: Automatically detects the version of GLIBC that is required.
 # Can check a file or directory recursively.
 
-local modulename="DETECT-GLIBC"
-local commandaction="Detect Glibc"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="DEV-DETECT-GLIBC"
+commandaction="Developer detect glibc"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 echo -e "================================="
 echo -e "glibc Requirements Checker"
@@ -33,7 +33,7 @@ fi
 echo -e ""
 
 
-local glibc_check_dir_array=( steamcmddir serverfiles )
+glibc_check_dir_array=( steamcmddir serverfiles )
 for glibc_check_var in "${glibc_check_dir_array[@]}"
 do
 	if [ "${glibc_check_var}" == "serverfiles" ]; then

+ 3 - 3
lgsm/functions/command_dev_detect_ldd.sh

@@ -5,9 +5,9 @@
 # Description: Automatically detects required deps using ldd.
 # Can check a file or directory recursively.
 
-local modulename="DETECT-LDD"
-local commandaction="Detect LDD"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="DEV-DETECT-LDD"
+commandaction="Developer detect ldd"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 echo -e "================================="
 echo -e "Shared Object dependencies Checker"

+ 4 - 4
lgsm/functions/command_dev_query_raw.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Raw gamedig output of the server.
 
-local modulename="QUERY-RAW"
-local commandaction="Query Raw"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="DEV-QUERY-RAW"
+commandaction="Developer query raw"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 info_config.sh
@@ -35,7 +35,7 @@ fi
 query_gamedig.sh
 echo -e "${gamedigcmd}"
 echo""
-echo -e "${gamedigraw}" | jq
+echo "${gamedigraw}" | jq
 
 echo -e ""
 echo -e "gsquery Raw Output"

+ 3 - 3
lgsm/functions/command_donate.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Shows ways to donate.
 
-local modulename="CONSOLE"
-local commandaction="Console"
-local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
+commandname="DONATE"
+commandaction="Donate"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_print_ascii_logo
 echo -e "${lightyellow}Support LinuxGSM${default}"

+ 4 - 7
lgsm/functions/command_fastdl.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Creates a FastDL directory.
 
-local modulename="FASTDL"
-local commandaction="FastDL"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="FASTDL"
+commandaction="Fastdl"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 
@@ -77,7 +77,6 @@ fn_clear_old_fastdl(){
 			fn_print_ok_eol_nl
 			fn_script_log_pass "Clearing existing FastDL directory ${fastdldir}"
 		fi
-		fn_sleep_time
 	fi
 }
 
@@ -95,7 +94,6 @@ fn_fastdl_dirs(){
 			fn_print_ok_eol_nl
 			fn_script_log_pass "Creating web directory ${webdir}"
 		fi
-		fn_sleep_time
 	fi
 	if [ ! -d "${fastdldir}" ]; then
 		echo -en "creating fastdl directory ${fastdldir}..."
@@ -109,7 +107,6 @@ fn_fastdl_dirs(){
 			fn_print_ok_eol_nl
 			fn_script_log_pass "Creating fastdl directory ${fastdldir}"
 		fi
-		fn_sleep_time
 	fi
 }
 
@@ -135,7 +132,7 @@ fn_human_readable_file_size(){
 			local factor="${item%:*}"
 			local abbrev="${item#*:}"
 			if [[ "${bytes}" -ge "${factor}" ]]; then
-				local size=$(bc -l <<< "${bytes} / ${factor}")
+				size=$(bc -l <<< "${bytes} / ${factor}")
 				printf "%.*f %s\n" "${precision}" "${size}" "${abbrev}"
 				break
 			fi

+ 3 - 3
lgsm/functions/command_install.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Overall function for the installer.
 
-local modulename="INSTALL"
-local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="INSTALL"
+commandaction="Installing"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 if [ "$(whoami)" = "root" ]; then

+ 3 - 3
lgsm/functions/command_install_resources_mta.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Installs the default resources for Multi Theft Auto.
 
-local modulename="DEFAULT_RESOURCES"
-local commandaction="Default Resources"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="DEFAULT-RESOURCES"
+commandaction="Default Resources"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_install_resources(){
 	echo -e ""

+ 3 - 3
lgsm/functions/command_mods_install.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: List and installs available mods along with mods_list.sh and mods_core.sh.
 
-local modulename="MODS"
-local commandaction="addons/mods"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="MODS-INSTALL"
+commandaction="Installing mods"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 mods_core.sh

+ 3 - 4
lgsm/functions/command_mods_remove.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Uninstall mods along with mods_list.sh and mods_core.sh.
 
-local modulename="MODS"
-local commandaction="Mods Remove"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="MODS-REMOVE"
+commandaction="Removing mods"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 mods_core.sh
@@ -87,7 +87,6 @@ if [ ${exitcode} -ne 0 ]; then
 else
 	fn_print_ok_eol_nl
 fi
-fn_sleep_time
 # Remove file list.
 echo -en "removing ${modcommand}-files.txt..."
 fn_sleep_time

+ 3 - 3
lgsm/functions/command_mods_update.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Updates installed mods along with mods_list.sh and mods_core.sh.
 
-local modulename="MODS"
-local commandaction="Mods Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="MODS-UPDATE"
+commandaction="Updating mods"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 mods_core.sh

+ 17 - 27
lgsm/functions/command_monitor.sh

@@ -6,9 +6,9 @@
 # Description: Monitors server by checking for running processes
 # then passes to gamedig and gsquery.
 
-local modulename="MONITOR"
-local commandaction="Monitor"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="MONITOR"
+commandaction="Monitoring"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_monitor_check_lockfile(){
 	# Monitor does not run it lockfile is not found.
@@ -16,17 +16,15 @@ fn_monitor_check_lockfile(){
 		fn_print_dots "Checking lockfile: "
 		fn_print_checking_eol
 		fn_script_log_info "Checking lockfile: CHECKING"
-		fn_sleep_time
 		fn_print_error "Checking lockfile: No lockfile found: "
 		fn_print_error_eol_nl
 		fn_script_log_error "Checking lockfile: No lockfile found: ERROR"
-		fn_sleep_time
 		echo -e "* Start ${selfname} to run monitor."
 		core_exit.sh
 	fi
 
 	# Fix if lockfile is not unix time or contains letters
-	if [[ "$(cat "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then
+	if [ -f "${lockdir}/${selfname}.lock" ]&&[[ "$(cat "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then
 			date '+%s' > "${lockdir}/${selfname}.lock"
 	fi
 }
@@ -37,11 +35,9 @@ fn_monitor_check_update(){
 		fn_print_dots "Checking active updates: "
 		fn_print_checking_eol
 		fn_script_log_info "Checking active updates: CHECKING"
-		fn_sleep_time
 		fn_print_error_nl "Checking active updates: SteamCMD is currently checking for updates: "
 		fn_print_error_eol
 		fn_script_log_error "Checking active updates: SteamCMD is currently checking for updates: ERROR"
-		fn_sleep_time
 		core_exit.sh
 	fi
 }
@@ -50,18 +46,15 @@ fn_monitor_check_session(){
 	fn_print_dots "Checking session: "
 	fn_print_checking_eol
 	fn_script_log_info "Checking session: CHECKING"
-	fn_sleep_time
 	# uses status var from check_status.sh
 	if [ "${status}" != "0" ]; then
 		fn_print_ok "Checking session: "
 		fn_print_ok_eol_nl
 		fn_script_log_pass "Checking session: OK"
-		fn_sleep_time
 	else
 		fn_print_error "Checking session: "
 		fn_print_fail_eol_nl
 		fn_script_log_fatal "Checking session: FAIL"
-		fn_sleep_time
 		alert="restart"
 		alert.sh
 		fn_script_log_info "Checking session: Monitor is restarting ${selfname}"
@@ -76,7 +69,6 @@ fn_monitor_check_queryport(){
 		fn_print_dots "Checking port: "
 		fn_print_checking_eol
 		fn_script_log_info "Checking port: CHECKING"
-		fn_sleep_time
 		if [ -n "${rconenabled}" ]&&[ "${rconenabled}" != "true" ]&&[ ${shortname} == "av" ]; then
 			fn_print_warn "Checking port: Unable to query as rconport, rcon not enabled: "
 			fn_print_warn_eol_nl
@@ -86,7 +78,6 @@ fn_monitor_check_queryport(){
 			fn_print_error_eol_nl
 			fn_script_log_error "Checking port: Unable to query as queryport is not set: ERROR"
 		fi
-		fn_sleep_time
 		core_exit.sh
 	fi
 }
@@ -112,14 +103,14 @@ for queryattempt in {1..5}; do
 	fn_print_dots "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: "
 	fn_print_querying_eol
 	fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : QUERYING"
-	fn_sleep_time
 	# querydelay
 	if [ "$(cat "${lockdir}/${selfname}.lock")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then
 		fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: "
 		fn_print_delay_eol_nl
 		fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : DELAY"
 		fn_script_log_info "Query bypassed: ${gameservername} started less than ${querydelay} minutes ago"
-		fn_sleep_time
+		fn_script_log_info "Server started: $(date -d @$(cat lgsm/lock/bmdmserver.lock))"
+		fn_script_log_info "Current time: $(date)"
 		monitorpass=1
 		core_exit.sh
 	# will use query method selected in fn_monitor_loop
@@ -139,13 +130,8 @@ for queryattempt in {1..5}; do
 		fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: "
 		fn_print_ok_eol_nl
 		fn_script_log_pass "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt}: OK"
-		fn_sleep_time
 		monitorpass=1
-		# send LinuxGSM stats if monitor is OK.
-		if [ "${stats}" == "on" ]||[ "${stats}" == "y" ]; then
-			info_stats.sh
-		fi
-    if [ "${querystatus}" == "0" ]; then
+		if [ "${querystatus}" == "0" ]; then
 			# Add query data to log.
 			if [ "${gdname}" ]; then
 				fn_script_log_info "Server name: ${gdname}"
@@ -154,14 +140,19 @@ for queryattempt in {1..5}; do
 				fn_script_log_info "Players: ${gdplayers}/${gdmaxplayers}"
 			fi
 			if [ "${gdbots}" ]; then
-                fn_script_log_info "Bots: ${gdbots}"
-            fi
+				fn_script_log_info "Bots: ${gdbots}"
+			fi
 			if [ "${gdmap}" ]; then
 				fn_script_log_info "Map: ${gdmap}"
 			fi
 			if [ "${gdgamemode}" ]; then
 				fn_script_log_info "Game Mode: ${gdgamemode}"
 			fi
+
+			# send LinuxGSM stats if monitor is OK.
+			if [ "${stats}" == "on" ]||[ "${stats}" == "y" ]; then
+				info_stats.sh
+			fi
 		fi
 		core_exit.sh
 	else
@@ -169,7 +160,6 @@ for queryattempt in {1..5}; do
 		fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: "
 		fn_print_fail_eol
 		fn_script_log_warn "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt}: FAIL"
-		fn_sleep_time
 		# Monitor will try gamedig (if supported) for first 30s then gsquery before restarting.
 		if [ "${querymethod}" ==  "gsquery" ]||[ "${querymethod}" ==  "tcp" ]; then
 			# gsquery will fail if longer than 60s
@@ -178,7 +168,6 @@ for queryattempt in {1..5}; do
 				fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: "
 				fn_print_fail_eol_nl
 				fn_script_log_warn "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt}: FAIL"
-				fn_sleep_time
 				# Send alert if enabled.
 				alert="restartquery"
 				alert.sh
@@ -194,7 +183,8 @@ for queryattempt in {1..5}; do
 
 		# Second counter will wait for 15s before breaking loop.
 		for seconds in {1..15}; do
-			fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: WAIT"
+			fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: ${cyan}WAIT${default}"
+			sleep 0.5
 			totalseconds=$((totalseconds + 1))
 			if [ "${seconds}" == "15" ]; then
 				break
@@ -239,7 +229,7 @@ fn_monitor_loop(){
 
 monitorflag=1
 check.sh
-logs.sh
+core_logs.sh
 info_config.sh
 info_parms.sh
 

+ 16 - 18
lgsm/functions/command_postdetails.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Strips sensitive information out of Details output
 
-local modulename="POSTDETAILS"
-local commandaction="Postdetails"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="POST-DETAILS"
+commandaction="Posting details"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Set posttarget to the appropriately-defined post destination.
 
@@ -74,14 +74,13 @@ else
 		fn_info_message_ports
 		fn_info_message_select_engine
 		fn_info_message_statusbottom
-	} | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${postdetailslog}" > /dev/null 2>&1
+	} | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a "${postdetailslog}" > /dev/null 2>&1
 fi
-
+# Pastebin
 if [ "${posttarget}" == "http://pastebin.com" ] ; then
 	fn_print_dots "pastbin.com for ${postexpire}"
 	# grab the return from 'value' from an initial visit to pastebin.
-	csrftoken=$(curl -s "${posttarget}" |
-					sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p')
+	csrftoken=$(curl -s "${posttarget}" | sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p')
 	#
 	# Use the csrftoken to then post the content.
 	#
@@ -94,9 +93,9 @@ if [ "${posttarget}" == "http://pastebin.com" ] ; then
 
 	 # Output the resulting link.
 	fn_print_ok_nl "pastbin.com for ${postexpire}"
+	fn_script_log_pass "pastbin.com for ${postexpire}"
 	pdurl="${posttarget}${link}"
-	echo -e ""
-	echo -e "  Please share the following url for support: ${pdurl}"
+# Hastebin
 elif [ "${posttarget}" == "https://hastebin.com" ] ; then
 	fn_print_dots "hastebin.com"
 	# hastebin is a bit simpler.  If successful, the returned result
@@ -104,21 +103,20 @@ elif [ "${posttarget}" == "https://hastebin.com" ] ; then
 	# we need in "key".  TODO - error handling. -CedarLUG
 	link=$(curl -H "HTTP_X_REQUESTED_WITH:XMLHttpRequest" -s -d "$(<${postdetailslog})" "${posttarget}/documents" | cut -d\" -f4)
 	fn_print_ok_nl "hastebin.com for ${postexpire}"
+	fn_script_log_pass "hastebin.com for ${postexpire}"
 	pdurl="${posttarget}/${link}"
-	echo -e ""
-	echo -e "Please share the following url for support: ${pdurl}"
+# Termbin
 elif [ "${posttarget}" == "https://termbin.com" ] ; then
 	fn_print_dots "termbin.com"
 	link=$(cat "${postdetailslog}" | nc termbin.com 9999 | tr -d '\n\0')
-	fn_print_ok_nl "termbin.com"
+	fn_print_ok_nl "termbin.com for 30D"
+	fn_script_log_pass "termbin.com for 30D"
 	pdurl="${link}"
-	echo -e ""
-	echo -e "Please share the following url for support: "
-	echo -e "${pdurl}"
-else
-	 fn_print_warn_nl "Review output in: ${postdetailslog}"
-	 core_exit.sh
 fi
+echo -e ""
+echo -e "Please share the following url for support: "
+echo -e "${pdurl}"
+fn_script_log_info "${pdurl}"
 
 if [ -z "${exitbypass}" ]; then
 	core_exit.sh

+ 3 - 3
lgsm/functions/command_restart.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Restarts the server.
 
-local modulename="RESTART"
-local commandaction="Restarting"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="MODS-INSTALL"
+commandaction="Restarting"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 info_config.sh
 exitbypass=1

+ 15 - 16
lgsm/functions/command_start.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Starts the server.
 
-local modulename="START"
-local commandaction="Starting"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="START"
+commandaction="Starting"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_start_teamspeak3(){
 	if [ ! -f "${servercfgfullpath}" ]; then
@@ -62,9 +62,9 @@ fn_start_tmux(){
 	fi
 
 	# Create lockfile
-	date > "${lockdir}/${selfname}.lock"
+	date '+%s' > "${lockdir}/${selfname}.lock"
 	cd "${executabledir}" || exit
-	tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${selfname}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp"
+	tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${sessionname}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp"
 
 	# Create logfile.
 	touch "${consolelog}"
@@ -79,7 +79,7 @@ fn_start_tmux(){
 		fn_script_log "Tmux version: master (user compiled)"
 		echo -e "Tmux version: master (user compiled)" >> "${consolelog}"
 		if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
-			tmux pipe-pane -o -t "${selfname}" "exec cat >> '${consolelog}'"
+			tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
 		fi
 	elif [ "${tmuxversion}" ]; then
 		# Get the digit version of tmux.
@@ -97,19 +97,19 @@ fn_start_tmux(){
 			Currently installed: $(tmux -V)" > "${consolelog}"
 		# Console logging enable or not set.
 		elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
-			tmux pipe-pane -o -t "${selfname}" "exec cat >> '${consolelog}'"
+			tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
 		fi
 	else
 		echo -e "Unable to detect tmux version" >> "${consolelog}"
 		fn_script_log_warn "Unable to detect tmux version"
 	fi
 
-# Console logging disabled.
-if [ "${consolelogging}" == "off" ]; then
-	echo -e "Console logging disabled by user" >> "${consolelog}"
-	fn_script_log_info "Console logging disabled by user"
-fi
-fn_sleep_time
+	# Console logging disabled.
+	if [ "${consolelogging}" == "off" ]; then
+		echo -e "Console logging disabled by user" >> "${consolelog}"
+		fn_script_log_info "Console logging disabled by user"
+	fi
+	fn_sleep_time
 
 	# If the server fails to start.
 	check_status.sh
@@ -122,7 +122,7 @@ fn_sleep_time
 			echo -e ""
 			echo -e "Command"
 			echo -e "================================="
-			echo -e "tmux new-session -d -s \"${selfname}\" \"${executable} ${parms}\"" | tee -a "${lgsmlog}"
+			echo -e "tmux new-session -d -s \"${sessionname}\" \"${executable} ${parms}\"" | tee -a "${lgsmlog}"
 			echo -e ""
 			echo -e "Error"
 			echo -e "================================="
@@ -156,7 +156,6 @@ fn_sleep_time
 				fi
 			fi
 		fi
-
 		core_exit.sh
 	else
 		fn_print_ok "${servername}"
@@ -183,7 +182,7 @@ if [ -z "${fixbypass}" ]; then
 	fix.sh
 fi
 info_config.sh
-logs.sh
+core_logs.sh
 
 # Will check for updates is updateonstart is yes.
 if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then

+ 11 - 15
lgsm/functions/command_stop.sh

@@ -5,16 +5,16 @@
 # Website: https://linuxgsm.com
 # Description: Stops the server.
 
-local modulename="STOP"
-local commandaction="Stopping"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="STOP"
+commandaction="Stopping"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Attempts graceful shutdown by sending 'CTRL+c'.
 fn_stop_graceful_ctrlc(){
 	fn_print_dots "Graceful: CTRL+c"
 	fn_script_log_info "Graceful: CTRL+c"
 	# Sends quit.
-	tmux send-keys -t "${selfname}" C-c  > /dev/null 2>&1
+	tmux send-keys -t "${sessionname}" C-c  > /dev/null 2>&1
 	# Waits up to 30 seconds giving the server time to shutdown gracefuly.
 	for seconds in {1..30}; do
 		check_status.sh
@@ -33,7 +33,6 @@ fn_stop_graceful_ctrlc(){
 		fn_print_fail_eol_nl
 		fn_script_log_error "Graceful: CTRL+c: FAIL"
 	fi
-	fn_sleep_time
 }
 
 # Attempts graceful shutdown by sending a specified command.
@@ -43,7 +42,7 @@ fn_stop_graceful_cmd(){
 	fn_print_dots "Graceful: sending \"${1}\""
 	fn_script_log_info "Graceful: sending \"${1}\""
 	# Sends specific stop command.
-	tmux send -t "${selfname}" "${1}" ENTER > /dev/null 2>&1
+	tmux send -t "${sessionname}" "${1}" ENTER > /dev/null 2>&1
 	# Waits up to ${seconds} seconds giving the server time to shutdown gracefully.
 	for ((seconds=1; seconds<=${2}; seconds++)); do
 		check_status.sh
@@ -62,7 +61,6 @@ fn_stop_graceful_cmd(){
 		fn_print_fail_eol_nl
 		fn_script_log_error "Graceful: sending \"${1}\": FAIL"
 	fi
-	fn_sleep_time
 }
 
 # Attempts graceful shutdown of goldsrc using rcon 'quit' command.
@@ -72,7 +70,7 @@ fn_stop_graceful_goldsrc(){
 	fn_print_dots "Graceful: sending \"quit\""
 	fn_script_log_info "Graceful: sending \"quit\""
 	# sends quit
-	tmux send -t "${selfname}" quit ENTER > /dev/null 2>&1
+	tmux send -t "${sessionname}" quit ENTER > /dev/null 2>&1
 	# Waits 3 seconds as goldsrc servers restart with the quit command.
 	for seconds in {1..3}; do
 		sleep 1
@@ -178,7 +176,6 @@ fn_stop_graceful_sdtd(){
 		fn_print_fail_eol_nl
 		fn_script_log_warn "Graceful: telnet: expect not installed: FAIL"
 	fi
-	fn_sleep_time
 }
 
 # Attempts graceful shutdown by sending /save /stop.
@@ -186,10 +183,10 @@ fn_stop_graceful_avorion(){
 	fn_print_dots "Graceful: /save /stop"
 	fn_script_log_info "Graceful: /save /stop"
 	# Sends /save.
-	tmux send-keys -t "${selfname}" /save ENTER > /dev/null 2>&1
+	tmux send-keys -t "${sessionname}" /save ENTER > /dev/null 2>&1
 	sleep 5
 	# Sends /quit.
-	tmux send-keys -t "${selfname}" /stop ENTER > /dev/null 2>&1
+	tmux send-keys -t "${sessionname}" /stop ENTER > /dev/null 2>&1
 	# Waits up to 30 seconds giving the server time to shutdown gracefuly.
 	for seconds in {1..30}; do
 		check_status.sh
@@ -208,7 +205,6 @@ fn_stop_graceful_avorion(){
 		fn_print_fail_eol_nl
 		fn_script_log_error "Graceful: /save /stop: FAIL"
 	fi
-	fn_sleep_time
 }
 
 fn_stop_graceful_select(){
@@ -237,10 +233,10 @@ fn_stop_graceful_select(){
 
 fn_stop_tmux(){
 	fn_print_dots "${servername}"
-	fn_script_log_info "tmux kill-session: ${servername}"
+	fn_script_log_info "tmux kill-session: ${sessionname}: ${servername}"
 	# Kill tmux session.
-	tmux kill-session -t "${selfname}" > /dev/null 2>&1
-	fn_sleep_time
+	tmux kill-session -t "${sessionname}" > /dev/null 2>&1
+	sleep 0.5
 	check_status.sh
 	if [ "${status}" == "0" ]; then
 		fn_print_ok_nl "${servername}"

+ 3 - 3
lgsm/functions/command_test_alert.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Sends a test alert.
 
-local modulename="ALERT"
-local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="TEST-ALERT"
+commandaction="Sending Alert"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_print_dots "${servername}"
 check.sh

+ 3 - 3
lgsm/functions/command_ts3_server_pass.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Changes TS3 serveradmin password.
 
-local modulename="PASSWORD-CHANGE"
-local commandaction="Password Change"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="CHANGE-PASSWORD"
+commandaction="Changing password"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_serveradmin_password_prompt(){
 	fn_print_header

+ 4 - 4
lgsm/functions/command_update.sh

@@ -4,13 +4,13 @@
 # Website: https://linuxgsm.com
 # Description: Handles updating of servers.
 
-local modulename="UPDATE"
-local commandaction="Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="UPDATE"
+commandaction="Updating"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_print_dots ""
 check.sh
-logs.sh
+core_logs.sh
 check_last_update.sh
 
 if [ "${shortname}" == "ts3" ]; then

+ 0 - 13
lgsm/functions/command_update_functions.sh

@@ -1,13 +0,0 @@
-#!/bin/bash
-# LinuxGSM command_update_functions.sh function
-# Author: Daniel Gibbs
-# Website: https://linuxgsm.com
-# Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
-# Legacy Command
-
-command_update_linuxgsm.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
-}
-
-command_update_linuxgsm.sh

+ 159 - 75
lgsm/functions/command_update_linuxgsm.sh

@@ -4,113 +4,197 @@
 # Website: https://linuxgsm.com
 # Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
 
-local modulename="UPDATE LINUXGSM"
-local commandaction="Update LinuxGSM"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="UPDATE-LGSM"
+commandaction="Updating LinuxGSM"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-fn_print_dots "Updating LinuxGSM"
 check.sh
+
+fn_print_dots ""
 fn_script_log_info "Updating LinuxGSM"
-echo -en "\n"
 
-if [ -z "${legacymode}" ]; then
-	# Check and update _default.cfg.
-	echo -en "    checking config _default.cfg...\c"
-	config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
-	if [ "${config_file_diff}" != "" ]; then
-		fn_print_update_eol_nl
-		fn_script_log_info "checking config _default.cfg: UPDATE"
-		rm -f "${configdirdefault:?}/config-lgsm/${gameservername}/_default.cfg"
-		fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforce" "nomd5"
-		alert="config"
-		alert.sh
+fn_print_dots "Selecting repo"
+fn_script_log_info "Selecting repo"
+# Select remotereponame
+curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1>/dev/null
+if [ $? != "0" ]; then
+	curl -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1>/dev/null
+	if [ $? != "0" ]; then
+		fn_print_fail_nl "Selecting repo: Unable to to access GitHub or Bitbucket repositories"
+		fn_script_log_fatal "Selecting repo: Unable to to access GitHub or Bitbucket repositories"
+		core_exit.sh
 	else
-		fn_print_ok_eol_nl
-		fn_script_log_info "checking config _default.cfg: OK"
+		remotereponame="Bitbucket"
+		fn_print_ok_nl "Selecting repo: ${remotereponame}"
 	fi
+else
+	remotereponame="GitHub"
+	fn_print_ok_nl "Selecting repo: ${remotereponame}"
+fi
+
+# Check _default.cfg.
+echo -en "checking ${remotereponame} config _default.cfg...\c"
+fn_script_log_info "Checking ${remotereponame} config _default.cfg"
+if [ "${remotereponame}" == "GitHub" ]; then
+	curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null
+else
+	curl -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null
+fi
+if [ $? != "0" ]; then
+	fn_print_fail_eol_nl
+	fn_script_log_fatal "Checking ${remotereponame} config _default.cfg"
+	fn_script_log_fatal "Curl returned error: $?"
+	core_exit.sh
+fi
+
+if [ "${remotereponame}" == "GitHub" ]; then
+	config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
+else
+	config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
+fi
+
+if [ "${config_file_diff}" != "" ]; then
+	fn_print_update_eol_nl
+	fn_script_log_update "Checking ${remotereponame} config _default.cfg"
+	rm -f "${configdirdefault:?}/config-lgsm/${gameservername:?}/_default.cfg"
+	fn_fetch_file_github "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "nochmodx" "norun" "noforce" "nomd5"
+	alert="config"
+	alert.sh
+else
+	fn_print_ok_eol_nl
+	fn_script_log_pass "Checking ${remotereponame} config _default.cfg"
+fi
+
+# Check linuxsm.sh
+echo -en "checking ${remotereponame} linuxgsm.sh...\c"
+if [ "${remotereponame}" == "GitHub" ]; then
+	curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1>/dev/null
+else
+	curl -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1>/dev/null
+fi
+if [ $? != "0" ]; then
+	fn_print_fail_eol_nl
+	fn_script_log_fatal "Checking ${remotereponame} linuxgsm.sh"
+	fn_script_log_fatal "Curl returned error: $?"
+	core_exit.sh
+fi
 
-	echo -en "    checking linuxgsm.sh...\c"
+if [ "${remotereponame}" == "GitHub" ]; then
 	tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh"))
-	if [ "${tmp_script_diff}" != "" ]; then
-		fn_print_update_eol_nl
-		fn_script_log_info "checking linuxgsm.sh: UPDATE"
-		rm -f "${tmpdir:?}/linuxgsm.sh"
-		fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "nochmodx" "norun" "noforcedl" "nomd5"
-		# Compare selfname against linuxgsm.sh in the tmp dir. Ignoring server specific vars.
+else
+	tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh"))
+fi
+
+if [ "${tmp_script_diff}" != "" ]; then
+	fn_print_update_eol_nl
+	fn_script_log_update "Checking ${remotereponame} linuxgsm.sh"
+	rm -f "${tmpdir:?}/linuxgsm.sh"
+	fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "nochmodx" "norun" "noforcedl" "nomd5"
+else
+	fn_print_ok_eol_nl
+	fn_script_log_pass "Checking ${remotereponame} linuxgsm.sh"
+fi
+
+# Check gameserver.sh
+# Compare gameserver.sh against linuxgsm.sh in the tmp dir.
+# Ignoring server specific vars.
+echo -en "checking ${selfname}...\c"
+fn_script_log_info "Checking ${selfname}"
+script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}"))
+if [ "${script_diff}" != "" ]; then
+	fn_print_update_eol_nl
+	fn_script_log_update "Checking ${selfname}"
+	echo -en "backup ${selfname}...\c"
+	fn_script_log_info "Backup ${selfname}"
+	if [ ! -d "${backupdir}/script" ]; then
+		mkdir -p "${backupdir}/script"
+	fi
+	cp "${rootdir}/${selfname}" "${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
+	if [ $? -ne 0 ]; then
+		fn_print_fail_eol_nl
+		fn_script_log_fatal "Backup ${selfname}"
+		core_exit.sh
 	else
-		fn_script_log_info "checking linuxgsm.sh: OK"
 		fn_print_ok_eol_nl
+		fn_script_log_pass "Backup ${selfname}"
+		echo -e "backup location ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
+		fn_script_log_pass "Backup location ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
 	fi
-	echo -en "    checking ${selfname}...\c"
-	script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}"))
-	if [ "${script_diff}" != "" ]; then
-		fn_print_update_eol_nl
-		echo -en "    backup ${selfname}...\c"
-		mkdir -p "${backupdir}/script/"
-		cp "${rootdir}/${selfname}" "${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
-		if [ $? -ne 0 ]; then
-			fn_print_fail_eol_nl
-			core_exit.sh
-		else
-			fn_print_ok_eol_nl
-			echo -e "	Backup: ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
-		fi
-		echo -en "    fetching ${selfname}...\c"
-		cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}"
-		sed -i "s/shortname=\"core\"/shortname=\"${shortname}\"/g" "${rootdir}/${selfname}"
-		sed -i "s/gameservername=\"core\"/gameservername=\"${gameservername}\"/g" "${rootdir}/${selfname}"
-		sed -i "s/gamename=\"core\"/gamename=\"${gamename}\"/g" "${rootdir}/${selfname}"
-		exitcode=$?
-		if [ "${exitcode}" != "0" ]; then
-			fn_print_fail_eol_nl
-			core_exit.sh
-		else
-			fn_print_ok_eol_nl
-		fi
+
+	echo -en "copying ${selfname}...\c"
+	fn_script_log_info "copying ${selfname}"
+	cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}"
+	sed -i "s+shortname=\"core\"+shortname=\"${shortname}\"+g" "${rootdir}/${selfname}"
+	sed -i "s+gameservername=\"core\"+gameservername=\"${gameservername}\"+g" "${rootdir}/${selfname}"
+	sed -i "s+gamename=\"core\"+gamename=\"${gamename}\"+g" "${rootdir}/${selfname}"
+	sed -i "s+githubuser=\"GameServerManagers\"+githubuser=\"${githubuser}\"+g" "${rootdir}/${selfname}"
+	sed -i "s+githubrepo=\"LinuxGSM\"+githubrepo=\"${githubrepo}\"+g" "${rootdir}/${selfname}"
+	sed -i "s+githubbranch=\"master\"+githubbranch=\"${githubbranch}\"+g" "${rootdir}/${selfname}"
+
+	if [ $? != "0" ]; then
+		fn_print_fail_eol_nl
+		fn_script_log_fatal "copying ${selfname}"
+		core_exit.sh
 	else
 		fn_print_ok_eol_nl
+		fn_script_log_pass "copying ${selfname}"
 	fi
+else
+	fn_print_ok_eol_nl
+	fn_script_log_info "Checking ${selfname}"
 fi
 
-# Check and update functions.
-if [ "${functionsdir}" ]; then
+# Check and update modules.
+if [ -n "${functionsdir}" ]; then
 	if [ -d "${functionsdir}" ]; then
 		cd "${functionsdir}" || exit
 		for functionfile in *
 		do
-			echo -en "    checking function ${functionfile}...\c"
+			# check if module exists in the repo and remove if missing.
+			# commonly used if module names change.
+			echo -en "checking ${remotereponame} module ${functionfile}...\c"
 			github_file_url_dir="lgsm/functions"
-			get_function_file=$(curl --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}")
-			exitcode=$?
-			function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}"))
-			if [ ${exitcode} -ne 0 ]; then
-				fn_print_fail_eol_nl
-				echo -en "    removing unknown function ${functionfile}...\c"
-				fn_script_log_fatal "removing unknown function ${functionfile}"
+			if [ "${remotereponame}" == "GitHub" ]; then
+				curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}" 1>/dev/null
+			else
+				curl -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}" 1>/dev/null
+			fi
+			if [ $? -ne 0 ]; then
+				fn_print_error_eol_nl
+				fn_script_log_error "Checking ${remotereponame} module ${functionfile}"
+				echo -en "removing module ${functionfile}...\c"
 				if ! rm -f "${functionfile:?}"; then
 					fn_print_fail_eol_nl
+					fn_script_log_fatal "Removing module ${functionfile}"
 					core_exit.sh
 				else
 					fn_print_ok_eol_nl
+					fn_script_log_pass "Removing module ${functionfile}"
 				fi
-			elif [ "${function_file_diff}" != "" ]; then
-				fn_print_update_eol_nl
-				fn_script_log_info "checking function ${functionfile}: UPDATE"
-				rm -rf "${functionsdir:?}/${functionfile}"
-				fn_update_function
 			else
-				fn_print_ok_eol_nl
+				# compare file
+				if [ "${remotereponame}" == "GitHub" ]; then
+					function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}"))
+				else
+					function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}"))
+				fi
+
+				# results
+				if [ "${function_file_diff}" != "" ]; then
+					fn_print_update_eol_nl
+					fn_script_log_update "Checking ${remotereponame} module ${functionfile}"
+					rm -rf "${functionsdir:?}/${functionfile}"
+					fn_update_function
+				else
+					fn_print_ok_eol_nl
+					fn_script_log_pass "Checking ${remotereponame} module ${functionfile}"
+				fi
 			fi
 		done
 	fi
 fi
 
-if [ "${exitcode}" != "0" ]&&[ -n "${exitcode}" ]; then
-	fn_print_fail "Updating functions"
-	fn_script_log_fatal "Updating functions"
-else
-	fn_print_ok "Updating functions"
-	fn_script_log_pass "Updating functions"
-fi
+fn_print_ok_nl "Updating functions"
+fn_script_log_pass "Updating functions"
 
 core_exit.sh

+ 5 - 4
lgsm/functions/command_validate.sh

@@ -4,9 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Runs a server validation.
 
-local modulename="VALIDATE"
-local commandaction="Validate"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="VALIDATE"
+commandaction="Validating"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_validate(){
 	fn_script_log_warn "Validating server: SteamCMD: Validate might overwrite some customised files"
@@ -79,7 +79,6 @@ fn_stop_warning(){
 fn_print_dots "Validating server"
 fn_print_dots "Validating server: SteamCMD"
 check.sh
-check_status.sh
 if [ "${status}" != "0" ]; then
 	fn_stop_warning
 	exitbypass=1
@@ -90,3 +89,5 @@ if [ "${status}" != "0" ]; then
 else
 	fn_validate
 fi
+
+core_exit.sh

+ 3 - 3
lgsm/functions/command_wipe.sh

@@ -5,9 +5,9 @@
 # Website: https://linuxgsm.com
 # Description: Wipes server data, useful after updates for some games like Rust
 
-local modulename="WIPE"
-local commandaction="Wipe"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="WIPE"
+commandaction="Wiping"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 fn_print_header

+ 3 - 2
lgsm/functions/compress_unreal2_maps.sh

@@ -4,8 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Compresses unreal maps.
 
-local commandaction="Unreal Map Compressor"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="MAP-COMPRESSOR"
+commandaction="Compressing maps"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 fn_print_header

+ 3 - 2
lgsm/functions/compress_ut99_maps.sh

@@ -4,8 +4,9 @@
 # Website: https://linuxgsm.com
 # Description: Compresses unreal maps.
 
-local commandaction="Unreal Map Compressor"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+commandname="MAP-COMPRESSOR"
+commandaction="Compressing maps"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 check.sh
 fn_print_header

+ 136 - 66
lgsm/functions/core_dl.sh

@@ -17,9 +17,7 @@
 # fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 # fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd"
 
-local modulename="DOWNLOAD"
-local commandaction="Download"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Emptys contents of the LinuxGSM tmpdir.
 fn_clear_tmp(){
@@ -42,7 +40,7 @@ fn_dl_md5(){
 	if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then
 		echo -en "verifying ${local_filename} with MD5..."
 		fn_sleep_time
-		local md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}')
+		md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}')
 		if [ "${md5sumcmd}" != "${md5}" ]; then
 			fn_print_fail_eol_nl
 			echo -e "${local_filename} returned MD5 checksum: ${md5sumcmd}"
@@ -77,9 +75,9 @@ fn_dl_extract(){
 	if [ "${mime}" == "application/gzip" ]||[ "${mime}" == "application/x-gzip" ]; then
 		extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdir}")
 	elif [ "${mime}" == "application/x-bzip2" ]; then
-		tarcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdir}")
+		extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdir}")
 	elif [ "${mime}" == "application/x-xz" ]; then
-		tarcmd=$(tar -xf "${local_filedir}/${local_filename}" -C "${extractdir}")
+		extractcmd=$(tar -xf "${local_filedir}/${local_filename}" -C "${extractdir}")
 	elif [ "${mime}" == "application/zip" ]; then
 		extractcmd=$(unzip -qo -d "${extractdir}" "${local_filedir}/${local_filename}")
 	fi
@@ -114,54 +112,99 @@ fn_fetch_trap(){
 
 fn_fetch_file(){
 	remote_fileurl="${1}"
-	local_filedir="${2}"
-	local_filename="${3}"
-	chmodx="${4:-0}"
-	run="${5:-0}"
-	forcedl="${6:-0}"
-	md5="${7:-0}"
+	remote_fileurl_backup="${2}"
+	remote_fileurl_name="${3}"
+	remote_fileurl_backup_name="${4}"
+	local_filedir="${5}"
+	local_filename="${6}"
+	chmodx="${7:-0}"
+	run="${8:-0}"
+	forcedl="${9:-0}"
+	md5="${10:-0}"
 
 	# Download file if missing or download forced.
 	if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then
-		if [ ! -d "${local_filedir}" ]; then
-			mkdir -p "${local_filedir}"
-		fi
-		# Trap will remove part downloaded files if canceled.
-		trap fn_fetch_trap INT
-		# Larger files show a progress bar.
-		if [ "${local_filename##*.}" == "bz2" ]||[ "${local_filename##*.}" == "gz" ]||[ "${local_filename##*.}" == "zip" ]||[ "${local_filename##*.}" == "jar" ]||[ "${local_filename##*.}" == "xz" ]; then
-			echo -en "downloading ${local_filename}..."
-			fn_sleep_time
-			echo -en "\033[1K"
-			curlcmd=$(curl --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}")
-			echo -en "downloading ${local_filename}..."
+		# If backup fileurl exists include it.
+		if [ -n "${remote_fileurl_backup}" ]; then
+			# counter set to 0 to allow second try
+			counter=0
+			remote_fileurls_array=( remote_fileurl remote_fileurl_backup )
 		else
-			echo -en "    fetching ${local_filename}...\c"
-			curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
+			# counter set to 1 to not allow second try
+			counter=1
+			remote_fileurls_array=( remote_fileurl )
 		fi
-		local exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
-			fn_print_fail_eol_nl
-			if [ -f "${lgsmlog}" ]; then
-				fn_script_log_fatal "Downloading ${local_filename}"
-				echo -e "${remote_fileurl}" >> "${lgsmlog}"
-				echo -e "${curlcmd}" >> "${lgsmlog}"
+		for remote_fileurl_array in "${remote_fileurls_array[@]}"
+		do
+			if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then
+				fileurl="${remote_fileurl}"
+				fileurl_name="${remote_fileurl_name}"
+			elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then
+				fileurl="${remote_fileurl_backup}"
+				fileurl_name="${remote_fileurl_backup_name}"
 			fi
-			echo -e "${remote_fileurl}"
-			echo -e "${curlcmd}"
-			core_exit.sh
-		else
-			fn_print_ok_eol_nl
-			if [ -f "${lgsmlog}" ]; then
-				fn_script_log_pass "Downloading ${local_filename}"
+			counter=$((counter+1))
+			if [ ! -d "${local_filedir}" ]; then
+				mkdir -p "${local_filedir}"
 			fi
-		fi
-		# Remove trap.
-		trap - INT
-		# Make file executable if chmodx is set.
-		if [ "${chmodx}" == "chmodx" ]; then
-			chmod +x "${local_filedir}/${local_filename}"
-		fi
+			# Trap will remove part downloaded files if canceled.
+			trap fn_fetch_trap INT
+			# Larger files show a progress bar.
+			if [ "${local_filename##*.}" == "bz2" ]||[ "${local_filename##*.}" == "gz" ]||[ "${local_filename##*.}" == "zip" ]||[ "${local_filename##*.}" == "jar" ]||[ "${local_filename##*.}" == "xz" ]; then
+				echo -en "downloading ${local_filename}..."
+				fn_sleep_time
+				echo -en "\033[1K"
+				curlcmd=$(curl --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}")
+				echo -en "downloading ${local_filename}..."
+			else
+				echo -en "fetching ${fileurl_name} ${local_filename}...\c"
+				curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}" 2>&1)
+			fi
+			local exitcode=$?
+
+			# Download will fail if downloads a html file.
+			if [ -f "${local_filedir}/${local_filename}" ]; then
+				if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE" )" ]; then
+					rm "${local_filedir:?}/${local_filename:?}"
+					local exitcode=2
+				fi
+			fi
+
+			# On first try will error. On second try will fail.
+			if [ ${exitcode} -ne 0 ]; then
+				if [ ${counter} -ge 2 ]; then
+					fn_print_fail_eol_nl
+					if [ -f "${lgsmlog}" ]; then
+						fn_script_log_fatal "Downloading ${local_filename}"
+						fn_script_log_fatal "${fileurl}"
+					fi
+					core_exit.sh
+				else
+					fn_print_error_eol_nl
+					if [ -f "${lgsmlog}" ]; then
+						fn_script_log_error "Downloading ${local_filename}"
+						fn_script_log_error "${fileurl}"
+					fi
+				fi
+			else
+				fn_print_ok_eol
+				sleep 0.3
+				echo -en "\033[2K\\r"
+				if [ -f "${lgsmlog}" ]; then
+					fn_script_log_pass "Downloading ${local_filename}"
+				fi
+
+				# Make file executable if chmodx is set.
+				if [ "${chmodx}" == "chmodx" ]; then
+					chmod +x "${local_filedir}/${local_filename}"
+				fi
+
+				# Remove trap.
+				trap - INT
+
+				break
+			fi
+		done
 	fi
 
 	if [ -f "${local_filedir}/${local_filename}" ]; then
@@ -189,13 +232,19 @@ fn_fetch_file(){
 # forcedl: Optional, force re-download of file even if exists
 # md5: Optional, set an md5 sum and will compare it against the file.
 
-# Fetches any files from the GitHub repo.
+# Fetches files from the Git repo.
 fn_fetch_file_github(){
 	github_file_url_dir="${1}"
 	github_file_url_name="${2}"
-	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
-
-	remote_fileurl="${githuburl}"
+	if [ "${githubbranch}" == "master" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
+		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
+		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
+	else
+		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+	fi
+	remote_fileurl_name="GitHub"
+	remote_fileurl_backup_name="Bitbucket"
 	local_filedir="${3}"
 	local_filename="${github_file_url_name}"
 	chmodx="${4:-0}"
@@ -203,15 +252,22 @@ fn_fetch_file_github(){
 	forcedl="${6:-0}"
 	md5="${7:-0}"
 	# Passes vars to the file download function.
-	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
+	fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 }
 
+# Fetches config files from the Git repo.
 fn_fetch_config(){
 	github_file_url_dir="${1}"
 	github_file_url_name="${2}"
-	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
-
-	remote_fileurl="${githuburl}"
+	if [ "${githubbranch}" == "master" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
+		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
+		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
+	else
+		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+	fi
+	remote_fileurl_name="GitHub"
+	remote_fileurl_backup_name="Bitbucket"
 	local_filedir="${3}"
 	local_filename="${4}"
 	chmodx="nochmodx"
@@ -219,16 +275,22 @@ fn_fetch_config(){
 	forcedl="noforce"
 	md5="nomd5"
 	# Passes vars to the file download function.
-	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
+	fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 }
 
-# Fetches functions.
+# Fetches modules from the Git repo during first download.
 fn_fetch_function(){
 	github_file_url_dir="lgsm/functions"
 	github_file_url_name="${functionfile}"
-	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
-
-	remote_fileurl="${githuburl}"
+	if [ "${githubbranch}" == "master" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
+		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
+		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
+	else
+		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+	fi
+	remote_fileurl_name="GitHub"
+	remote_fileurl_backup_name="Bitbucket"
 	local_filedir="${functionsdir}"
 	local_filename="${github_file_url_name}"
 	chmodx="chmodx"
@@ -236,23 +298,31 @@ fn_fetch_function(){
 	forcedl="noforce"
 	md5="nomd5"
 	# Passes vars to the file download function.
-	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
+	fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 }
 
+# Fetches modules from the Git repo during update-lgsm.
 fn_update_function(){
-	exitbypass=1
 	github_file_url_dir="lgsm/functions"
 	github_file_url_name="${functionfile}"
-	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
-
-	remote_fileurl="${githuburl}"
+	if [ "${githubbranch}" == "master" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
+		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
+		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
+	else
+		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+	fi
+	remote_fileurl_name="GitHub"
+	remote_fileurl_backup_name="Bitbucket"
 	local_filedir="${functionsdir}"
 	local_filename="${github_file_url_name}"
 	chmodx="chmodx"
 	run="norun"
 	forcedl="noforce"
 	md5="nomd5"
-	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
+	# Passes vars to the file download function.
+	fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
+
 }
 
 # Check that curl is installed

+ 9 - 7
lgsm/functions/core_exit.sh

@@ -4,10 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Handles exiting of LinuxGSM by running and reporting an exit code.
 
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
 fn_exit_dev_debug(){
 	if [ -f "${rootdir}/.dev-debug" ]; then
 		echo -e ""
-		echo -e "${function_selfname} exiting with code: ${exitcode}"
+		echo -e "${functionselfname} exiting with code: ${exitcode}"
 		if [ -f "${rootdir}/dev-debug.log" ]; then
 			grep "functionfile=" "${rootdir}/dev-debug.log" | sed 's/functionfile=//g' > "${rootdir}/dev-debug-function-order.log"
 		fi
@@ -26,13 +28,13 @@ elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then
 	# List LinuxGSM version in logs
 	fn_script_log_info "LinuxGSM version: ${version}"
 	if [ "${exitcode}" == "1" ]; then
-		fn_script_log_fatal "${function_selfname} exiting with code: ${exitcode}"
+		fn_script_log_fatal "${functionselfname} exiting with code: ${exitcode}"
 	elif [ "${exitcode}" == "2" ]; then
-		fn_script_log_error "${function_selfname} exiting with code: ${exitcode}"
+		fn_script_log_error "${functionselfname} exiting with code: ${exitcode}"
 	elif [ "${exitcode}" == "3" ]; then
-		fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}"
+		fn_script_log_warn "${functionselfname} exiting with code: ${exitcode}"
 	else
-		fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}"
+		fn_script_log_warn "${functionselfname} exiting with code: ${exitcode}"
 	fi
 	fn_exit_dev_debug
 	# remove trap.
@@ -41,7 +43,7 @@ elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then
 elif [ "${exitcode}" ]&&[ "${exitcode}" == "0" ]; then
 	# List LinuxGSM version in logs
 	fn_script_log_info "LinuxGSM version: ${version}"
-	fn_script_log_pass "${function_selfname} exiting with code: ${exitcode}"
+	fn_script_log_pass "${functionselfname} exiting with code: ${exitcode}"
 	fn_exit_dev_debug
 	# remove trap.
 	trap - INT
@@ -50,7 +52,7 @@ else
 	# List LinuxGSM version in logs
 	fn_script_log_info "LinuxGSM version: ${version}"
 	fn_print_error "No exit code set"
-	fn_script_log_pass "${function_selfname} exiting with code: NOT SET"
+	fn_script_log_pass "${functionselfname} exiting with code: NOT SET"
 	fn_exit_dev_debug
 	# remove trap.
 	trap - INT

+ 20 - 1
lgsm/functions/core_functions.sh

@@ -5,6 +5,10 @@
 # Description: Defines all functions to allow download and execution of functions using fn_fetch_function.
 # This function is called first before any other function. Without this file other functions will not load.
 
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+modulesversion="v20.3.0"
+
 # Core
 
 core_dl.sh(){
@@ -233,6 +237,11 @@ functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
+check_version.sh(){
+functionfile="${FUNCNAME[0]}"
+fn_fetch_function
+}
+
 # Compress
 
 compress_unreal2_maps.sh(){
@@ -311,6 +320,11 @@ functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
+fix_cmw.sh(){
+functionfile="${FUNCNAME[0]}"
+fn_fetch_function
+}
+
 fix_csgo.sh(){
 functionfile="${FUNCNAME[0]}"
 fn_fetch_function
@@ -541,7 +555,7 @@ fn_fetch_function
 }
 # Logs
 
-logs.sh(){
+core_logs.sh(){
 functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
@@ -664,6 +678,11 @@ functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
+install_modules.sh(){
+functionfile="${FUNCNAME[0]}"
+fn_fetch_function
+}
+
 install_retry.sh(){
 functionfile="${FUNCNAME[0]}"
 fn_fetch_function

+ 1 - 1
lgsm/functions/core_getopt.sh

@@ -4,7 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: getopt arguments.
 
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 ### Define all commands here.
 ## User commands | Trigger commands | Description

+ 2 - 0
lgsm/functions/core_legacy.sh

@@ -4,6 +4,8 @@
 # Website: https://linuxgsm.com
 # Description: Code for backwards compatability with older versions of LinuxGSM.
 
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
 if [ -z "${serverfiles}" ]; then
 	legacymode=1
 	serverfiles="${filesdir}"

+ 3 - 4
lgsm/functions/logs.sh → lgsm/functions/core_logs.sh

@@ -1,12 +1,11 @@
 #!/bin/bash
-# LinuxGSM logs.sh function
+# LinuxGSM core_logs.sh function
 # Author: Daniel Gibbs
 # Contributor: UltimateByte
 # Website: https://linuxgsm.com
 # Description: Acts as a log rotator, removing old logs.
 
-local modulename="LOGS"
-local commandaction="Log-Manager"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Check if logfile variable and file exist, create logfile if it doesn't exist.
 if [ "${consolelog}" ]; then
@@ -17,7 +16,7 @@ fi
 
 # For games not displaying a console, and having logs into their game directory.
 check_status.sh
-if [ "${status}" != "0" ]&&[ "${function_selfname}" == "command_start.sh" ]&&[ -n "${gamelogfile}" ]; then
+if [ "${status}" != "0" ]&&[ "${commandname}" == "START" ]&&[ -n "${gamelogfile}" ]; then
 	if [ "$(find "${systemdir}" -name "gamelog*.log")" ]; then
 		fn_print_info "Moving game logs to ${gamelogdir}"
 		fn_script_log_info "Moving game logs to ${gamelogdir}"

+ 62 - 16
lgsm/functions/core_messages.sh

@@ -5,6 +5,8 @@
 # Website: https://linuxgsm.com
 # Description: Defines on-screen messages such as [  OK  ] and how script logs look.
 
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
 # nl: new line: message is following by a new line.
 # eol: end of line: message is placed at the end of the current line.
 fn_ansi_loader(){
@@ -46,8 +48,8 @@ fn_sleep_time(){
 ## Feb 28 14:56:58 ut99-server: Monitor:
 fn_script_log(){
 	if [ -d "${lgsmlogdir}" ]; then
-		if [ "${modulename}" ]; then
-			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: ${1}" >> "${lgsmlog}"
+		if [ -n "${commandname}" ]; then
+			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ${1}" >> "${lgsmlog}"
 		else
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${1}" >> "${lgsmlog}"
 		fi
@@ -58,8 +60,8 @@ fn_script_log(){
 fn_script_log_pass(){
 	if [ -d "${lgsmlogdir}" ]; then
 
-		if [ "${modulename}" ]; then
-			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: PASS: ${1}" >> "${lgsmlog}"
+		if [ -n "${commandname}" ]; then
+			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: PASS: ${1}" >> "${lgsmlog}"
 		else
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: PASS: ${1}" >> "${lgsmlog}"
 		fi
@@ -70,8 +72,8 @@ fn_script_log_pass(){
 ## Feb 28 14:56:58 ut99-server: Monitor: FATAL:
 fn_script_log_fatal(){
 	if [ -d "${lgsmlogdir}" ]; then
-		if [ "${modulename}" ]; then
-			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: FATAL: ${1}" >> "${lgsmlog}"
+		if [ -n "${commandname}" ]; then
+			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: FATAL: ${1}" >> "${lgsmlog}"
 		else
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: FATAL: ${1}" >> "${lgsmlog}"
 		fi
@@ -82,8 +84,8 @@ fn_script_log_fatal(){
 ## Feb 28 14:56:58 ut99-server: Monitor: ERROR:
 fn_script_log_error(){
 	if [ -d "${lgsmlogdir}" ]; then
-		if [ "${modulename}" ]; then
-			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: ERROR: ${1}" >> "${lgsmlog}"
+		if [ -n "${commandname}" ]; then
+			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ERROR: ${1}" >> "${lgsmlog}"
 		else
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ERROR: ${1}" >> "${lgsmlog}"
 		fi
@@ -94,8 +96,8 @@ fn_script_log_error(){
 ## Feb 28 14:56:58 ut99-server: Monitor: WARN:
 fn_script_log_warn(){
 	if [ -d "${lgsmlogdir}" ]; then
-		if [ "${modulename}" ]; then
-			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: WARN: ${1}" >> "${lgsmlog}"
+		if [ -n "${commandname}" ]; then
+			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: WARN: ${1}" >> "${lgsmlog}"
 		else
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: WARN: ${1}" >> "${lgsmlog}"
 		fi
@@ -106,14 +108,25 @@ fn_script_log_warn(){
 ## Feb 28 14:56:58 ut99-server: Monitor: INFO:
 fn_script_log_info(){
 	if [ -d "${lgsmlogdir}" ]; then
-		if [ "${modulename}" ]; then
-			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: INFO: ${1}" >> "${lgsmlog}"
+		if [ -n "${commandname}" ]; then
+			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: INFO: ${1}" >> "${lgsmlog}"
 		else
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: INFO: ${1}" >> "${lgsmlog}"
 		fi
 	fi
 }
 
+## Feb 28 14:56:58 ut99-server: Monitor: INFO:
+fn_script_log_update(){
+	if [ -d "${lgsmlogdir}" ]; then
+		if [ -n "${commandname}" ]; then
+			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: UPDATE: ${1}" >> "${lgsmlog}"
+		else
+			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: UPDATE: ${1}" >> "${lgsmlog}"
+		fi
+	fi
+}
+
 # On-Screen - Automated functions
 ##################################
 
@@ -352,100 +365,133 @@ fn_prompt_yn(){
 # OK
 fn_print_ok_eol(){
 	echo -en "${green}OK${default}"
+	fn_sleep_time
 }
 
 fn_print_ok_eol_nl(){
 	echo -e "${green}OK${default}"
+	fn_sleep_time
 }
 
 # FAIL
 fn_print_fail_eol(){
 	echo -en "${red}FAIL${default}"
+	fn_sleep_time
 }
 
 fn_print_fail_eol_nl(){
 	echo -e "${red}FAIL${default}"
+	fn_sleep_time
 }
 
 # ERROR
 fn_print_error_eol(){
 	echo -en "${red}ERROR${default}"
+	fn_sleep_time
 }
 
 fn_print_error_eol_nl(){
 	echo -e "${red}ERROR${default}"
+	fn_sleep_time
+}
+
+# WAIT
+fn_print_wait_eol(){
+	echo -en "${cyan}WAIT${default}"
+	fn_sleep_time
+}
+
+fn_print_wait_eol_nl(){
+	echo -e "${cyan}WAIT${default}"
+	fn_sleep_time
 }
 
 # WARN
 fn_print_warn_eol(){
 	echo -en "${lightyellow}WARN${default}"
+	fn_sleep_time
 }
 
 fn_print_warn_eol_nl(){
 	echo -e "${lightyellow}WARN${default}"
+	fn_sleep_time
 }
 
 # INFO
 fn_print_info_eol(){
-	echo -en "${red}INFO${default}"
+	echo -en "${cyan}INFO${default}"
+	fn_sleep_time
 }
 
 fn_print_info_eol_nl(){
-	echo -e "${red}INFO${default}"
+	echo -e "${cyan}INFO${default}"
+	fn_sleep_time
 }
 
 # QUERYING
 fn_print_querying_eol(){
 	echo -en "${cyan}QUERYING${default}"
+	fn_sleep_time
 }
 
 fn_print_querying_eol_nl(){
 	echo -e "${cyan}QUERYING${default}"
+	fn_sleep_time
 }
 
 # CHECKING
 fn_print_checking_eol(){
 	echo -en "${cyan}CHECKING${default}"
+	fn_sleep_time
 }
 
 fn_print_checking_eol_nl(){
 	echo -e "${cyan}CHECKING${default}"
+	fn_sleep_time
 }
 
 # DELAY
 fn_print_delay_eol(){
 	echo -en "${green}DELAY${default}"
+	fn_sleep_time
 }
 
 fn_print_delay_eol_nl(){
 	echo -e "${green}DELAY${default}"
+	fn_sleep_time
 }
 
 # CANCELED
 fn_print_canceled_eol(){
-	echo -en "${yellow}CANCELED${default}"
+	echo -en "${lightyellow}CANCELED${default}"
+	fn_sleep_time
 }
 
 fn_print_canceled_eol_nl(){
-	echo -e "${yellow}CANCELED${default}"
+	echo -e "${lightyellow}CANCELED${default}"
+	fn_sleep_time
 }
 
 # REMOVED
 fn_print_removed_eol(){
 	echo -en "${red}REMOVED${default}"
+	fn_sleep_time
 }
 
 fn_print_removed_eol_nl(){
 	echo -e "${red}REMOVED${default}"
+	fn_sleep_time
 }
 
 # UPDATE
 fn_print_update_eol(){
 	echo -en "${cyan}UPDATE${default}"
+	fn_sleep_time
 }
 
 fn_print_update_eol_nl(){
 	echo -e "${cyan}UPDATE${default}"
+	fn_sleep_time
 }
 
 fn_print_ascii_logo(){

+ 2 - 0
lgsm/functions/core_trap.sh

@@ -4,6 +4,8 @@
 # Website: https://linuxgsm.com
 # Description: Handles CTRL-C trap to give an exit code.
 
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
 fn_exit_trap(){
 	echo -e ""
 	core_exit.sh

+ 6 - 5
lgsm/functions/fix.sh

@@ -5,8 +5,7 @@
 # Description: Overall function for managing fixes.
 # Runs functions that will fix an issue.
 
-local modulename="FIX"
-local commandaction="Fix"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Messages that are displayed for some fixes.
 fn_fix_msg_start(){
@@ -32,7 +31,7 @@ fn_fix_msg_end(){
 }
 
 # Fixes that are run on start.
-if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; then
+if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then
 	if [ "${appid}" ]; then
 		fix_steamcmd.sh
 	fi
@@ -43,6 +42,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th
 		fix_ark.sh
 	elif [ "${shortname}" == "csgo" ]; then
 		fix_csgo.sh
+	elif [ "${shortname}" == "cmw" ]; then
+		fix_cmw.sh
 	elif [ "${shortname}" == "dst" ]; then
 		fix_dst.sh
 	elif [ "${shortname}" == "ges" ]; then
@@ -89,8 +90,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th
 fi
 
 # Fixes that are run on install only.
-if [ "${function_selfname}" == "command_install.sh" ]; then
-		if [ "${shortname}" == "av" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then
+if [ "${commandname}" == "INSTALL" ]; then
+		if [ "${shortname}" == "av" ]||[ "${shortname}" == "cmw" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then
 			echo -e ""
 			echo -e "Applying Post-Install Fixes"
 			echo -e "================================="

+ 44 - 34
lgsm/functions/fix_ark.sh

@@ -4,44 +4,54 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with ARK: Survival Evolved.
 
-# Steam mods directory selecter
-# This allows LinxuGSM to select either ~/.steam or ~/Steam. depending on what is being used
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-steamappsfile=$(find ${HOME} -name appworkshop_346110.acf)
-steamappsdir=$(dirname "${steamappsfile}")
-steamappspath=$(cd ${steamappsdir};cd ../;pwd)
-
-# removes the symlink if exists.
-# fixes issue with older versions of LinuxGSM linking to /home/arkserver/steamcmd
-if [ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]; then
-	fixname="broken SteamCMD symlink"
+# removes mulitple appworkshop_346110.acf if found.
+steamappsfilewc=$(find ${HOME} -name appworkshop_346110.acf | wc -l)
+if [ "${steamappsfilewc}" -gt "1" ]; then
+	fixname="multiple appworkshop acf files"
 	fn_fix_msg_start
-	unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux"
+	find ${HOME} -name appworkshop_346110.acf -exec rm -f {} \;
 	fn_fix_msg_end
-	check_steamcmd.sh
-fi
+elif [ "${steamappsfilewc}" -eq "1" ]; then
+	# Steam mods directory selecter
+	# This allows LinxuGSM to select either ~/.steam or ~/Steam. depending on what is being used
+	steamappsfile=$(find ${HOME} -name appworkshop_346110.acf)
+	steamappsdir=$(dirname "${steamappsfile}")
+	steamappspath=$(cd "${steamappsdir}"|| return; cd ../;pwd)
 
-# removed ARK steamcmd directory if steamcmd is missing.
-if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then
-	fixname="remove invalid ARK SteamCMD directory"
-	fn_fix_msg_start
-	rm -rf "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux"
-	fn_fix_msg_end
-	check_steamcmd.sh
-fi
+	# removes the symlink if exists.
+	# fixes issue with older versions of LinuxGSM linking to /home/arkserver/steamcmd
+	if [ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]; then
+		fixname="broken SteamCMD symlink"
+		fn_fix_msg_start
+		unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux"
+		fn_fix_msg_end
+		check_steamcmd.sh
+	fi
 
-# if the steamapps symlink is incorrect unlink it.
-if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]&&[ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]&&[ "$(readlink ${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps)" != "${steamappspath}" ]; then
-	fixname="incorrect steamapps symlink"
-	fn_fix_msg_start
-	unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps"
-	fn_fix_msg_end
-fi
+	# removed ARK steamcmd directory if steamcmd is missing.
+	if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then
+		fixname="remove invalid ARK SteamCMD directory"
+		fn_fix_msg_start
+		rm -rf "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux"
+		fn_fix_msg_end
+		check_steamcmd.sh
+	fi
 
-# Put symlink to steamapps directory into the ARK SteamCMD directory to link the downloaded mods to the correct location.
-if [ ! -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]; then
-	fixname="steamapps symlink"
-	fn_fix_msg_start
-	ln -s "${steamappspath}" "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps"
-	fn_fix_msg_end
+	# if the steamapps symlink is incorrect unlink it.
+	if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]&&[ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]&&[ "$(readlink ${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps)" != "${steamappspath}" ]; then
+		fixname="incorrect steamapps symlink"
+		fn_fix_msg_start
+		unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps"
+		fn_fix_msg_end
+	fi
+
+	# Put symlink to steamapps directory into the ARK SteamCMD directory to link the downloaded mods to the correct location.
+	if [ ! -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]; then
+		fixname="steamapps symlink"
+		fn_fix_msg_start
+		ln -s "${steamappspath}" "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps"
+		fn_fix_msg_end
+	fi
 fi

+ 1 - 3
lgsm/functions/fix_arma3.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves an issue with ARMA3.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Fixes: 20150 Segmentation fault (core dumped) error.
 if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3" ]||[ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3 - Other Profiles" ]; then

+ 1 - 2
lgsm/functions/fix_av.sh

@@ -4,8 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves startup issue with Avorion
 
-local commandname="FIX"
-local commandaction="Fix"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64"
 

+ 33 - 0
lgsm/functions/fix_cmw.sh

@@ -0,0 +1,33 @@
+#!/bin/bash
+# LinuxGSM fix_cmw.sh function
+# Author: Christian Birk
+# Website: https://linuxgsm.com
+# Description: Resolves the issue of the not starting server on linux
+
+fixname="steam_appid.txt"
+
+if [ ! -f "${executabledir}/steam_appid.txt" ]; then
+	fn_fix_msg_start
+	echo 219640 > "${executabledir}/steam_appid.txt"
+	fn_fix_msg_end
+fi
+
+
+if [ ! -f "${executabledir}/lib/steamclient.so" ]; then
+	fixname="steamclient.so"
+	fn_fix_msg_start
+	if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
+		cp "${steamcmddir}/linux32/steamclient.so" "${executabledir}/lib/steamclient.so"
+	elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
+		cp "${steamcmddir}/linux32/steamclient.so" "${executabledir}/lib/steamclient.so"
+	fi
+	fn_fix_msg_end
+fi
+
+if [ ! -f "${servercfgfullpath}" ]; then
+	fn_fix_msg_start
+	fixname="copy config"
+	mkdir "${servercfgdir}"
+	cp "${systemdir}/UDKGame/Config/"*.ini "${servercfgdir}"
+	fn_fix_msg_end
+fi

+ 1 - 3
lgsm/functions/fix_csgo.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with CS:GO.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Fixes: server not always creating steam_appid.txt file.
 if [ ! -f "${serverfiles}/steam_appid.txt" ]; then

+ 1 - 3
lgsm/functions/fix_dst.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Don't Starve Together.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer).
 # Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.

+ 1 - 2
lgsm/functions/fix_ges.sh

@@ -4,8 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with GoldenEye: Source.
 
-local modulename="FIX"
-local commandaction="Fix"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Fixes: MALLOC_CHECK_ needing to be set to 0.
 export MALLOC_CHECK_=0

+ 6 - 4
lgsm/functions/fix_hw.sh

@@ -4,15 +4,17 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Hurtworld.
 
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
 if [ "${shortname}" == "hw" ]; then
 	# Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so.
 	if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then
 		fixname="steamclient.so x86"
 		fn_fix_msg_start
 		if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
-			cp -v "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}"
+			cp "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}"
 		elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
-			cp -v "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}"
+			cp "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}"
 		else
 			:
 		fi
@@ -22,9 +24,9 @@ if [ "${shortname}" == "hw" ]; then
 		fixname="steamclient.so x86_64"
 		fn_fix_msg_start
 		if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
-			cp -v "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}"
+			cp "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}"
 		elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
-			cp -v "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}"
+			cp "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}"
 		else
 			:
 		fi

+ 2 - 3
lgsm/functions/fix_ins.sh

@@ -4,8 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Insurgency.
 
-local modulename="FIX"
-local commandaction="Fix"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Fixes: ./srcds_linux: error while loading shared libraries: libtier0.so: cannot open shared object file: No such file or directory.
 
@@ -13,7 +12,7 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/bin"
 
 # Fixes: issue #529 - gamemode not passed to debug or start.
 
-if [ "${function_selfname}" == "command_debug.sh" ]; then
+if [ "${commandname}" == "DEBUG" ]; then
 	defaultmap="\"${defaultmap}\""
 else
 	defaultmap="\\\"${defaultmap}\\\""

+ 1 - 3
lgsm/functions/fix_kf.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Killing Floor.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 echo -e "Applying WebAdmin ROOst.css fix."
 echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"

+ 1 - 3
lgsm/functions/fix_kf2.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Killing Floor 2.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_parms(){
 parms="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\""

+ 1 - 2
lgsm/functions/fix_mcb.sh

@@ -4,8 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves possible startup issue with Minecraft Bedrock.
 
-local modulename="FIX"
-local commandaction="Fix"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # official docs state that the server should be started with: LD_LIBRARY_PATH=. ./bedrock_server
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}"

+ 1 - 3
lgsm/functions/fix_mta.sh

@@ -5,9 +5,7 @@
 # Website: https://linuxgsm.com
 # Description: Installs the libmysqlclient for database functions on the server.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 if [ ! -f "${lgsmdir}/lib/libmysqlclient.so.16" ]; then
 	fixname="libmysqlclient16"

+ 1 - 2
lgsm/functions/fix_nmrih.sh

@@ -4,8 +4,7 @@
 # Description: Create symlinks for renamed No More Room In Hell serverfiles.
 # Solution from Steam Community post: https://steamcommunity.com/app/224260/discussions/2/1732089092441769414/
 
-local modulename="FIX"
-local commandaction="Fix"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 ln -s "${serverfiles}/bin/vphysics_srv.so" "${serverfiles}/bin/vphysics.so"
 ln -s "${serverfiles}/bin/studiorender_srv.so" "${serverfiles}/bin/studiorender.so"

+ 1 - 3
lgsm/functions/fix_onset.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Onset.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}"
 

+ 1 - 3
lgsm/functions/fix_ro.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Red Orchestra.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 echo -e "Applying WebAdmin ROOst.css fix."
 echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"

+ 1 - 2
lgsm/functions/fix_rust.sh

@@ -4,8 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves startup issue with Rust.
 
-local modulename="FIX"
-local commandaction="Fix"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Fixes: [Raknet] Server Shutting Down (Shutting Down).
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${systemdir}/RustDedicated_Data/Plugins/x86_64"

+ 1 - 2
lgsm/functions/fix_rw.sh

@@ -4,7 +4,6 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Rising World.
 
-local modulename="FIX"
-local commandaction="Fix"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64"

+ 1 - 2
lgsm/functions/fix_sdtd.sh

@@ -4,7 +4,6 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with 7 Days to Die.
 
-local modulename="FIX"
-local commandaction="Fix"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}"

+ 1 - 3
lgsm/functions/fix_sfc.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Source Forts Classic.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 if [ ! -f "${serverfiles}/bin/datacache.so" ]; then
 	ln -s "${serverfiles}/bin/datacache_srv.so" "${serverfiles}/bin/datacache.so"

+ 1 - 3
lgsm/functions/fix_sof2.sh

@@ -4,8 +4,6 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Soldier of Fortune 2.
 
-local modulename="FIX"
-local commandaction="Fix"
-
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 # Fixes: error while loading shared libraries: libcxa.so.1
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}"

+ 1 - 3
lgsm/functions/fix_ss3.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues with Serious Sam 3.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Fixes: https://steamcommunity.com/app/41070/discussions/0/353916981477716386/
 if [ ! -f "${serverfiles}/Bin/steamclient.so" ]||[ "$(diff "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Bin/steamclient.so" 2>/dev/null)" ]; then

+ 5 - 11
lgsm/functions/fix_steamcmd.sh

@@ -4,9 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves various issues related to SteamCMD.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Helps fix: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
 if [ ! -f "${HOME}/.steam/sdk64/steamclient.so" ]; then
@@ -14,11 +12,9 @@ if [ ! -f "${HOME}/.steam/sdk64/steamclient.so" ]; then
 	fn_fix_msg_start
 	mkdir -pv "${HOME}/.steam/sdk64" >> "${lgsmlog}"
 	if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
-		cp -v "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}"
+		cp "${steamcmddir}/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}"
 	elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
-		cp -v "${steamcmddir}/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}"
-	else
-		$?=2
+		cp "${steamcmddir}/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}"
 	fi
 	fn_fix_msg_end
 fi
@@ -29,11 +25,9 @@ if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
 	fn_fix_msg_start
 	mkdir -pv "${HOME}/.steam/sdk32" >> "${lgsmlog}"
 	if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
-		cp -v "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}"
+		cp "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}"
 	elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
-		cp -v "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}"
-	else
-		$?=2
+		cp "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}"
 	fi
 	fn_fix_msg_end
 fi

+ 1 - 3
lgsm/functions/fix_terraria.sh

@@ -4,8 +4,6 @@
 # Website: https://linuxgsm.com
 # Description: Resolves an issue with Terraria.
 
-local modulename="FIX"
-local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 export TERM=xterm

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно