Просмотр исходного кода

Merge branch 'release/v22.2.0'

Daniel Gibbs 3 лет назад
Родитель
Сommit
55694a0a88
100 измененных файлов с 1935 добавлено и 1605 удалено
  1. 15 0
      .editorconfig
  2. 9 9
      .gitattributes
  3. 17 15
      .github/ISSUE_TEMPLATE/bug-report.md
  4. 16 15
      .github/ISSUE_TEMPLATE/feature-request.md
  5. 6 7
      .github/ISSUE_TEMPLATE/new-server-request.md
  6. 0 1
      .github/dependabot.yml
  7. 46 46
      .github/labeler.yml
  8. 16 15
      .github/pull_request_template.md
  9. 2 2
      .github/workflows/create-release.yml
  10. 12 12
      .github/workflows/git-sync.yml
  11. 2 2
      .github/workflows/labeler.yml
  12. 55 0
      .github/workflows/linter.yml
  13. 4 4
      .github/workflows/lock.yml
  14. 2 2
      .github/workflows/potential-duplicates.yml
  15. 17 0
      .github/workflows/update-copyright-years-in-license-file.yml
  16. 2 2
      .github/workflows/version-check.sh
  17. 5 5
      .github/workflows/version-check.yml
  18. 1 0
      .gitignore
  19. 3 0
      .prettierrc.json
  20. 11 0
      .vscode/extensions.json
  21. 20 21
      CODE_OF_CONDUCT.md
  22. 75 67
      CONTRIBUTING.md
  23. 2 2
      LICENSE
  24. 0 0
      README.md
  25. 1 1
      lgsm/config-default/config-lgsm/emserver/_default.cfg
  26. 1 1
      lgsm/config-default/config-lgsm/squadserver/_default.cfg
  27. 6 5
      lgsm/config-default/config-lgsm/stserver/_default.cfg
  28. 179 0
      lgsm/config-default/config-lgsm/vpmcserver/_default.cfg
  29. 2 1
      lgsm/data/almalinux-8.csv
  30. 1 1
      lgsm/data/centos-7.csv
  31. 2 1
      lgsm/data/centos-8.csv
  32. 1 0
      lgsm/data/debian-10.csv
  33. 1 0
      lgsm/data/debian-11.csv
  34. 2 1
      lgsm/data/rhel-7.csv
  35. 2 1
      lgsm/data/rhel-8.csv
  36. 2 1
      lgsm/data/rocky-8.csv
  37. 1 0
      lgsm/data/serverlist.csv
  38. 1 0
      lgsm/data/ubuntu-18.04.csv
  39. 3 2
      lgsm/data/ubuntu-20.04.csv
  40. 3 2
      lgsm/data/ubuntu-21.04.csv
  41. 3 2
      lgsm/data/ubuntu-21.10.csv
  42. 3 2
      lgsm/data/ubuntu-22.04.csv
  43. 10 9
      lgsm/functions/README.md
  44. 43 43
      lgsm/functions/alert.sh
  45. 2 1
      lgsm/functions/alert_discord.sh
  46. 2 1
      lgsm/functions/alert_gotify.sh
  47. 2 1
      lgsm/functions/alert_ifttt.sh
  48. 6 6
      lgsm/functions/alert_mailgun.sh
  49. 2 1
      lgsm/functions/alert_pushbullet.sh
  50. 1 1
      lgsm/functions/alert_pushover.sh
  51. 2 1
      lgsm/functions/alert_rocketchat.sh
  52. 2 1
      lgsm/functions/alert_slack.sh
  53. 2 1
      lgsm/functions/alert_telegram.sh
  54. 10 10
      lgsm/functions/check.sh
  55. 5 5
      lgsm/functions/check_config.sh
  56. 45 46
      lgsm/functions/check_deps.sh
  57. 18 18
      lgsm/functions/check_ip.sh
  58. 2 2
      lgsm/functions/check_last_update.sh
  59. 3 3
      lgsm/functions/check_logs.sh
  60. 30 30
      lgsm/functions/check_permissions.sh
  61. 1 1
      lgsm/functions/check_status.sh
  62. 1 1
      lgsm/functions/check_steamcmd.sh
  63. 3 3
      lgsm/functions/check_system_requirements.sh
  64. 3 3
      lgsm/functions/check_tmuxception.sh
  65. 1 1
      lgsm/functions/check_version.sh
  66. 23 23
      lgsm/functions/command_backup.sh
  67. 9 5
      lgsm/functions/command_check_update.sh
  68. 4 4
      lgsm/functions/command_debug.sh
  69. 2 2
      lgsm/functions/command_details.sh
  70. 18 18
      lgsm/functions/command_dev_detect_deps.sh
  71. 16 17
      lgsm/functions/command_dev_detect_glibc.sh
  72. 12 14
      lgsm/functions/command_dev_detect_ldd.sh
  73. 141 142
      lgsm/functions/command_dev_query_raw.sh
  74. 36 31
      lgsm/functions/command_fastdl.sh
  75. 1 1
      lgsm/functions/command_install_resources_mta.sh
  76. 11 11
      lgsm/functions/command_mods_install.sh
  77. 7 6
      lgsm/functions/command_mods_remove.sh
  78. 7 7
      lgsm/functions/command_mods_update.sh
  79. 92 92
      lgsm/functions/command_monitor.sh
  80. 2 3
      lgsm/functions/command_postdetails.sh
  81. 1 1
      lgsm/functions/command_send.sh
  82. 1 1
      lgsm/functions/command_skeleton.sh
  83. 15 16
      lgsm/functions/command_start.sh
  84. 17 15
      lgsm/functions/command_stop.sh
  85. 2 2
      lgsm/functions/command_ts3_server_pass.sh
  86. 1 1
      lgsm/functions/command_update.sh
  87. 10 10
      lgsm/functions/command_update_linuxgsm.sh
  88. 1 1
      lgsm/functions/command_validate.sh
  89. 13 13
      lgsm/functions/command_wipe.sh
  90. 46 46
      lgsm/functions/core_dl.sh
  91. 3 3
      lgsm/functions/core_exit.sh
  92. 462 457
      lgsm/functions/core_functions.sh
  93. 80 81
      lgsm/functions/core_getopt.sh
  94. 9 9
      lgsm/functions/core_github.sh
  95. 2 2
      lgsm/functions/core_legacy.sh
  96. 10 3
      lgsm/functions/core_logs.sh
  97. 75 75
      lgsm/functions/core_messages.sh
  98. 23 23
      lgsm/functions/core_steamcmd.sh
  99. 1 1
      lgsm/functions/core_trap.sh
  100. 34 32
      lgsm/functions/fix.sh

+ 15 - 0
.editorconfig

@@ -11,3 +11,18 @@ indent_size = 4
 trim_trailing_whitespace = true
 end_of_line = lf
 insert_final_newline = true
+
+# YAML Files
+[*.{yml,yaml}]
+indent_size = 2
+indent_style = space
+
+# JSON Files
+[*.{json,json5,webmanifest}]
+indent_size = 2
+indent_style = space
+
+# BASH Files
+[*.{.sh}]
+indent_style = tab
+indent_size = 4

+ 9 - 9
.gitattributes

@@ -7,16 +7,16 @@
 *.so.6 binary
 
 # Custom for Visual Studio
-*.cs     diff=csharp
+*.cs diff=csharp
 
 # Standard to msysgit
-*.doc	 diff=astextplain
-*.DOC	 diff=astextplain
+*.doc diff=astextplain
+*.DOC diff=astextplain
 *.docx diff=astextplain
 *.DOCX diff=astextplain
-*.dot  diff=astextplain
-*.DOT  diff=astextplain
-*.pdf  diff=astextplain
-*.PDF	 diff=astextplain
-*.rtf	 diff=astextplain
-*.RTF	 diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain

+ 17 - 15
.github/ISSUE_TEMPLATE/bug-report.md

@@ -2,25 +2,26 @@
 name: Bug Report
 about: Found a bug? Raise a report.
 title: "[BUG]"
-labels: 'type: bug'
-assignees: ''
-
+labels: "type: bug"
+assignees: ""
 ---
 
 Issues raised here are **ONLY** for:
-* LinuxGSM bugs.
-* Feature suggestions.
-* Code contributions.
+
+-   LinuxGSM bugs.
+-   Feature suggestions.
+-   Code contributions.
 
 Issues raised here are **NOT** for:
-* General support.
-* Specific game server issues (e.g CS:GO, TF2).
-* Dedicated server issues (e.g Ubuntu, CentOS).
-* Anything not directly related to LinuxGSM development.
+
+-   General support.
+-   Specific game server issues (e.g CS:GO, TF2).
+-   Dedicated server issues (e.g Ubuntu, CentOS).
+-   Anything not directly related to LinuxGSM development.
 
 For general support visit the **[LinuxGSM-Support](https://linuxgsm.com/support)**.
 
-***Please use the template below, deleting the above text***
+**_Please use the template below, deleting the above text_**
 
 ## User Story
 
@@ -28,10 +29,10 @@ As a [user description], I want [desired action] so that [desired outcome].
 
 ## Basic info
 
-* **Distro:** [Ubuntu 18.04]
-* **Game:** [Garry's Mod]
-* **Command:** [Monitor]
-* **LinuxGSM version:** [v20.1.3]
+-   **Distro:** [Ubuntu 18.04]
+-   **Game:** [Garry's Mod]
+-   **Command:** [Monitor]
+-   **LinuxGSM version:** [v20.1.3]
 
 ## Further Information
 
@@ -40,6 +41,7 @@ A clear description of what the bug is and any ideas on how to resolve it. Plus
 ## To Reproduce
 
 Steps to reproduce the behaviour:
+
 1. Go to '...'
 2. Click on '....'
 3. Scroll down to '....'

+ 16 - 15
.github/ISSUE_TEMPLATE/feature-request.md

@@ -2,25 +2,26 @@
 name: Feature Request
 about: Suggest an idea for LinuxGSM.
 title: "[FEATURE]"
-labels: 'type: feature request'
-assignees: ''
-
+labels: "type: feature request"
+assignees: ""
 ---
 
 Issues raised here are **ONLY** for:
-* LinuxGSM bugs.
-* Feature suggestions.
-* Code contributions.
+
+-   LinuxGSM bugs.
+-   Feature suggestions.
+-   Code contributions.
 
 Issues raised here are **NOT** for:
-* General support.
-* Specific game server issues (e.g CS:GO, TF2).
-* Dedicated server issues (e.g Ubuntu, CentOS).
-* Anything not directly related to LinuxGSM development.
+
+-   General support.
+-   Specific game server issues (e.g CS:GO, TF2).
+-   Dedicated server issues (e.g Ubuntu, CentOS).
+-   Anything not directly related to LinuxGSM development.
 
 For general support visit the **[LinuxGSM Support](https://linuxgsm.com/support)** page.
 
-***Please use the template below, deleting the above text***
+**_Please use the template below, deleting the above text_**
 
 ## User Story
 
@@ -28,10 +29,10 @@ As a [user description], I want [desired action] so that [desired outcome].
 
 ## Basic info
 
-* **Distro:** [Ubuntu 20.04]
-* **Game:** [Garry's Mod]
-* **Command:** [Monitor]
-* **LinuxGSM version:** [v20.1.3]
+-   **Distro:** [Ubuntu 20.04]
+-   **Game:** [Garry's Mod]
+-   **Command:** [Monitor]
+-   **LinuxGSM version:** [v20.1.3]
 
 ## Further Information
 

+ 6 - 7
.github/ISSUE_TEMPLATE/new-server-request.md

@@ -2,9 +2,8 @@
 name: New Server Request
 about: Suggest a new game server to be added.
 title: "[Server Request]"
-labels: 'type: game server request'
-assignees: ''
-
+labels: "type: game server request"
+assignees: ""
 ---
 
 ## What game server would you like to add?
@@ -17,8 +16,8 @@ Provide any useful documentation or resources that might help.
 
 ## Is the server on Steam?
 
-* [ ] Yes
-* [ ] No
+-   [ ] Yes
+-   [ ] No
 
 If yes Use SteamDB to get the appid. (https://steamdb.info).
 
@@ -28,5 +27,5 @@ If yes Use SteamDB to get the appid. (https://steamdb.info).
 
 We only support Linux servers and do **not** support Wine.
 
-* [ ] Yes
-* [ ] No
+-   [ ] Yes
+-   [ ] No

+ 0 - 1
.github/dependabot.yml

@@ -1,7 +1,6 @@
 # Set update schedule for GitHub Actions
 version: 2
 updates:
-
   - package-ecosystem: "github-actions"
     directory: "/"
     schedule:

+ 46 - 46
.github/labeler.yml

@@ -1,98 +1,98 @@
 # Add/remove 'critical' label if issue contains the words 'urgent' or 'critical'
 # Type
 "type: game server request":
-    - '/(Server Request)/i'
+  - "/(Server Request)/i"
 "type: bug":
-    - '/(bug)/i'
+  - "/(bug)/i"
 "type: feature request":
-    - '/(feature)/i'
+  - "/(feature)/i"
 # Commands
 "command: backup":
-    - '/(backup)/i'
+  - "/(backup)/i"
 "command: console":
-    - '/(console|tmux)/i'
+  - "/(console|tmux)/i"
 "command: debug":
-    - '/(debug)/i'
+  - "/(debug)/i"
 "command: details":
-    - '/(details)/i'
+  - "/(details)/i"
 "command: fast-dl":
-    - '/(fast-dl|fastdl)/i'
+  - "/(fast-dl|fastdl)/i"
 "command: install":
-    - '/(install)/i'
+  - "/(install)/i"
 "command: mods":
-    - '/(mods)/i'
+  - "/(mods)/i"
 "command: monitor":
-    - '/(monitor)/i'
+  - "/(monitor)/i"
 "command: post-details":
-    - '/(post-details)/i'
+  - "/(post-details)/i"
 "command: restart":
-    - '/(restart)/i'
+  - "/(restart)/i"
 "command: send":
-    - '/(send)/i'
+  - "/(send)/i"
 "command: skeleton":
-    - '/(skeleton)/i'
+  - "/(skeleton)/i"
 "command: start":
-    - '/(start)/i'
+  - "/(start)/i"
 "command: stop":
-    - '/(stop)/i'
+  - "/(stop)/i"
 "command: update-lgsm":
-    - '/(update-lgsm)/i'
+  - "/(update-lgsm)/i"
 "command: update":
-    - '/(update)/i'
+  - "/(update)/i"
 "command: validate":
-    - '/(validate)/i'
+  - "/(validate)/i"
 "command: wipe":
-    - '/(wipe)/i'
+  - "/(wipe)/i"
 # Distros
 "distro: AlmaLinux":
-    - '/(Alma)/i'
+  - "/(Alma)/i"
 "distro: Arch Linux":
-    - '/(Arch)/i'
+  - "/(Arch)/i"
 "distro: CentOS":
-    - '/(CentOS)/i'
+  - "/(CentOS)/i"
 "distro: Debian":
-    - '/(Debian)/i'
+  - "/(Debian)/i"
 "distro: Fedora":
-    - '/(Fedora)/i'
+  - "/(Fedora)/i"
 "distro: openSUSE":
-    - '/(openSUSE|suse)/i'
+  - "/(openSUSE|suse)/i"
 "distro: Rocky Linux":
-    - '/(Rocky)/i'
+  - "/(Rocky)/i"
 "distro: Slackware":
-    - '/(Slackware)/i'
+  - "/(Slackware)/i"
 "distro: Ubuntu":
-    - '/(Ubuntu)/i'
+  - "/(Ubuntu)/i"
 # Info
 "info: alerts":
-    - '/(alert)/i'
+  - "/(alert)/i"
 "info: dependency":
-    - '/(dependency|deps)/i'
+  - "/(dependency|deps)/i"
 "info: docker":
-    - '/(docker)/i'
+  - "/(docker)/i"
 "info: docs":
-    - '/(documentation|docs)/i'
+  - "/(documentation|docs)/i"
 "info: email":
-    - '/(postfix|sendmail|exim|smtp)/i'
+  - "/(postfix|sendmail|exim|smtp)/i"
 "info: query":
-    - '/(gamedig|gsquery)/i'
+  - "/(gamedig|gsquery)/i"
 "info: steamcmd":
-    - '/(steamcmd)/i'
+  - "/(steamcmd)/i"
 "info: systemd":
-    - '/(systemd)/i'
+  - "/(systemd)/i"
 "info: tmux":
-    - '/(tmux)/i'
+  - "/(tmux)/i"
 "info: website":
-    - '/(website)/i'
+  - "/(website)/i"
 # Games
 "game: Ark: Survival Evolved":
-    - '/(Ark: Survival Evolved|Ark)/i'
+  - "/(Ark: Survival Evolved|Ark)/i"
 "game: ARMA 3":
-    - '/(ARMA 3)/i'
+  - "/(ARMA 3)/i"
 "game: Assetto Corsa":
-    - '/(Assetto Corsa)/i'
+  - "/(Assetto Corsa)/i"
 "game: Avorion":
-    - '/(Avorion)/i'
+  - "/(Avorion)/i"
 "game: Ballistic Overkill":
-    - '/(Ballistic Overkill)/i'
+  - "/(Ballistic Overkill)/i"
 "game: Barotrauma":
-    - '/(Barotrauma)/i'
+  - "/(Barotrauma)/i"

+ 16 - 15
.github/pull_request_template.md

@@ -6,29 +6,30 @@ Fixes #[issue]
 
 ## Type of change
 
-* [ ] Bug fix (a change which fixes an issue).
-* [ ] New feature (change which adds functionality).
-* [ ] New Server (new server added).
-* [ ] Refactor (restructures existing code).
-* [ ] Comment update (typo, spelling, explanation, examples, etc).
+-   [ ] Bug fix (a change which fixes an issue).
+-   [ ] New feature (change which adds functionality).
+-   [ ] New Server (new server added).
+-   [ ] Refactor (restructures existing code).
+-   [ ] Comment update (typo, spelling, explanation, examples, etc).
 
 ## Checklist
 
 PR will not be merged until all steps are complete.
 
-* [ ] This pull request links to an issue.
-* [ ] This pull request uses the `develop` branch as its base.
-* [ ] This pull request Subject follows the Conventional Commits standard.
-* [ ] This code follows the style guidelines of this project.
-* [ ] I have performed a self-review of my code.
-* [ ] I have checked that this code is commented where required.
-* [ ] I have provided a detailed with enough description of this PR.
-* [ ] I have checked If documentation needs updating.
+-   [ ] This pull request links to an issue.
+-   [ ] This pull request uses the `develop` branch as its base.
+-   [ ] This pull request Subject follows the Conventional Commits standard.
+-   [ ] This code follows the style guidelines of this project.
+-   [ ] I have performed a self-review of my code.
+-   [ ] I have checked that this code is commented where required.
+-   [ ] I have provided a detailed with enough description of this PR.
+-   [ ] I have checked If documentation needs updating.
 
 ## Documentation
 
 If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.
-* User docs: https://github.com/GameServerManagers/LinuxGSM-Docs
-* Dev docs: https://github.com/GameServerManagers/LinuxGSM-Dev-Docs
+
+-   User docs: https://github.com/GameServerManagers/LinuxGSM-Docs
+-   Dev docs: https://github.com/GameServerManagers/LinuxGSM-Dev-Docs
 
 **Thank you for your Pull Request!**

+ 2 - 2
.github/workflows/create-release.yml

@@ -11,8 +11,8 @@ permissions:
 jobs:
   update_release_draft:
     permissions:
-      contents: write  # for release-drafter/release-drafter to create a github release
-      pull-requests: write  # for release-drafter/release-drafter to add label to PR
+      contents: write # for release-drafter/release-drafter to create a github release
+      pull-requests: write # for release-drafter/release-drafter to add label to PR
     runs-on: ubuntu-latest
     steps:
       # Drafts your next Release notes as Pull Requests are merged into "master"

+ 12 - 12
.github/workflows/git-sync.yml

@@ -10,16 +10,16 @@ jobs:
   GitHub-to-Bitbucket:
     runs-on: ubuntu-latest
     steps:
-    - name: webfactory/ssh-agent@v0.5.4
-      uses: webfactory/ssh-agent@v0.5.4
-      with:
-        ssh-private-key: ${{ secrets.BITBUCKET_SECRET }}
+      - name: webfactory/ssh-agent@v0.5.4
+        uses: webfactory/ssh-agent@v0.5.4
+        with:
+          ssh-private-key: ${{ secrets.BITBUCKET_SECRET }}
 
-    - name: wei/git-sync@v3.0.0
-      uses: wei/git-sync@v3.0.0
-      with:
-        ssh_private_key: ${{ secrets.BITBUCKET_SECRET }}
-        source_repo: "https://github.com/GameServerManagers/LinuxGSM"
-        source_branch: "refs/heads/*"
-        destination_repo: "git@bitbucket.org:GameServerManagers/linuxgsm.git"
-        destination_branch: "refs/heads/*"
+      - name: wei/git-sync@v3.0.0
+        uses: wei/git-sync@v3.0.0
+        with:
+          ssh_private_key: ${{ secrets.BITBUCKET_SECRET }}
+          source_repo: "https://github.com/GameServerManagers/LinuxGSM"
+          source_branch: "refs/heads/*"
+          destination_repo: "git@bitbucket.org:GameServerManagers/linuxgsm.git"
+          destination_branch: "refs/heads/*"

+ 2 - 2
.github/workflows/labeler.yml

@@ -9,8 +9,8 @@ permissions:
 jobs:
   triage:
     permissions:
-      contents: read  # for github/issue-labeler to get repo contents
-      issues: write  # for github/issue-labeler to create or remove labels
+      contents: read # for github/issue-labeler to get repo contents
+      issues: write # for github/issue-labeler to create or remove labels
     runs-on: ubuntu-latest
     steps:
     - uses: github/issue-labeler@v2.5

+ 55 - 0
.github/workflows/linter.yml

@@ -0,0 +1,55 @@
+---
+#################################
+#################################
+## Super Linter GitHub Actions ##
+#################################
+#################################
+name: Lint Code Base
+
+#
+# Documentation:
+# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
+#
+
+#############################
+# Start the job on all push #
+#############################
+on:
+  push:
+    branches-ignore: [master, main]
+    # Remove the line above to run when pushing to master
+  pull_request:
+
+###############
+# Set the Job #
+###############
+jobs:
+  build:
+    # Name the Job
+    name: Lint Code Base
+    # Set the agent to run on
+    runs-on: ubuntu-latest
+
+    ##################
+    # Load all steps #
+    ##################
+    steps:
+      ##########################
+      # Checkout the code base #
+      ##########################
+      - name: Checkout Code
+        uses: actions/checkout@v2
+        with:
+          # Full git history is needed to get a proper list of changed files within `super-linter`
+          fetch-depth: 0
+
+      ################################
+      # Run Linter against code base #
+      ################################
+      - name: Lint Code Base
+        uses: github/super-linter@v4
+        env:
+          VALIDATE_ALL_CODEBASE: false
+          # Change to 'master' if your main branch differs
+          DEFAULT_BRANCH: main
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 4 - 4
.github/workflows/lock.yml

@@ -1,8 +1,8 @@
-name: 'Lock Threads'
+name: "Lock Threads"
 
 on:
   schedule:
-    - cron: '0 0 * * *'
+    - cron: "0 0 * * *"
 
 permissions:
   contents: read
@@ -10,8 +10,8 @@ permissions:
 jobs:
   lock:
     permissions:
-      issues: write  # for dessant/lock-threads to lock issues
-      pull-requests: write  # for dessant/lock-threads to lock PRs
+      issues: write # for dessant/lock-threads to lock issues
+      pull-requests: write # for dessant/lock-threads to lock PRs
     runs-on: ubuntu-latest
     steps:
       - uses: dessant/lock-threads@v3

+ 2 - 2
.github/workflows/potential-duplicates.yml

@@ -12,9 +12,9 @@ jobs:
           # Issue title filter work with anymatch https://www.npmjs.com/package/anymatch.
           # Any matched issue will stop detection immediately.
           # You can specify multi filters in each line.
-          filter: ''
+          filter: ""
           # Exclude keywords in title before detecting.
-          exclude: ''
+          exclude: ""
           # Label to set, when potential duplicates are detected.
           label: potential-duplicate
           # Get issues with state to compare. Supported state: 'all', 'closed', 'open'.

+ 17 - 0
.github/workflows/update-copyright-years-in-license-file.yml

@@ -0,0 +1,17 @@
+---
+name: Update copyright year(s) in license file
+
+on:
+  schedule:
+    - cron: "0 3 1 1 *" # 03:00 AM on January 1
+
+jobs:
+  update-license-year:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+      - uses: FantasticFiasco/action-update-license-year@v2
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}

+ 2 - 2
.github/workflows/version-check.sh

@@ -1,5 +1,5 @@
-version=$(grep "version=" linuxgsm.sh | sed -e 's/version//g'| tr -d '="')
-modulesversion=$(grep "modulesversion=" lgsm/functions/core_functions.sh | sed -e 's/modulesversion//g'| tr -d '="')
+version=$(grep "version=" linuxgsm.sh | sed -e 's/version//g' | tr -d '="')
+modulesversion=$(grep "modulesversion=" lgsm/functions/core_functions.sh | sed -e 's/modulesversion//g' | tr -d '="')
 
 if [ "${version}" != "${modulesversion}" ]; then
 	echo "Error! LinuxGSM version mismatch"

+ 5 - 5
.github/workflows/version-check.yml

@@ -18,9 +18,9 @@ jobs:
 
     # Steps represent a sequence of tasks that will be executed as part of the job
     steps:
-    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
-    - uses: actions/checkout@v3
+      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+      - uses: actions/checkout@v3
 
-    # Runs a single command using the runners shell
-    - name: compare versions
-      run: chmod +x .github/workflows/version-check.sh; .github/workflows/version-check.sh
+      # Runs a single command using the runners shell
+      - name: compare versions
+        run: chmod +x .github/workflows/version-check.sh; .github/workflows/version-check.sh

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 *.db
 .idea
+/node_modules

+ 3 - 0
.prettierrc.json

@@ -0,0 +1,3 @@
+{
+  "plugins": ["prettier-plugin-sh"]
+}

+ 11 - 0
.vscode/extensions.json

@@ -0,0 +1,11 @@
+{
+    "recommendations": [
+        "ms-python.python",
+        "editorconfig.editorconfig",
+        "yzhang.markdown-all-in-one",
+        "esbenp.prettier-vscode",
+        "timonwong.shellcheck",
+        "foxundermoon.shell-format",
+        "redhat.vscode-yaml"
+    ]
+}

+ 20 - 21
CODE_OF_CONDUCT.md

@@ -1,4 +1,3 @@
-
 # Contributor Covenant Code of Conduct
 
 ## Our Pledge
@@ -18,24 +17,24 @@ diverse, inclusive, and healthy community.
 Examples of behavior that contributes to a positive environment for our
 community include:
 
-* Demonstrating empathy and kindness toward other people
-* Being respectful of differing opinions, viewpoints, and experiences
-* Giving and gracefully accepting constructive feedback
-* Accepting responsibility and apologizing to those affected by our mistakes,
-  and learning from the experience
-* Focusing on what is best not just for us as individuals, but for the
-  overall community
+-   Demonstrating empathy and kindness toward other people
+-   Being respectful of differing opinions, viewpoints, and experiences
+-   Giving and gracefully accepting constructive feedback
+-   Accepting responsibility and apologizing to those affected by our mistakes,
+    and learning from the experience
+-   Focusing on what is best not just for us as individuals, but for the
+    overall community
 
 Examples of unacceptable behavior include:
 
-* The use of sexualized language or imagery, and sexual attention or
-  advances of any kind
-* Trolling, insulting or derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or email
-  address, without their explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
-  professional setting
+-   The use of sexualized language or imagery, and sexual attention or
+    advances of any kind
+-   Trolling, insulting or derogatory comments, and personal or political attacks
+-   Public or private harassment
+-   Publishing others' private information, such as a physical or email
+    address, without their explicit permission
+-   Other conduct which could reasonably be considered inappropriate in a
+    professional setting
 
 ## Enforcement Responsibilities
 
@@ -107,7 +106,7 @@ Violating these terms may lead to a permanent ban.
 ### 4. Permanent Ban
 
 **Community Impact**: Demonstrating a pattern of violation of community
-standards, including sustained inappropriate behavior,  harassment of an
+standards, including sustained inappropriate behavior, harassment of an
 individual, or aggression toward or disparagement of classes of individuals.
 
 **Consequence**: A permanent ban from any sort of public interaction within
@@ -120,14 +119,14 @@ version 2.1, available at
 [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
 
 Community Impact Guidelines were inspired by
-[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
+[Mozilla's code of conduct enforcement ladder][mozilla coc].
 
 For answers to common questions about this code of conduct, see the FAQ at
-[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
+[https://www.contributor-covenant.org/faq][faq]. Translations are available
 at [https://www.contributor-covenant.org/translations][translations].
 
 [homepage]: https://www.contributor-covenant.org
 [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
-[Mozilla CoC]: https://github.com/mozilla/diversity
-[FAQ]: https://www.contributor-covenant.org/faq
+[mozilla coc]: https://github.com/mozilla/diversity
+[faq]: https://www.contributor-covenant.org/faq
 [translations]: https://www.contributor-covenant.org/translations

+ 75 - 67
CONTRIBUTING.md

@@ -6,32 +6,33 @@ The following is a set of guidelines for contributing to LinuxGSM, which are hos
 
 ## Table of Contents
 
- [Contributing to LinuxGSM](#contributing-to-linuxgsm)
-  * [Table of Contents](#table-of-contents)
-  * [Code of Conduct](#code-of-conduct)
-  * [🎉 Bug/Enhancement Contributions 🐛](#bug-enhancement-contributions)
-    + [🐛Reporting Bugs](#reporting-bugs)
-      - [Before Submitting A Bug Report](#before-submitting-a-bug-report)
-      - [How Do I Submit A (Good) Bug Report?](#how-do-i-submit-a--good--bug-report-)
-    + [🎉Suggesting Features](#suggesting-features)
-      - [Before Submitting An Feature Suggestion](#before-submitting-an-feature-suggestion)
-      - [How Do I Submit A (Good) Feature Suggestion?](#how-do-i-submit-a--good--feature-suggestion-)
-    + [🎮 Game Server Requests](#game-server-requests)
-      - [Before Submitting a Game Server Request](#before-submitting-a-game-server-request)
-      - [How Do I Submit A (Good) Game Server Request?](#how-do-i-submit-a--good--game-server-request-)
-    + [🎮 Game Server Specific Issues](#game-server-specific-issues)
-  * [💻 Code Contributions](#code-contributions)
-    + [Pull Requests](#pull-requests)
-      - [Pull Request naming convention](#pull-request-naming-convention)
-    + [Testing](#testing)
-      - [Pull Request Status Checks](#pull-request-status-checks)
-      - [Test Environment](#test-environment)
-    + [:wine_glass: Styleguides](#-wine-glass--styleguides)
-      - [Git Commit Messages](#git-commit-messages)
-      - [BASH Styleguide](#bash-styleguide)
-  * [:blue_book: Document Contributions](#-blue-book--document-contributions)
-    + [Documentation Styleguide](#documentation-styleguide)
-  * [Issue and Pull Request Labels](#issue-and-pull-request-labels)
+[Contributing to LinuxGSM](#contributing-to-linuxgsm)
+
+-   [Table of Contents](#table-of-contents)
+-   [Code of Conduct](#code-of-conduct)
+-   [🎉 Bug/Enhancement Contributions 🐛](#bug-enhancement-contributions)
+    -   [🐛Reporting Bugs](#reporting-bugs)
+        -   [Before Submitting A Bug Report](#before-submitting-a-bug-report)
+        -   [How Do I Submit A (Good) Bug Report?](#how-do-i-submit-a--good--bug-report-)
+    -   [🎉Suggesting Features](#suggesting-features)
+        -   [Before Submitting An Feature Suggestion](#before-submitting-an-feature-suggestion)
+        -   [How Do I Submit A (Good) Feature Suggestion?](#how-do-i-submit-a--good--feature-suggestion-)
+    -   [🎮 Game Server Requests](#game-server-requests)
+        -   [Before Submitting a Game Server Request](#before-submitting-a-game-server-request)
+        -   [How Do I Submit A (Good) Game Server Request?](#how-do-i-submit-a--good--game-server-request-)
+    -   [🎮 Game Server Specific Issues](#game-server-specific-issues)
+-   [💻 Code Contributions](#code-contributions)
+    -   [Pull Requests](#pull-requests)
+        -   [Pull Request naming convention](#pull-request-naming-convention)
+    -   [Testing](#testing)
+        -   [Pull Request Status Checks](#pull-request-status-checks)
+        -   [Test Environment](#test-environment)
+    -   [:wine_glass: Styleguides](#-wine-glass--styleguides)
+        -   [Git Commit Messages](#git-commit-messages)
+        -   [BASH Styleguide](#bash-styleguide)
+-   [:blue_book: Document Contributions](#-blue-book--document-contributions)
+    -   [Documentation Styleguide](#documentation-styleguide)
+-   [Issue and Pull Request Labels](#issue-and-pull-request-labels)
 
 ## Code of Conduct
 
@@ -43,24 +44,24 @@ This project and everyone participating in it is governed by the [LinuxGSM Code
 
 This section guides you through submitting a bug report for LinuxGSM. Following these guidelines help maintainers and the community understand your report 📝, reproduce the behaviour💻, and find any related reports 🔎.
 
-Before creating bug reports, please check [this list](https://github.com/GameServerManagers/linuxgsm/blob/master/CONTRIBUTING.md#before-submitting-a-bug-report) as you might find out that you don’t need to create one. When you are creating a bug report, please [include as many details as possible](https://github.com/GameServerManagers/linuxgsm/blob/master/CONTRIBUTING.md#how-do-i-submit-a-good-bug-report). Fill out [the required template]([https://github.com/GameServerManagers/LinuxGSM/issues/new/choose](https://github.com/GameServerManagers/LinuxGSM/issues/new/choose)), the information it asks for helps us resolve issues faster.
+Before creating bug reports, please check [this list](https://github.com/GameServerManagers/linuxgsm/blob/master/CONTRIBUTING.md#before-submitting-a-bug-report) as you might find out that you don’t need to create one. When you are creating a bug report, please [include as many details as possible](https://github.com/GameServerManagers/linuxgsm/blob/master/CONTRIBUTING.md#how-do-i-submit-a-good-bug-report). Fill out [the required template](<[https://github.com/GameServerManagers/LinuxGSM/issues/new/choose](https://github.com/GameServerManagers/LinuxGSM/issues/new/choose)>), the information it asks for helps us resolve issues faster.
 
 #### Before Submitting A Bug Report
 
-* **Check the [documentation](https://docs.linuxgsm.com).** You might be able to find the cause of the problem and fix things yourself.
-* **Check the** [**support page**](https://linuxgsm.com/support) for links to other support options.
-* **Perform a** [**cursory search**](https://github.com/search?q=org:GameServerManagers%20type:issues&type=Issues) to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue and give it a thumbs up instead of opening a new one.
+-   **Check the [documentation](https://docs.linuxgsm.com).** You might be able to find the cause of the problem and fix things yourself.
+-   **Check the** [**support page**](https://linuxgsm.com/support) for links to other support options.
+-   **Perform a** [**cursory search**](https://github.com/search?q=org:GameServerManagers%20type:issues&type=Issues) to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue and give it a thumbs up instead of opening a new one.
 
 #### How Do I Submit A (Good) Bug Report?
 
 Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). Create an issue and provide the following information by filling in [the issues form](https://github.com/GameServerManagers/LinuxGSM/issues/new/choose).
 
-* **Use a clear and descriptive title** for the issue to identify the problem.
-* **Complete the user story** to give a summary of the issue.
-* **Provide basic info** to help us understand the context of the issue.
-* **Provide further info** to give specifics and more detail.
-* **Give steps to reproduce** the issue, allowing developers to follow steps that lead to the issue.
-* **Explain what you expect** to happen, so we know what you think should occur.
+-   **Use a clear and descriptive title** for the issue to identify the problem.
+-   **Complete the user story** to give a summary of the issue.
+-   **Provide basic info** to help us understand the context of the issue.
+-   **Provide further info** to give specifics and more detail.
+-   **Give steps to reproduce** the issue, allowing developers to follow steps that lead to the issue.
+-   **Explain what you expect** to happen, so we know what you think should occur.
 
 ### 🎉Suggesting Features
 
@@ -68,31 +69,34 @@ This section guides you through submitting a feature suggestion for LinuxGSM, in
 
 #### Before Submitting An Feature Suggestion
 
-* **Check the** [**documentation**](https://docs.linuxgsm.com/%5D(https://docs.linuxgsm.com/)) to confirm that the enhancement doesn’t already exist.
-* **Check your** [**LinuxGSM version**](https://docs.linuxgsm.com/commands/update-lgsm)**.** A newer version of LinuxGSM may already have your enhancement.
-* **Perform a** [**cursory search**](https://github.com/search?q=org:GameServerManagers%20type:issues&type=Issues) to see if the enhancement has already been suggested. If it has **and the enhancement is still open**, add a comment to the existing issue and give it a thumbs up instead of opening a new one.
+-   **Check the** [**documentation**](<https://docs.linuxgsm.com/%5D(https://docs.linuxgsm.com/)>) to confirm that the enhancement doesn’t already exist.
+-   **Check your** [**LinuxGSM version**](https://docs.linuxgsm.com/commands/update-lgsm)**.** A newer version of LinuxGSM may already have your enhancement.
+-   **Perform a** [**cursory search**](https://github.com/search?q=org:GameServerManagers%20type:issues&type=Issues) to see if the enhancement has already been suggested. If it has **and the enhancement is still open**, add a comment to the existing issue and give it a thumbs up instead of opening a new one.
 
 #### How Do I Submit A (Good) Feature Suggestion?
 
 Features are tracked as [GitHub issues](https://guides.github.com/features/issues/). Create an issue and provide the following information by filling in [the issues form](https://github.com/GameServerManagers/LinuxGSM/issues/new/choose).
 
-* **Use a clear and descriptive title** for the issue to identify the problem.
-* **Complete the user story** to give a summary of the issue.
-* **Provide basic info** to help us understand the context of the enhancement.
-* **Provide further info** to give specifics and more detail.
-* **Provide any further reading** materials that might assist in developing the enhancement.
+-   **Use a clear and descriptive title** for the issue to identify the problem.
+-   **Complete the user story** to give a summary of the issue.
+-   **Provide basic info** to help us understand the context of the enhancement.
+-   **Provide further info** to give specifics and more detail.
+-   **Provide any further reading** materials that might assist in developing the enhancement.
 
 ### 🎮 Game Server Requests
 
 This section guides you through submitting a game server request for LinuxGSM, Following these guidelines help maintainers and the community understand your game server request 📝.
+
 #### Before Submitting a Game Server Request
 
-* **Check for existing** [**game server requests**](https://github.com/GameServerManagers/LinuxGSM/labels/type%3A%20game%20server%20request) to see if the new game server has already been suggested. If it has **and if the new game server is still open**, give it a thumbs up.
-* **Check the game server is supported on Linux**, this does not include Wine servers which we do not support.
+-   **Check for existing** [**game server requests**](https://github.com/GameServerManagers/LinuxGSM/labels/type%3A%20game%20server%20request) to see if the new game server has already been suggested. If it has **and if the new game server is still open**, give it a thumbs up.
+-   **Check the game server is supported on Linux**, this does not include Wine servers which we do not support.
+
 #### How Do I Submit A (Good) Game Server Request?
-* The title should be as follows: **[Server Request] Game Name**
-*  **Provide Steam App ID** if applicable
-* **Supply any documentation/how-to guides** for the game server.
+
+-   The title should be as follows: **[Server Request] Game Name**
+-   **Provide Steam App ID** if applicable
+-   **Supply any documentation/how-to guides** for the game server.
 
 ### 🎮 Game Server Specific Issues
 
@@ -110,10 +114,10 @@ A [list](https://docs.linuxgsm.com/support/game-server) of known game developer
 
 The process described here has several goals:
 
-* Maintain LinuxGSM quality.
-* Fix problems that are important to users.
-* Engage the community in working toward the best possible LinuxGSM.
-* Enable a sustainable system for LinuxGSM maintainers to review contributions.
+-   Maintain LinuxGSM quality.
+-   Fix problems that are important to users.
+-   Engage the community in working toward the best possible LinuxGSM.
+-   Enable a sustainable system for LinuxGSM maintainers to review contributions.
 
 Please follow these steps to have your contribution considered by the maintainers:
 
@@ -135,18 +139,18 @@ If applied, this commit will _your subject line here_
 
 For example:
 
-* If applied, this commit will **refactor subsystem X for readability**
-* If applied, this commit will **update getting started documentation**
-* If applied, this commit will **remove deprecated methods**
-* If applied, this commit will **release version 1.0.0**
-* If applied, this commit will **merge pull request #123 from user/branch**
+-   If applied, this commit will **refactor subsystem X for readability**
+-   If applied, this commit will **update getting started documentation**
+-   If applied, this commit will **remove deprecated methods**
+-   If applied, this commit will **release version 1.0.0**
+-   If applied, this commit will **merge pull request #123 from user/branch**
 
 Notice how this doesn’t work for the other non-imperative forms:
 
-* If applied, this commit will **fixed bug with Y**
-* If applied, this commit will **change the behaviour of X**
-* If applied, this commit will **more fixes for broken stuff**
-* If applied, this commit will **sweet new API methods**
+-   If applied, this commit will **fixed bug with Y**
+-   If applied, this commit will **change the behaviour of X**
+-   If applied, this commit will **more fixes for broken stuff**
+-   If applied, this commit will **sweet new API methods**
 
 Below is an example of the subject line for a pull request:
 
@@ -157,10 +161,13 @@ Below is an example of the subject line for a pull request:
 ### Testing
 
 #### Pull Request Status Checks
-When a Pull Request is submitted, a series of status check tests are conducted.  These tests will assess the code quality, complete CI tests etc. To get your PR merged these status checks must pass.
+
+When a Pull Request is submitted, a series of status check tests are conducted. These tests will assess the code quality, complete CI tests etc. To get your PR merged these status checks must pass.
 
 #### Test Environment
+
 It is recommended that you have a testing environment available to test your code during development. To test your own code you must change some variables within the `linuxgsm.sh` file. This will force the use of your own code branch.
+
 ```bash
 ## GitHub Branch Select
 # Allows for the use of different function files
@@ -203,10 +210,11 @@ Highlights the LinuxGSM command the Issue/PR relates to.
 Labels to help pinpoint what the issue or PR relates to.
 
 variants:
-* _distro_
-* _engine_
-* _game_
-* _info_
+
+-   _distro_
+-   _engine_
+-   _game_
+-   _info_
 
 **outcome** Labels
 Labels that identify why an issue was closed.

+ 2 - 2
LICENSE

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

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
README.md


+ 1 - 1
lgsm/config-default/config-lgsm/emserver/_default.cfg

@@ -13,7 +13,7 @@ ip="0.0.0.0"
 port="27015"
 clientport="27005"
 sourcetvport="27020"
-defaultmap="emp_district"
+defaultmap="con_district402"
 maxplayers="62"
 
 ## Game Server Login Token (GSLT): Optional

+ 1 - 1
lgsm/config-default/config-lgsm/squadserver/_default.cfg

@@ -163,7 +163,7 @@ systemdir="${serverfiles}/SquadGame"
 executabledir="${serverfiles}"
 executable="./SquadGameServer.sh"
 servercfgdir="${systemdir}/ServerConfig"
-servercfg="${selfname}.cfg"
+servercfg="Server.cfg"
 servercfgdefault="Server.cfg"
 servercfgfullpath="${servercfgdir}/${servercfg}"
 

+ 6 - 5
lgsm/config-default/config-lgsm/stserver/_default.cfg

@@ -10,16 +10,17 @@
 
 ## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
 ip="0.0.0.0"
+servername="LinuxGSM"
 port="27500"
 queryport="27015"
 worldtype="Moon"
+maxplayers="10"
 autosaveinterval=300
-clearinterval=60
 worldname="moon_save"
 
 ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
 # Edit with care
-startparameters="-batchmode -nographics -autostart -gameport=${port} -updateport=${queryport} -worldtype=${worldtype} -loadworld=${worldname} -worldname=${worldname} -autosaveinterval=${autosaveinterval} -clearallinterval=${clearinterval}"
+startparameters="-LOADLATEST ${worldname} ${worldtype} -settings ServerName ${servername} StartLocalHost true ServerVisible true ServerMaxPlayers ${maxplayers} GamePort ${port} UpdatePort ${queryport} UPNPEnabled true AutoSave true SaveInterval ${autosaveinterval}"
 
 #### LinuxGSM Settings ####
 
@@ -139,7 +140,7 @@ steammaster="false"
 # 9: GoldSrc
 # 10: Avorion
 # 11: end
-stopmode="2"
+stopmode="3"
 
 ## Query mode
 # 1: session only
@@ -168,8 +169,8 @@ systemdir="${serverfiles}"
 executabledir="${serverfiles}"
 executable="./rocketstation_DedicatedServer.x86_64"
 servercfgdir="${systemdir}"
-servercfg="default.ini"
-servercfgdefault="default.ini"
+servercfg="setting.xml"
+servercfgdefault="setting.xml"
 servercfgfullpath="${servercfgdir}/${servercfg}"
 
 ## Backup Directory

+ 179 - 0
lgsm/config-default/config-lgsm/vpmcserver/_default.cfg

@@ -0,0 +1,179 @@
+##################################
+######## 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 ####
+
+## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
+javaram="1024" # -Xmx$1024M
+
+## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+startparameters=""
+
+## Release Settings | https://docs.linuxgsm.com/game-servers/minecraft#release-settings
+# Version (latest|3.1.1)
+mcversion="latest"
+
+#### 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"
+
+# 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=""
+
+# Gotify Alerts | https://docs.linuxgsm.com/alerts/gotify
+gotifyalert="off"
+gotifytoken="token"
+gotifywebhook="webhook"
+
+# 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"
+mailgunapiregion="us"
+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"
+pushoveruserkey="userkey"
+
+# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat
+rocketchatalert="off"
+rocketchatwebhook="webhook"
+rocketchattoken=""
+
+# 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) in "curlcustomstring".
+# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help".
+telegramapi="api.telegram.org"
+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"
+
+## 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
+# 11: end
+# 12: shutdown
+stopmode="12"
+
+## Query mode
+# 1: session only
+# 2: gamedig (gsquery fallback)
+# 3: gamedig
+# 4: gsquery
+# 5: tcp
+querymode="2"
+querytype="minecraft"
+
+## Console type
+consoleverbose="yes"
+consoleinteract="yes"
+
+## Game Server Details
+# Do not edit
+gamename="Velocity Proxy"
+engine="lwjgl2"
+glibc="null"
+
+#### Directories ####
+# Edit with care
+
+## Game Server Directories
+systemdir="${serverfiles}"
+executabledir="${serverfiles}"
+preexecutable="java -Xmx${javaram}M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -jar"
+executable="./velocity.jar"
+servercfgdir="${systemdir}"
+servercfg="velocity.toml"
+servercfgdefault="velocity.toml"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${lgsmdir}/backup"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${systemdir}/logs"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+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"

+ 2 - 1
lgsm/data/almalinux-8.csv

@@ -1,4 +1,4 @@
-all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
+all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
 steamcmd,glibc.i686,libstdc++.i686
 ac
 ahl
@@ -119,6 +119,7 @@ ut99
 vh,glibc-devel
 vs
 vints,mono-complete
+vpmc,java-11-openjdk
 wet
 wf
 wmc,java-11-openjdk

+ 1 - 1
lgsm/data/centos-7.csv

@@ -1,4 +1,4 @@
-all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python3,tar,tmux,unzip,util-linux,wget,xz
+all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python3,tar,tmux,unzip,util-linux,wget,xz
 steamcmd,glibc.i686,libstdc++.i686
 ac
 ahl

+ 2 - 1
lgsm/data/centos-8.csv

@@ -1,4 +1,4 @@
-all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
+all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
 steamcmd,glibc.i686,libstdc++.i686
 ac
 ahl
@@ -118,6 +118,7 @@ ut99
 vh,glibc-devel
 vs
 vints,mono-complete
+vpmc,java-11-openjdk
 wet
 wf
 wmc,java-11-openjdk

+ 1 - 0
lgsm/data/debian-10.csv

@@ -119,6 +119,7 @@ ut99
 vh,libc6-dev
 vs
 vints,mono-complete
+vpmc,openjdk-11-jre
 wet
 wf
 wmc,openjdk-11-jre

+ 1 - 0
lgsm/data/debian-11.csv

@@ -119,6 +119,7 @@ ut99
 vh,libc6-dev
 vs
 vints,mono-complete
+vpmc,openjdk-11-jre
 wet
 wf
 wmc,openjdk-17-jre

+ 2 - 1
lgsm/data/rhel-7.csv

@@ -1,4 +1,4 @@
-all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
+all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
 steamcmd,glibc.i686,libstdc++.i686
 ac
 ahl
@@ -119,6 +119,7 @@ ut99
 vh,glibc-devel
 vs
 vints,mono-complete
+vpmc,java-11-openjdk
 wet
 wf
 wmc,java-11-openjdk

+ 2 - 1
lgsm/data/rhel-8.csv

@@ -1,4 +1,4 @@
-all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
+all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
 steamcmd,glibc.i686,libstdc++.i686
 ac
 ahl
@@ -119,6 +119,7 @@ ut99
 vh,glibc-devel
 vs
 vints,mono-complete
+vpmc,java-11-openjdk
 wet
 wf
 wmc,java-11-openjdk

+ 2 - 1
lgsm/data/rocky-8.csv

@@ -1,4 +1,4 @@
-all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
+all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz
 steamcmd,glibc.i686,libstdc++.i686
 ac
 ahl
@@ -119,6 +119,7 @@ ut99
 vh,glibc-devel
 vs
 vints,mono-complete
+vpmc,java-11-openjdk
 wet
 wf
 wmc,java-11-openjdk

+ 1 - 0
lgsm/data/serverlist.csv

@@ -117,6 +117,7 @@ ut3,ut3server,Unreal Tournament 3
 ut99,ut99server,Unreal Tournament 99
 vh,vhserver,Valheim
 vints,vintsserver,Vintage Story
+vpmc,vpmcserver,Velocity Proxy MC
 vs,vsserver,Vampire Slayer
 wet,wetserver,Wolfenstein: Enemy Territory
 wf,wfserver,Warfork

+ 1 - 0
lgsm/data/ubuntu-18.04.csv

@@ -119,6 +119,7 @@ ut99
 vh,libc6-dev
 vs
 vints,mono-complete
+vpmc,openjdk-11-jre
 wet
 wf
 wmc,openjdk-11-jre

+ 3 - 2
lgsm/data/ubuntu-20.04.csv

@@ -79,7 +79,7 @@ pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii
 pvr,libc++1
-pz,openjdk-16-jre,rng-tools
+pz,openjdk-17-jre,rng-tools
 q2
 q3
 ql
@@ -88,7 +88,7 @@ ricochet
 ro
 rtcw
 rust,lib32z1
-rw,openjdk-16-jre
+rw,openjdk-17-jre
 samp
 sb
 sbots
@@ -119,6 +119,7 @@ ut99
 vh,libc6-dev
 vs
 vints,mono-complete
+vpmc,openjdk-11-jre
 wet
 wf
 wmc,openjdk-17-jre

+ 3 - 2
lgsm/data/ubuntu-21.04.csv

@@ -79,7 +79,7 @@ pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii
 pvr,libc++1
-pz,openjdk-16-jre,rng-tools
+pz,openjdk-17-jre,rng-tools
 q2
 q3
 ql
@@ -88,7 +88,7 @@ ricochet
 ro
 rtcw
 rust,lib32z1
-rw,openjdk-16-jre
+rw,openjdk-17-jre
 samp
 sb
 sbots
@@ -119,6 +119,7 @@ ut99
 vh,libc6-dev
 vs
 vints,mono-complete
+vpmc,openjdk-11-jre
 wet
 wf
 wmc,openjdk-17-jre

+ 3 - 2
lgsm/data/ubuntu-21.10.csv

@@ -77,7 +77,7 @@ pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii
 pvr,libc++1
-pz,openjdk-16-jre,rng-tools
+pz,openjdk-17-jre,rng-tools
 q2
 q3
 ql
@@ -86,7 +86,7 @@ ricochet
 ro
 rtcw
 rust,lib32z1
-rw,openjdk-16-jre
+rw,openjdk-17-jre
 samp
 sb
 sbots
@@ -117,6 +117,7 @@ ut99
 vh,libc6-dev
 vs
 vints,mono-complete
+vpmc,openjdk-11-jre
 wet
 wf
 wmc,openjdk-17-jre

+ 3 - 2
lgsm/data/ubuntu-22.04.csv

@@ -77,7 +77,7 @@ pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii
 pvr,libc++1
-pz,openjdk-16-jre,rng-tools
+pz,openjdk-17-jre,rng-tools5
 q2
 q3
 ql
@@ -86,7 +86,7 @@ ricochet
 ro
 rtcw
 rust,lib32z1
-rw,openjdk-16-jre
+rw,openjdk-17-jre
 samp
 sb
 sbots
@@ -117,6 +117,7 @@ ut99
 vh,libc6-dev
 vs
 vints,mono-complete
+vpmc,openjdk-11-jre
 wet
 wf
 wmc,openjdk-17-jre

+ 10 - 9
lgsm/functions/README.md

@@ -3,14 +3,15 @@
 These modules are scripts that are called upon by the primary script linuxgsm.sh
 
 ## Module Names
+
 Modules have been named to give an idea of what the function does.
 
-* core: Essential modules that will always run first.
-* command: Primary command function.
-* check: Runs checks that will either halt on or fix an issue.
-* dev: development modules.
-* fix: Applies a game server specific fix.
-* info: retrieves information from a source such as config file or the OS.
-* install: modules related to the installer.
-* monitor: modules related to monitor.
-* update: modules that update the game server.
+-   core: Essential modules that will always run first.
+-   command: Primary command function.
+-   check: Runs checks that will either halt on or fix an issue.
+-   dev: development modules.
+-   fix: Applies a game server specific fix.
+-   info: retrieves information from a source such as config file or the OS.
+-   install: modules related to the installer.
+-   monitor: modules related to monitor.
+-   update: modules that update the game server.

+ 43 - 43
lgsm/functions/alert.sh

@@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Generates alert log of the details at the time of the alert.
 # Used with email alerts.
-fn_alert_log(){
+fn_alert_log() {
 	info_distro.sh
 	info_game.sh
 	info_messages.sh
@@ -24,10 +24,10 @@ fn_alert_log(){
 		fn_info_message_gameserver_resource
 		fn_info_message_gameserver
 		fn_info_logs
-	} | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${alertlog}" > /dev/null 2>&1
+	} | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a "${alertlog}" > /dev/null 2>&1
 }
 
-fn_alert_test(){
+fn_alert_test() {
 	fn_script_log_info "Sending test alert"
 	alertsubject="Alert - ${selfname} - Test"
 	alertemoji="🚧"
@@ -36,7 +36,7 @@ fn_alert_test(){
 	alertbody="Testing LinuxGSM Alert. No action to be taken."
 }
 
-fn_alert_restart(){
+fn_alert_restart() {
 	fn_script_log_info "Sending alert: Restarted: ${executable} not running"
 	alertsubject="Alert - ${selfname} - Restarted"
 	alertemoji="🚨"
@@ -45,7 +45,7 @@ fn_alert_restart(){
 	alertbody="${selfname} ${executable} not running"
 }
 
-fn_alert_restart_query(){
+fn_alert_restart_query() {
 	fn_script_log_info "Sending alert: Restarted: ${selfname}"
 	alertsubject="Alert - ${selfname} - Restarted"
 	alertemoji="🚨"
@@ -54,7 +54,7 @@ fn_alert_restart_query(){
 	alertbody="Unable to query: ${selfname}"
 }
 
-fn_alert_update(){
+fn_alert_update() {
 	fn_script_log_info "Sending alert: Updated"
 	alertsubject="Alert - ${selfname} - Updated"
 	alertemoji="🎮"
@@ -63,7 +63,7 @@ fn_alert_update(){
 	alertbody="${gamename} received update"
 }
 
-fn_alert_check_update(){
+fn_alert_check_update() {
 	fn_script_log_info "Sending alert: Update available"
 	alertsubject="Alert - ${selfname} - Update available"
 	alertemoji="🎮"
@@ -72,7 +72,7 @@ fn_alert_check_update(){
 	alertbody="${gamename} update available"
 }
 
-fn_alert_permissions(){
+fn_alert_permissions() {
 	fn_script_log_info "Sending alert: Permissions error"
 	alertsubject="Alert - ${selfname}: Permissions error"
 	alertemoji="❗"
@@ -81,7 +81,7 @@ fn_alert_permissions(){
 	alertbody="${selfname} has permissions issues"
 }
 
-fn_alert_config(){
+fn_alert_config() {
 	fn_script_log_info "Sending alert: New _default.cfg"
 	alertsubject="Alert - ${selfname} - New _default.cfg"
 	alertemoji="🎮"
@@ -110,128 +110,128 @@ fi
 fn_alert_log
 
 # Generates the more info link.
-if [ "${postalert}" == "on" ]&&[ -n "${postalert}" ]; then
+if [ "${postalert}" == "on" ] && [ -n "${postalert}" ]; then
 	exitbypass=1
 	command_postdetails.sh
 	fn_firstcommand_reset
 	unset exitbypass
-elif [ "${postalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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"
 fi
 
-if [ "${discordalert}" == "on" ]&&[ -n "${discordalert}" ]; then
+if [ "${discordalert}" == "on" ] && [ -n "${discordalert}" ]; then
 	alert_discord.sh
-elif [ "${discordalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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}" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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"
 fi
 
-if [ "${emailalert}" == "on" ]&&[ -n "${email}" ]; then
+if [ "${emailalert}" == "on" ] && [ -n "${email}" ]; then
 	alert_email.sh
-elif [ "${emailalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
+elif [ -z "${email}" ] && [ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Email not set"
 	fn_script_log_error "Email not set"
 fi
 
-if [ "${gotifyalert}" == "on" ]&&[ -n "${gotifyalert}" ]; then
+if [ "${gotifyalert}" == "on" ] && [ -n "${gotifyalert}" ]; then
 	alert_gotify.sh
-elif [ "${gotifyalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
+elif [ "${gotifyalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "Gotify alerts not enabled"
 	fn_script_log_warn "Gotify alerts not enabled"
-elif [ -z "${gotifytoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
+elif [ -z "${gotifytoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Gotify token not set"
 	echo -e "* https://docs.linuxgsm.com/alerts/gotify"
 	fn_script_error "Gotify token not set"
-elif [ -z "${gotifywebhook}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
+elif [ -z "${gotifywebhook}" ] && [ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Gotify webhook not set"
 	echo -e "* https://docs.linuxgsm.com/alerts/gotify"
 	fn_script_error "Gotify webhook not set"
 fi
 
-if [ "${iftttalert}" == "on" ]&&[ -n "${iftttalert}" ]; then
+if [ "${iftttalert}" == "on" ] && [ -n "${iftttalert}" ]; then
 	alert_ifttt.sh
-elif [ "${iftttalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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}" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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"
 fi
 
-if [ "${mailgunalert}" == "on" ]&&[ -n "${mailgunalert}" ]; then
+if [ "${mailgunalert}" == "on" ] && [ -n "${mailgunalert}" ]; then
 	alert_mailgun.sh
-elif [ "${mailgunalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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}" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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"
 fi
 
-if [ "${pushbulletalert}" == "on" ]&&[ -n "${pushbullettoken}" ]; then
+if [ "${pushbulletalert}" == "on" ] && [ -n "${pushbullettoken}" ]; then
 	alert_pushbullet.sh
-elif [ "${pushbulletalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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}" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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"
 fi
 
-if [ "${pushoveralert}" == "on" ]&&[ -n "${pushoveralert}" ]; then
+if [ "${pushoveralert}" == "on" ] && [ -n "${pushoveralert}" ]; then
 	alert_pushover.sh
-elif [ "${pushoveralert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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}" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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"
 fi
 
-if [ "${telegramalert}" == "on" ]&&[ -n "${telegramtoken}" ]; then
+if [ "${telegramalert}" == "on" ] && [ -n "${telegramtoken}" ]; then
 	alert_telegram.sh
-elif [ "${telegramalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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}" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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}" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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."
 fi
 
-if [ "${rocketchatalert}" == "on" ]&&[ -n "${rocketchatalert}" ]; then
+if [ "${rocketchatalert}" == "on" ] && [ -n "${rocketchatalert}" ]; then
 	alert_rocketchat.sh
-elif [ "${rocketchatalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
+elif [ "${rocketchatalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "Rocketchat alerts not enabled"
 	fn_script_log_warn "Rocketchat alerts not enabled"
-elif [ -z "${rocketchattoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
+elif [ -z "${rocketchattoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_error_nl "Rocketchat token not set"
 	#echo -e "* https://docs.linuxgsm.com/alerts/slack"
 	fn_script_error "Rocketchat token not set"
 fi
 
-if [ "${slackalert}" == "on" ]&&[ -n "${slackalert}" ]; then
+if [ "${slackalert}" == "on" ] && [ -n "${slackalert}" ]; then
 	alert_slack.sh
-elif [ "${slackalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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}" ]&&[ "${commandname}" == "TEST-ALERT" ]; 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"

+ 2 - 1
lgsm/functions/alert_discord.sh

@@ -7,7 +7,8 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-json=$(cat <<EOF
+json=$(
+	cat << EOF
 {
 	"username":"LinuxGSM",
 	"avatar_url":"https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",

+ 2 - 1
lgsm/functions/alert_gotify.sh

@@ -7,7 +7,8 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-json=$(cat <<EOF
+json=$(
+	cat << EOF
 {
 	"title": "${alertemoji} ${alertsubject} ${alertemoji}",
 	"message": "Server name\n${servername}\n\nMessage\n${alertbody}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}",

+ 2 - 1
lgsm/functions/alert_ifttt.sh

@@ -7,7 +7,8 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-json=$(cat <<EOF
+json=$(
+	cat << EOF
 {
 	"value1": "${selfname}",
 	"value2": "${alertemoji} ${alertsubject} ${alertemoji}",

+ 6 - 6
lgsm/functions/alert_mailgun.sh

@@ -16,12 +16,12 @@ fi
 fn_print_dots "Sending Email alert: Mailgun: ${mailgunemail}"
 
 mailgunsend=$(curl --connect-timeout 10 -s --user "api:${mailguntoken}" \
--F from="LinuxGSM <${mailgunemailfrom}>" \
--F to="LinuxGSM Admin <${mailgunemail}>" \
--F subject="${alertemoji} ${alertsubject} ${alertemoji}" \
--F o:tag='alert' \
--F o:tag='LinuxGSM' \
--F text="$(cat "${alertlog}")" "${mailgunapiurl}/v3/${mailgundomain}/messages")
+	-F from="LinuxGSM <${mailgunemailfrom}>" \
+	-F to="LinuxGSM Admin <${mailgunemail}>" \
+	-F subject="${alertemoji} ${alertsubject} ${alertemoji}" \
+	-F o:tag='alert' \
+	-F o:tag='LinuxGSM' \
+	-F text="$(cat "${alertlog}")" "${mailgunapiurl}/v3/${mailgundomain}/messages")
 
 if [ -z "${mailgunsend}" ]; then
 	fn_print_fail_nl "Sending Email alert: Mailgun: ${mailgunemail}"

+ 2 - 1
lgsm/functions/alert_pushbullet.sh

@@ -7,7 +7,8 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-json=$(cat <<EOF
+json=$(
+	cat << EOF
 {
 	"channel_tag": "${channeltag}",
 	"type": "note",

+ 1 - 1
lgsm/functions/alert_pushover.sh

@@ -22,7 +22,7 @@ else
 	alertpriority="0"
 fi
 
-pushoversend=$(curl --connect-timeout 10 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}"  -F priority="${alertpriority}" -F title="${alertemoji} ${alertsubject} ${alertemoji}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Message</b><br>${alertbody}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
+pushoversend=$(curl --connect-timeout 10 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alertemoji} ${alertsubject} ${alertemoji}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Message</b><br>${alertbody}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
 
 if [ -n "${pushoversend}" ]; then
 	fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"

+ 2 - 1
lgsm/functions/alert_rocketchat.sh

@@ -7,7 +7,8 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-json=$(cat <<EOF
+json=$(
+	cat << EOF
 {
 	"alias": "LinuxGSM",
 	"text": "*${alertemoji} ${alertsubject} ${alertemoji}* \n *${servername}* \n ${alertbody} \n More info: ${alerturl}",

+ 2 - 1
lgsm/functions/alert_slack.sh

@@ -7,7 +7,8 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-json=$(cat <<EOF
+json=$(
+	cat << EOF
 {
 		"attachments": [
 			{

+ 2 - 1
lgsm/functions/alert_telegram.sh

@@ -7,7 +7,8 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-json=$(cat <<EOF
+json=$(
+	cat << EOF
 {
 	"chat_id": "${telegramchatid}",
 	"parse_mode": "HTML",

+ 10 - 10
lgsm/functions/check.sh

@@ -27,11 +27,11 @@ if [ "$(whoami)" != "root" ]; then
 	fi
 fi
 
-if [ "${commandname}" != "INSTALL" ]&&[ "${commandname}" != "UPDATE-LGSM" ]&&[ "${commandname}" != "DETAILS" ]&&[ "${commandname}" != "POST-DETAILS" ]; then
+if [ "${commandname}" != "INSTALL" ] && [ "${commandname}" != "UPDATE-LGSM" ] && [ "${commandname}" != "DETAILS" ] && [ "${commandname}" != "POST-DETAILS" ]; then
 	check_system_dir.sh
 fi
 
-allowed_commands_array=( START DEBUG )
+allowed_commands_array=(START DEBUG)
 for allowed_command in "${allowed_commands_array[@]}"; do
 	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_executable.sh
@@ -39,7 +39,7 @@ for allowed_command in "${allowed_commands_array[@]}"; do
 done
 
 if [ "$(whoami)" != "root" ]; then
-	allowed_commands_array=( DEBUG START INSTALL )
+	allowed_commands_array=(DEBUG START INSTALL)
 	for allowed_command in "${allowed_commands_array[@]}"; do
 		if [ "${allowed_command}" == "${commandname}" ]; then
 			check_glibc.sh
@@ -47,28 +47,28 @@ if [ "$(whoami)" != "root" ]; then
 	done
 fi
 
-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 WIPE )
+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 WIPE)
 for allowed_command in "${allowed_commands_array[@]}"; do
 	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_logs.sh
 	fi
 done
 
-allowed_commands_array=( DEBUG START )
+allowed_commands_array=(DEBUG START)
 for allowed_command in "${allowed_commands_array[@]}"; do
 	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_deps.sh
 	fi
 done
 
-allowed_commands_array=( CONSOLE DEBUG MONITOR START STOP )
+allowed_commands_array=(CONSOLE DEBUG MONITOR START STOP)
 for allowed_command in "${allowed_commands_array[@]}"; do
 	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_config.sh
 	fi
 done
 
-allowed_commands_array=( DEBUG DETAILS DEV-QUERY-RAW MONITOR POST_DETAILS START STOP POST-DETAILS )
+allowed_commands_array=(DEBUG DETAILS DEV-QUERY-RAW MONITOR POST_DETAILS START STOP POST-DETAILS)
 for allowed_command in "${allowed_commands_array[@]}"; do
 	if [ "${allowed_command}" == "${commandname}" ]; then
 		if [ -z "${installflag}" ]; then
@@ -77,7 +77,7 @@ for allowed_command in "${allowed_commands_array[@]}"; do
 	fi
 done
 
-allowed_commands_array=( DEBUG START UPDATE VALIDATE )
+allowed_commands_array=(DEBUG START UPDATE VALIDATE)
 for allowed_command in "${allowed_commands_array[@]}"; do
 	if [ "${allowed_command}" == "${commandname}" ]; then
 		if [ "${appid}" ]; then
@@ -86,14 +86,14 @@ for allowed_command in "${allowed_commands_array[@]}"; do
 	fi
 done
 
-allowed_commands_array=( CHANGE-PASSWORD DETAILS MONITOR START STOP UPDATE VALIDATE POST-DETAILS )
+allowed_commands_array=(CHANGE-PASSWORD DETAILS MONITOR START STOP UPDATE VALIDATE POST-DETAILS)
 for allowed_command in "${allowed_commands_array[@]}"; do
 	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_status.sh
 	fi
 done
 
-allowed_commands_array=( DEBUG START INSTALL )
+allowed_commands_array=(DEBUG START INSTALL)
 for allowed_command in "${allowed_commands_array[@]}"; do
 	if [ "${allowed_command}" == "${commandname}" ]; then
 		check_system_requirements.sh

+ 5 - 5
lgsm/functions/check_config.sh

@@ -7,7 +7,7 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-if [ -n "${servercfgfullpath}" ]&&[ ! -f "${servercfgfullpath}" ]; then
+if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then
 	fn_print_dots ""
 	fn_print_warn_nl "Configuration file missing!"
 	echo -e "${servercfgfullpath}"
@@ -16,20 +16,20 @@ if [ -n "${servercfgfullpath}" ]&&[ ! -f "${servercfgfullpath}" ]; then
 	install_config.sh
 fi
 
-if [ "${shortname}" == "rust" ]&&[ -v rconpassword ]&&[ -z "${rconpassword}" ]; then
+if [ "${shortname}" == "rust" ] && [ -v rconpassword ] && [ -z "${rconpassword}" ]; then
 	fn_print_dots ""
 	fn_print_fail_nl "RCON password is not set"
 	fn_script_log_warn "RCON password is not set"
-elif [ -v rconpassword ]&&[ "${rconpassword}" == "CHANGE_ME" ]; then
+elif [ -v rconpassword ] && [ "${rconpassword}" == "CHANGE_ME" ]; then
 	fn_print_dots ""
 	fn_print_warn_nl "Default RCON Password detected"
 	fn_script_log_warn "Default RCON Password detected"
 fi
 
-if [ "${shortname}" == "vh" ]&&[ -z "${serverpassword}" ]; then
+if [ "${shortname}" == "vh" ] && [ -z "${serverpassword}" ]; then
 	fn_print_fail_nl "serverpassword is not set"
 	fn_script_log_fatal "serverpassword is not set"
-elif [ "${shortname}" == "vh" ]&&[ "${#serverpassword}" -le "4" ]; then
+elif [ "${shortname}" == "vh" ] && [ "${#serverpassword}" -le "4" ]; then
 	fn_print_fail_nl "serverpassword is to short (min 5 chars)"
 	fn_script_log_fatal "serverpassword is to short (min 5 chars)"
 fi

+ 45 - 46
lgsm/functions/check_deps.sh

@@ -7,7 +7,7 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-fn_install_mono_repo(){
+fn_install_mono_repo() {
 	if [ "${autodepinstall}" == "0" ]; then
 		fn_print_information_nl "Automatically adding Mono repository."
 		fn_script_log_info "Automatically adding Mono repository."
@@ -36,7 +36,7 @@ fn_install_mono_repo(){
 			else
 				monoautoinstall="1"
 			fi
-		elif [ "${distroid}" == "centos" ]||[ "${distroid}" == "almalinux" ]||[ "${distroid}" == "rocky" ]; then
+		elif [ "${distroid}" == "centos" ] || [ "${distroid}" == "almalinux" ] || [ "${distroid}" == "rocky" ]; then
 			if [ "${distroversion}" == "8" ]; then
 				cmd="sudo rpmkeys --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF';su -c 'curl https://download.mono-project.com/repo/centos8-stable.repo | tee /etc/yum.repos.d/mono-centos8-stable.repo'"
 			elif [ "${distroversion}" == "7" ]; then
@@ -85,30 +85,30 @@ fn_install_mono_repo(){
 	fi
 }
 
-fn_deps_email(){
+fn_deps_email() {
 	# Adds postfix to required dependencies if email alert is enabled.
 	if [ "${emailalert}" == "on" ]; then
 		if [ -f /usr/bin/mailx ]; then
 			if [ -d /etc/exim4 ]; then
-				array_deps_required+=( exim4 )
+				array_deps_required+=(exim4)
 			elif [ -d /etc/sendmail ]; then
-				array_deps_required+=( sendmail )
-			elif [ "$(command -v dpkg-query 2>/dev/null)" ]; then
-				array_deps_required+=( mailutils postfix )
-			elif [ "$(command -v rpm 2>/dev/null)" ]; then
-				array_deps_required+=( mailx postfix )
+				array_deps_required+=(sendmail)
+			elif [ "$(command -v dpkg-query 2> /dev/null)" ]; then
+				array_deps_required+=(mailutils postfix)
+			elif [ "$(command -v rpm 2> /dev/null)" ]; then
+				array_deps_required+=(mailx postfix)
 			fi
 		else
-			if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
-				array_deps_required+=( mailutils postfix )
-			elif [ "$(command -v rpm 2>/dev/null)" ]; then
-				array_deps_required+=( mailx postfix )
+			if [ "$(command -v dpkg-query 2> /dev/null)" ]; then
+				array_deps_required+=(mailutils postfix)
+			elif [ "$(command -v rpm 2> /dev/null)" ]; then
+				array_deps_required+=(mailx postfix)
 			fi
 		fi
 	fi
 }
 
-fn_install_missing_deps(){
+fn_install_missing_deps() {
 	# If any dependencies are not installed.
 	if [ "${#array_deps_missing[*]}" != "0" ]; then
 		if [ "${commandname}" == "INSTALL" ]; then
@@ -143,9 +143,8 @@ fn_install_missing_deps(){
 			fi
 		fi
 
-
 		# Add sudo dpkg --add-architecture i386 if using i386 packages.
-		if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
+		if [ "$(command -v dpkg-query 2> /dev/null)" ]; then
 			if printf '%s\n' "${array_deps_required[@]}" | grep -q -P 'i386'; then
 				i386installcommand="sudo dpkg --add-architecture i386; "
 			fi
@@ -162,13 +161,13 @@ fn_install_missing_deps(){
 			echo -en "...\r"
 			sleep 1
 			echo -en "   \r"
-			if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
+			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; ${i386installcommand}sudo apt-get update; sudo apt-get -y install ${array_deps_missing[*]}"
 				eval "${cmd}"
-			elif [ "$(command -v dnf 2>/dev/null)" ]; then
+			elif [ "$(command -v dnf 2> /dev/null)" ]; then
 				cmd="sudo dnf -y install ${array_deps_missing[*]}"
 				eval "${cmd}"
-			elif [ "$(command -v yum 2>/dev/null)" ]; then
+			elif [ "$(command -v yum 2> /dev/null)" ]; then
 				cmd="sudo yum -y install ${array_deps_missing[*]}"
 				eval "${cmd}"
 			fi
@@ -182,11 +181,11 @@ fn_install_missing_deps(){
 
 		# If automatic dependency install is unavailable.
 		if [ "${autodepinstall}" != "0" ]; then
-			if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
+			if [ "$(command -v dpkg-query 2> /dev/null)" ]; then
 				echo -e "${i386installcommand}sudo apt update; sudo apt install ${array_deps_missing[*]}"
-			elif [ "$(command -v dnf 2>/dev/null)" ]; then
+			elif [ "$(command -v dnf 2> /dev/null)" ]; then
 				echo -e "sudo dnf install ${array_deps_missing[*]}"
-			elif [ "$(command -v yum 2>/dev/null)" ]; then
+			elif [ "$(command -v yum 2> /dev/null)" ]; then
 				echo -e "sudo yum install ${array_deps_missing[*]}"
 			fi
 		fi
@@ -210,7 +209,7 @@ fn_install_missing_deps(){
 	fi
 }
 
-fn_check_loop(){
+fn_check_loop() {
 	# Loop though required depenencies checking if they are installed.
 	for deptocheck in ${array_deps_required[*]}; do
 		fn_deps_detector
@@ -221,21 +220,21 @@ fn_check_loop(){
 }
 
 # Checks if dependency is installed or not.
-fn_deps_detector(){
+fn_deps_detector() {
 	## Check.
 	# SteamCMD: Will be removed from required array if no appid is present or non-free repo is not available.
 	# This will cause SteamCMD to be installed using tar.
-	if [ "${deptocheck}" == "libsdl2-2.0-0:i386" ]&&[ -z "${appid}" ]; then
-		array_deps_required=( "${array_deps_required[@]/libsdl2-2.0-0:i386}" )
+	if [ "${deptocheck}" == "libsdl2-2.0-0:i386" ] && [ -z "${appid}" ]; then
+		array_deps_required=("${array_deps_required[@]/libsdl2-2.0-0:i386/}")
 		steamcmdstatus=1
-	elif [ "${deptocheck}" == "steamcmd" ]&&[ -z "${appid}" ]; then
-		array_deps_required=( "${array_deps_required[@]/steamcmd}" )
+	elif [ "${deptocheck}" == "steamcmd" ] && [ -z "${appid}" ]; then
+		array_deps_required=("${array_deps_required[@]/steamcmd/}")
 		steamcmdstatus=1
-	elif [ "${deptocheck}" == "steamcmd" ]&&[ "${distroid}" == "debian" ]&& ! grep -qE "^deb .*non-free" /etc/apt/sources.list; then
-		array_deps_required=( "${array_deps_required[@]/steamcmd}" )
+	elif [ "${deptocheck}" == "steamcmd" ] && [ "${distroid}" == "debian" ] && ! grep -qE "^deb .*non-free" /etc/apt/sources.list; then
+		array_deps_required=("${array_deps_required[@]/steamcmd/}")
 		steamcmdstatus=1
 	# Java: Added for users using Oracle JRE to bypass check.
-	elif [[ ${deptocheck} == "openjdk"* ]]||[[ ${deptocheck} == "java"* ]]; then
+	elif [[ ${deptocheck} == "openjdk"* ]] || [[ ${deptocheck} == "java"* ]]; then
 		# Is java already installed?
 		if [ -n "${javaversion}" ]; then
 			# Added for users using Oracle JRE to bypass check.
@@ -246,7 +245,7 @@ fn_deps_detector(){
 		fi
 	# Mono: A Mono repo needs to be installed.
 	elif [ "${deptocheck}" == "mono-complete" ]; then
-		if [ -n "${monoversion}" ]&&[ "${monoversion}" -ge "5" ]; then
+		if [ -n "${monoversion}" ] && [ "${monoversion}" -ge "5" ]; then
 			# Mono >= 5.0.0 already installed.
 			depstatus=0
 			monostatus=0
@@ -255,13 +254,13 @@ fn_deps_detector(){
 			depstatus=1
 			monostatus=1
 		fi
-	elif [ "$(command -v dpkg-query 2>/dev/null)" ]; then
-		dpkg-query -W -f='${Status}' "${deptocheck}" 2>/dev/null | grep -q -P '^install ok installed'
+	elif [ "$(command -v dpkg-query 2> /dev/null)" ]; then
+		dpkg-query -W -f='${Status}' "${deptocheck}" 2> /dev/null | grep -q -P '^install ok installed'
 		depstatus=$?
-	elif [ "$(command -v dnf 2>/dev/null)" ]; then
+	elif [ "$(command -v dnf 2> /dev/null)" ]; then
 		dnf list installed "${deptocheck}" > /dev/null 2>&1
 		depstatus=$?
-	elif [ "$(command -v rpm 2>/dev/null)" ]; then
+	elif [ "$(command -v rpm 2> /dev/null)" ]; then
 		rpm -q "${deptocheck}" > /dev/null 2>&1
 		depstatus=$?
 	fi
@@ -286,11 +285,11 @@ fn_deps_detector(){
 		fi
 		# If SteamCMD requirements are not met install will fail.
 		if [ -n "${appid}" ]; then
-				for steamcmddeptocheck in ${array_deps_required_steamcmd[*]}; do
-					if [ "${deptocheck}" != "steamcmd" ]&&[ "${deptocheck}" == "${steamcmddeptocheck}" ]; then
-						steamcmdfail=1
-					fi
-				done
+			for steamcmddeptocheck in ${array_deps_required_steamcmd[*]}; do
+				if [ "${deptocheck}" != "steamcmd" ] && [ "${deptocheck}" == "${steamcmddeptocheck}" ]; then
+					steamcmdfail=1
+				fi
+			done
 		fi
 	fi
 	unset depstatus
@@ -326,10 +325,10 @@ fi
 
 info_distro.sh
 
-if [ ! -f "${tmpdir}/dependency-no-check.tmp" ]&&[ ! -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
+if [ ! -f "${tmpdir}/dependency-no-check.tmp" ] && [ ! -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
 	# Check that the distro dependency csv file exists.
 	fn_check_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv"
-	if [ -n "${checkflag}" ]&&[ "${checkflag}" == "0" ]; then
+	if [ -n "${checkflag}" ] && [ "${checkflag}" == "0" ]; then
 		fn_fetch_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" "lgsm/data" "chmodx" "norun" "noforce" "nohash"
 	fi
 fi
@@ -338,7 +337,7 @@ fi
 if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
 	depall=$(awk -F, '$1=="all" {$1=""; print $0}' "${datadir}/${distroid}-${distroversioncsv}.csv")
 	depsteamcmd=$(awk -F, '$1=="steamcmd" {$1=""; print $0}' "${datadir}/${distroid}-${distroversioncsv}.csv")
-	depshortname=$(awk -v shortname="$shortname" -F, '$1==shortname {$1=""; print $0}'  "${datadir}/${distroid}-${distroversioncsv}.csv")
+	depshortname=$(awk -v shortname="$shortname" -F, '$1==shortname {$1=""; print $0}' "${datadir}/${distroid}-${distroversioncsv}.csv")
 
 	# Generate array of missing deps.
 	array_deps_missing=()
@@ -351,11 +350,11 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
 
 	fn_check_loop
 # Warn the user that dependency checking is unavailable for their distro.
-elif [ "${commandname}" == "INSTALL" ]||[ -n "${checkflag}" ]&&[ "${checkflag}" != "0" ]; then
+elif [ "${commandname}" == "INSTALL" ] || [ -n "${checkflag}" ] && [ "${checkflag}" != "0" ]; then
 	fn_print_warning_nl "LinuxGSM dependency checking currently unavailable for ${distroname}."
 	# Prevent future dependency checking if unavailable for the distro.
 	echo "${version}" > "${tmpdir}/dependency-no-check.tmp"
-elif 	[ -f "${tmpdir}/dependency-no-check.tmp" ]; then
+elif [ -f "${tmpdir}/dependency-no-check.tmp" ]; then
 	# Allow LinuxGSM to try a dependency check if LinuxGSM has been recently updated.
 	nocheckversion=$(cat "${tmpdir}/dependency-no-check.tmp")
 	if [ "${version}" != "${nocheckversion}" ]; then

+ 18 - 18
lgsm/functions/check_ip.sh

@@ -10,17 +10,17 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 info_game.sh
 
-ip_commands_array=( "/bin/ip" "/usr/sbin/ip" "ip")
+ip_commands_array=("/bin/ip" "/usr/sbin/ip" "ip")
 for ip_command in "${ip_commands_array[@]}"; do
-	if [ "$(command -v ${ip_command} 2>/dev/null)" ]; then
+	if [ "$(command -v ${ip_command} 2> /dev/null)" ]; then
 		ipcommand="${ip_command}"
 		break
 	fi
 done
 
-ethtool_commands_array=( "/bin/ethtool" "/usr/sbin/ethtool" "ethtool")
+ethtool_commands_array=("/bin/ethtool" "/usr/sbin/ethtool" "ethtool")
 for ethtool_command in "${ethtool_commands_array[@]}"; do
-	if [ "$(command -v ${ethtool_command} 2>/dev/null)" ]; then
+	if [ "$(command -v ${ethtool_command} 2> /dev/null)" ]; then
 		ethtoolcommand="${ethtool_command}"
 		break
 	fi
@@ -32,27 +32,27 @@ getipwc=$(${ipcommand} -o -4 addr | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\
 # Check if server has multiple IP addresses
 
 # If the IP variable has been set by user.
-if [ -n "${ip}" ]&&[ "${ip}" != "0.0.0.0" ]; then
-	queryips=( "${ip}" )
-	webadminip=( "${ip}" )
-	telnetip=( "${ip}" )
+if [ -n "${ip}" ] && [ "${ip}" != "0.0.0.0" ]; then
+	queryips=("${ip}")
+	webadminip=("${ip}")
+	telnetip=("${ip}")
 # If game config does have an IP set.
-elif [ -n "${configip}" ]&&[ "${configip}" != "0.0.0.0" ];then
-	queryips=( "${configip}" )
+elif [ -n "${configip}" ] && [ "${configip}" != "0.0.0.0" ]; then
+	queryips=("${configip}")
 	ip="${configip}"
-	webadminip=( "${configip}" )
-	telnetip=( "${configip}" )
+	webadminip=("${configip}")
+	telnetip=("${configip}")
 # If there is only 1 server IP address.
 # Some IP details can automaticly use the one IP
 elif [ "${getipwc}" == "1" ]; then
-	queryips=( $(echo "${getip}") )
+	queryips=($(echo "${getip}"))
 	ip="0.0.0.0"
-	webadminip=( "${getip}" )
-	telnetip=( "${getip}" )
+	webadminip=("${getip}")
+	telnetip=("${getip}")
 # If no ip is set by the user and server has more than one IP.
 else
-	queryips=( $(echo "${getip}") )
+	queryips=($(echo "${getip}"))
 	ip="0.0.0.0"
-	webadminip=( "${ip}" )
-	telnetip=( "${ip}" )
+	webadminip=("${ip}")
+	telnetip=("${ip}")
 fi

+ 2 - 2
lgsm/functions/check_last_update.sh

@@ -16,8 +16,8 @@ if [ -f "${lockdir}/lastupdate.lock" ]; then
 fi
 
 check_status.sh
-if [ -f "${lockdir}/lastupdate.lock" ]&&[ "${status}" != "0" ]; then
-	if [ ! -f "${lockdir}/${selfname}-laststart.lock" ]||[ "${laststart}" -lt "${lastupdate}" ]; then
+if [ -f "${lockdir}/lastupdate.lock" ] && [ "${status}" != "0" ]; then
+	if [ ! -f "${lockdir}/${selfname}-laststart.lock" ] || [ "${laststart}" -lt "${lastupdate}" ]; then
 		fn_print_info "${selfname} has not been restarted since last update"
 		fn_script_log_info "${selfname} has not been restarted since last update"
 		command_restart.sh

+ 3 - 3
lgsm/functions/check_logs.sh

@@ -7,7 +7,7 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-fn_check_logs(){
+fn_check_logs() {
 	fn_print_dots "Checking for log files"
 	fn_print_info_nl "Checking for log files: Creating log files"
 	checklogs=1
@@ -15,12 +15,12 @@ fn_check_logs(){
 }
 
 # Create directories for the script and console logs.
-if [ ! -d "${lgsmlogdir}" ]||[ ! -d "${consolelogdir}" ]; then
+if [ ! -d "${lgsmlogdir}" ] || [ ! -d "${consolelogdir}" ]; then
 	fn_check_logs
 fi
 
 # Create gamelogdir.
 # If variable exists gamelogdir exists and log/server does not.
-if [ "${gamelogdir}" ]&&[ -d "${gamelogdir}" ]&&[ ! -d "${logdir}/server" ]; then
+if [ "${gamelogdir}" ] && [ -d "${gamelogdir}" ] && [ ! -d "${logdir}/server" ]; then
 	fn_check_logs
 fi

+ 30 - 30
lgsm/functions/check_permissions.sh

@@ -7,7 +7,7 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-fn_check_ownership(){
+fn_check_ownership() {
 	if [ -f "${rootdir}/${selfname}" ]; then
 		if [ "$(find "${rootdir}/${selfname}" -not -user "$(whoami)" | wc -l)" -ne "0" ]; then
 			selfownissue=1
@@ -23,7 +23,7 @@ fn_check_ownership(){
 			filesownissue=1
 		fi
 	fi
-	if [ "${selfownissue}" == "1" ]||[ "${funcownissue}" == "1" ]||[ "${filesownissue}" == "1" ]; then
+	if [ "${selfownissue}" == "1" ] || [ "${funcownissue}" == "1" ] || [ "${filesownissue}" == "1" ]; then
 		fn_print_fail_nl "Ownership issues found"
 		fn_script_log_fatal "Ownership issues found"
 		fn_print_information_nl "The current user ($(whoami)) does not have ownership of the following files:"
@@ -36,7 +36,7 @@ fn_check_ownership(){
 			if [ "${funcownissue}" == "1" ]; then
 				find "${functionsdir}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n"
 			fi
-			if [ "${filesownissue}" == "1"  ]; then
+			if [ "${filesownissue}" == "1" ]; then
 				find "${serverfiles}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n"
 			fi
 
@@ -52,7 +52,7 @@ fn_check_ownership(){
 	fi
 }
 
-fn_check_permissions(){
+fn_check_permissions() {
 	if [ -d "${functionsdir}" ]; then
 		if [ "$(find "${functionsdir}" -type f -not -executable | wc -l)" -ne "0" ]; then
 			fn_print_fail_nl "Permissions issues found"
@@ -78,7 +78,7 @@ fn_check_permissions(){
 		# Grab the first and second digit for user and group permission.
 		userrootdirperm="${rootdirperm:0:1}"
 		grouprootdirperm="${rootdirperm:1:1}"
-		if [ "${userrootdirperm}" != "7" ]&&[ "${grouprootdirperm}" != "7" ]; then
+		if [ "${userrootdirperm}" != "7" ] && [ "${grouprootdirperm}" != "7" ]; then
 			fn_print_fail_nl "Permissions issues found"
 			fn_script_log_fatal "Permissions issues found"
 			fn_print_information_nl "The following directory does not have the correct permissions:"
@@ -102,9 +102,9 @@ fn_check_permissions(){
 		userexecperm="${execperm:0:1}"
 		groupexecperm="${execperm:1:1}"
 		# Check for invalid user permission.
-		if [ "${userexecperm}" == "0" ]||[ "${userexecperm}" == "2" ]||[ "${userexecperm}" == "4" ]||[ "${userexecperm}" == "6" ]; then
+		if [ "${userexecperm}" == "0" ] || [ "${userexecperm}" == "2" ] || [ "${userexecperm}" == "4" ] || [ "${userexecperm}" == "6" ]; then
 			# If user permission is invalid, then check for invalid group permissions.
-			if [ "${groupexecperm}" == "0" ]||[ "${groupexecperm}" == "2" ]||[ "${groupexecperm}" == "4" ]||[ "${groupexecperm}" == "6" ]; then
+			if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ] || [ "${groupexecperm}" == "6" ]; then
 				# If permission issues are found.
 				fn_print_warn_nl "Permissions issue found"
 				fn_script_log_warn "Permissions issue found"
@@ -122,18 +122,18 @@ fn_check_permissions(){
 				# Grab the first and second digit for user and group permission.
 				userexecperm="${execperm:0:1}"
 				groupexecperm="${execperm:1:1}"
-				if [ "${userexecperm}" == "0" ]||[ "${userexecperm}" == "2" ]||[ "${userexecperm}" == "4" ]||[ "${userexecperm}" == "6" ]; then
-					if [ "${groupexecperm}" == "0" ]||[ "${groupexecperm}" == "2" ]||[ "${groupexecperm}" == "4" ]||[ "${groupexecperm}" == "6" ]; then
-					# If errors are still found.
-					fn_print_fail_nl "The following file could not be set executable:"
-					ls -l "${executabledir}/${execname}"
-					fn_script_log_warn "The following file could not be set executable:"
-					fn_script_log_info "${executabledir}/${execname}"
-					if [ "${monitorflag}" == "1" ]; then
-						alert="permissions"
-						alert.sh
-					fi
-					core_exit.sh
+				if [ "${userexecperm}" == "0" ] || [ "${userexecperm}" == "2" ] || [ "${userexecperm}" == "4" ] || [ "${userexecperm}" == "6" ]; then
+					if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ] || [ "${groupexecperm}" == "6" ]; then
+						# If errors are still found.
+						fn_print_fail_nl "The following file could not be set executable:"
+						ls -l "${executabledir}/${execname}"
+						fn_script_log_warn "The following file could not be set executable:"
+						fn_script_log_info "${executabledir}/${execname}"
+						if [ "${monitorflag}" == "1" ]; then
+							alert="permissions"
+							alert.sh
+						fi
+						core_exit.sh
 					fi
 				fi
 			fi
@@ -144,26 +144,26 @@ fn_check_permissions(){
 ## The following fn_sys_perm_* functions checks for permission errors in /sys directory.
 
 # Checks for permission errors in /sys directory.
-fn_sys_perm_errors_detect(){
+fn_sys_perm_errors_detect() {
 	# Reset test variables.
 	sysdirpermerror="0"
 	classdirpermerror="0"
 	netdirpermerror="0"
 	# Check permissions.
 	# /sys, /sys/class and /sys/class/net should be readable & executable.
-	if [ ! -r "/sys" ]||[ ! -x "/sys" ]; then
+	if [ ! -r "/sys" ] || [ ! -x "/sys" ]; then
 		sysdirpermerror="1"
 	fi
-	if [ ! -r "/sys/class" ]||[ ! -x "/sys/class" ]; then
+	if [ ! -r "/sys/class" ] || [ ! -x "/sys/class" ]; then
 		classdirpermerror="1"
 	fi
-	if [ ! -r "/sys/class/net" ]||[ ! -x "/sys/class/net" ]; then
+	if [ ! -r "/sys/class/net" ] || [ ! -x "/sys/class/net" ]; then
 		netdirpermerror="1"
 	fi
 }
 
 # Display a message on how to fix the issue manually.
-fn_sys_perm_fix_manually_msg(){
+fn_sys_perm_fix_manually_msg() {
 	echo -e ""
 	fn_print_information_nl "This error causes servers to fail starting properly"
 	fn_script_log_info "This error causes servers to fail starting properly."
@@ -180,7 +180,7 @@ fn_sys_perm_fix_manually_msg(){
 }
 
 # Attempt to fix /sys related permission errors if sudo is available, exits otherwise.
-fn_sys_perm_errors_fix(){
+fn_sys_perm_errors_fix() {
 	if sudo -n true > /dev/null 2>&1; then
 		fn_print_dots "Automatically fixing /sys permissions"
 		fn_script_log_info "Automatically fixing /sys permissions."
@@ -195,7 +195,7 @@ fn_sys_perm_errors_fix(){
 		fi
 		# Run check again to see if it's fixed.
 		fn_sys_perm_errors_detect
-		if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then
+		if [ "${sysdirpermerror}" == "1" ] || [ "${classdirpermerror}" == "1" ] || [ "${netdirpermerror}" == "1" ]; then
 			fn_print_error "Could not fix /sys permissions"
 			fn_script_log_error "Could not fix /sys permissions."
 			fn_sleep_time
@@ -206,16 +206,16 @@ fn_sys_perm_errors_fix(){
 			fn_script_log_pass "Permissions in /sys fixed"
 		fi
 	else
-	# Show the user how to fix.
-	fn_sys_perm_fix_manually_msg
+		# Show the user how to fix.
+		fn_sys_perm_fix_manually_msg
 	fi
 }
 
 # Processes to the /sys related permission errors check & fix/info.
-fn_sys_perm_error_process(){
+fn_sys_perm_error_process() {
 	fn_sys_perm_errors_detect
 	# If any error was found.
-	if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then
+	if [ "${sysdirpermerror}" == "1" ] || [ "${classdirpermerror}" == "1" ] || [ "${netdirpermerror}" == "1" ]; then
 		fn_print_error_nl "Permission error(s) found in /sys"
 		fn_script_log_error "Permission error(s) found in /sys"
 		# Run the fix

+ 1 - 1
lgsm/functions/check_status.sh

@@ -7,4 +7,4 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-status=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${sessionname}")
+status=$(tmux list-sessions -F "#{session_name}" 2> /dev/null | grep -Ecx "^${sessionname}")

+ 1 - 1
lgsm/functions/check_steamcmd.sh

@@ -12,7 +12,7 @@ core_steamcmd.sh
 
 fn_check_steamcmd_clear
 fn_check_steamcmd
-if [ ${shortname} == "ark" ]; then
+if [ "${shortname}" == "ark" ]; then
 	fn_check_steamcmd_ark
 fi
 fn_check_steamcmd_dir

+ 3 - 3
lgsm/functions/check_system_requirements.sh

@@ -26,19 +26,19 @@ elif [ "${shortname}" == "arma3" ]; then
 elif [ "${shortname}" == "rust" ]; then
 	ramrequirementmb="4000"
 	ramrequirementgb="4"
-elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then
+elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "wmc" ]; then
 	ramrequirementmb="1000"
 	ramrequirementgb="1"
 elif [ "${shortname}" == "pstbs" ]; then
 	ramrequirementmb="2000"
 	ramrequirementgb="2"
-elif [ "${shortname}" == "ns2" ]||[ "${shortname}" == "ns2c" ]; then
+elif [ "${shortname}" == "ns2" ] || [ "${shortname}" == "ns2c" ]; then
 	ramrequirementmb="1000"
 	ramrequirementgb="1"
 elif [ "${shortname}" == "st" ]; then
 	ramrequirementmb="1000"
 	ramrequirementgb="1"
-elif [ "${shortname}" == "pvr" ];then
+elif [ "${shortname}" == "pvr" ]; then
 	ramrequirementmb="2000"
 	ramrequirementgb="2"
 fi

+ 3 - 3
lgsm/functions/check_tmuxception.sh

@@ -7,8 +7,8 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-fn_check_is_in_tmux(){
-  if [ "${TMUX}" ]; then
+fn_check_is_in_tmux() {
+	if [ "${TMUX}" ]; then
 		fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a tmux session."
 		fn_script_log_fatal "Tmuxception error: Attempted to start a tmux session inside of a tmux session."
 		fn_print_information_nl "LinuxGSM creates a tmux session when starting the server."
@@ -18,7 +18,7 @@ fn_check_is_in_tmux(){
 	fi
 }
 
-fn_check_is_in_screen(){
+fn_check_is_in_screen() {
 	if [ "${STY}" ]; then
 		fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a screen session."
 		fn_script_log_fatal "Tmuxception error: Attempted to start a tmux session inside of a screen session."

+ 1 - 1
lgsm/functions/check_version.sh

@@ -8,7 +8,7 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-if [ -n "${modulesversion}" ]&&[ -n "${version}" ]&&[ "${version}" != "${modulesversion}" ]; then
+if [ -n "${modulesversion}" ] && [ -n "${version}" ] && [ "${version}" != "${modulesversion}" ]; then
 	exitbypass=1
 	echo -e ""
 	fn_print_error_nl "LinuxGSM version mismatch"

+ 23 - 23
lgsm/functions/command_backup.sh

@@ -13,7 +13,7 @@ fn_firstcommand_set
 check.sh
 
 # Trap to remove lockfile on quit.
-fn_backup_trap(){
+fn_backup_trap() {
 	echo -e ""
 	echo -en "backup ${backupname}.tar.gz..."
 	fn_print_canceled_eol_nl
@@ -30,7 +30,7 @@ fn_backup_trap(){
 }
 
 # Check if a backup is pending or has been aborted using backup.lock.
-fn_backup_check_lockfile(){
+fn_backup_check_lockfile() {
 	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"
@@ -39,7 +39,7 @@ fn_backup_check_lockfile(){
 }
 
 # Initialisation.
-fn_backup_init(){
+fn_backup_init() {
 	# Backup file name with selfname and current date.
 	backupname="${selfname}-$(date '+%Y-%m-%d-%H%M%S')"
 
@@ -47,7 +47,7 @@ fn_backup_init(){
 	fn_print_dots "Backup starting"
 	fn_script_log_info "Backup starting"
 	fn_print_ok_nl "Backup starting"
-	if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
+	if [ ! -d "${backupdir}" ] || [ "${backupcount}" == "0" ]; then
 		fn_print_info_nl "There are no previous backups"
 	else
 		if [ "${lastbackupdaysago}" == "0" ]; then
@@ -62,7 +62,7 @@ fn_backup_init(){
 }
 
 # Check if server is started and whether to stop it.
-fn_backup_stop_server(){
+fn_backup_stop_server() {
 	check_status.sh
 	# Server is running but will not be stopped.
 	if [ "${stoponbackup}" == "off" ]; then
@@ -82,7 +82,7 @@ fn_backup_stop_server(){
 }
 
 # Create required folders.
-fn_backup_dir(){
+fn_backup_dir() {
 	# Create backupdir if it doesn't exist.
 	if [ ! -d "${backupdir}" ]; then
 		mkdir -p "${backupdir}"
@@ -90,17 +90,17 @@ fn_backup_dir(){
 }
 
 # Migrate Backups from old dir before refactor
-fn_backup_migrate_olddir(){
+fn_backup_migrate_olddir() {
 	# Check if old backup dir is there before the refactor and move the backups
 	if [ -d "${rootdir}/backups" ]; then
 		if [ "${rootdir}/backups" != "${backupdir}" ]; then
 			fn_print_dots "Backup directory is being migrated"
 			fn_script_log_info "Backup directory is being migrated"
 			fn_script_log_info "${rootdir}/backups > ${backupdir}"
-			mv "${rootdir}/backups/"* "${backupdir}" 2>/dev/null
+			mv "${rootdir}/backups/"* "${backupdir}" 2> /dev/null
 			exitcode=$?
 			if [ "${exitcode}" -eq 0 ]; then
-				rmdir "${rootdir}/backups" 2>/dev/null
+				rmdir "${rootdir}/backups" 2> /dev/null
 				exitcode=$?
 			fi
 			if [ "${exitcode}" -eq 0 ]; then
@@ -114,7 +114,7 @@ fn_backup_migrate_olddir(){
 	fi
 }
 
-fn_backup_create_lockfile(){
+fn_backup_create_lockfile() {
 	# Create lockfile.
 	date '+%s' > "${lockdir}/backup.lock"
 	fn_script_log_info "Lockfile generated"
@@ -124,7 +124,7 @@ fn_backup_create_lockfile(){
 }
 
 # Compressing files.
-fn_backup_compression(){
+fn_backup_compression() {
 	# Tells how much will be compressed using rootdirduexbackup value from info_distro and prompt for continue.
 	fn_print_info "A total of ${rootdirduexbackup} will be compressed."
 	fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.tar.gz"
@@ -133,7 +133,7 @@ fn_backup_compression(){
 	excludedir=$(fn_backup_relpath)
 
 	# Check that excludedir is a valid path.
-	if [ ! -d "${excludedir}" ] ; then
+	if [ ! -d "${excludedir}" ]; then
 		fn_print_fail_nl "Problem identifying the previous backup directory for exclusion."
 		fn_script_log_fatal "Problem identifying the previous backup directory for exclusion"
 		core_exit.sh
@@ -157,17 +157,17 @@ fn_backup_compression(){
 }
 
 # Clear old backups according to maxbackups and maxbackupdays variables.
-fn_backup_prune(){
+fn_backup_prune() {
 	# Clear if backup variables are set.
-	if [ "${maxbackups}" ]&&[ -n "${maxbackupdays}" ]; then
+	if [ "${maxbackups}" ] && [ -n "${maxbackupdays}" ]; then
 		# How many backups there are.
 		info_distro.sh
 		# How many backups exceed maxbackups.
-		backupquotadiff=$((backupcount-maxbackups))
+		backupquotadiff=$((backupcount - maxbackups))
 		# How many backups exceed maxbackupdays.
-		backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.gz" -mtime +"${maxbackupdays}"|wc -l)
+		backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.gz" -mtime +"${maxbackupdays}" | wc -l)
 		# If anything can be cleared.
-		if [ "${backupquotadiff}" -gt "0" ]||[ "${backupsoudatedcount}" -gt "0" ]; then
+		if [ "${backupquotadiff}" -gt "0" ] || [ "${backupsoudatedcount}" -gt "0" ]; then
 			fn_print_dots "Pruning"
 			fn_script_log_info "Backup pruning activated"
 			fn_print_ok_nl "Pruning"
@@ -220,32 +220,32 @@ fn_backup_relpath() {
 
 	# Compare the leading entries of each array.  These common elements will be clipped off.
 	# for the relative path output.
-	for ((base=0; base<${#rdirtoks[@]}; base++)); do
+	for ((base = 0; base < ${#rdirtoks[@]}; base++)); do
 		[[ "${rdirtoks[$base]}" != "${bdirtoks[$base]}" ]] && break
 	done
 
 	# Next, climb out of the remaining rootdir location with updir references.
-	for ((x=base;x<${#rdirtoks[@]};x++)); do
+	for ((x = base; x < ${#rdirtoks[@]}; x++)); do
 		echo -n "../"
 	done
 
 	# Climb down the remaining components of the backupdir location.
-	for ((x=base;x<$(( ${#bdirtoks[@]} - 1 ));x++)); do
+	for ((x = base; x < $((${#bdirtoks[@]} - 1)); x++)); do
 		echo -n "${bdirtoks[$x]}/"
 	done
 
 	# In the event there were no directories left in the backupdir above to
 	# traverse down, just add a newline. Otherwise at this point, there is
 	# one remaining directory component in the backupdir to navigate.
-	if (( "$base" < "${#bdirtoks[@]}" )) ; then
-		echo -e "${bdirtoks[ $(( ${#bdirtoks[@]} - 1)) ]}"
+	if (("$base" < "${#bdirtoks[@]}")); then
+		echo -e "${bdirtoks[$((${#bdirtoks[@]} - 1))]}"
 	else
 		echo
 	fi
 }
 
 # Start the server if it was stopped for the backup.
-fn_backup_start_server(){
+fn_backup_start_server() {
 	if [ -n "${startserver}" ]; then
 		exitbypass=1
 		command_start.sh

+ 9 - 5
lgsm/functions/command_check_update.sh

@@ -14,12 +14,16 @@ fn_print_dots ""
 check.sh
 core_logs.sh
 
-core_steamcmd.sh
+if [ "${appid}" ]; then
+	core_steamcmd.sh
 
-check_steamcmd.sh
+	check_steamcmd.sh
 
-fn_update_steamcmd_localbuild
-fn_update_steamcmd_remotebuild
-fn_update_steamcmd_compare
+	fn_update_steamcmd_localbuild
+	fn_update_steamcmd_remotebuild
+	fn_update_steamcmd_compare
+elif [ "${shortname}" == "ts3" ]; then
+	update_ts3.sh
+fi
 
 core_exit.sh

+ 4 - 4
lgsm/functions/command_debug.sh

@@ -11,7 +11,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 fn_firstcommand_set
 
 # Trap to remove lockfile on quit.
-fn_lockfile_trap(){
+fn_lockfile_trap() {
 	# Remove lockfile.
 	rm -f "${lockdir:?}/${selfname}.lock"
 	# resets terminal. Servers can sometimes mess up the terminal on exit.
@@ -32,7 +32,7 @@ info_game.sh
 fn_print_header
 {
 	echo -e "${lightblue}Distro:\t\t${default}${distroname}"
-	echo -e "${lightblue}Arch:\t\t${default}${arch}"
+	echo -e "${lightblue}Architecture:\t\t${default}${arch}"
 	echo -e "${lightblue}Kernel:\t\t${default}${kernel}"
 	echo -e "${lightblue}Hostname:\t\t${default}${HOSTNAME}"
 	echo -e "${lightblue}tmux:\t\t${default}${tmuxv}"
@@ -70,7 +70,7 @@ fi
 
 fn_reload_startparameters
 echo -e "${lightblue}Start parameters:${default}"
-if [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then
+if [ "${engine}" == "source" ] || [ "${engine}" == "goldsrc" ]; then
 	echo -e "${executable} ${startparameters} -debug"
 elif [ "${engine}" == "quake" ]; then
 	echo -e "${executable} ${startparameters} -condebug"
@@ -111,7 +111,7 @@ else
 fi
 
 # Note: do not add double quotes to ${executable} ${startparameters}.
-if [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then
+if [ "${engine}" == "source" ] || [ "${engine}" == "goldsrc" ]; then
 	eval "${executable} ${startparameters} -debug"
 elif [ "${engine}" == "quake" ]; then
 	eval "${executable} ${startparameters} -condebug"

+ 2 - 2
lgsm/functions/command_details.sh

@@ -15,7 +15,7 @@ check.sh
 info_distro.sh
 info_game.sh
 info_messages.sh
-if [ "${querymode}" == "2" ]||[ "${querymode}" == "3" ]; then
+if [ "${querymode}" == "2" ] || [ "${querymode}" == "3" ]; then
 	for queryip in "${queryips[@]}"; do
 		query_gamedig.sh
 		if [ "${querystatus}" == "0" ]; then
@@ -30,7 +30,7 @@ fn_info_message_gameserver
 fn_info_message_script
 fn_info_message_backup
 # Some game servers do not have parms.
-if [ "${shortname}" != "jc2" ]&&[ "${shortname}" != "dst" ]&&[ "${shortname}" != "pz" ]&&[ "${engine}" != "renderware" ]; then
+if [ "${shortname}" != "jc2" ] && [ "${shortname}" != "dst" ] && [ "${shortname}" != "pz" ] && [ "${engine}" != "renderware" ]; then
 	fn_info_message_commandlineparms
 fi
 fn_info_message_ports_edit

+ 18 - 18
lgsm/functions/command_dev_detect_deps.sh

@@ -15,26 +15,26 @@ echo -e "Dependencies Checker"
 echo -e "================================="
 echo -e "Checking directory: "
 echo -e "${serverfiles}"
-if [ "$(command -v eu-readelf 2>/dev/null)" ]; then
+if [ "$(command -v eu-readelf 2> /dev/null)" ]; then
 	readelf=eu-readelf
-elif [ "$(command -v readelf 2>/dev/null)" ]; then
+elif [ "$(command -v readelf 2> /dev/null)" ]; then
 	readelf=readelf
 else
 	echo -e "readelf/eu-readelf not installed"
 fi
 files=$(find "${serverfiles}" | wc -l)
-find "${serverfiles}" -type f -print0 |
-while IFS= read -r -d $'\0' line; do
-	if [ "${readelf}" == "eu-readelf" ]; then
-		${readelf} -d "${line}" 2>/dev/null | grep NEEDED| awk '{ print $4 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
-	else
-		${readelf} -d "${line}" 2>/dev/null | grep NEEDED | awk '{ print $5 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
-	fi
-	echo -n "${i} / ${files}" $'\r'
-	((i++))
-done
+find "${serverfiles}" -type f -print0 \
+	| while IFS= read -r -d $'\0' line; do
+		if [ "${readelf}" == "eu-readelf" ]; then
+			${readelf} -d "${line}" 2> /dev/null | grep NEEDED | awk '{ print $4 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
+		else
+			${readelf} -d "${line}" 2> /dev/null | grep NEEDED | awk '{ print $5 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
+		fi
+		echo -n "${i} / ${files}" $'\r'
+		((i++))
+	done
 
-sort "${tmpdir}/.depdetect_readelf" |uniq >"${tmpdir}/.depdetect_readelf_uniq"
+sort "${tmpdir}/.depdetect_readelf" | uniq > "${tmpdir}/.depdetect_readelf_uniq"
 
 touch "${tmpdir}/.depdetect_centos_list"
 touch "${tmpdir}/.depdetect_ubuntu_list"
@@ -42,7 +42,7 @@ touch "${tmpdir}/.depdetect_debian_list"
 
 while read -r lib; do
 	echo -e "${lib}"
-	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
 			echo -e "glibc.i686" >> "${tmpdir}/.depdetect_centos_list"
@@ -52,7 +52,7 @@ while read -r lib; do
 		fi
 	done
 
-	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
 			echo -e "java-1.8.0-openjdk" >> "${tmpdir}/.depdetect_centos_list"
@@ -62,7 +62,7 @@ while read -r lib; do
 		fi
 	done
 
-	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.
 		if [ "${lib}" == "${lib_file}" ]; then
@@ -85,12 +85,12 @@ while read -r lib; do
 		echo -e "libcurl4-gnutls-dev:i386" >> "${tmpdir}/.depdetect_ubuntu_list"
 		echo -e "libcurl4-gnutls-dev:i386" >> "${tmpdir}/.depdetect_debian_list"
 		libdetected=1
-	elif [ "${lib}" == "libspeex.so.1" ]||[ "${lib}" == "libspeexdsp.so.1" ]; then
+	elif [ "${lib}" == "libspeex.so.1" ] || [ "${lib}" == "libspeexdsp.so.1" ]; then
 		echo -e "speex.i686" >> "${tmpdir}/.depdetect_centos_list"
 		echo -e "speex:i386" >> "${tmpdir}/.depdetect_ubuntu_list"
 		echo -e "speex:i386" >> "${tmpdir}/.depdetect_debian_list"
 		libdetected=1
-	elif [ "${lib}" == "./libSDL-1.2.so.0" ]||[ "${lib}" == "libSDL-1.2.so.0" ]; then
+	elif [ "${lib}" == "./libSDL-1.2.so.0" ] || [ "${lib}" == "libSDL-1.2.so.0" ]; then
 		echo -e "SDL.i686" >> "${tmpdir}/.depdetect_centos_list"
 		echo -e "libsdl1.2debian" >> "${tmpdir}/.depdetect_ubuntu_list"
 		echo -e "libsdl1.2debian" >> "${tmpdir}/.depdetect_debian_list"

+ 16 - 17
lgsm/functions/command_dev_detect_glibc.sh

@@ -34,8 +34,7 @@ elif [ -f "${serverfiles}" ]; then
 fi
 echo -e ""
 
-
-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
 		glibc_check_dir="${serverfiles}"
@@ -47,23 +46,23 @@ for glibc_check_var in "${glibc_check_dir_array[@]}"; do
 
 	if [ -d "${glibc_check_dir}" ]; then
 		glibc_check_files=$(find "${glibc_check_dir}" | wc -l)
-		find "${glibc_check_dir}" -type f -print0 |
-		while IFS= read -r -d $'\0' line; do
-			glibcversion=$(objdump -T "${line}" 2>/dev/null | grep -oP "GLIBC[^ ]+" | grep -v GLIBCXX | sort | uniq | sort -r --version-sort | head -n 1)
-			if [ "${glibcversion}" ]; then
-				echo -e "${glibcversion}: ${line}" >>"${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp"
-			fi
-			objdump -T "${line}" 2>/dev/null | grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc_${glibc_check_var}.tmp"
-			echo -n "${i} / ${glibc_check_files}" $'\r'
-			((i++))
-		done
-			echo -e ""
-			echo -e ""
-			echo -e "${glibc_check_name} glibc Requirements"
-			echo -e "================================="
+		find "${glibc_check_dir}" -type f -print0 \
+			| while IFS= read -r -d $'\0' line; do
+				glibcversion=$(objdump -T "${line}" 2> /dev/null | grep -oP "GLIBC[^ ]+" | grep -v GLIBCXX | sort | uniq | sort -r --version-sort | head -n 1)
+				if [ "${glibcversion}" ]; then
+					echo -e "${glibcversion}: ${line}" >> "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp"
+				fi
+				objdump -T "${line}" 2> /dev/null | grep -oP "GLIBC[^ ]+" >> "${tmpdir}/detect_glibc_${glibc_check_var}.tmp"
+				echo -n "${i} / ${glibc_check_files}" $'\r'
+				((i++))
+			done
+		echo -e ""
+		echo -e ""
+		echo -e "${glibc_check_name} glibc Requirements"
+		echo -e "================================="
 		if [ -f "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp" ]; then
 			echo -e "Required glibc"
-			cat "${tmpdir}/detect_glibc_${glibc_check_var}.tmp" | sort | uniq | sort -r --version-sort | head -1 |tee -a "${tmpdir}/detect_glibc_highest.tmp"
+			cat "${tmpdir}/detect_glibc_${glibc_check_var}.tmp" | sort | uniq | sort -r --version-sort | head -1 | tee -a "${tmpdir}/detect_glibc_highest.tmp"
 			echo -e ""
 			echo -e "Files requiring GLIBC"
 			echo -e "Highest verion required: filename"

+ 12 - 14
lgsm/functions/command_dev_detect_ldd.sh

@@ -31,21 +31,19 @@ touch "${tmpdir}/detect_ldd.tmp"
 touch "${tmpdir}/detect_ldd_not_found.tmp"
 
 files=$(find "${serverfiles}" | wc -l)
-find "${serverfiles}" -type f -print0 |
-while IFS= read -r -d $'\0' line; do
-	if ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable"
-	then
-		echo -e "${line}" >> "${tmpdir}/detect_ldd.tmp"
-		ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" >> "${tmpdir}/detect_ldd.tmp"
-		if ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" | grep "not found"
-		then
-			echo -e "${line}" >> "${tmpdir}/detect_ldd_not_found.tmp"
-			ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" | grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp"
+find "${serverfiles}" -type f -print0 \
+	| while IFS= read -r -d $'\0' line; do
+		if ldd "${line}" 2> /dev/null | grep -v "not a dynamic executable"; then
+			echo -e "${line}" >> "${tmpdir}/detect_ldd.tmp"
+			ldd "${line}" 2> /dev/null | grep -v "not a dynamic executable" >> "${tmpdir}/detect_ldd.tmp"
+			if ldd "${line}" 2> /dev/null | grep -v "not a dynamic executable" | grep "not found"; then
+				echo -e "${line}" >> "${tmpdir}/detect_ldd_not_found.tmp"
+				ldd "${line}" 2> /dev/null | grep -v "not a dynamic executable" | grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp"
+			fi
 		fi
-	fi
-	echo -n "$i / $files" $'\r'
-	((i++))
-done
+		echo -n "$i / $files" $'\r'
+		((i++))
+	done
 echo -e ""
 echo -e ""
 echo -e "All"

+ 141 - 142
lgsm/functions/command_dev_query_raw.sh

@@ -26,175 +26,174 @@ echo -e ""
 echo -e "${lightgreen}Game Server Ports${default}"
 echo -e "=================================================================="
 {
-echo -e "${lightblue}Port Name \tPort Number \tStatus \tTCP \tUDP${default}"
-if [ -v port ]; then
-	echo -e "Game: \t${port} \t$(ss -tupl|grep ${port}|wc -l) \t$(ss -tupl|grep ${port}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Game:"
-fi
-if [ "${shortname}" == "rw" ]; then
-	if [ -v port2 ]; then
-		echo -e "Game+1: \t${port2} \t$(ss -tupl|grep ${port}|wc -l) \t$(ss -tupl|grep ${port2}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port2}|grep udp|awk '{ print $2 }')"
+	echo -e "${lightblue}Port Name \tPort Number \tStatus \tTCP \tUDP${default}"
+	if [ -v port ]; then
+		echo -e "Game: \t${port} \t$(ss -tupl | grep ${port} | wc -l) \t$(ss -tupl | grep ${port} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port} | grep udp | awk '{ print $2 }')"
 	else
-		echo -e "Game+1:"
+		echo -e "Game:"
 	fi
+	if [ "${shortname}" == "rw" ]; then
+		if [ -v port2 ]; then
+			echo -e "Game+1: \t${port2} \t$(ss -tupl | grep ${port} | wc -l) \t$(ss -tupl | grep ${port2} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port2} | grep udp | awk '{ print $2 }')"
+		else
+			echo -e "Game+1:"
+		fi
 
-	if [ -v port3 ]; then
-		echo -e "Game+2: \t${port3} \t$(ss -tupl|grep ${port}|wc -l) \t$(ss -tupl|grep ${port3}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port3}|grep udp|awk '{ print $2 }')"
-	else
-		echo -e "Game+2:"
+		if [ -v port3 ]; then
+			echo -e "Game+2: \t${port3} \t$(ss -tupl | grep ${port} | wc -l) \t$(ss -tupl | grep ${port3} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port3} | grep udp | awk '{ print $2 }')"
+		else
+			echo -e "Game+2:"
+		fi
+
+		if [ -v port4 ]; then
+			echo -e "Game+3: \t${port4} \t$(ss -tupl | grep ${port} | wc -l) \t$(ss -tupl | grep ${port4} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port4} | grep udp | awk '{ print $2 }')"
+		else
+			echo -e "Game+3:"
+		fi
 	fi
 
-	if [ -v port4 ]; then
-		echo -e "Game+3: \t${port4} \t$(ss -tupl|grep ${port}|wc -l) \t$(ss -tupl|grep ${port4}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port4}|grep udp|awk '{ print $2 }')"
+	if [ -v port401 ]; then
+		echo -e "Game+400: \t${port401} \t$(ss -tupl | grep ${port401} | wc -l) \t$(ss -tupl | grep ${port401} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port401} | grep udp | awk '{ print $2 }')"
 	else
-		echo -e "Game+3:"
+		echo -e "Game+400:"
 	fi
-fi
-
-if [ -v port401 ]; then
-	echo -e "Game+400: \t${port401} \t$(ss -tupl|grep ${port401}|wc -l) \t$(ss -tupl|grep ${port401}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port401}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Game+400:"
-fi
-
-if [ -v portipv6 ]; then
-	echo -e "Game ipv6: \t${portipv6} \t$(ss -tupl|grep ${portipv6}|wc -l) \t$(ss -tupl|grep ${portipv6}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${portipv6}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Game ipv6:"
-fi
 
-if [ -v queryport ]; then
-	echo -e "Query: \t${queryport} \t$(ss -tupl|grep ${queryport}|wc -l) \t$(ss -tupl|grep ${queryport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${queryport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Query:"
-fi
+	if [ -v portipv6 ]; then
+		echo -e "Game ipv6: \t${portipv6} \t$(ss -tupl | grep ${portipv6} | wc -l) \t$(ss -tupl | grep ${portipv6} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${portipv6} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Game ipv6:"
+	fi
 
-if [ -v httpport ]; then
-	echo -e "HTTP: \t${httpport} \t$(ss -tupl|grep ${httpport}|wc -l) \t$(ss -tupl|grep ${httpport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${httpport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "HTTP:"
-fi
+	if [ -v queryport ]; then
+		echo -e "Query: \t${queryport} \t$(ss -tupl | grep ${queryport} | wc -l) \t$(ss -tupl | grep ${queryport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${queryport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Query:"
+	fi
 
-if [ -v httpqueryport ]; then
-	echo -e "HTTP Query: \t${httpqueryport} \t$(ss -tupl|grep ${httpqueryport}|wc -l) \t$(ss -tupl|grep ${httpqueryport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${httpqueryport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "HTTP Query:"
-fi
+	if [ -v httpport ]; then
+		echo -e "HTTP: \t${httpport} \t$(ss -tupl | grep ${httpport} | wc -l) \t$(ss -tupl | grep ${httpport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${httpport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "HTTP:"
+	fi
 
+	if [ -v httpqueryport ]; then
+		echo -e "HTTP Query: \t${httpqueryport} \t$(ss -tupl | grep ${httpqueryport} | wc -l) \t$(ss -tupl | grep ${httpqueryport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${httpqueryport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "HTTP Query:"
+	fi
 
-if [ -v webadminport ]; then
-	echo -e "Web Admin: \t${webadminport} \t$(ss -tupl|grep ${webadminport}|wc -l) \t$(ss -tupl|grep ${webadminport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${webadminport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Web Admin:"
-fi
+	if [ -v webadminport ]; then
+		echo -e "Web Admin: \t${webadminport} \t$(ss -tupl | grep ${webadminport} | wc -l) \t$(ss -tupl | grep ${webadminport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${webadminport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Web Admin:"
+	fi
 
-if [ -v clientport ]; then
-	echo -e "Client: \t${clientport} \t$(ss -tupl|grep ${clientport}|wc -l) \t$(ss -tupl|grep ${clientport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${clientport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Client:"
-fi
+	if [ -v clientport ]; then
+		echo -e "Client: \t${clientport} \t$(ss -tupl | grep ${clientport} | wc -l) \t$(ss -tupl | grep ${clientport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${clientport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Client:"
+	fi
 
-if [ -v rconport ]; then
-	echo -e "RCON: \t${rconport} \t$(ss -tupl|grep ${rconport}|wc -l) \t$(ss -tupl|grep ${rconport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${rconport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "RCON:"
-fi
+	if [ -v rconport ]; then
+		echo -e "RCON: \t${rconport} \t$(ss -tupl | grep ${rconport} | wc -l) \t$(ss -tupl | grep ${rconport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${rconport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "RCON:"
+	fi
 
-if [ -v rawport ]; then
-	echo -e "RAW UDP Socket: \t${rawport} \t$(ss -tupl|grep ${rawport}|wc -l) \t$(ss -tupl|grep ${rawport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${rawport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "RAW UDP Socket:"
-fi
+	if [ -v rawport ]; then
+		echo -e "RAW UDP Socket: \t${rawport} \t$(ss -tupl | grep ${rawport} | wc -l) \t$(ss -tupl | grep ${rawport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${rawport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "RAW UDP Socket:"
+	fi
 
-if [ -v masterport ]; then
-	echo -e "Game: Master: \t${masterport} \t$(ss -tupl|grep ${masterport}|wc -l) \t$(ss -tupl|grep ${masterport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${masterport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Game: Master:"
-fi
+	if [ -v masterport ]; then
+		echo -e "Game: Master: \t${masterport} \t$(ss -tupl | grep ${masterport} | wc -l) \t$(ss -tupl | grep ${masterport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${masterport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Game: Master:"
+	fi
 
-if [ -v steamport ]; then
-	echo -e "Steam: \t${steamport} \t$(ss -tupl|grep ${steamport}|wc -l) \t$(ss -tupl|grep ${steamport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${steamport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Steam:"
-fi
+	if [ -v steamport ]; then
+		echo -e "Steam: \t${steamport} \t$(ss -tupl | grep ${steamport} | wc -l) \t$(ss -tupl | grep ${steamport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${steamport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Steam:"
+	fi
 
-if [ -v steamauthport ]; then
-	echo -e "Steam: Auth: \t${steamauthport} \t$(ss -tupl|grep ${steamauthport}|wc -l) \t$(ss -tupl|grep ${steamauthport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${steamauthport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Steam: Auth:"
-fi
+	if [ -v steamauthport ]; then
+		echo -e "Steam: Auth: \t${steamauthport} \t$(ss -tupl | grep ${steamauthport} | wc -l) \t$(ss -tupl | grep ${steamauthport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${steamauthport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Steam: Auth:"
+	fi
 
-if [ -v steammasterport ]; then
-	echo -e "Steam: Master: \t${steammasterport} \t$(ss -tupl|grep ${steammasterport}|wc -l) \t$(ss -tupl|grep ${steammasterport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${steammasterport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Steam: Master:"
-fi
+	if [ -v steammasterport ]; then
+		echo -e "Steam: Master: \t${steammasterport} \t$(ss -tupl | grep ${steammasterport} | wc -l) \t$(ss -tupl | grep ${steammasterport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${steammasterport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Steam: Master:"
+	fi
 
-if [ -v steamqueryport ]; then
-	echo -e "Steam: Query: \t${steamqueryport} \t$(ss -tupl|grep ${steamqueryport}|wc -l) \t$(ss -tupl|grep ${steamqueryport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${steamqueryport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Steam: Query:"
-fi
-if [ -v beaconport ]; then
-	echo -e "Beacon: \t${beaconport} \t$(ss -tupl|grep ${beaconport}|wc -l) \t$(ss -tupl|grep ${beaconport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${beaconport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Beacon:"
-fi
+	if [ -v steamqueryport ]; then
+		echo -e "Steam: Query: \t${steamqueryport} \t$(ss -tupl | grep ${steamqueryport} | wc -l) \t$(ss -tupl | grep ${steamqueryport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${steamqueryport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Steam: Query:"
+	fi
+	if [ -v beaconport ]; then
+		echo -e "Beacon: \t${beaconport} \t$(ss -tupl | grep ${beaconport} | wc -l) \t$(ss -tupl | grep ${beaconport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${beaconport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Beacon:"
+	fi
 
-if [ -v appport ]; then
-	echo -e "App: \t${appport} \t$(ss -tupl|grep ${appport}|wc -l) \t$(ss -tupl|grep ${appport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${appport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "App:"
-fi
+	if [ -v appport ]; then
+		echo -e "App: \t${appport} \t$(ss -tupl | grep ${appport} | wc -l) \t$(ss -tupl | grep ${appport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${appport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "App:"
+	fi
 
-if [ -v telnetport ]; then
-	echo -e "Telnet: \t${telnetport} \t$(ss -tupl|grep ${telnetport}|wc -l) \t$(ss -tupl|grep ${telnetport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${telnetport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Telnet:"
-fi
+	if [ -v telnetport ]; then
+		echo -e "Telnet: \t${telnetport} \t$(ss -tupl | grep ${telnetport} | wc -l) \t$(ss -tupl | grep ${telnetport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${telnetport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Telnet:"
+	fi
 
-if [ -v sourcetvport ]; then
-	echo -e "SourceTV: \t${sourcetvport} \t$(ss -tupl|grep ${sourcetvport}|wc -l) \t$(ss -tupl|grep ${sourcetvport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${sourcetvport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "SourceTV:"
-fi
+	if [ -v sourcetvport ]; then
+		echo -e "SourceTV: \t${sourcetvport} \t$(ss -tupl | grep ${sourcetvport} | wc -l) \t$(ss -tupl | grep ${sourcetvport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${sourcetvport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "SourceTV:"
+	fi
 
-if [ -v fileport ]; then
-	echo -e "File: \t${fileport} \t$(ss -tupl|grep ${fileport}|wc -l) \t$(ss -tupl|grep ${fileport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${fileport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "File:"
-fi
+	if [ -v fileport ]; then
+		echo -e "File: \t${fileport} \t$(ss -tupl | grep ${fileport} | wc -l) \t$(ss -tupl | grep ${fileport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${fileport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "File:"
+	fi
 
-if [ -v udplinkport ]; then
-	echo -e "UDP Link: \t${udplinkport} \t$(ss -tupl|grep ${udplinkport}|wc -l) \t$(ss -tupl|grep ${udplinkport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${udplinkport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "UDP Link:"
-fi
+	if [ -v udplinkport ]; then
+		echo -e "UDP Link: \t${udplinkport} \t$(ss -tupl | grep ${udplinkport} | wc -l) \t$(ss -tupl | grep ${udplinkport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${udplinkport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "UDP Link:"
+	fi
 
-if [ -v voiceport ]; then
-	echo -e "Voice: \t${voiceport} \t$(ss -tupl|grep ${voiceport}|wc -l) \t$(ss -tupl|grep ${voiceport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${voiceport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Voice:"
-fi
+	if [ -v voiceport ]; then
+		echo -e "Voice: \t${voiceport} \t$(ss -tupl | grep ${voiceport} | wc -l) \t$(ss -tupl | grep ${voiceport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${voiceport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Voice:"
+	fi
 
-if [ -v voiceunusedport ]; then
-	echo -e "Voice (Unused): \t${voiceunusedport} \t$(ss -tupl|grep ${voiceunusedport}|wc -l) \t$(ss -tupl|grep ${voiceunusedport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${voiceunusedport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Voice (Unused):"
-fi
+	if [ -v voiceunusedport ]; then
+		echo -e "Voice (Unused): \t${voiceunusedport} \t$(ss -tupl | grep ${voiceunusedport} | wc -l) \t$(ss -tupl | grep ${voiceunusedport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${voiceunusedport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Voice (Unused):"
+	fi
 
-if [ -v battleeyeport ]; then
-	echo -e "BattleEye: \t${battleeyeport} \t$(ss -tupl|grep ${battleeyeport}|wc -l) \t$(ss -tupl|grep ${battleeyeport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${battleeyeport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "BattleEye:"
-fi
+	if [ -v battleeyeport ]; then
+		echo -e "BattleEye: \t${battleeyeport} \t$(ss -tupl | grep ${battleeyeport} | wc -l) \t$(ss -tupl | grep ${battleeyeport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${battleeyeport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "BattleEye:"
+	fi
 
-if [ -v statsport ]; then
-	echo -e "Stats: \t${battleeyeport} \t$(ss -tupl|grep ${statsport}|wc -l) \t$(ss -tupl|grep ${statsport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${statsport}|grep udp|awk '{ print $2 }')"
-else
-	echo -e "Stats:"
-fi
+	if [ -v statsport ]; then
+		echo -e "Stats: \t${battleeyeport} \t$(ss -tupl | grep ${statsport} | wc -l) \t$(ss -tupl | grep ${statsport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${statsport} | grep udp | awk '{ print $2 }')"
+	else
+		echo -e "Stats:"
+	fi
 
 } | column -s $'\t' -t
 echo -e ""
@@ -211,10 +210,10 @@ echo -e ""
 echo -e "${lightgreen}Gamedig Raw Output${default}"
 echo -e "================================="
 echo -e ""
-if [ ! "$(command -v gamedig 2>/dev/null)" ]; then
+if [ ! "$(command -v gamedig 2> /dev/null)" ]; then
 	fn_print_failure_nl "gamedig not installed"
 fi
-if [ ! "$(command -v jq 2>/dev/null)" ]; then
+if [ ! "$(command -v jq 2> /dev/null)" ]; then
 	fn_print_failure_nl "jq not installed"
 fi
 for queryip in "${queryips[@]}"; do

+ 36 - 31
lgsm/functions/command_fastdl.sh

@@ -24,7 +24,7 @@ luafastdlfile="lgsm_cl_force_fastdl.lua"
 luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
 
 # Check if bzip2 is installed.
-if [ ! "$(command -v bzip2 2>/dev/null)" ]; then
+if [ ! "$(command -v bzip2 2> /dev/null)" ]; then
 	fn_print_fail "bzip2 is not installed"
 	fn_script_log_fatal "bzip2 is not installed"
 	core_exit.sh
@@ -64,7 +64,7 @@ if [ "${shortname}" == "gmod" ]; then
 fi
 
 # Clears any fastdl directory content.
-fn_clear_old_fastdl(){
+fn_clear_old_fastdl() {
 	# Clearing old FastDL.
 	if [ -d "${fastdldir}" ]; then
 		echo -en "clearing existing FastDL directory ${fastdldir}..."
@@ -81,7 +81,7 @@ fn_clear_old_fastdl(){
 	fi
 }
 
-fn_fastdl_dirs(){
+fn_fastdl_dirs() {
 	# Check and create directories.
 	if [ ! -d "${webdir}" ]; then
 		echo -en "creating web directory ${webdir}..."
@@ -112,7 +112,7 @@ fn_fastdl_dirs(){
 }
 
 # Using this gist https://gist.github.com/agunnerson-ibm/efca449565a3e7356906
-fn_human_readable_file_size(){
+fn_human_readable_file_size() {
 	local abbrevs=(
 		$((1 << 60)):ZB
 		$((1 << 50)):EB
@@ -142,7 +142,7 @@ fn_human_readable_file_size(){
 }
 
 # Provides info about the fastdl directory content and prompts for confirmation.
-fn_fastdl_preview(){
+fn_fastdl_preview() {
 	# Remove any file list.
 	if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then
 		rm -f "${tmpdir:?}/fastdl_files_to_compress.txt"
@@ -152,13 +152,14 @@ fn_fastdl_preview(){
 	# Garry's Mod
 	if [ "${shortname}" == "gmod" ]; then
 		cd "${systemdir}" || exit
-		allowed_extentions_array=( "*.ain" "*.bsp" "*.mdl" "*.mp3" "*.ogg" "*.otf" "*.pcf" "*.phy" "*.png" "*.svg" "*.vtf" "*.vmt" "*.vtx" "*.vvd" "*.ttf" "*.wav" )
+		allowed_extentions_array=("*.ain" "*.bsp" "*.mdl" "*.mp3" "*.ogg" "*.otf" "*.pcf" "*.phy" "*.png" "*.svg" "*.vtf" "*.vmt" "*.vtx" "*.vvd" "*.ttf" "*.wav")
 		for allowed_extention in "${allowed_extentions_array[@]}"; do
 			fileswc=0
 			tput sc
 			while read -r ext; do
 				((fileswc++))
-				tput rc; tput el
+				tput rc
+				tput el
 				echo -e "gathering ${allowed_extention} : ${fileswc}..."
 				echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
 			done < <(find . -type f -iname "${allowed_extention}")
@@ -170,30 +171,32 @@ fn_fastdl_preview(){
 		done
 	# Source engine
 	else
-		fastdl_directories_array=( "maps" "materials" "models" "particles" "sound" "resources" )
+		fastdl_directories_array=("maps" "materials" "models" "particles" "sound" "resources")
 		for directory in "${fastdl_directories_array[@]}"; do
 			if [ -d "${systemdir}/${directory}" ]; then
 				if [ "${directory}" == "maps" ]; then
-					local allowed_extentions_array=( "*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt" )
+					local allowed_extentions_array=("*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt")
 				elif [ "${directory}" == "materials" ]; then
-					local allowed_extentions_array=( "*.vtf" "*.vmt" "*.vbf" "*.png" "*.svg" )
+					local allowed_extentions_array=("*.vtf" "*.vmt" "*.vbf" "*.png" "*.svg")
 				elif [ "${directory}" == "models" ]; then
-					local allowed_extentions_array=( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" "*.vmt" "*.vtf" )
+					local allowed_extentions_array=("*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" "*.vmt" "*.vtf")
 				elif [ "${directory}" == "particles" ]; then
-					local allowed_extentions_array=( "*.pcf" )
+					local allowed_extentions_array=("*.pcf")
 				elif [ "${directory}" == "sound" ]; then
-					local allowed_extentions_array=( "*.wav" "*.mp3" "*.ogg" )
+					local allowed_extentions_array=("*.wav" "*.mp3" "*.ogg")
 				fi
 				for allowed_extention in "${allowed_extentions_array[@]}"; do
 					fileswc=0
 					tput sc
 					while read -r ext; do
 						((fileswc++))
-						tput rc; tput el
+						tput rc
+						tput el
 						echo -e "gathering ${directory} ${allowed_extention} : ${fileswc}..."
 						echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
 					done < <(find "${systemdir}/${directory}" -type f -iname "${allowed_extention}")
-					tput rc; tput el
+					tput rc
+					tput el
 					echo -e "gathering ${directory} ${allowed_extention} : ${fileswc}..."
 					if [ ${fileswc} != 0 ]; then
 						fn_print_ok_eol_nl
@@ -211,14 +214,14 @@ fn_fastdl_preview(){
 		# Calculates total file size.
 		while read -r dufile; do
 			filesize=$(stat -c %s "${dufile}")
-			filesizetotal=$(( filesizetotal+filesize ))
+			filesizetotal=$((filesizetotal + filesize))
 			exitcode=$?
 			if [ "${exitcode}" != 0 ]; then
 				fn_print_fail_eol_nl
 				fn_script_log_fatal "Calculating total file size."
 				core_exit.sh
 			fi
-		done <"${tmpdir}/fastdl_files_to_compress.txt"
+		done < "${tmpdir}/fastdl_files_to_compress.txt"
 	else
 		fn_print_fail_eol_nl "generating file list"
 		fn_script_log_fatal "Generating file list."
@@ -234,14 +237,15 @@ fn_fastdl_preview(){
 }
 
 # Builds Garry's Mod fastdl directory content.
-fn_fastdl_gmod(){
+fn_fastdl_gmod() {
 	cd "${systemdir}" || exit
 	for allowed_extention in "${allowed_extentions_array[@]}"; do
 		fileswc=0
 		tput sc
 		while read -r fastdlfile; do
 			((fileswc++))
-			tput rc; tput el
+			tput rc
+			tput el
 			echo -e "copying ${allowed_extention} : ${fileswc}..."
 			cp --parents "${fastdlfile}" "${fastdldir}"
 			exitcode=$?
@@ -305,30 +309,31 @@ fn_fastdl_gmod(){
 		while read -r dufile; do
 			filesize=$(du -b "${dufile}" | awk '{ print $1 }')
 			filesizetotal=$((filesizetotal + filesize))
-		done <"${tmpdir}/fastdl_files_to_compress.txt"
+		done < "${tmpdir}/fastdl_files_to_compress.txt"
 	fi
 }
 
-fn_fastdl_source(){
+fn_fastdl_source() {
 	for directory in "${fastdl_directories_array[@]}"; do
 		if [ -d "${systemdir}/${directory}" ]; then
 			if [ "${directory}" == "maps" ]; then
-				local allowed_extentions_array=( "*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt" )
+				local allowed_extentions_array=("*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt")
 			elif [ "${directory}" == "materials" ]; then
-				local allowed_extentions_array=( "*.vtf" "*.vmt" "*.vbf" "*.png" "*.svg" )
+				local allowed_extentions_array=("*.vtf" "*.vmt" "*.vbf" "*.png" "*.svg")
 			elif [ "${directory}" == "models" ]; then
-				local allowed_extentions_array=( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" )
+				local allowed_extentions_array=("*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png")
 			elif [ "${directory}" == "particles" ]; then
-				local allowed_extentions_array=( "*.pcf" )
+				local allowed_extentions_array=("*.pcf")
 			elif [ "${directory}" == "sound" ]; then
-				local allowed_extentions_array=( "*.wav" "*.mp3" "*.ogg" )
+				local allowed_extentions_array=("*.wav" "*.mp3" "*.ogg")
 			fi
 			for allowed_extention in "${allowed_extentions_array[@]}"; do
 				fileswc=0
 				tput sc
 				while read -r fastdlfile; do
 					((fileswc++))
-					tput rc; tput el
+					tput rc
+					tput el
 					echo -e "copying ${directory} ${allowed_extention} : ${fileswc}..."
 					fn_sleep_time
 					# get relative path of file in the dir
@@ -357,7 +362,7 @@ fn_fastdl_source(){
 }
 
 # Builds the fastdl directory content.
-fn_fastdl_build(){
+fn_fastdl_build() {
 	# Copy all needed files for FastDL.
 	echo -e "copying files to ${fastdldir}"
 	fn_script_log_info "Copying files to ${fastdldir}"
@@ -370,7 +375,7 @@ fn_fastdl_build(){
 }
 
 # Generate lua file that will force download any file into the FastDL directory.
-fn_fastdl_gmod_dl_enforcer(){
+fn_fastdl_gmod_dl_enforcer() {
 	# Clear old lua file.
 	if [ -f "${luafastdlfullpath}" ]; then
 		echo -en "removing existing download enforcer: ${luafastdlfile}..."
@@ -406,7 +411,7 @@ fn_fastdl_gmod_dl_enforcer(){
 }
 
 # Compresses FastDL files using bzip2.
-fn_fastdl_bzip2(){
+fn_fastdl_bzip2() {
 	while read -r filetocompress; do
 		echo -en "\r\033[Kcompressing ${filetocompress}..."
 		bzip2 -f "${filetocompress}"
@@ -418,7 +423,7 @@ fn_fastdl_bzip2(){
 		else
 			fn_script_log_pass "Compressing ${filetocompress}"
 		fi
-	done < <(find  "${fastdldir:?}" \( -type f ! -name "*.bz2" \))
+	done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \))
 	fn_print_ok_eol_nl
 }
 

+ 1 - 1
lgsm/functions/command_install_resources_mta.sh

@@ -10,7 +10,7 @@ commandaction="Default Resources"
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 fn_firstcommand_set
 
-fn_install_resources(){
+fn_install_resources() {
 	echo -e ""
 	echo -e "Installing Default Resources"
 	echo -e "================================="

+ 11 - 11
lgsm/functions/command_mods_install.sh

@@ -21,7 +21,7 @@ if [ "${installedmodscount}" -gt "0" ]; then
 	echo -e "Installed addons/mods"
 	echo -e "================================="
 	# Go through all available commands, get details and display them to the user.
-	for ((llindex=0; llindex < ${#installedmodslist[@]}; llindex++)); do
+	for ((llindex = 0; llindex < ${#installedmodslist[@]}; llindex++)); do
 		# Current mod is the "llindex" value of the array we're going through.
 		currentmod="${installedmodslist[llindex]}"
 		fn_mod_get_info
@@ -40,9 +40,9 @@ compatiblemodslistindex=0
 while [ "${compatiblemodslistindex}" -lt "${#compatiblemodslist[@]}" ]; do
 	# Set values for convenience.
 	displayedmodname="${compatiblemodslist[compatiblemodslistindex]}"
-	displayedmodcommand="${compatiblemodslist[compatiblemodslistindex+1]}"
-	displayedmodsite="${compatiblemodslist[compatiblemodslistindex+2]}"
-	displayedmoddescription="${compatiblemodslist[compatiblemodslistindex+3]}"
+	displayedmodcommand="${compatiblemodslist[compatiblemodslistindex + 1]}"
+	displayedmodsite="${compatiblemodslist[compatiblemodslistindex + 2]}"
+	displayedmoddescription="${compatiblemodslist[compatiblemodslistindex + 3]}"
 	# Output mods to the user.
 	echo -e "${displayedmodname} - ${displayedmoddescription} - ${displayedmodsite}"
 	echo -e " * ${cyan}${displayedmodcommand}${default}"
@@ -65,8 +65,8 @@ while [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; do
 	echo -en "Enter an ${cyan}addon/mod${default} to ${green}install${default} (or exit to abort): "
 	read -r usermodselect
 	# Exit if user says exit or abort.
-	if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
-			core_exit.sh
+	if [ "${usermodselect}" == "exit" ] || [ "${usermodselect}" == "abort" ]; then
+		core_exit.sh
 	# Supplementary output upon invalid user input.
 	elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
 		fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
@@ -100,11 +100,11 @@ if [ "${modcommand}" == "amxmodx" ]; then
 	fn_mod_exist "metamod"
 fi
 
-if [ "${modcommand}" == "amxmodxcs"  ] ||
-   [ "${modcommand}" == "amxmodxdod" ] ||
-   [ "${modcommand}" == "amxmodxtfc" ] ||
-   [ "${modcommand}" == "amxmodxns"  ] ||
-   [ "${modcommand}" == "amxmodxts"  ]; then
+if [ "${modcommand}" == "amxmodxcs" ] \
+	|| [ "${modcommand}" == "amxmodxdod" ] \
+	|| [ "${modcommand}" == "amxmodxtfc" ] \
+	|| [ "${modcommand}" == "amxmodxns" ] \
+	|| [ "${modcommand}" == "amxmodxts" ]; then
 	fn_mod_exist "amxmodx"
 fi
 

+ 7 - 6
lgsm/functions/command_mods_remove.sh

@@ -21,7 +21,7 @@ echo -e "================================="
 # Displays list of installed mods.
 # Generates list to display to user.
 fn_mods_installed_list
-for ((mlindex=0; mlindex < ${#installedmodslist[@]}; mlindex++)); do
+for ((mlindex = 0; mlindex < ${#installedmodslist[@]}; mlindex++)); do
 	# Current mod is the "mlindex" value of the array we are going through.
 	currentmod="${installedmodslist[mlindex]}"
 	# Get mod info.
@@ -36,7 +36,7 @@ while [[ ! " ${installedmodslist[@]} " =~ " ${usermodselect} " ]]; do
 	echo -en "Enter an ${cyan}addon/mod${default} to ${red}remove${default} (or exit to abort): "
 	read -r usermodselect
 	# Exit if user says exit or abort.
-	if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
+	if [ "${usermodselect}" == "exit" ] || [ "${usermodselect}" == "abort" ]; then
 		core_exit.sh
 	# Supplementary output upon invalid user input.
 	elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
@@ -68,9 +68,9 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
 	currentfileremove=$(sed "${modfileline}q;d" "${modsdir}/${modcommand}-files.txt")
 	# If file or directory exists, then remove it.
 
-	if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then
+	if [ -f "${modinstalldir}/${currentfileremove}" ] || [ -d "${modinstalldir}/${currentfileremove}" ]; then
 		rm -rf "${modinstalldir:?}/${currentfileremove:?}"
-		((exitcode=$?))
+		((exitcode = $?))
 		if [ "${exitcode}" != 0 ]; then
 			fn_script_log_fatal "Removing ${modinstalldir}/${currentfileremove}"
 			break
@@ -78,7 +78,8 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
 			fn_script_log_pass "Removing ${modinstalldir}/${currentfileremove}"
 		fi
 	fi
-	tput rc; tput el
+	tput rc
+	tput el
 	echo -e "removing ${modprettyname} ${modfileline} / ${modsfilelistsize} : ${currentfileremove}..."
 	((modfileline++))
 done
@@ -127,7 +128,7 @@ fi
 
 # Oxide fix
 # Oxide replaces server files, so a validate is required after uninstall.
-if [ "${engine}" == "unity3d" ]&&[[ "${modprettyname}" == *"Oxide"* ]]; then
+if [ "${engine}" == "unity3d" ] && [[ "${modprettyname}" == *"Oxide"* ]]; then
 	fn_print_information_nl "Validating to restore original ${gamename} files replaced by Oxide"
 	fn_script_log "Validating to restore original ${gamename} files replaced by Oxide"
 	exitbypass="1"

+ 7 - 7
lgsm/functions/command_mods_update.sh

@@ -15,25 +15,25 @@ mods_core.sh
 
 # Prevents specific files being overwritten upon update (set by ${modkeepfiles}).
 # For that matter, remove cfg files after extraction before copying them to destination.
-fn_remove_cfg_files(){
-	if [ "${modkeepfiles}" !=  "OVERWRITE" ]&&[ "${modkeepfiles}" != "NOUPDATE" ]; then
+fn_remove_cfg_files() {
+	if [ "${modkeepfiles}" != "OVERWRITE" ] && [ "${modkeepfiles}" != "NOUPDATE" ]; then
 		echo -e "the following files/directories will be preserved:"
 		fn_sleep_time
 		# Count how many files there are to remove.
 		filestopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' '{ print NF }')
 		# Test all subvalues of "modkeepfiles" using the ";" separator.
-		for ((preservefilesindex=1; preservefilesindex < filestopreserve; preservefilesindex++)); do
+		for ((preservefilesindex = 1; preservefilesindex < filestopreserve; preservefilesindex++)); do
 			# Put the current file we are looking for into a variable.
-			filetopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' -v x=${preservefilesindex} '{ print $x }' )
+			filetopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' -v x=${preservefilesindex} '{ print $x }')
 			echo -e "	* serverfiles/${filetopreserve}"
 			# If it matches an existing file that have been extracted delete the file.
-			if [ -f "${extractdir}/${filetopreserve}" ]||[ -d "${extractdir}/${filetopreserve}" ]; then
+			if [ -f "${extractdir}/${filetopreserve}" ] || [ -d "${extractdir}/${filetopreserve}" ]; then
 				rm -r "${extractdir:?}/${filetopreserve}"
 				# Write the file path in a tmp file, to rebuild a full file list as it is rebuilt upon update.
 				if [ ! -f "${modsdir}/.removedfiles.tmp" ]; then
 					touch "${modsdir}/.removedfiles.tmp"
 				fi
-					echo -e "${filetopreserve}" >> "${modsdir}/.removedfiles.tmp"
+				echo -e "${filetopreserve}" >> "${modsdir}/.removedfiles.tmp"
 			fi
 		done
 	fi
@@ -45,7 +45,7 @@ fn_print_info_nl "Update addons/mods: ${installedmodscount} addons/mods will be
 fn_script_log_info "${installedmodscount} mods or addons will be updated"
 fn_mods_installed_list
 # Go through all available commands, get details and display them to the user.
-for ((ulindex=0; ulindex < ${#installedmodslist[@]}; ulindex++)); do
+for ((ulindex = 0; ulindex < ${#installedmodslist[@]}; ulindex++)); do
 	# Current mod is the "ulindex" value of the array we're going through.
 	currentmod="${installedmodslist[ulindex]}"
 	fn_mod_get_info

+ 92 - 92
lgsm/functions/command_monitor.sh

@@ -11,7 +11,7 @@ commandaction="Monitoring"
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 fn_firstcommand_set
 
-fn_monitor_check_lockfile(){
+fn_monitor_check_lockfile() {
 	# Monitor does not run it lockfile is not found.
 	if [ ! -f "${lockdir}/${selfname}.lock" ]; then
 		fn_print_dots "Checking lockfile: "
@@ -25,14 +25,14 @@ fn_monitor_check_lockfile(){
 	fi
 
 	# Fix if lockfile is not unix time or contains letters
-	if [ -f "${lockdir}/${selfname}.lock" ]&&[[ "$(head -n 1 "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then
+	if [ -f "${lockdir}/${selfname}.lock" ] && [[ "$(head -n 1 "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then
 		date '+%s' > "${lockdir}/${selfname}.lock"
 		echo "${version}" >> "${lockdir}/${selfname}.lock"
 		echo "${port}" >> "${lockdir}/${selfname}.lock"
 	fi
 }
 
-fn_monitor_check_update(){
+fn_monitor_check_update() {
 	# Monitor will check if update is already running.
 	if [ "$(pgrep "${selfname} update" | wc -l)" != "0" ]; then
 		fn_print_dots "Checking active updates: "
@@ -45,7 +45,7 @@ fn_monitor_check_update(){
 	fi
 }
 
-fn_monitor_check_session(){
+fn_monitor_check_session() {
 	fn_print_dots "Checking session: "
 	fn_print_checking_eol
 	fn_script_log_info "Checking session: CHECKING"
@@ -66,13 +66,13 @@ fn_monitor_check_session(){
 	fi
 }
 
-fn_monitor_check_queryport(){
+fn_monitor_check_queryport() {
 	# Monitor will check queryport is set before continuing.
-	if [ -z "${queryport}" ]||[ "${queryport}" == "0" ]; then
+	if [ -z "${queryport}" ] || [ "${queryport}" == "0" ]; then
 		fn_print_dots "Checking port: "
 		fn_print_checking_eol
 		fn_script_log_info "Checking port: CHECKING"
-		if [ -n "${rconenabled}" ]&&[ "${rconenabled}" != "true" ]&&[ ${shortname} == "av" ]; then
+		if [ -n "${rconenabled}" ] && [ "${rconenabled}" != "true" ] && [ ${shortname} == "av" ]; then
 			fn_print_warn "Checking port: Unable to query, rcon is not enabled"
 			fn_script_log_warn "Checking port: Unable to query, rcon is not enabled"
 		else
@@ -83,7 +83,7 @@ fn_monitor_check_queryport(){
 	fi
 }
 
-fn_query_gsquery(){
+fn_query_gsquery() {
 	if [ ! -f "${functionsdir}/query_gsquery.py" ]; then
 		fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nohash"
 	fi
@@ -91,93 +91,93 @@ fn_query_gsquery(){
 	querystatus="$?"
 }
 
-fn_query_tcp(){
+fn_query_tcp() {
 	bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}'' > /dev/null 2>&1
 	querystatus="$?"
 }
 
-fn_monitor_query(){
-# Will loop and query up to 5 times every 15 seconds.
-# Query will wait up to 60 seconds to confirm server is down as server can become non-responsive during map changes.
-totalseconds=0
-for queryattempt in {1..5}; do
-	for queryip in "${queryips[@]}"; do
-		fn_print_dots "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
-		fn_print_querying_eol
-		fn_script_log_info "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : QUERYING"
-		# querydelay
-		if [ "$(head -n 1 "${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_script_log_info "Server started: $(date -d @$(head -n 1 "${lockdir}/${selfname}.lock"))"
-			fn_script_log_info "Current time: $(date)"
-			monitorpass=1
-			core_exit.sh
-		# will use query method selected in fn_monitor_loop
-		# gamedig
-		elif [ "${querymethod}" ==  "gamedig" ]; then
-			query_gamedig.sh
-		# gsquery
-		elif [ "${querymethod}" ==  "gsquery" ]; then
-			fn_query_gsquery
-		#tcp query
-		elif [ "${querymethod}" ==  "tcp" ]; then
-			fn_query_tcp
-		fi
+fn_monitor_query() {
+	# Will loop and query up to 5 times every 15 seconds.
+	# Query will wait up to 60 seconds to confirm server is down as server can become non-responsive during map changes.
+	totalseconds=0
+	for queryattempt in {1..5}; do
+		for queryip in "${queryips[@]}"; do
+			fn_print_dots "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
+			fn_print_querying_eol
+			fn_script_log_info "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : QUERYING"
+			# querydelay
+			if [ "$(head -n 1 "${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_script_log_info "Server started: $(date -d @$(head -n 1 "${lockdir}/${selfname}.lock"))"
+				fn_script_log_info "Current time: $(date)"
+				monitorpass=1
+				core_exit.sh
+			# will use query method selected in fn_monitor_loop
+			# gamedig
+			elif [ "${querymethod}" == "gamedig" ]; then
+				query_gamedig.sh
+			# gsquery
+			elif [ "${querymethod}" == "gsquery" ]; then
+				fn_query_gsquery
+			#tcp query
+			elif [ "${querymethod}" == "tcp" ]; then
+				fn_query_tcp
+			fi
 
-		if [ "${querystatus}" == "0" ]; then
-			# Server query OK.
-			fn_print_ok "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
-			fn_print_ok_eol_nl
-			fn_script_log_pass "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: OK"
-			monitorpass=1
 			if [ "${querystatus}" == "0" ]; then
-				# Add query data to log.
-				if [ "${gdname}" ]; then
-					fn_script_log_info "Server name: ${gdname}"
-				fi
-				if [ "${gdplayers}" ]; then
-					fn_script_log_info "Players: ${gdplayers}/${gdmaxplayers}"
-				fi
-				if [ "${gdbots}" ]; then
-					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
+				# Server query OK.
+				fn_print_ok "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
+				fn_print_ok_eol_nl
+				fn_script_log_pass "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: OK"
+				monitorpass=1
+				if [ "${querystatus}" == "0" ]; then
+					# Add query data to log.
+					if [ "${gdname}" ]; then
+						fn_script_log_info "Server name: ${gdname}"
+					fi
+					if [ "${gdplayers}" ]; then
+						fn_script_log_info "Players: ${gdplayers}/${gdmaxplayers}"
+					fi
+					if [ "${gdbots}" ]; then
+						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
-			fi
-			core_exit.sh
-		else
-			# Server query FAIL.
-			fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
-			fn_print_fail_eol
-			fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: FAIL"
-			# Monitor will try gamedig (if supported) for first 30s then gsquery before restarting.
-			# gsquery will fail if longer than 60s
-			if [ "${totalseconds}" -ge "59" ]; then
-				# Monitor will FAIL if over 60s and trigger gane server reboot.
+				core_exit.sh
+			else
+				# Server query FAIL.
 				fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
-				fn_print_fail_eol_nl
+				fn_print_fail_eol
 				fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: FAIL"
-				# Send alert if enabled.
-				alert="restartquery"
-				alert.sh
-				command_restart.sh
-				fn_firstcommand_reset
-				core_exit.sh
+				# Monitor will try gamedig (if supported) for first 30s then gsquery before restarting.
+				# gsquery will fail if longer than 60s
+				if [ "${totalseconds}" -ge "59" ]; then
+					# Monitor will FAIL if over 60s and trigger gane server reboot.
+					fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
+					fn_print_fail_eol_nl
+					fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: FAIL"
+					# Send alert if enabled.
+					alert="restartquery"
+					alert.sh
+					command_restart.sh
+					fn_firstcommand_reset
+					core_exit.sh
+				fi
 			fi
-		fi
-	done
+		done
 		# 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}: ${cyan}WAIT${default}"
@@ -187,25 +187,25 @@ for queryattempt in {1..5}; do
 				break
 			fi
 		done
-done
+	done
 }
 
-fn_monitor_loop(){
+fn_monitor_loop() {
 	# loop though query methods selected by querymode.
 	totalseconds=0
 	if [ "${querymode}" == "2" ]; then
-		local query_methods_array=( gamedig gsquery )
+		local query_methods_array=(gamedig gsquery)
 	elif [ "${querymode}" == "3" ]; then
-		local query_methods_array=( gamedig )
+		local query_methods_array=(gamedig)
 	elif [ "${querymode}" == "4" ]; then
-			local query_methods_array=( gsquery )
+		local query_methods_array=(gsquery)
 	elif [ "${querymode}" == "5" ]; then
-		local query_methods_array=( tcp )
+		local query_methods_array=(tcp)
 	fi
 	for querymethod in "${query_methods_array[@]}"; do
 		# Will check if gamedig is installed and bypass if not.
 		if [ "${querymethod}" == "gamedig" ]; then
-			if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then
+			if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then
 				if [ -z "${monitorpass}" ]; then
 					fn_monitor_query
 				fi

+ 2 - 3
lgsm/functions/command_postdetails.sh

@@ -34,8 +34,7 @@ else
 	info_game.sh
 	info_distro.sh
 	info_messages.sh
-	for queryip in "${queryips[@]}"
-	do
+	for queryip in "${queryips[@]}"; do
 		query_gamedig.sh
 		if [ "${querystatus}" == "0" ]; then
 			break
@@ -50,7 +49,7 @@ else
 		fn_info_message_script
 		fn_info_message_backup
 		# Some game servers do not have parms.
-		if [ "${shortname}" != "jc2" ]&&[ "${shortname}" != "jc3" ]&&[ "${shortname}" != "dst" ]&&[ "${shortname}" != "pz" ]&&[ "${engine}" != "renderware" ]; then
+		if [ "${shortname}" != "jc2" ] && [ "${shortname}" != "jc3" ] && [ "${shortname}" != "dst" ] && [ "${shortname}" != "pz" ] && [ "${engine}" != "renderware" ]; then
 			fn_info_message_commandlineparms
 		fi
 		fn_info_message_ports_edit

+ 1 - 1
lgsm/functions/command_send.sh

@@ -22,7 +22,7 @@ if [ "${status}" != "0" ]; then
 		commandtosend="${userinput2}"
 	else
 		echo ""
-		commandtosend=$( fn_prompt_message "send: " )
+		commandtosend=$(fn_prompt_message "send: ")
 	fi
 	echo ""
 	fn_print_dots "Sending command to console: \"${commandtosend}\""

+ 1 - 1
lgsm/functions/command_skeleton.sh

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

+ 15 - 16
lgsm/functions/command_start.sh

@@ -10,17 +10,17 @@ commandaction="Starting"
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 fn_firstcommand_set
 
-fn_start_teamspeak3(){
+fn_start_teamspeak3() {
 	if [ ! -f "${servercfgfullpath}" ]; then
 		fn_print_warn_nl "${servercfgfullpath} is missing"
 		fn_script_log_warn "${servercfgfullpath} is missing"
-		echo  "	* Creating blank ${servercfg}"
+		echo "	* Creating blank ${servercfg}"
 		fn_script_log_info "Creating blank ${servercfg}"
 		fn_sleep_time
-		echo  "	* ${servercfg} can remain blank by default."
+		echo "	* ${servercfg} can remain blank by default."
 		fn_script_log_info "${servercfgfullpath} can remain blank by default."
 		fn_sleep_time
-		echo  "	* ${servercfg} is located in ${servercfgfullpath}."
+		echo "	* ${servercfg} is located in ${servercfgfullpath}."
 		fn_script_log_info "${servercfg} is located in ${servercfgfullpath}."
 		sleep 5
 		touch "${servercfgfullpath}"
@@ -34,12 +34,12 @@ fn_start_teamspeak3(){
 
 # This will allow the Jedi Knight 2 version to be printed in console on start.
 # Used to allow update to detect JK2MV server version.
-fn_start_jk2(){
+fn_start_jk2() {
 	fn_start_tmux
 	tmux send -t "${sessionname}" version ENTER > /dev/null 2>&1
 }
 
-fn_start_tmux(){
+fn_start_tmux() {
 	if [ "${parmsbypass}" ]; then
 		startparameters=""
 	fi
@@ -57,7 +57,7 @@ fn_start_tmux(){
 
 	# Log rotation.
 	fn_script_log_info "Rotating log files"
-	if [ "${engine}" == "unreal2" ]&&[ -f "${gamelog}" ]; then
+	if [ "${engine}" == "unreal2" ] && [ -f "${gamelog}" ]; then
 		mv "${gamelog}" "${gamelogdate}"
 	fi
 	if [ -f "${lgsmlog}" ]; then
@@ -91,7 +91,7 @@ fn_start_tmux(){
 	if [ "${tmuxv}" == "master" ]; then
 		fn_script_log "tmux version: master (user compiled)"
 		echo -e "tmux version: master (user compiled)" >> "${consolelog}"
-		if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
+		if [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then
 			tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
 		fi
 	elif [ -n "${tmuxv}" ]; then
@@ -107,7 +107,7 @@ fn_start_tmux(){
 			https://linuxgsm.com/tmux-upgrade
 			Currently installed: $(tmux -V)" > "${consolelog}"
 		# Console logging enable or not set.
-		elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
+		elif [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then
 			tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
 		fi
 	else
@@ -140,11 +140,10 @@ fn_start_tmux(){
 			cat "${lgsmlogdir}/.${selfname}-tmux-error.tmp" | tee -a "${lgsmlog}"
 
 			# Detected error https://linuxgsm.com/support
-			if grep -c "Operation not permitted" "${lgsmlogdir}/.${selfname}-tmux-error.tmp"
-			then
-			echo -e ""
-			echo -e "Fix"
-			echo -e "================================="
+			if grep -c "Operation not permitted" "${lgsmlogdir}/.${selfname}-tmux-error.tmp"; then
+				echo -e ""
+				echo -e "Fix"
+				echo -e "================================="
 				if ! grep "tty:" /etc/group | grep "$(whoami)"; then
 					echo -e "$(whoami) is not part of the tty group."
 					fn_script_log_info "$(whoami) is not part of the tty group."
@@ -172,7 +171,7 @@ fn_start_tmux(){
 		fn_print_ok "${servername}"
 		fn_script_log_pass "Started ${servername}"
 	fi
-	rm "${lgsmlogdir:?}/.${selfname}-tmux-error.tmp" 2>/dev/null
+	rm "${lgsmlogdir:?}/.${selfname}-tmux-error.tmp" 2> /dev/null
 	echo -en "\n"
 }
 
@@ -195,7 +194,7 @@ info_game.sh
 core_logs.sh
 
 # Will check for updates is updateonstart is yes.
-if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
+if [ "${updateonstart}" == "yes" ] || [ "${updateonstart}" == "1" ] || [ "${updateonstart}" == "on" ]; then
 	exitbypass=1
 	unset updateonstart
 	command_update.sh

+ 17 - 15
lgsm/functions/command_stop.sh

@@ -11,11 +11,11 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 fn_firstcommand_set
 
 # Attempts graceful shutdown by sending 'CTRL+c'.
-fn_stop_graceful_ctrlc(){
+fn_stop_graceful_ctrlc() {
 	fn_print_dots "Graceful: CTRL+c"
 	fn_script_log_info "Graceful: CTRL+c"
 	# Sends quit.
-	tmux send-keys -t "${sessionname}" 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
@@ -39,13 +39,13 @@ fn_stop_graceful_ctrlc(){
 # Attempts graceful shutdown by sending a specified command.
 # Usage: fn_stop_graceful_cmd "console_command" "timeout_in_seconds"
 # e.g.: fn_stop_graceful_cmd "quit" "30"
-fn_stop_graceful_cmd(){
+fn_stop_graceful_cmd() {
 	fn_print_dots "Graceful: sending \"${1}\""
 	fn_script_log_info "Graceful: sending \"${1}\""
 	# Sends specific stop command.
 	tmux send -t "${sessionname}" ENTER "${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
+	for ((seconds = 1; seconds <= ${2}; seconds++)); do
 		check_status.sh
 		if [ "${status}" == "0" ]; then
 			fn_print_ok "Graceful: sending \"${1}\": ${seconds}: "
@@ -67,7 +67,7 @@ fn_stop_graceful_cmd(){
 # Attempts graceful shutdown of goldsrc using rcon 'quit' command.
 # There is only a 3 second delay before a forced a tmux shutdown
 # as GoldSrc servers 'quit' command does a restart rather than shutdown.
-fn_stop_graceful_goldsrc(){
+fn_stop_graceful_goldsrc() {
 	fn_print_dots "Graceful: sending \"quit\""
 	fn_script_log_info "Graceful: sending \"quit\""
 	# sends quit
@@ -83,9 +83,9 @@ fn_stop_graceful_goldsrc(){
 }
 
 # telnet command for sdtd graceful shutdown.
-fn_stop_graceful_sdtd_telnet(){
-	if [ -z "${telnetpass}" ]||[ "${telnetpass}" == "NOT SET" ]; then
-		sdtd_telnet_shutdown=$( expect -c '
+fn_stop_graceful_sdtd_telnet() {
+	if [ -z "${telnetpass}" ] || [ "${telnetpass}" == "NOT SET" ]; then
+		sdtd_telnet_shutdown=$(expect -c '
 		proc abort {} {
 			puts "Timeout or EOF\n"
 			exit 1
@@ -99,7 +99,7 @@ fn_stop_graceful_sdtd_telnet(){
 		puts "Completed.\n"
 		')
 	else
-		sdtd_telnet_shutdown=$( expect -c '
+		sdtd_telnet_shutdown=$(expect -c '
 		proc abort {} {
 			puts "Timeout or EOF\n"
 			exit 1
@@ -120,12 +120,12 @@ fn_stop_graceful_sdtd_telnet(){
 }
 
 # Attempts graceful shutdown of 7 Days To Die using telnet.
-fn_stop_graceful_sdtd(){
+fn_stop_graceful_sdtd() {
 	fn_print_dots "Graceful: telnet"
 	fn_script_log_info "Graceful: telnet"
 	if [ "${telnetenabled}" == "false" ]; then
 		fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}"
-	elif [ "$(command -v expect 2>/dev/null)" ]; then
+	elif [ "$(command -v expect 2> /dev/null)" ]; then
 		# Tries to shutdown with both localhost and server IP.
 		for telnetip in 127.0.0.1 ${ip}; do
 			fn_print_dots "Graceful: telnet: ${telnetip}:${telnetport}"
@@ -180,7 +180,7 @@ fn_stop_graceful_sdtd(){
 }
 
 # Attempts graceful shutdown by sending /save /stop.
-fn_stop_graceful_avorion(){
+fn_stop_graceful_avorion() {
 	fn_print_dots "Graceful: /save /stop"
 	fn_script_log_info "Graceful: /save /stop"
 	# Sends /save.
@@ -208,7 +208,7 @@ fn_stop_graceful_avorion(){
 	fi
 }
 
-fn_stop_graceful_select(){
+fn_stop_graceful_select() {
 	if [ "${stopmode}" == "1" ]; then
 		fn_stop_tmux
 	elif [ "${stopmode}" == "2" ]; then
@@ -231,10 +231,12 @@ fn_stop_graceful_select(){
 		fn_stop_graceful_avorion
 	elif [ "${stopmode}" == "11" ]; then
 		fn_stop_graceful_cmd "end" 30
+	elif [ "${stopmode}" == "12" ]; then
+		fn_stop_graceful_cmd "shutdown" 30
 	fi
 }
 
-fn_stop_tmux(){
+fn_stop_tmux() {
 	fn_print_dots "${servername}"
 	fn_script_log_info "tmux kill-session: ${sessionname}: ${servername}"
 	# Kill tmux session.
@@ -251,7 +253,7 @@ fn_stop_tmux(){
 }
 
 # Checks if the server is already stopped.
-fn_stop_pre_check(){
+fn_stop_pre_check() {
 	if [ "${status}" == "0" ]; then
 		fn_print_info_nl "${servername} is already stopped"
 		fn_script_log_error "${servername} is already stopped"

+ 2 - 2
lgsm/functions/command_ts3_server_pass.sh

@@ -10,7 +10,7 @@ commandaction="Changing password"
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 fn_firstcommand_set
 
-fn_serveradmin_password_prompt(){
+fn_serveradmin_password_prompt() {
 	fn_print_header
 	fn_print_information_nl "You are about to change the ${gamename} ServerAdmin password."
 	fn_print_warning_nl "${gamename} will restart during this process."
@@ -25,7 +25,7 @@ fn_serveradmin_password_prompt(){
 	fn_script_log_info "Changing password"
 }
 
-fn_serveradmin_password_set(){
+fn_serveradmin_password_set() {
 	# Start server in "new password mode".
 	ts3serverpass="1"
 	exitbypass="1"

+ 1 - 1
lgsm/functions/command_update.sh

@@ -21,7 +21,7 @@ elif [ "${shortname}" == "mc" ]; then
 	update_minecraft.sh
 elif [ "${shortname}" == "mcb" ]; then
 	update_minecraft_bedrock.sh
-elif [ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then
+elif [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then
 	update_papermc.sh
 elif [ "${shortname}" == "mumble" ]; then
 	update_mumble.sh

+ 10 - 10
lgsm/functions/command_update_linuxgsm.sh

@@ -19,9 +19,9 @@ fn_script_log_info "Updating LinuxGSM"
 fn_print_dots "Selecting repo"
 fn_script_log_info "Selecting repo"
 # Select remotereponame
-curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1>/dev/null
+curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
 if [ $? != "0" ]; then
-	curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1>/dev/null
+	curl --connect-timeout 10 -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"
@@ -38,9 +38,9 @@ fi
 # Check linuxsm.sh
 echo -en "checking ${remotereponame} linuxgsm.sh...\c"
 if [ "${remotereponame}" == "GitHub" ]; then
-	curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1>/dev/null
+	curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
 else
-	curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1>/dev/null
+	curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null
 fi
 if [ $? != "0" ]; then
 	fn_print_fail_eol_nl
@@ -118,9 +118,9 @@ fi
 echo -en "checking ${remotereponame} config _default.cfg...\c"
 fn_script_log_info "Checking ${remotereponame} config _default.cfg"
 if [ "${remotereponame}" == "GitHub" ]; then
-	curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null
+	curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null
 else
-	curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null
+	curl --connect-timeout 10 -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
@@ -152,9 +152,9 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
 	echo -en "checking ${remotereponame} config ${distroid}-${distroversioncsv}.csv...\c"
 	fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
 	if [ "${remotereponame}" == "GitHub" ]; then
-		curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1>/dev/null
+		curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
 	else
-		curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1>/dev/null
+		curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
 	fi
 	if [ $? != "0" ]; then
 		fn_print_fail_eol_nl
@@ -189,9 +189,9 @@ if [ -n "${functionsdir}" ]; then
 			echo -en "checking ${remotereponame} module ${functionfile}...\c"
 			github_file_url_dir="lgsm/functions"
 			if [ "${remotereponame}" == "GitHub" ]; then
-				curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}" 1>/dev/null
+				curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}" 1> /dev/null
 			else
-				curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}" 1>/dev/null
+				curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}" 1> /dev/null
 			fi
 			if [ $? != 0 ]; then
 				fn_print_error_eol_nl

+ 1 - 1
lgsm/functions/command_validate.sh

@@ -10,7 +10,7 @@ commandaction="Validating"
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 fn_firstcommand_set
 
-fn_validate(){
+fn_validate() {
 	fn_print_warn "Validate might overwrite some customised files"
 	fn_script_log_warn "${commandaction} server: Validate might overwrite some customised files"
 	totalseconds=3

+ 13 - 13
lgsm/functions/command_wipe.sh

@@ -11,7 +11,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 fn_firstcommand_set
 
 # Provides an exit code upon error.
-fn_wipe_exit_code(){
+fn_wipe_exit_code() {
 	exitcode=$?
 	if [ "${exitcode}" != 0 ]; then
 		fn_print_fail_eol_nl
@@ -22,17 +22,17 @@ fn_wipe_exit_code(){
 }
 
 # Removes files to wipe server.
-fn_wipe_files(){
+fn_wipe_files() {
 	fn_print_start_nl "${wipetype}"
 	fn_script_log_info "${wipetype}"
 
 	# Remove Map files
-	if [ -n "${serverwipe}" ]||[ -n "${mapwipe}" ]; then
+	if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then
 		if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]; then
 			echo -en "removing .map file(s)..."
 			fn_script_log_info "removing *.map file(s)"
 			fn_sleep_time
-			find "${serveridentitydir:?}" -type f -name "*.map" -printf "%f\n" >>  "${lgsmlog}"
+			find "${serveridentitydir:?}" -type f -name "*.map" -printf "%f\n" >> "${lgsmlog}"
 			find "${serveridentitydir:?}" -type f -name "*.map" -delete | tee -a "${lgsmlog}"
 			fn_wipe_exit_code
 		else
@@ -42,12 +42,12 @@ fn_wipe_files(){
 		fi
 	fi
 	# Remove Save files.
-	if [ -n "${serverwipe}" ]||[ -n "${mapwipe}" ]; then
+	if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then
 		if [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]; then
 			echo -en "removing .sav file(s)..."
 			fn_script_log_info "removing .sav file(s)"
 			fn_sleep_time
-			find "${serveridentitydir:?}" -type f -name "*.sav*" -printf "%f\n" >>  "${lgsmlog}"
+			find "${serveridentitydir:?}" -type f -name "*.sav*" -printf "%f\n" >> "${lgsmlog}"
 			find "${serveridentitydir:?}" -type f -name "*.sav*" -delete
 			fn_wipe_exit_code
 		else
@@ -74,7 +74,7 @@ fn_wipe_files(){
 	fi
 }
 
-fn_map_wipe_warning(){
+fn_map_wipe_warning() {
 	fn_print_warn "Map wipe will reset the map data and keep blueprint data"
 	fn_script_log_warn "Map wipe will reset the map data and keep blueprint data"
 	totalseconds=3
@@ -89,7 +89,7 @@ fn_map_wipe_warning(){
 	fn_print_warn_nl "Map wipe will reset the map data and keep blueprint data"
 }
 
-fn_full_wipe_warning(){
+fn_full_wipe_warning() {
 	fn_print_warn "Server wipe will reset the map data and remove blueprint data"
 	fn_script_log_warn "Server wipe will reset the map data and remove blueprint data"
 	totalseconds=3
@@ -105,8 +105,8 @@ fn_full_wipe_warning(){
 }
 
 # Will change the seed if the seed is not defined by the user.
-fn_wipe_random_seed(){
-	if [ -f "${datadir}/${selfname}-seed.txt" ]&&[ -n "${randomseed}" ]; then
+fn_wipe_random_seed() {
+	if [ -f "${datadir}/${selfname}-seed.txt" ] && [ -n "${randomseed}" ]; then
 		shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt"
 		seed=$(cat "${datadir}/${selfname}-seed.txt")
 		randomseed=1
@@ -118,10 +118,10 @@ fn_wipe_random_seed(){
 }
 
 # A summary of what wipe is going to do.
-fn_wipe_details(){
+fn_wipe_details() {
 	fn_print_information_nl "Wipe does not remove Rust+ data."
 	echo -en "* Wipe map data: "
-	if [ -n "${serverwipe}" ]||[ -n "${mapwipe}" ]; then
+	if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then
 		fn_print_yes_eol_nl
 	else
 		fn_print_no_eol_nl
@@ -147,7 +147,7 @@ check.sh
 fix_rust.sh
 
 # Check if there is something to wipe.
-if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]&&[ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then
+if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ] || [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ] && [ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then
 	if [ -n "${serverwipe}" ]; then
 		wipetype="Full wipe"
 		fn_full_wipe_warning

+ 46 - 46
lgsm/functions/core_dl.sh

@@ -19,7 +19,7 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-fn_dl_steamcmd(){
+fn_dl_steamcmd() {
 	fn_print_start_nl "${remotelocation}"
 	fn_script_log_info "${commandaction} ${selfname}: ${remotelocation}"
 	if [ -n "${branch}" ]; then
@@ -41,7 +41,7 @@ fn_dl_steamcmd(){
 	fi
 
 	# Validate will be added as a parameter if required.
-	if [ "${commandname}" == "VALIDATE" ]||[ "${commandname}" == "INSTALL" ]; then
+	if [ "${commandname}" == "VALIDATE" ] || [ "${commandname}" == "INSTALL" ]; then
 		validate="validate"
 	fi
 
@@ -53,13 +53,13 @@ fn_dl_steamcmd(){
 		rm -f "${steamcmdlog:?}"
 	fi
 	counter=0
-	while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do
-		counter=$((counter+1))
+	while [ "${counter}" == "0" ] || [ "${exitcode}" != "0" ]; do
+		counter=$((counter + 1))
 		# Select SteamCMD parameters
 		# If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands.
 		if [ "${appid}" == "90" ]; then
 			# If using a specific branch.
-			if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then
+			if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then
 				${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 			elif [ -n "${branch}" ]; then
 				${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
@@ -68,7 +68,7 @@ fn_dl_steamcmd(){
 			fi
 		# Force Windows Platform type.
 		elif [ "${steamcmdforcewindows}" == "yes" ]; then
-			if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then
+			if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then
 				${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 			elif [ -n "${branch}" ]; then
 				${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
@@ -77,7 +77,7 @@ fn_dl_steamcmd(){
 			fi
 		# All other servers.
 		else
-			if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then
+			if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then
 				${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 			elif [ -n "${branch}" ]; then
 				${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
@@ -89,7 +89,7 @@ fn_dl_steamcmd(){
 		# Error checking for SteamCMD. Some errors will loop to try again and some will just exit.
 		# Check also if we have more errors than retries to be sure that we do not loop to many times and error out.
 		exitcode=$?
-		if [ -n "$(grep -i "Error!" "${steamcmdlog}" | tail -1)" ]&&[ "$(grep -ic "Error!" "${steamcmdlog}")" -ge "${counter}" ] ; then
+		if [ -n "$(grep -i "Error!" "${steamcmdlog}" | tail -1)" ] && [ "$(grep -ic "Error!" "${steamcmdlog}")" -ge "${counter}" ]; then
 			# Not enough space.
 			if [ -n "$(grep "0x202" "${steamcmdlog}" | tail -1)" ]; then
 				fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files"
@@ -97,9 +97,9 @@ fn_dl_steamcmd(){
 				core_exit.sh
 				# Not enough space.
 			elif [ -n "$(grep "0x212" "${steamcmdlog}" | tail -1)" ]; then
-					fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files"
-					fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files"
-					core_exit.sh
+				fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files"
+				fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files"
+				core_exit.sh
 			# Need tp purchase game.
 			elif [ -n "$(grep "No subscription" "${steamcmdlog}" | tail -1)" ]; then
 				fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Steam account does not have a license for the required game"
@@ -110,13 +110,13 @@ fn_dl_steamcmd(){
 				fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Two-factor authentication failure"
 				fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Two-factor authentication failure"
 				core_exit.sh
-				# Incorrect Branch password
-				elif [ -n "$(grep "Password check for AppId" "${steamcmdlog}" | tail -1)" ]; then
-					fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect"
-					fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect"
-					core_exit.sh
+			# Incorrect Branch password
+			elif [ -n "$(grep "Password check for AppId" "${steamcmdlog}" | tail -1)" ]; then
+				fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect"
+				fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect"
+				core_exit.sh
 			# Update did not finish.
-			elif [ -n "$(grep "0x402" "${steamcmdlog}" | tail -1)" ]||[ -n "$(grep "0x602" "${steamcmdlog}" | tail -1)" ]; then
+			elif [ -n "$(grep "0x402" "${steamcmdlog}" | tail -1)" ] || [ -n "$(grep "0x602" "${steamcmdlog}" | tail -1)" ]; then
 				fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Update required but not completed - check network"
 				fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Update required but not completed - check network"
 			else
@@ -141,7 +141,7 @@ fn_dl_steamcmd(){
 }
 
 # Emptys contents of the LinuxGSM tmpdir.
-fn_clear_tmp(){
+fn_clear_tmp() {
 	echo -en "clearing LinuxGSM tmp directory..."
 	if [ -d "${tmpdir}" ]; then
 		rm -rf "${tmpdir:?}/"*
@@ -156,9 +156,9 @@ fn_clear_tmp(){
 	fi
 }
 
-fn_dl_hash(){
+fn_dl_hash() {
 	# Runs Hash Check if available.
-	if [ "${hash}" != "0" ]&&[ "${hash}" != "nohash" ]&&[ "${hash}" != "nomd5" ]; then
+	if [ "${hash}" != "0" ] && [ "${hash}" != "nohash" ] && [ "${hash}" != "nomd5" ]; then
 		# MD5
 		if [ "${#hash}" == "32" ]; then
 			hashbin="md5sum"
@@ -204,7 +204,7 @@ fn_dl_hash(){
 # Extracts can be defined in code like so:
 # fn_dl_extract "${local_filedir}" "${local_filename}" "${extractdir}"
 # fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles"
-fn_dl_extract(){
+fn_dl_extract() {
 	local_filedir="${1}"
 	local_filename="${2}"
 	extractdir="${3}"
@@ -214,7 +214,7 @@ fn_dl_extract(){
 	if [ ! -d "${extractdir}" ]; then
 		mkdir "${extractdir}"
 	fi
-	if [ "${mime}" == "application/gzip" ]||[ "${mime}" == "application/x-gzip" ]; then
+	if [ "${mime}" == "application/gzip" ] || [ "${mime}" == "application/x-gzip" ]; then
 		extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdir}")
 	elif [ "${mime}" == "application/x-bzip2" ]; then
 		extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdir}")
@@ -239,7 +239,7 @@ fn_dl_extract(){
 }
 
 # Trap to remove file download if canceled before completed.
-fn_fetch_trap(){
+fn_fetch_trap() {
 	echo -e ""
 	echo -en "downloading ${local_filename}..."
 	fn_print_canceled_eol_nl
@@ -253,7 +253,7 @@ fn_fetch_trap(){
 }
 
 # Will check a file exists and download it. Will not exit if fails to download.
-fn_check_file(){
+fn_check_file() {
 	remote_fileurl="${1}"
 	remote_fileurl_backup="${2}"
 	remote_fileurl_name="${3}"
@@ -263,11 +263,11 @@ fn_check_file(){
 	if [ -n "${remote_fileurl_backup}" ]; then
 		# counter set to 0 to allow second try
 		counter=0
-		remote_fileurls_array=( remote_fileurl remote_fileurl_backup )
+		remote_fileurls_array=(remote_fileurl remote_fileurl_backup)
 	else
 		# counter set to 1 to not allow second try
 		counter=1
-		remote_fileurls_array=( remote_fileurl )
+		remote_fileurls_array=(remote_fileurl)
 	fi
 	for remote_fileurl_array in "${remote_fileurls_array[@]}"; do
 		if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then
@@ -277,7 +277,7 @@ fn_check_file(){
 			fileurl="${remote_fileurl_backup}"
 			fileurl_name="${remote_fileurl_backup_name}"
 		fi
-		counter=$((counter+1))
+		counter=$((counter + 1))
 		echo -en "checking ${fileurl_name} ${remote_filename}...\c"
 		curlcmd=$(curl --output /dev/null --silent --head --fail "${fileurl}" 2>&1)
 		local exitcode=$?
@@ -321,7 +321,7 @@ fn_check_file(){
 	fi
 }
 
-fn_fetch_file(){
+fn_fetch_file() {
 	remote_fileurl="${1}"
 	remote_fileurl_backup="${2}"
 	remote_fileurl_name="${3}"
@@ -334,16 +334,16 @@ fn_fetch_file(){
 	hash="${10:-0}"
 
 	# Download file if missing or download forced.
-	if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then
+	if [ ! -f "${local_filedir}/${local_filename}" ] || [ "${forcedl}" == "forcedl" ]; then
 		# 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 )
+			remote_fileurls_array=(remote_fileurl remote_fileurl_backup)
 		else
 			# counter set to 1 to not allow second try
 			counter=1
-			remote_fileurls_array=( remote_fileurl )
+			remote_fileurls_array=(remote_fileurl)
 		fi
 		for remote_fileurl_array in "${remote_fileurls_array[@]}"; do
 			if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then
@@ -353,14 +353,14 @@ fn_fetch_file(){
 				fileurl="${remote_fileurl_backup}"
 				fileurl_name="${remote_fileurl_backup_name}"
 			fi
-			counter=$((counter+1))
+			counter=$((counter + 1))
 			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
+			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"
@@ -374,7 +374,7 @@ fn_fetch_file(){
 
 			# 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
+				if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE")" ]; then
 					rm "${local_filedir:?}/${local_filename:?}"
 					local exitcode=2
 				fi
@@ -443,7 +443,7 @@ fn_fetch_file(){
 # hash: Optional, set an hash sum and will compare it against the file.
 
 # Fetches files from the Git repo.
-fn_fetch_file_github(){
+fn_fetch_file_github() {
 	github_fileurl_dir="${1}"
 	github_fileurl_name="${2}"
 	# For legacy versions - code can be removed at a future date
@@ -451,7 +451,7 @@ fn_fetch_file_github(){
 		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
 		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
 	# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
-	elif [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
+	elif [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
 		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 	else
@@ -470,10 +470,10 @@ fn_fetch_file_github(){
 	fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
 }
 
-fn_check_file_github(){
+fn_check_file_github() {
 	github_fileurl_dir="${1}"
 	github_fileurl_name="${2}"
-	if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
+	if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
 		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 	else
@@ -486,11 +486,11 @@ fn_check_file_github(){
 }
 
 # Fetches config files from the Git repo.
-fn_fetch_config(){
+fn_fetch_config() {
 	github_fileurl_dir="${1}"
 	github_fileurl_name="${2}"
 	# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
-	if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
+	if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
 		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 	else
@@ -510,11 +510,11 @@ fn_fetch_config(){
 }
 
 # Fetches modules from the Git repo during first download.
-fn_fetch_function(){
+fn_fetch_function() {
 	github_fileurl_dir="lgsm/functions"
 	github_fileurl_name="${functionfile}"
-		# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
-	if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
+	# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
+	if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
 		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 	else
@@ -534,11 +534,11 @@ fn_fetch_function(){
 }
 
 # Fetches modules from the Git repo during update-lgsm.
-fn_update_function(){
+fn_update_function() {
 	github_fileurl_dir="lgsm/functions"
 	github_fileurl_name="${functionfile}"
 	# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
-	if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
+	if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
 		remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 		remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
 	else
@@ -563,7 +563,7 @@ fn_update_function(){
 # $2 Repo name.
 # $3 Destination for download.
 # $4 Search string in releases (needed if there are more files that can be downloaded from the release pages).
-fn_dl_latest_release_github(){
+fn_dl_latest_release_github() {
 	local githubreleaseuser="${1}"
 	local githubreleaserepo="${2}"
 	local githubreleasedownloadpath="${3}"

+ 3 - 3
lgsm/functions/core_exit.sh

@@ -7,7 +7,7 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-fn_exit_dev_debug(){
+fn_exit_dev_debug() {
 	if [ -f "${rootdir}/.dev-debug" ]; then
 		echo -e ""
 		echo -e "${functionselfname} exiting with code: ${exitcode}"
@@ -25,7 +25,7 @@ fi
 
 if [ "${exitbypass}" ]; then
 	unset exitbypass
-elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then
+elif [ "${exitcode}" ] && [ "${exitcode}" != "0" ]; then
 	# List LinuxGSM version in logs
 	fn_script_log_info "LinuxGSM version: ${version}"
 	if [ "${exitcode}" == "1" ]; then
@@ -41,7 +41,7 @@ elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then
 	# remove trap.
 	trap - INT
 	exit "${exitcode}"
-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 "${functionselfname} exiting with code: ${exitcode}"

+ 462 - 457
lgsm/functions/core_functions.sh

@@ -8,784 +8,789 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-modulesversion="v22.1.0"
+modulesversion="v22.2.0"
 
 # Core
 
-core_dl.sh(){
-functionfile="${FUNCNAME[0]}"
-if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
-	fn_fetch_core_dl "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
-else
-	fn_bootstrap_fetch_file_github "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
-fi
+core_dl.sh() {
+	functionfile="${FUNCNAME[0]}"
+	if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then
+		fn_fetch_core_dl "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
+	else
+		fn_bootstrap_fetch_file_github "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
+	fi
 }
 
-core_messages.sh(){
-functionfile="${FUNCNAME[0]}"
-if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
-	fn_fetch_core_dl "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
-else
-	fn_bootstrap_fetch_file_github "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
-fi
+core_messages.sh() {
+	functionfile="${FUNCNAME[0]}"
+	if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then
+		fn_fetch_core_dl "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
+	else
+		fn_bootstrap_fetch_file_github "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
+	fi
 }
 
-core_legacy.sh(){
-functionfile="${FUNCNAME[0]}"
-if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
-	fn_fetch_core_dl "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
-else
-	fn_bootstrap_fetch_file_github "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
-fi
+core_legacy.sh() {
+	functionfile="${FUNCNAME[0]}"
+	if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then
+		fn_fetch_core_dl "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
+	else
+		fn_bootstrap_fetch_file_github "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash"
+	fi
 }
 
-core_exit.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+core_exit.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-core_getopt.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+core_getopt.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-core_trap.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+core_trap.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-core_steamcmd.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+core_steamcmd.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-core_github.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+core_github.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Commands
 
-command_backup.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_backup.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_console.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_console.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_debug.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_debug.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_details.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_details.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_donate.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_donate.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_postdetails.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_postdetails.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_test_alert.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_test_alert.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_monitor.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_monitor.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_start.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_start.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_stop.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_stop.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_validate.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_validate.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_install.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_install.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_install_resources_mta.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_install_resources_mta.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_squad_license.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_squad_license.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_mods_install.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_mods_install.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_mods_update.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_mods_update.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_mods_remove.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_mods_remove.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_fastdl.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_fastdl.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_ts3_server_pass.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_ts3_server_pass.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_restart.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_restart.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_skeleton.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_skeleton.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_wipe.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_wipe.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_send.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_send.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Checks
 
-check.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_config.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_config.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_deps.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_deps.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_executable.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_executable.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_glibc.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_glibc.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_ip.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_ip.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_last_update.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_last_update.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_logs.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_logs.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_permissions.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_permissions.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_root.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_root.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_status.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_status.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_steamcmd.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_steamcmd.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_system_dir.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_system_dir.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_system_requirements.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_system_requirements.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_tmuxception.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_tmuxception.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-check_version.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+check_version.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Compress
 
-compress_unreal2_maps.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+compress_unreal2_maps.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-compress_ut99_maps.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+compress_ut99_maps.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Mods
 
-mods_list.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+mods_list.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-mods_core.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+mods_core.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Dev
 
-command_dev_clear_functions.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_dev_clear_functions.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_dev_debug.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_dev_debug.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_dev_detect_deps.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_dev_detect_deps.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_dev_detect_glibc.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_dev_detect_glibc.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_dev_detect_ldd.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_dev_detect_ldd.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_dev_query_raw.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_dev_query_raw.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Fix
 
-fix.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
+}
+
+fix_ark.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_ark.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_av.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_av.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_arma3.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_arma3.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_armar.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_armar.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_bt.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_bo.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_bo.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_cmw.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_cmw.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_csgo.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_csgo.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_dst.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_dst.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_hw.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_hw.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_ins.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_ins.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_kf.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_kf.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_kf2.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_kf2.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_lo.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_lo.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_mcb.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_mcb.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_mta.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_mta.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_nmrih.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_nmrih.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_onset.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_onset.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_ro.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_ro.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_rust.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_rust.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_rw.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_rw.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_sfc.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_sfc.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_st.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_st.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_steamcmd.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_steamcmd.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_terraria.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_terraria.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_tf2.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_tf2.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_ut3.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_ut3.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_rust.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_rust.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_samp.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_samp.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_sdtd.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_sdtd.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_sof2.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_sof2.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_squad.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_squad.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_ts3.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_ts3.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_ut2k4.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_ut2k4.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_ut.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_ut.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_unt.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_unt.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_vh.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_vh.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_wurm.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_wurm.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fix_zmr.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fix_zmr.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Info
 
-info_distro.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+info_distro.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-info_game.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+info_game.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-info_messages.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+info_messages.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-info_stats.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+info_stats.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Alert
 
-alert.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_discord.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_discord.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_email.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_email.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_ifttt.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_ifttt.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_mailgun.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_mailgun.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_pushbullet.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_pushbullet.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_pushover.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_pushover.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_gotify.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_gotify.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_telegram.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_telegram.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_rocketchat.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_rocketchat.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-alert_slack.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+alert_slack.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 # Logs
 
-core_logs.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+core_logs.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Query
 
-query_gamedig.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+query_gamedig.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Update
 
-command_update_functions.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_update_functions.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_update_linuxgsm.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_update_linuxgsm.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_update.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_update.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-command_check_update.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+command_check_update.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_ts3.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_ts3.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_minecraft.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_minecraft.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_minecraft_bedrock.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_minecraft_bedrock.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_papermc.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_papermc.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_mumble.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_mumble.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_mta.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_mta.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_factorio.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_factorio.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_jediknight2.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_jediknight2.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_steamcmd.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_steamcmd.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-update_vintagestory.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+update_vintagestory.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-fn_update_functions.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+fn_update_functions.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 #
 ## Installer functions
 #
 
-fn_autoinstall(){
-autoinstall=1
-command_install.sh
+fn_autoinstall() {
+	autoinstall=1
+	command_install.sh
 }
 
-install_complete.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_complete.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_config.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_config.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_factorio_save.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_factorio_save.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_dst_token.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_dst_token.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_eula.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_eula.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_gsquery.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_gsquery.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_gslt.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_gslt.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_header.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_header.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_logs.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_logs.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_retry.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_retry.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_server_dir.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_server_dir.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
-install_server_files.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_server_files.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_stats.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_stats.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_steamcmd.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_steamcmd.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_ts3.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_ts3.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_ts3db.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_ts3db.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_ut2k4.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_ut2k4.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_dl_ut2k4.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_dl_ut2k4.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
-install_ut2k4_key.sh(){
-functionfile="${FUNCNAME[0]}"
-fn_fetch_function
+install_ut2k4_key.sh() {
+	functionfile="${FUNCNAME[0]}"
+	fn_fetch_function
 }
 
 # Calls code required for legacy servers

+ 80 - 81
lgsm/functions/core_getopt.sh

@@ -10,158 +10,157 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 ### Define all commands here.
 ## User commands | Trigger commands | Description
 # Standard commands.
-cmd_install=( "i;install" "command_install.sh" "Install the server." )
-cmd_auto_install=( "ai;auto-install" "fn_autoinstall" "Install the server without prompts." )
-cmd_start=( "st;start" "command_start.sh" "Start the server." )
-cmd_stop=( "sp;stop" "command_stop.sh" "Stop the server." )
-cmd_restart=( "r;restart" "command_restart.sh" "Restart the server." )
-cmd_details=( "dt;details" "command_details.sh" "Display server information." )
-cmd_postdetails=( "pd;postdetails" "command_postdetails.sh" "Post details to termbin.com (removing passwords)." )
-cmd_backup=( "b;backup" "command_backup.sh" "Create backup archives of the server." )
-cmd_update_linuxgsm=( "ul;update-lgsm;uf;update-functions" "command_update_linuxgsm.sh" "Check and apply any LinuxGSM updates." )
-cmd_test_alert=( "ta;test-alert" "command_test_alert.sh" "Send a test alert." )
-cmd_monitor=( "m;monitor" "command_monitor.sh" "Check server status and restart if crashed." )
-cmd_skeleton=( "sk;skeleton" "command_skeleton.sh" "Create a skeleton directory." )
-cmd_donate=( "do;donate" "command_donate.sh" "Donation options." )
-cmd_send=( "sd;send" "command_send.sh" "Send command to game server console." )
+cmd_install=("i;install" "command_install.sh" "Install the server.")
+cmd_auto_install=("ai;auto-install" "fn_autoinstall" "Install the server without prompts.")
+cmd_start=("st;start" "command_start.sh" "Start the server.")
+cmd_stop=("sp;stop" "command_stop.sh" "Stop the server.")
+cmd_restart=("r;restart" "command_restart.sh" "Restart the server.")
+cmd_details=("dt;details" "command_details.sh" "Display server information.")
+cmd_postdetails=("pd;postdetails" "command_postdetails.sh" "Post details to termbin.com (removing passwords).")
+cmd_backup=("b;backup" "command_backup.sh" "Create backup archives of the server.")
+cmd_update_linuxgsm=("ul;update-lgsm;uf;update-functions" "command_update_linuxgsm.sh" "Check and apply any LinuxGSM updates.")
+cmd_test_alert=("ta;test-alert" "command_test_alert.sh" "Send a test alert.")
+cmd_monitor=("m;monitor" "command_monitor.sh" "Check server status and restart if crashed.")
+cmd_skeleton=("sk;skeleton" "command_skeleton.sh" "Create a skeleton directory.")
+cmd_donate=("do;donate" "command_donate.sh" "Donation options.")
+cmd_send=("sd;send" "command_send.sh" "Send command to game server console.")
 # Console servers only.
-cmd_console=( "c;console" "command_console.sh" "Access server console." )
-cmd_debug=( "d;debug" "command_debug.sh" "Start server directly in your terminal." )
+cmd_console=("c;console" "command_console.sh" "Access server console.")
+cmd_debug=("d;debug" "command_debug.sh" "Start server directly in your terminal.")
 # Update servers only.
-cmd_update=( "u;update" "command_update.sh" "Check and apply any server updates." )
-cmd_check_update=( "cu;check-update" "command_check_update.sh" "Check if a gameserver update is available" )
-cmd_force_update=( "fu;force-update;update-restart;ur" "forceupdate=1; command_update.sh" "Apply server updates bypassing check." )
+cmd_update=("u;update" "command_update.sh" "Check and apply any server updates.")
+cmd_check_update=("cu;check-update" "command_check_update.sh" "Check if a gameserver update is available")
+cmd_force_update=("fu;force-update;update-restart;ur" "forceupdate=1; command_update.sh" "Apply server updates bypassing check.")
 # SteamCMD servers only.
-cmd_validate=( "v;validate" "command_validate.sh" "Validate server files with SteamCMD." )
+cmd_validate=("v;validate" "command_validate.sh" "Validate server files with SteamCMD.")
 # Server with mods-install.
-cmd_mods_install=( "mi;mods-install" "command_mods_install.sh" "View and install available mods/addons." )
-cmd_mods_remove=( "mr;mods-remove" "command_mods_remove.sh" "View and remove an installed mod/addon." )
-cmd_mods_update=( "mu;mods-update" "command_mods_update.sh" "Update installed mods/addons." )
+cmd_mods_install=("mi;mods-install" "command_mods_install.sh" "View and install available mods/addons.")
+cmd_mods_remove=("mr;mods-remove" "command_mods_remove.sh" "View and remove an installed mod/addon.")
+cmd_mods_update=("mu;mods-update" "command_mods_update.sh" "Update installed mods/addons.")
 # Server specific.
-cmd_change_password=( "pw;change-password" "command_ts3_server_pass.sh" "Change TS3 serveradmin password." )
-cmd_install_default_resources=( "ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources." )
-cmd_fullwipe=( "fw;full-wipe;wa;wipeall" "serverwipe=1; command_wipe.sh" "Reset the map and remove blueprint data." )
-cmd_mapwipe=( "mw;map-wipe;w;wipe;wi" "mapwipe=1; command_wipe.sh" "Reset the map and keep blueprint data." )
-cmd_map_compressor_u99=( "mc;map-compressor" "compress_ut99_maps.sh" "Compresses all ${gamename} server maps." )
-cmd_map_compressor_u2=( "mc;map-compressor" "compress_unreal2_maps.sh" "Compresses all ${gamename} server maps." )
-cmd_install_cdkey=( "cd;server-cd-key" "install_ut2k4_key.sh" "Add your server cd key." )
-cmd_install_dst_token=( "ct;cluster-token" "install_dst_token.sh" "Configure cluster token." )
-cmd_install_squad_license=( "li;license" "install_squad_license.sh" "Add your Squad server license." )
-cmd_fastdl=( "fd;fastdl" "command_fastdl.sh" "Build a FastDL directory." )
+cmd_change_password=("pw;change-password" "command_ts3_server_pass.sh" "Change TS3 serveradmin password.")
+cmd_install_default_resources=("ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources.")
+cmd_fullwipe=("fw;full-wipe;wa;wipeall" "serverwipe=1; command_wipe.sh" "Reset the map and remove blueprint data.")
+cmd_mapwipe=("mw;map-wipe;w;wipe;wi" "mapwipe=1; command_wipe.sh" "Reset the map and keep blueprint data.")
+cmd_map_compressor_u99=("mc;map-compressor" "compress_ut99_maps.sh" "Compresses all ${gamename} server maps.")
+cmd_map_compressor_u2=("mc;map-compressor" "compress_unreal2_maps.sh" "Compresses all ${gamename} server maps.")
+cmd_install_cdkey=("cd;server-cd-key" "install_ut2k4_key.sh" "Add your server cd key.")
+cmd_install_dst_token=("ct;cluster-token" "install_dst_token.sh" "Configure cluster token.")
+cmd_install_squad_license=("li;license" "install_squad_license.sh" "Add your Squad server license.")
+cmd_fastdl=("fd;fastdl" "command_fastdl.sh" "Build a FastDL directory.")
 # Dev commands.
-cmd_dev_debug=( "dev;developer" "command_dev_debug.sh" "Enable developer Mode." )
-cmd_dev_detect_deps=( "dd;detect-deps" "command_dev_detect_deps.sh" "Detect required dependencies." )
-cmd_dev_detect_glibc=( "dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc." )
-cmd_dev_detect_ldd=( "dl;detect-ldd" "command_dev_detect_ldd.sh" "Detect required dynamic dependencies." )
-cmd_dev_query_raw=( "qr;query-raw" "command_dev_query_raw.sh" "The raw output of gamedig and gsquery." )
-cmd_dev_clear_functions=( "cf;clear-functions" "command_dev_clear_functions.sh" "Delete the contents of the functions dir." )
-
+cmd_dev_debug=("dev;developer" "command_dev_debug.sh" "Enable developer Mode.")
+cmd_dev_detect_deps=("dd;detect-deps" "command_dev_detect_deps.sh" "Detect required dependencies.")
+cmd_dev_detect_glibc=("dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc.")
+cmd_dev_detect_ldd=("dl;detect-ldd" "command_dev_detect_ldd.sh" "Detect required dynamic dependencies.")
+cmd_dev_query_raw=("qr;query-raw" "command_dev_query_raw.sh" "The raw output of gamedig and gsquery.")
+cmd_dev_clear_functions=("cf;clear-functions" "command_dev_clear_functions.sh" "Delete the contents of the functions dir.")
 
 ### Set specific opt here.
 
-currentopt=( "${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monitor[@]}" "${cmd_test_alert[@]}" "${cmd_details[@]}" "${cmd_postdetails[@]}" "${cmd_skeleton[@]}" )
+currentopt=("${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monitor[@]}" "${cmd_test_alert[@]}" "${cmd_details[@]}" "${cmd_postdetails[@]}" "${cmd_skeleton[@]}")
 
 # Update LinuxGSM.
-currentopt+=( "${cmd_update_linuxgsm[@]}" )
+currentopt+=("${cmd_update_linuxgsm[@]}")
 
 # Exclude noupdate games here.
-if [ "${shortname}" == "jk2" ]||[ "${engine}" != "idtech3" ];then
-	if [ "${shortname}" != "bf1942" ]&&[ "${shortname}" != "bfv" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]&&[ "${engine}" != "quake" ]&&[ "${shortname}" != "samp" ]&&[ "${shortname}" != "ut2k4" ]&&[ "${shortname}" != "ut99" ]; then
-		currentopt+=( "${cmd_update[@]}" )
+if [ "${shortname}" == "jk2" ] || [ "${engine}" != "idtech3" ]; then
+	if [ "${shortname}" != "bf1942" ] && [ "${shortname}" != "bfv" ] && [ "${engine}" != "idtech2" ] && [ "${engine}" != "iw2.0" ] && [ "${engine}" != "iw3.0" ] && [ "${engine}" != "quake" ] && [ "${shortname}" != "samp" ] && [ "${shortname}" != "ut2k4" ] && [ "${shortname}" != "ut99" ]; then
+		currentopt+=("${cmd_update[@]}")
 		# force update for SteamCMD or Multi Theft Auto only.
-		if [ "${appid}" ]||[ "${shortname}" == "mta" ]; then
-			currentopt+=( "${cmd_force_update[@]}" )
+		if [ "${appid}" ] || [ "${shortname}" == "mta" ]; then
+			currentopt+=("${cmd_force_update[@]}")
 		fi
 	fi
 fi
 
 # Validate and check-update command.
-if [ "${appid}" ]; then
-	currentopt+=( "${cmd_validate[@]}" "${cmd_check_update[@]}" )
+if [ "${appid}" ]||[ "${shortname}" == "ts3" ]; then
+	currentopt+=("${cmd_validate[@]}" "${cmd_check_update[@]}")
 fi
 
 # Backup.
-currentopt+=( "${cmd_backup[@]}" )
+currentopt+=("${cmd_backup[@]}")
 
 # Console & Debug.
-currentopt+=( "${cmd_console[@]}" "${cmd_debug[@]}" )
+currentopt+=("${cmd_console[@]}" "${cmd_debug[@]}")
 
 # Console send.
 if [ "${consoleinteract}" == "yes" ]; then
-	currentopt+=( "${cmd_send[@]}" )
+	currentopt+=("${cmd_send[@]}")
 fi
 
 ## Game server exclusive commands.
 
 # FastDL command.
 if [ "${engine}" == "source" ]; then
-	currentopt+=( "${cmd_fastdl[@]}" )
+	currentopt+=("${cmd_fastdl[@]}")
 fi
 
 # TeamSpeak exclusive.
 if [ "${shortname}" == "ts3" ]; then
-	currentopt+=( "${cmd_change_password[@]}" )
+	currentopt+=("${cmd_change_password[@]}")
 fi
 
 # Unreal exclusive.
 if [ "${shortname}" == "rust" ]; then
-	currentopt+=( "${cmd_fullwipe[@]}" "${cmd_mapwipe[@]}" )
+	currentopt+=("${cmd_fullwipe[@]}" "${cmd_mapwipe[@]}")
 fi
 if [ "${engine}" == "unreal2" ]; then
 	if [ "${shortname}" == "ut2k4" ]; then
-		currentopt+=( "${cmd_install_cdkey[@]}" "${cmd_map_compressor_u2[@]}" )
+		currentopt+=("${cmd_install_cdkey[@]}" "${cmd_map_compressor_u2[@]}")
 	else
-		currentopt+=( "${cmd_map_compressor_u2[@]}" )
+		currentopt+=("${cmd_map_compressor_u2[@]}")
 	fi
 fi
 if [ "${engine}" == "unreal" ]; then
-	currentopt+=( "${cmd_map_compressor_u99[@]}" )
+	currentopt+=("${cmd_map_compressor_u99[@]}")
 fi
 
 # DST exclusive.
 if [ "${shortname}" == "dst" ]; then
-	currentopt+=( "${cmd_install_dst_token[@]}" )
+	currentopt+=("${cmd_install_dst_token[@]}")
 fi
 
 # MTA exclusive.
 if [ "${shortname}" == "mta" ]; then
-	currentopt+=( "${cmd_install_default_resources[@]}" )
+	currentopt+=("${cmd_install_default_resources[@]}")
 fi
 
 # Squad license exclusive.
 if [ "${shortname}" == "squad" ]; then
-	currentopt+=( "${cmd_install_squad_license[@]}" )
+	currentopt+=("${cmd_install_squad_license[@]}")
 fi
 
 ## Mods commands.
-if [ "${engine}" == "source" ]||[ "${shortname}" == "rust" ]||[ "${shortname}" == "hq" ]||[ "${shortname}" == "sdtd" ]||[ "${shortname}" == "cs" ]||[ "${shortname}" == "dod" ]||[ "${shortname}" == "tfc" ]||[ "${shortname}" == "ns" ]||[ "${shortname}" == "ts" ]||[ "${shortname}" == "hldm" ]||[ "${shortname}" == "vh" ]; then
-	currentopt+=( "${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}" )
+if [ "${engine}" == "source" ] || [ "${shortname}" == "rust" ] || [ "${shortname}" == "hq" ] || [ "${shortname}" == "sdtd" ] || [ "${shortname}" == "cs" ] || [ "${shortname}" == "dod" ] || [ "${shortname}" == "tfc" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "hldm" ] || [ "${shortname}" == "vh" ]; then
+	currentopt+=("${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}")
 fi
 
 ## Installer.
-currentopt+=( "${cmd_install[@]}" "${cmd_auto_install[@]}" )
+currentopt+=("${cmd_install[@]}" "${cmd_auto_install[@]}")
 
 ## Developer commands.
-currentopt+=( "${cmd_dev_debug[@]}" )
+currentopt+=("${cmd_dev_debug[@]}")
 if [ -f ".dev-debug" ]; then
-	currentopt+=( "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_functions[@]}" )
+	currentopt+=("${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_functions[@]}")
 fi
 
 ## Donate.
-currentopt+=( "${cmd_donate[@]}" )
+currentopt+=("${cmd_donate[@]}")
 
 ### Build list of available commands.
 optcommands=()
 index="0"
-for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
+for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
 	cmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
-	for ((cmdindex=1; cmdindex <= cmdamount; cmdindex++)); do
-		optcommands+=( "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')" )
+	for ((cmdindex = 1; cmdindex <= cmdamount; cmdindex++)); do
+		optcommands+=("$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')")
 	done
 done
 
 # Shows LinuxGSM usage.
-fn_opt_usage(){
+fn_opt_usage() {
 	echo -e "Usage: $0 [option]"
 	echo -e ""
 	echo -e "LinuxGSM - ${gamename} - Version ${version}"
@@ -171,12 +170,12 @@ fn_opt_usage(){
 	# Display available commands.
 	index="0"
 	{
-	for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
-		# Hide developer commands.
-		if [ "${currentopt[index+2]}" != "DEVCOMMAND" ]; then
-			echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index+2]}"
-		fi
-	done
+		for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
+			# Hide developer commands.
+			if [ "${currentopt[index + 2]}" != "DEVCOMMAND" ]; then
+				echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}"
+			fi
+		done
 	} | column -s $'\t' -t
 	fn_script_log_pass "Display commands"
 	core_exit.sh
@@ -188,15 +187,15 @@ if [ -z "${getopt}" ]; then
 fi
 # If command exists.
 for i in "${optcommands[@]}"; do
-	if [ "${i}" == "${getopt}" ] ; then
+	if [ "${i}" == "${getopt}" ]; then
 		# Seek and run command.
 		index="0"
-		for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
+		for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
 			currcmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
-			for ((currcmdindex=1; currcmdindex <= currcmdamount; currcmdindex++)); do
+			for ((currcmdindex = 1; currcmdindex <= currcmdamount; currcmdindex++)); do
 				if [ "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
 					# Run command.
-					eval "${currentopt[index+1]}"
+					eval "${currentopt[index + 1]}"
 					# Exit should occur in modules. Should this not happen print an error
 					fn_print_error2_nl "Command did not exit correctly: ${getopt}"
 					fn_script_log_error "Command did not exit correctly: ${getopt}"

+ 9 - 9
lgsm/functions/core_github.sh

@@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 github_api="https://api.github.com"
 
-fn_githublocalversionfile(){
+fn_githublocalversionfile() {
 	local githubreleaseuser="${1}"
 	local githubreleaserepo="${2}"
 
@@ -18,12 +18,12 @@ fn_githublocalversionfile(){
 
 # $1 githubuser/group
 # $2 github repo name
-fn_github_get_latest_release_version(){
+fn_github_get_latest_release_version() {
 	local githubreleaseuser="${1}"
 	local githubreleaserepo="${2}"
 	local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest"
 
-	githubreleaseversion=$(curl -s --connect-timeout 10 "${githublatestreleaseurl}" | jq '.tag_name' )
+	githubreleaseversion=$(curl -s --connect-timeout 10 "${githublatestreleaseurl}" | jq '.tag_name')
 
 	# error if no version is there
 	if [ -z "${githubreleaseversion}" ]; then
@@ -34,14 +34,14 @@ fn_github_get_latest_release_version(){
 
 # $1 githubuser/group
 # $2 github repo name
-fn_github_set_latest_release_version(){
+fn_github_set_latest_release_version() {
 	local githubreleaseuser="${1}"
 	local githubreleaserepo="${2}"
 
 	fn_githublocalversionfile "${githubreleaseuser}" "${githubreleaserepo}"
 
 	local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest"
-	githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq -r '.tag_name' )
+	githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq -r '.tag_name')
 
 	# error if no version is there
 	if [ -z "${githubreleaseversion}" ]; then
@@ -54,7 +54,7 @@ fn_github_set_latest_release_version(){
 
 # $1 githubuser/group
 # $2 github repo name
-fn_github_get_installed_version(){
+fn_github_get_installed_version() {
 	local githubreleaseuser="${1}"
 	local githubreleaserepo="${2}"
 
@@ -66,7 +66,7 @@ fn_github_get_installed_version(){
 # $1 githubuser/group
 # $2 github repo name
 # if a update needs to be downloaded - updateneeded is set to 1
-fn_github_compare_version(){
+fn_github_compare_version() {
 	local githubreleaseuser="${1}"
 	local githubreleaserepo="${2}"
 	exitcode=0
@@ -76,7 +76,7 @@ fn_github_compare_version(){
 	local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest"
 
 	githublocalversion=$(cat "${githublocalversionfile}")
-	githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq '.tag_name' )
+	githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq '.tag_name')
 
 	# error if no version is there
 	if [ -z "${githubreleaseversion}" ]; then
@@ -91,7 +91,7 @@ fn_github_compare_version(){
 			echo -en "\n"
 		else
 			# check if version that is installed is higher than the remote version to not override it
-			last_version=$(echo -e "${githublocalversion}\n${githubreleaseversion}" | sort -V | head -n1 )
+			last_version=$(echo -e "${githublocalversion}\n${githubreleaseversion}" | sort -V | head -n1)
 			if [ "${githubreleaseversion}" == "${last_version}" ]; then
 				echo -en "\n"
 				echo -e "Update from github.com/${githubreleaseuser}/${githubreleaserepo}/ available:"

+ 2 - 2
lgsm/functions/core_legacy.sh

@@ -8,7 +8,7 @@
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # This is to help the transition to v20.3.0 and above
-legacy_versions_array=( v20.2.1 v20.2.0 v20.1.5 v20.1.4 v20.1.3 v20.1.2 v20.1.1 v20.1.0 v19.12.5 v19.12.4 v19.12.3 v19.12.2 v19.12.1 v19.12.0 )
+legacy_versions_array=(v20.2.1 v20.2.0 v20.1.5 v20.1.4 v20.1.3 v20.1.2 v20.1.1 v20.1.0 v19.12.5 v19.12.4 v19.12.3 v19.12.2 v19.12.1 v19.12.0)
 for legacy_version in "${legacy_versions_array[@]}"; do
 	if [ "${version}" == "${legacy_version}" ]; then
 		legacymode=1
@@ -78,7 +78,7 @@ if [ -z "${wsstartmap}" ]; then
 	fi
 fi
 
-fn_parms(){
+fn_parms() {
 	fn_reload_startparameters
 	parms="${startparameters}"
 }

+ 10 - 3
lgsm/functions/core_logs.sh

@@ -16,7 +16,7 @@ fi
 
 # For games not displaying a console, and having logs into their game directory.
 check_status.sh
-if [ "${status}" != "0" ]&&[ "${commandname}" == "START" ]&&[ -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}"
@@ -38,7 +38,14 @@ if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ];
 	darkrplogdir="${systemdir}/data/darkrp_logs"
 	legacyserverlogdir="${logdir}/server"
 	# Setting up counting variables
-	scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0"
+	scriptcount="0"
+	consolecount="0"
+	gamecount="0"
+	srcdscount="0"
+	smcount="0"
+	ulxcount="0"
+	darkrpcount="0"
+	legacycount="0"
 	fn_sleep_time
 	fn_print_info "Removing logs older than ${logdays} days"
 	fn_script_log_info "Removing logs older than ${logdays} days"
@@ -48,7 +55,7 @@ if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ];
 	scriptcount=$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)
 	find "${lgsmlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 	# SRCDS and unreal logfiles.
-	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
+	if [ "${engine}" == "unreal2" ] || [ "${engine}" == "source" ]; then
 		find "${gamelogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
 		gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}" | wc -l)
 		find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;

+ 75 - 75
lgsm/functions/core_messages.sh

@@ -9,7 +9,7 @@ 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(){
+fn_ansi_loader() {
 	if [ "${ansi}" != "off" ]; then
 		# echo colors
 		default="\e[0m"
@@ -34,8 +34,8 @@ fn_ansi_loader(){
 	creeol="\r\033[K"
 }
 
-fn_sleep_time(){
-	if [ "${sleeptime}" != "0" ]||[ "${travistest}" != "1" ]; then
+fn_sleep_time() {
+	if [ "${sleeptime}" != "0" ] || [ "${travistest}" != "1" ]; then
 		if [ -z "${sleeptime}" ]; then
 			sleeptime=0.5
 		fi
@@ -46,7 +46,7 @@ fn_sleep_time(){
 # Log display
 ########################
 ## Feb 28 14:56:58 ut99-server: Monitor:
-fn_script_log(){
+fn_script_log() {
 	if [ -d "${lgsmlogdir}" ]; then
 		if [ -n "${commandname}" ]; then
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ${1}" >> "${lgsmlog}"
@@ -57,7 +57,7 @@ fn_script_log(){
 }
 
 ## Feb 28 14:56:58 ut99-server: Monitor: PASS:
-fn_script_log_pass(){
+fn_script_log_pass() {
 	if [ -d "${lgsmlogdir}" ]; then
 
 		if [ -n "${commandname}" ]; then
@@ -70,7 +70,7 @@ fn_script_log_pass(){
 }
 
 ## Feb 28 14:56:58 ut99-server: Monitor: FATAL:
-fn_script_log_fatal(){
+fn_script_log_fatal() {
 	if [ -d "${lgsmlogdir}" ]; then
 		if [ -n "${commandname}" ]; then
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: FATAL: ${1}" >> "${lgsmlog}"
@@ -82,7 +82,7 @@ fn_script_log_fatal(){
 }
 
 ## Feb 28 14:56:58 ut99-server: Monitor: ERROR:
-fn_script_log_error(){
+fn_script_log_error() {
 	if [ -d "${lgsmlogdir}" ]; then
 		if [ -n "${commandname}" ]; then
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ERROR: ${1}" >> "${lgsmlog}"
@@ -94,7 +94,7 @@ fn_script_log_error(){
 }
 
 ## Feb 28 14:56:58 ut99-server: Monitor: WARN:
-fn_script_log_warn(){
+fn_script_log_warn() {
 	if [ -d "${lgsmlogdir}" ]; then
 		if [ -n "${commandname}" ]; then
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: WARN: ${1}" >> "${lgsmlog}"
@@ -106,7 +106,7 @@ fn_script_log_warn(){
 }
 
 ## Feb 28 14:56:58 ut99-server: Monitor: INFO:
-fn_script_log_info(){
+fn_script_log_info() {
 	if [ -d "${lgsmlogdir}" ]; then
 		if [ -n "${commandname}" ]; then
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: INFO: ${1}" >> "${lgsmlog}"
@@ -117,7 +117,7 @@ fn_script_log_info(){
 }
 
 ## Feb 28 14:56:58 ut99-server: Monitor: UPDATE:
-fn_script_log_update(){
+fn_script_log_update() {
 	if [ -d "${lgsmlogdir}" ]; then
 		if [ -n "${commandname}" ]; then
 			echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: UPDATE: ${1}" >> "${lgsmlog}"
@@ -131,7 +131,7 @@ fn_script_log_update(){
 ##################################
 
 # [ .... ]
-fn_print_dots(){
+fn_print_dots() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[ .... ] ${commandaction} ${selfname}: $*"
 	else
@@ -140,7 +140,7 @@ fn_print_dots(){
 	fn_sleep_time
 }
 
-fn_print_dots_nl(){
+fn_print_dots_nl() {
 	if [ "${commandaction}" ]; then
 		echo -e "${creeol}[ .... ] ${commandaction} ${selfname}: $*"
 	else
@@ -151,7 +151,7 @@ fn_print_dots_nl(){
 }
 
 # [  OK  ]
-fn_print_ok(){
+fn_print_ok() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${green}  OK  ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -160,7 +160,7 @@ fn_print_ok(){
 	fn_sleep_time
 }
 
-fn_print_ok_nl(){
+fn_print_ok_nl() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${green}  OK  ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -171,7 +171,7 @@ fn_print_ok_nl(){
 }
 
 # [ FAIL ]
-fn_print_fail(){
+fn_print_fail() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -180,7 +180,7 @@ fn_print_fail(){
 	fn_sleep_time
 }
 
-fn_print_fail_nl(){
+fn_print_fail_nl() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -191,7 +191,7 @@ fn_print_fail_nl(){
 }
 
 # [ ERROR ]
-fn_print_error(){
+fn_print_error() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -200,7 +200,7 @@ fn_print_error(){
 	fn_sleep_time
 }
 
-fn_print_error_nl(){
+fn_print_error_nl() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -211,7 +211,7 @@ fn_print_error_nl(){
 }
 
 # [ WARN ]
-fn_print_warn(){
+fn_print_warn() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -220,7 +220,7 @@ fn_print_warn(){
 	fn_sleep_time
 }
 
-fn_print_warn_nl(){
+fn_print_warn_nl() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -231,7 +231,7 @@ fn_print_warn_nl(){
 }
 
 # [ INFO ]
-fn_print_info(){
+fn_print_info() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -240,7 +240,7 @@ fn_print_info(){
 	fn_sleep_time
 }
 
-fn_print_info_nl(){
+fn_print_info_nl() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -251,7 +251,7 @@ fn_print_info_nl(){
 }
 
 # [ START ]
-fn_print_start(){
+fn_print_start() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -260,7 +260,7 @@ fn_print_start(){
 	fn_sleep_time
 }
 
-fn_print_start_nl(){
+fn_print_start_nl() {
 	if [ "${commandaction}" ]; then
 		echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*"
 	else
@@ -275,69 +275,69 @@ fn_print_start_nl(){
 
 # No More Room in Hell Debug
 # =================================
-fn_print_header(){
+fn_print_header() {
 	echo -e ""
 	echo -e "${lightyellow}${gamename} ${commandaction}${default}"
 	echo -e "=================================${default}"
 }
 
 # Complete!
-fn_print_complete(){
+fn_print_complete() {
 	echo -en "${green}Complete!${default} $*"
 	fn_sleep_time
 }
 
-fn_print_complete_nl(){
+fn_print_complete_nl() {
 	echo -e "${green}Complete!${default} $*"
 	fn_sleep_time
 }
 
 # Failure!
-fn_print_failure(){
+fn_print_failure() {
 	echo -en "${red}Failure!${default} $*"
 	fn_sleep_time
 }
 
-fn_print_failure_nl(){
+fn_print_failure_nl() {
 	echo -e "${red}Failure!${default} $*"
 	fn_sleep_time
 }
 
 # Error!
-fn_print_error2(){
+fn_print_error2() {
 	echo -en "${red}Error!${default} $*"
 	fn_sleep_time
 }
 
-fn_print_error2_nl(){
+fn_print_error2_nl() {
 	echo -e "${red}Error!${default} $*"
 	fn_sleep_time
 }
 
 # Warning!
-fn_print_warning(){
+fn_print_warning() {
 	echo -en "${lightyellow}Warning!${default} $*"
 	fn_sleep_time
 }
 
-fn_print_warning_nl(){
+fn_print_warning_nl() {
 	echo -e "${lightyellow}Warning!${default} $*"
 	fn_sleep_time
 }
 
 # Information!
-fn_print_information(){
+fn_print_information() {
 	echo -en "${cyan}Information!${default} $*"
 	fn_sleep_time
 }
 
-fn_print_information_nl(){
+fn_print_information_nl() {
 	echo -e "${cyan}Information!${default} $*"
 	fn_sleep_time
 }
 
 # Y/N Prompt
-fn_prompt_yn(){
+fn_prompt_yn() {
 	local prompt="$1"
 	local initial="$2"
 
@@ -350,23 +350,23 @@ fn_prompt_yn(){
 	fi
 
 	while true; do
-		read -e -i "${initial}" -p  "${prompt}" -r yn
+		read -e -i "${initial}" -p "${prompt}" -r yn
 		case "${yn}" in
-			[Yy]|[Yy][Ee][Ss]) return 0 ;;
-			[Nn]|[Nn][Oo]) return 1 ;;
-		*) echo -e "Please answer yes or no." ;;
+			[Yy] | [Yy][Ee][Ss]) return 0 ;;
+			[Nn] | [Nn][Oo]) return 1 ;;
+			*) echo -e "Please answer yes or no." ;;
 		esac
 	done
 }
 
 # Prompt for message
-fn_prompt_message(){
+fn_prompt_message() {
 	while true; do
 		unset prompt
 		local prompt="$1"
-		read -e -p  "${prompt}" -r answer
+		read -e -p "${prompt}" -r answer
 		if fn_prompt_yn "Continue" Y; then
-			break;
+			break
 		fi
 	done
 	echo "${answer}"
@@ -376,160 +376,160 @@ fn_prompt_message(){
 ##################################
 
 # YES
-fn_print_yes_eol(){
+fn_print_yes_eol() {
 	echo -en "${cyan}YES${default}"
 	fn_sleep_time
 }
 
-fn_print_yes_eol_nl(){
+fn_print_yes_eol_nl() {
 	echo -e "${cyan}YES${default}"
 	fn_sleep_time
 }
 
 # NO
-fn_print_no_eol(){
+fn_print_no_eol() {
 	echo -en "${red}NO${default}"
 	fn_sleep_time
 }
 
-fn_print_no_eol_nl(){
+fn_print_no_eol_nl() {
 	echo -e "${red}NO${default}"
 	fn_sleep_time
 }
 
 # OK
-fn_print_ok_eol(){
+fn_print_ok_eol() {
 	echo -en "${green}OK${default}"
 	fn_sleep_time
 }
 
-fn_print_ok_eol_nl(){
+fn_print_ok_eol_nl() {
 	echo -e "${green}OK${default}"
 	fn_sleep_time
 }
 
 # FAIL
-fn_print_fail_eol(){
+fn_print_fail_eol() {
 	echo -en "${red}FAIL${default}"
 	fn_sleep_time
 }
 
-fn_print_fail_eol_nl(){
+fn_print_fail_eol_nl() {
 	echo -e "${red}FAIL${default}"
 	fn_sleep_time
 }
 
 # ERROR
-fn_print_error_eol(){
+fn_print_error_eol() {
 	echo -en "${red}ERROR${default}"
 	fn_sleep_time
 }
 
-fn_print_error_eol_nl(){
+fn_print_error_eol_nl() {
 	echo -e "${red}ERROR${default}"
 	fn_sleep_time
 }
 
 # WAIT
-fn_print_wait_eol(){
+fn_print_wait_eol() {
 	echo -en "${cyan}WAIT${default}"
 	fn_sleep_time
 }
 
-fn_print_wait_eol_nl(){
+fn_print_wait_eol_nl() {
 	echo -e "${cyan}WAIT${default}"
 	fn_sleep_time
 }
 
 # WARN
-fn_print_warn_eol(){
+fn_print_warn_eol() {
 	echo -en "${lightyellow}WARN${default}"
 	fn_sleep_time
 }
 
-fn_print_warn_eol_nl(){
+fn_print_warn_eol_nl() {
 	echo -e "${lightyellow}WARN${default}"
 	fn_sleep_time
 }
 
 # INFO
-fn_print_info_eol(){
+fn_print_info_eol() {
 	echo -en "${cyan}INFO${default}"
 	fn_sleep_time
 }
 
-fn_print_info_eol_nl(){
+fn_print_info_eol_nl() {
 	echo -e "${cyan}INFO${default}"
 	fn_sleep_time
 }
 
 # QUERYING
-fn_print_querying_eol(){
+fn_print_querying_eol() {
 	echo -en "${cyan}QUERYING${default}"
 	fn_sleep_time
 }
 
-fn_print_querying_eol_nl(){
+fn_print_querying_eol_nl() {
 	echo -e "${cyan}QUERYING${default}"
 	fn_sleep_time
 }
 
 # CHECKING
-fn_print_checking_eol(){
+fn_print_checking_eol() {
 	echo -en "${cyan}CHECKING${default}"
 	fn_sleep_time
 }
 
-fn_print_checking_eol_nl(){
+fn_print_checking_eol_nl() {
 	echo -e "${cyan}CHECKING${default}"
 	fn_sleep_time
 }
 
 # DELAY
-fn_print_delay_eol(){
+fn_print_delay_eol() {
 	echo -en "${green}DELAY${default}"
 	fn_sleep_time
 }
 
-fn_print_delay_eol_nl(){
+fn_print_delay_eol_nl() {
 	echo -e "${green}DELAY${default}"
 	fn_sleep_time
 }
 
 # CANCELED
-fn_print_canceled_eol(){
+fn_print_canceled_eol() {
 	echo -en "${lightyellow}CANCELED${default}"
 	fn_sleep_time
 }
 
-fn_print_canceled_eol_nl(){
+fn_print_canceled_eol_nl() {
 	echo -e "${lightyellow}CANCELED${default}"
 	fn_sleep_time
 }
 
 # REMOVED
-fn_print_removed_eol(){
+fn_print_removed_eol() {
 	echo -en "${red}REMOVED${default}"
 	fn_sleep_time
 }
 
-fn_print_removed_eol_nl(){
+fn_print_removed_eol_nl() {
 	echo -e "${red}REMOVED${default}"
 	fn_sleep_time
 }
 
 # UPDATE
-fn_print_update_eol(){
+fn_print_update_eol() {
 	echo -en "${cyan}UPDATE${default}"
 	fn_sleep_time
 }
 
-fn_print_update_eol_nl(){
+fn_print_update_eol_nl() {
 	echo -e "${cyan}UPDATE${default}"
 	fn_sleep_time
 }
 
-fn_print_ascii_logo(){
+fn_print_ascii_logo() {
 	echo -e ""
 	echo -e "                                mdMMMMbm"
 	echo -e "                              mMMMMMMMMMMm"
@@ -565,7 +565,7 @@ fn_print_ascii_logo(){
 	echo -e ""
 }
 
-fn_print_restart_warning(){
+fn_print_restart_warning() {
 	fn_print_warn "${selfname} will be restarted"
 	fn_script_log_warn "${selfname} will be restarted"
 	totalseconds=3
@@ -584,7 +584,7 @@ fn_print_restart_warning(){
 # Useful when a command has to call upon another command causing the other command to overrite commandname variables
 
 # Used to remember the command that ran first.
-fn_firstcommand_set(){
+fn_firstcommand_set() {
 	if [ -z "${firstcommandname}" ]; then
 		firstcommandname="${commandname}"
 		firstcommandaction="${commandaction}"
@@ -592,7 +592,7 @@ fn_firstcommand_set(){
 }
 
 # Used to reset commandname variables to the command the script ran first.
-fn_firstcommand_reset(){
+fn_firstcommand_reset() {
 	commandname="${firstcommandname}"
 	commandaction="${firstcommandaction}"
 }

+ 23 - 23
lgsm/functions/core_steamcmd.sh

@@ -7,8 +7,8 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-fn_install_steamcmd(){
-	if [ "${shortname}" == "ark" ]&&[ "${installsteamcmd}" == "1" ]; then
+fn_install_steamcmd() {
+	if [ "${shortname}" == "ark" ] && [ "${installsteamcmd}" == "1" ]; then
 		steamcmddir="${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux"
 	fi
 	if [ ! -d "${steamcmddir}" ]; then
@@ -19,7 +19,7 @@ fn_install_steamcmd(){
 	chmod +x "${steamcmddir}/steamcmd.sh"
 }
 
-fn_check_steamcmd_user(){
+fn_check_steamcmd_user() {
 	# Checks if steamuser is setup.
 	if [ "${steamuser}" == "username" ]; then
 		fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}"
@@ -39,10 +39,10 @@ fn_check_steamcmd_user(){
 	fi
 }
 
-fn_check_steamcmd(){
+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 [ ! -f "${steamcmddir}/steamcmd.sh" ] && [ -z "$(command -v steamcmd 2> /dev/null)" ]; then
 		if [ "${commandname}" == "INSTALL" ]; then
 			fn_install_steamcmd
 		else
@@ -56,7 +56,7 @@ fn_check_steamcmd(){
 	fi
 }
 
-fn_check_steamcmd_dir(){
+fn_check_steamcmd_dir() {
 	# Worksround that pre-installs the correct steam directories to ensure all packages use the correct Standard.
 	# https://github.com/ValveSoftware/steam-for-linux/issues/6976#issuecomment-610446347
 
@@ -86,25 +86,25 @@ fn_check_steamcmd_dir(){
 	fi
 }
 
-fn_check_steamcmd_dir_legacy(){
+fn_check_steamcmd_dir_legacy() {
 	# Remove old Steam installation directories ~/Steam and ${rootdir}/steamcmd
-	if [ -d "${rootdir}/steamcmd" ]&&[ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then
+	if [ -d "${rootdir}/steamcmd" ] && [ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then
 		rm -rf "${rootdir:?}/steamcmd"
 	fi
 
-	if [ -d "${HOME}/Steam" ]&&[ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then
+	if [ -d "${HOME}/Steam" ] && [ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then
 		rm -rf "${HOME}/Steam"
 	fi
 }
 
-fn_check_steamcmd_steamapp(){
+fn_check_steamcmd_steamapp() {
 	# Check that steamapp directory fixes issue #3481
 	if [ ! -d "${serverfiles}/steamapps" ]; then
 		mkdir -p "${serverfiles}/steamapps"
 	fi
 }
 
-fn_check_steamcmd_ark(){
+fn_check_steamcmd_ark() {
 	# Checks if SteamCMD exists in
 	# Engine/Binaries/ThirdParty/SteamCMD/Linux
 	# to allow ark mods to work
@@ -123,9 +123,9 @@ fn_check_steamcmd_ark(){
 	fi
 }
 
-fn_check_steamcmd_clear(){
+fn_check_steamcmd_clear() {
 	# Will remove steamcmd dir if steamcmd package is installed.
-	if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${rootdir}/steamcmd" ]; then
+	if [ "$(command -v steamcmd 2> /dev/null)" ] && [ -d "${rootdir}/steamcmd" ]; then
 		rm -rf "${steamcmddir:?}"
 		exitcode=$?
 		if [ "${exitcode}" != 0 ]; then
@@ -136,15 +136,15 @@ fn_check_steamcmd_clear(){
 	fi
 }
 
-fn_check_steamcmd_exec(){
-	if [ "$(command -v steamcmd 2>/dev/null)" ]; then
+fn_check_steamcmd_exec() {
+	if [ "$(command -v steamcmd 2> /dev/null)" ]; then
 		steamcmdcommand="steamcmd"
 	else
 		steamcmdcommand="./steamcmd.sh"
 	fi
 }
 
-fn_update_steamcmd_localbuild(){
+fn_update_steamcmd_localbuild() {
 	# Gets local build info.
 	fn_print_dots "Checking local build: ${remotelocation}"
 	fn_appmanifest_check
@@ -157,7 +157,7 @@ fn_update_steamcmd_localbuild(){
 	fi
 
 	# Checks if localbuild variable has been set.
-	if [ -z "${localbuild}" ]||[ "${localbuild}" == "null" ]; then
+	if [ -z "${localbuild}" ] || [ "${localbuild}" == "null" ]; then
 		fn_print_fail "Checking local build: ${remotelocation}"
 		fn_script_log_fatal "Checking local build"
 		core_exit.sh
@@ -167,7 +167,7 @@ fn_update_steamcmd_localbuild(){
 	fi
 }
 
-fn_update_steamcmd_remotebuild(){
+fn_update_steamcmd_remotebuild() {
 	# Gets remote build info.
 	if [ -d "${steamcmddir}" ]; then
 		cd "${steamcmddir}" || exit
@@ -184,7 +184,7 @@ fn_update_steamcmd_remotebuild(){
 	if [ "${firstcommandname}" != "INSTALL" ]; then
 		fn_print_dots "Checking remote build: ${remotelocation}"
 		# Checks if remotebuild variable has been set.
-		if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then
+		if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
 			fn_print_fail "Checking remote build: ${remotelocation}"
 			fn_script_log_fatal "Checking remote build"
 			core_exit.sh
@@ -194,7 +194,7 @@ fn_update_steamcmd_remotebuild(){
 		fi
 	else
 		# Checks if remotebuild variable has been set.
-		if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then
+		if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
 			fn_print_failure "Unable to get remote build"
 			fn_script_log_fatal "Unable to get remote build"
 			core_exit.sh
@@ -202,7 +202,7 @@ fn_update_steamcmd_remotebuild(){
 	fi
 }
 
-fn_update_steamcmd_compare(){
+fn_update_steamcmd_compare() {
 	fn_print_dots "Checking for update: ${remotelocation}"
 	if [ "${localbuild}" != "${remotebuild}" ]; then
 		fn_print_ok_nl "Checking for update: ${remotelocation}"
@@ -280,12 +280,12 @@ fn_update_steamcmd_compare(){
 	fi
 }
 
-fn_appmanifest_info(){
+fn_appmanifest_info() {
 	appmanifestfile=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf")
 	appmanifestfilewc=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf" | wc -l)
 }
 
-fn_appmanifest_check(){
+fn_appmanifest_check() {
 	fn_appmanifest_info
 	# Multiple or no matching appmanifest files may sometimes be present.
 	# This error is corrected if required.

+ 1 - 1
lgsm/functions/core_trap.sh

@@ -7,7 +7,7 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-fn_exit_trap(){
+fn_exit_trap() {
 	if [ -z "${exitcode}" ]; then
 		exitcode=$?
 	fi

+ 34 - 32
lgsm/functions/fix.sh

@@ -9,19 +9,19 @@
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Messages that are displayed for some fixes.
-fn_fix_msg_start(){
+fn_fix_msg_start() {
 	fn_print_dots "Applying ${fixname} fix: ${gamename}"
 	fn_print_info "Applying ${fixname} fix: ${gamename}"
 	fn_script_log_info "Applying ${fixname} fix: ${gamename}"
 }
 
-fn_fix_msg_start_nl(){
+fn_fix_msg_start_nl() {
 	fn_print_dots "Applying ${fixname} fix: ${gamename}"
 	fn_print_info "Applying ${fixname} fix: ${gamename}"
 	fn_script_log_info "Applying ${fixname} fix: ${gamename}"
 }
 
-fn_fix_msg_end(){
+fn_fix_msg_end() {
 	if [ $? != 0 ]; then
 		fn_print_error_nl "Applying ${fixname} fix: ${gamename}"
 		fn_script_log_error "Applying ${fixname} fix: ${gamename}"
@@ -32,17 +32,19 @@ fn_fix_msg_end(){
 }
 
 # Fixes that are run on start.
-if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then
+if [ "${commandname}" != "INSTALL" ] && [ -z "${fixbypass}" ]; then
 	if [ "${appid}" ]; then
 		fix_steamcmd.sh
 	fi
 
-	if  [ "${shortname}" == "arma3" ]; then
+	if [ "${shortname}" == "arma3" ]; then
 		fix_arma3.sh
 	elif [ "${shortname}" == "armar" ]; then
 		fix_armar.sh
 	elif [ "${shortname}" == "ark" ]; then
 		fix_ark.sh
+	elif [ "${shortname}" == "bt" ]; then
+		fix_bt.sh
 	elif [ "${shortname}" == "bo" ]; then
 		fix_bo.sh
 	elif [ "${shortname}" == "csgo" ]; then
@@ -96,32 +98,32 @@ fi
 
 # Fixes that are run on install only.
 if [ "${commandname}" == "INSTALL" ]; then
-		if [ "${shortname}" == "av" ]||[ "${shortname}" == "cmw" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "lo" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "samp" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then
-			echo -e ""
-			echo -e "${lightyellow}Applying Post-Install Fixes${default}"
-			echo -e "================================="
-			fn_sleep_time
-			postinstall=1
-			if [ "${shortname}" == "av" ]; then
-				fix_av.sh
-			elif [ "${shortname}" == "kf" ]; then
-				fix_kf.sh
-			elif [ "${shortname}" == "kf2" ]; then
-				fix_kf2.sh
-			elif [ "${shortname}" == "lo" ]; then
-				fix_lo.sh
-			elif [ "${shortname}" == "ro" ]; then
-				fix_ro.sh
-			elif [ "${shortname}" == "samp" ]; then
-				fix_samp.sh
-			elif [ "${shortname}" == "ut2k4" ]; then
-				fix_ut2k4.sh
-			elif [ "${shortname}" == "ut" ]; then
-				fix_ut.sh
-			elif [ "${shortname}" == "ut3" ]; then
-				fix_ut3.sh
-			else
-				fn_print_information_nl "No fixes required."
-			fi
+	if [ "${shortname}" == "av" ] || [ "${shortname}" == "cmw" ] || [ "${shortname}" == "kf" ] || [ "${shortname}" == "kf2" ] || [ "${shortname}" == "lo" ] || [ "${shortname}" == "onset" ] || [ "${shortname}" == "ro" ] || [ "${shortname}" == "samp" ] || [ "${shortname}" == "ut2k4" ] || [ "${shortname}" == "ut" ] || [ "${shortname}" == "ut3" ]; then
+		echo -e ""
+		echo -e "${lightyellow}Applying Post-Install Fixes${default}"
+		echo -e "================================="
+		fn_sleep_time
+		postinstall=1
+		if [ "${shortname}" == "av" ]; then
+			fix_av.sh
+		elif [ "${shortname}" == "kf" ]; then
+			fix_kf.sh
+		elif [ "${shortname}" == "kf2" ]; then
+			fix_kf2.sh
+		elif [ "${shortname}" == "lo" ]; then
+			fix_lo.sh
+		elif [ "${shortname}" == "ro" ]; then
+			fix_ro.sh
+		elif [ "${shortname}" == "samp" ]; then
+			fix_samp.sh
+		elif [ "${shortname}" == "ut2k4" ]; then
+			fix_ut2k4.sh
+		elif [ "${shortname}" == "ut" ]; then
+			fix_ut.sh
+		elif [ "${shortname}" == "ut3" ]; then
+			fix_ut3.sh
+		else
+			fn_print_information_nl "No fixes required."
 		fi
+	fi
 fi

Некоторые файлы не были показаны из-за большого количества измененных файлов