Browse Source

Merge branch 'release/v22.2.0'

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

15
.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

32
.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 '....'

31
.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

13
.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

1
.github/dependabot.yml

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

92
.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"

31
.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!**

55
.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
.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

4
.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
.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 }}

4
.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"

1
.gitignore

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

3
.prettierrc.json

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

11
.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"
]
}

29
CODE_OF_CONDUCT.md

@ -1,4 +1,3 @@
# Contributor Covenant Code of Conduct
## Our Pledge
@ -18,23 +17,23 @@ 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,
- 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
- 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
- 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
- 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
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
@ -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

118
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)
[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)
- [🎉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)
- [🎮 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)
- [🎮 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)
- [Testing](#testing)
- [Pull Request Status Checks](#pull-request-status-checks)
- [Test Environment](#test-environment)
+ [:wine_glass: Styleguides](#-wine-glass--styleguides)
- [: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)
- [: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.
#### 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.

4
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

22
README.md

File diff suppressed because one or more lines are too long

2
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

2
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}"

11
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
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 protected]"
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="[email protected]"
mailgunemail="[email protected]"
# 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"

3
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

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

2
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

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

3
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

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

1
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

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

1
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

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

3
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

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

3
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

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

3
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

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

1
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 ac acserver Assetto Corsa

1
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

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

5
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

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

5
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

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

5
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

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

5
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

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

19
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.

86
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"

3
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",

3
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}",

3
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}",

12
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}"

3
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",

3
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}",

3
lgsm/functions/alert_slack.sh

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

3
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",

20
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

10
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

79
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
@ -287,7 +286,7 @@ fn_deps_detector(){
# 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
if [ "${deptocheck}" != "steamcmd" ] && [ "${deptocheck}" == "${steamcmddeptocheck}" ]; then
steamcmdfail=1
fi
done
@ -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
@ -351,7 +350,7 @@ 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"

36
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

4
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

6
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

34
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:"
@ -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,8 +122,8 @@ 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 [ "${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}"
@ -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
@ -212,10 +212,10 @@ fn_sys_perm_errors_fix(){
}
# 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

2
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}")

2
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

6
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

4
lgsm/functions/check_tmuxception.sh

@ -7,7 +7,7 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_check_is_in_tmux(){
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."
@ -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."

2
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"

46
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

14
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

8
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"

4
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

26
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
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"
${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"
${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
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"

15
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,13 +46,13 @@ 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)
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"
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"
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
@ -63,7 +62,7 @@ for glibc_check_var in "${glibc_check_dir_array[@]}"; do
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"

16
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
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
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"
ldd "${line}" 2> /dev/null | grep -v "not a dynamic executable" | grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp"
fi
fi
echo -n "$i / $files" $'\r'
((i++))
done
done
echo -e ""
echo -e ""
echo -e "All"

217
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 "${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
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 "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 }')"
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 }')"
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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

65
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}"

2
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 "================================="

20
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,7 +65,7 @@ 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
if [ "${usermodselect}" == "exit" ] || [ "${usermodselect}" == "abort" ]; then
core_exit.sh
# Supplementary output upon invalid user input.
elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
@ -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

13
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"

12
lgsm/functions/command_mods_update.sh

@ -15,19 +15,19 @@ 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
@ -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

44
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,16 +91,16 @@ 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
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
@ -152,7 +152,7 @@ for queryattempt in {1..5}; do
fi
# send LinuxGSM stats if monitor is OK.
if [ "${stats}" == "on" ]||[ "${stats}" == "y" ]; then
if [ "${stats}" == "on" ] || [ "${stats}" == "y" ]; then
info_stats.sh
fi
fi
@ -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

5
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

2
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}\""

2
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"

19
lgsm/functions/command_start.sh

@ -10,7 +10,7 @@ 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"
@ -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,8 +140,7 @@ 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
if grep -c "Operation not permitted" "${lgsmlogdir}/.${selfname}-tmux-error.tmp"; then
echo -e ""
echo -e "Fix"
echo -e "================================="
@ -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

30
lgsm/functions/command_stop.sh

@ -11,7 +11,7 @@ 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.
@ -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"

4
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"

2
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

20
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

2
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

22
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,12 +22,12 @@ 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)"
@ -42,7 +42,7 @@ 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)"
@ -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

74
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"
@ -116,7 +116,7 @@ fn_dl_steamcmd(){
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 [ "${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}"

6
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}"

907
lgsm/functions/core_functions.sh

File diff suppressed because it is too large

155
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,10 +170,10 @@ fn_opt_usage(){
# Display available commands.
index="0"
{
for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
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]}"
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
@ -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}"

18
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:"

4
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}"
}

13
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 {} \;

144
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"
@ -352,21 +352,21 @@ fn_prompt_yn(){
while true; do
read -e -i "${initial}" -p "${prompt}" -r yn
case "${yn}" in
[Yy]|[Yy][Ee][Ss]) return 0 ;;
[Nn]|[Nn][Oo]) return 1 ;;
[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
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}"
}

46
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.

2
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

12
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,7 +32,7 @@ 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
@ -43,6 +43,8 @@ if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; 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,7 +98,7 @@ 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
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 "================================="

8
lgsm/functions/fix_ark.sh

@ -19,7 +19,11 @@ elif [ "${steamappsfilewc}" -eq "1" ]; then
# This allows LinxuGSM to select either ~/.steam or ~/Steam. depending on what is being used
steamappsfile=$(find "${HOME}" -name appworkshop_346110.acf)
steamappsdir=$(dirname "${steamappsfile}")
steamappspath=$(cd "${steamappsdir}" || return; cd ../;pwd)
steamappspath=$(
cd "${steamappsdir}" || return
cd ../
pwd
)
# removes the symlink if exists.
# fixes issue with older versions of LinuxGSM linking to /home/arkserver/steamcmd
@ -41,7 +45,7 @@ elif [ "${steamappsfilewc}" -eq "1" ]; then
fi
# if the steamapps symlink is incorrect unlink it.
if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]&&[ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]&&[ "$(readlink "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps")" != "${steamappspath}" ]; then
if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ] && [ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ] && [ "$(readlink "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps")" != "${steamappspath}" ]; then
fixname="incorrect steamapps symlink"
fn_fix_msg_start
unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps"

2
lgsm/functions/fix_arma3.sh

@ -8,7 +8,7 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Fixes: 20150 Segmentation fault (core dumped) error.
if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3" ]||[ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3 - Other Profiles" ]; then
if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3" ] || [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3 - Other Profiles" ]; then
fixname="20150 Segmentation fault (core dumped)"
fn_fix_msg_start
mkdir -p "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3 - Other Profiles"

16
lgsm/functions/fix_bt.sh

@ -0,0 +1,16 @@
#!/bin/bash
# LinuxGSM fix_bt.sh module
# Author: Daniel Gibbs
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Resolves an issue with Barotrauma.
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Fixes: Missing user data directory error.
if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Daedalic Entertainment GmbH/Barotrauma" ]; then
fixname="Missing user data directory error."
fn_fix_msg_start
mkdir -p "${XDG_DATA_HOME:="${HOME}/.local/share"}/Daedalic Entertainment GmbH/Barotrauma"
fn_fix_msg_end
fi

9
lgsm/functions/fix_csgo.sh

@ -31,3 +31,12 @@ if [ -f "${servercfgdir}/valve.rc" ] && grep -E '^\s*exec\s*(default|joystick)\.
sed -i 's/^\s*exec\s*joystick.cfg/\/\/exec joystick.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1
fn_fix_msg_end
fi
# Fixes: Detected engine 11 but could not load: /home/csgo/serverfiles/bin/libgcc_s.so.1: version `GCC_7.0.0' not found (required by /lib/i386-linux-gnu/libstdc++.so.6)
libgccc_so="${serverfiles}/bin/libgcc_s.so.1"
if [ -f "${libgccc_so}" ]; then
fixname="libgcc_s.so.1 move away"
fn_fix_msg_start
mv -v "${libgccc_so}" "${libgccc_so}.bck"
fn_fix_msg_end
fi

2
lgsm/functions/fix_dst.sh

@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer).
# Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.
if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" ]; then
if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" ]; then
fixname="libcurl-gnutls.so.4"
fn_fix_msg_start
ln -s "/usr/lib/libcurl.so.4" "${serverfiles}/bin/lib32/libcurl-gnutls.so.4"

2
lgsm/functions/fix_onset.sh

@ -11,7 +11,7 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}"
# Fixes: Failed loading "mariadb": libmariadbclient.so.18: cannot open shared object file: No such file or directory
# Issue only occures on CentOS as libmariadbclient.so.18 is called libmariadb.so.3 on CentOS.
if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/libmariadbclient.so.18" ]&&[ -f "/usr/lib64/libmariadb.so.3" ]; then
if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/libmariadbclient.so.18" ] && [ -f "/usr/lib64/libmariadb.so.3" ]; then
fixname="libmariadbclient.so.18"
fn_fix_msg_start
ln -s "/usr/lib64/libmariadb.so.3" "${serverfiles}/libmariadbclient.so.18"

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

Loading…
Cancel
Save