Browse Source

chore: use prettier for code tidy (#3901)

* feat: start using prettier linter

https://prettier.io/

* feat: prettier code formatting

* feat: add super linter
pull/3911/head
Daniel Gibbs 3 years ago
committed by GitHub
parent
commit
635f4bce52
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      .gitattributes
  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. 4
      .github/workflows/create-release.yml
  9. 24
      .github/workflows/git-sync.yml
  10. 16
      .github/workflows/labeler.yml
  11. 55
      .github/workflows/linter.yml
  12. 8
      .github/workflows/lock.yml
  13. 4
      .github/workflows/potential-duplicates.yml
  14. 4
      .github/workflows/version-check.sh
  15. 10
      .github/workflows/version-check.yml
  16. 41
      CODE_OF_CONDUCT.md
  17. 142
      CONTRIBUTING.md
  18. 22
      README.md
  19. 19
      lgsm/functions/README.md
  20. 86
      lgsm/functions/alert.sh
  21. 3
      lgsm/functions/alert_discord.sh
  22. 3
      lgsm/functions/alert_gotify.sh
  23. 3
      lgsm/functions/alert_ifttt.sh
  24. 12
      lgsm/functions/alert_mailgun.sh
  25. 3
      lgsm/functions/alert_pushbullet.sh
  26. 2
      lgsm/functions/alert_pushover.sh
  27. 3
      lgsm/functions/alert_rocketchat.sh
  28. 3
      lgsm/functions/alert_slack.sh
  29. 3
      lgsm/functions/alert_telegram.sh
  30. 20
      lgsm/functions/check.sh
  31. 10
      lgsm/functions/check_config.sh
  32. 91
      lgsm/functions/check_deps.sh
  33. 36
      lgsm/functions/check_ip.sh
  34. 4
      lgsm/functions/check_last_update.sh
  35. 6
      lgsm/functions/check_logs.sh
  36. 60
      lgsm/functions/check_permissions.sh
  37. 2
      lgsm/functions/check_status.sh
  38. 6
      lgsm/functions/check_system_requirements.sh
  39. 6
      lgsm/functions/check_tmuxception.sh
  40. 2
      lgsm/functions/check_version.sh
  41. 46
      lgsm/functions/command_backup.sh
  42. 6
      lgsm/functions/command_debug.sh
  43. 4
      lgsm/functions/command_details.sh
  44. 36
      lgsm/functions/command_dev_detect_deps.sh
  45. 33
      lgsm/functions/command_dev_detect_glibc.sh
  46. 26
      lgsm/functions/command_dev_detect_ldd.sh
  47. 283
      lgsm/functions/command_dev_query_raw.sh
  48. 67
      lgsm/functions/command_fastdl.sh
  49. 2
      lgsm/functions/command_install_resources_mta.sh
  50. 22
      lgsm/functions/command_mods_install.sh
  51. 13
      lgsm/functions/command_mods_remove.sh
  52. 14
      lgsm/functions/command_mods_update.sh
  53. 184
      lgsm/functions/command_monitor.sh
  54. 5
      lgsm/functions/command_postdetails.sh
  55. 2
      lgsm/functions/command_send.sh
  56. 2
      lgsm/functions/command_skeleton.sh
  57. 31
      lgsm/functions/command_start.sh
  58. 30
      lgsm/functions/command_stop.sh
  59. 4
      lgsm/functions/command_ts3_server_pass.sh
  60. 2
      lgsm/functions/command_update.sh
  61. 20
      lgsm/functions/command_update_linuxgsm.sh
  62. 2
      lgsm/functions/command_validate.sh
  63. 26
      lgsm/functions/command_wipe.sh
  64. 92
      lgsm/functions/core_dl.sh
  65. 6
      lgsm/functions/core_exit.sh
  66. 912
      lgsm/functions/core_functions.sh
  67. 159
      lgsm/functions/core_getopt.sh
  68. 18
      lgsm/functions/core_github.sh
  69. 4
      lgsm/functions/core_legacy.sh
  70. 13
      lgsm/functions/core_logs.sh
  71. 150
      lgsm/functions/core_messages.sh
  72. 46
      lgsm/functions/core_steamcmd.sh
  73. 2
      lgsm/functions/core_trap.sh
  74. 64
      lgsm/functions/fix.sh
  75. 8
      lgsm/functions/fix_ark.sh
  76. 2
      lgsm/functions/fix_arma3.sh
  77. 2
      lgsm/functions/fix_dst.sh
  78. 10
      lgsm/functions/fix_lo.sh
  79. 2
      lgsm/functions/fix_onset.sh
  80. 4
      lgsm/functions/fix_samp.sh
  81. 2
      lgsm/functions/fix_squad.sh
  82. 4
      lgsm/functions/fix_steamcmd.sh
  83. 2
      lgsm/functions/fix_tf2.sh
  84. 4
      lgsm/functions/fix_ts3.sh
  85. 6
      lgsm/functions/fix_vh.sh
  86. 67
      lgsm/functions/info_distro.sh
  87. 282
      lgsm/functions/info_game.sh
  88. 264
      lgsm/functions/info_messages.sh
  89. 6
      lgsm/functions/info_stats.sh
  90. 238
      lgsm/functions/install_config.sh
  91. 4
      lgsm/functions/install_eula.sh
  92. 2
      lgsm/functions/install_gslt.sh
  93. 2
      lgsm/functions/install_logs.sh
  94. 3
      lgsm/functions/install_retry.sh
  95. 195
      lgsm/functions/install_server_files.sh
  96. 18
      lgsm/functions/install_ts3db.sh
  97. 142
      lgsm/functions/mods_core.sh
  98. 106
      lgsm/functions/mods_list.sh
  99. 8
      lgsm/functions/query_gamedig.sh
  100. 14
      lgsm/functions/update_factorio.sh

18
.gitattributes

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

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

4
.github/workflows/create-release.yml

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

24
.github/workflows/git-sync.yml

@ -10,16 +10,16 @@ jobs:
GitHub-to-Bitbucket:
runs-on: ubuntu-latest
steps:
- name: webfactory/[email protected]
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.BITBUCKET_SECRET }}
- name: webfactory/[email protected]
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.BITBUCKET_SECRET }}
- name: wei/[email protected]
uses: wei/[email protected]
with:
ssh_private_key: ${{ secrets.BITBUCKET_SECRET }}
source_repo: "https://github.com/GameServerManagers/LinuxGSM"
source_branch: "refs/heads/*"
destination_repo: "[email protected]:GameServerManagers/linuxgsm.git"
destination_branch: "refs/heads/*"
- name: wei/[email protected]
uses: wei/[email protected]
with:
ssh_private_key: ${{ secrets.BITBUCKET_SECRET }}
source_repo: "https://github.com/GameServerManagers/LinuxGSM"
source_branch: "refs/heads/*"
destination_repo: "[email protected]:GameServerManagers/linuxgsm.git"
destination_branch: "refs/heads/*"

16
.github/workflows/labeler.yml

@ -9,13 +9,13 @@ permissions:
jobs:
triage:
permissions:
contents: read # for github/issue-labeler to get repo contents
issues: write # for github/issue-labeler to create or remove labels
contents: read # for github/issue-labeler to get repo contents
issues: write # for github/issue-labeler to create or remove labels
runs-on: ubuntu-latest
steps:
- uses: github/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
not-before:
enable-versioned-regex: 0
- uses: github/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
not-before:
enable-versioned-regex: 0

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

8
.github/workflows/lock.yml

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

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

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"

10
.github/workflows/version-check.yml

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

41
CODE_OF_CONDUCT.md

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

142
CONTRIBUTING.md

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

22
README.md

File diff suppressed because one or more lines are too long

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

2
lgsm/functions/alert_pushover.sh

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

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

91
lgsm/functions/check_deps.sh

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

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

60
lgsm/functions/check_permissions.sh

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

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

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

6
lgsm/functions/check_tmuxception.sh

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

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

6
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.
@ -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

36
lgsm/functions/command_dev_detect_deps.sh

@ -15,26 +15,26 @@ echo -e "Dependencies Checker"
echo -e "================================="
echo -e "Checking directory: "
echo -e "${serverfiles}"
if [ "$(command -v eu-readelf 2>/dev/null)" ]; then
if [ "$(command -v eu-readelf 2> /dev/null)" ]; then
readelf=eu-readelf
elif [ "$(command -v readelf 2>/dev/null)" ]; then
elif [ "$(command -v readelf 2> /dev/null)" ]; then
readelf=readelf
else
echo -e "readelf/eu-readelf not installed"
fi
files=$(find "${serverfiles}" | wc -l)
find "${serverfiles}" -type f -print0 |
while IFS= read -r -d $'\0' line; do
if [ "${readelf}" == "eu-readelf" ]; then
${readelf} -d "${line}" 2>/dev/null | grep NEEDED| awk '{ print $4 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
else
${readelf} -d "${line}" 2>/dev/null | grep NEEDED | awk '{ print $5 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
fi
echo -n "${i} / ${files}" $'\r'
((i++))
done
find "${serverfiles}" -type f -print0 \
| while IFS= read -r -d $'\0' line; do
if [ "${readelf}" == "eu-readelf" ]; then
${readelf} -d "${line}" 2> /dev/null | grep NEEDED | awk '{ print $4 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
else
${readelf} -d "${line}" 2> /dev/null | grep NEEDED | awk '{ print $5 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
fi
echo -n "${i} / ${files}" $'\r'
((i++))
done
sort "${tmpdir}/.depdetect_readelf" |uniq >"${tmpdir}/.depdetect_readelf_uniq"
sort "${tmpdir}/.depdetect_readelf" | uniq > "${tmpdir}/.depdetect_readelf_uniq"
touch "${tmpdir}/.depdetect_centos_list"
touch "${tmpdir}/.depdetect_ubuntu_list"
@ -42,7 +42,7 @@ touch "${tmpdir}/.depdetect_debian_list"
while read -r lib; do
echo -e "${lib}"
libs_array=( libm.so.6 libc.so.6 libtcmalloc_minimal.so.4 libpthread.so.0 libdl.so.2 libnsl.so.1 libgcc_s.so.1 librt.so.1 ld-linux.so.2 libdbus-glib-1.so.2 libgio-2.0.so.0 libglib-2.0.so.0 libGL.so.1 libgobject-2.0.so.0 libnm-glib.so.4 libnm-util.so.2 )
libs_array=(libm.so.6 libc.so.6 libtcmalloc_minimal.so.4 libpthread.so.0 libdl.so.2 libnsl.so.1 libgcc_s.so.1 librt.so.1 ld-linux.so.2 libdbus-glib-1.so.2 libgio-2.0.so.0 libglib-2.0.so.0 libGL.so.1 libgobject-2.0.so.0 libnm-glib.so.4 libnm-util.so.2)
for lib_file in "${libs_array[@]}"; do
if [ "${lib}" == "${lib_file}" ]; then
echo -e "glibc.i686" >> "${tmpdir}/.depdetect_centos_list"
@ -52,7 +52,7 @@ while read -r lib; do
fi
done
libs_array=( libawt.so libjava.so libjli.so libjvm.so libnet.so libnio.so libverify.so )
libs_array=(libawt.so libjava.so libjli.so libjvm.so libnet.so libnio.so libverify.so)
for lib_file in "${libs_array[@]}"; do
if [ "${lib}" == "${lib_file}" ]; then
echo -e "java-1.8.0-openjdk" >> "${tmpdir}/.depdetect_centos_list"
@ -62,7 +62,7 @@ while read -r lib; do
fi
done
libs_array=( libtier0.so libtier0_srv.so libvstdlib_srv.so Core.so libvstdlib.so libtier0_s.so Editor.so Engine.so liblua.so libsteam_api.so ld-linux-x86-64.so.2 libPhysX3_x86.so libPhysX3Common_x86.so libPhysX3Cooking_x86.so)
libs_array=(libtier0.so libtier0_srv.so libvstdlib_srv.so Core.so libvstdlib.so libtier0_s.so Editor.so Engine.so liblua.so libsteam_api.so ld-linux-x86-64.so.2 libPhysX3_x86.so libPhysX3Common_x86.so libPhysX3Cooking_x86.so)
for lib_file in "${libs_array[@]}"; do
# Known shared libs what dont requires dependencies.
if [ "${lib}" == "${lib_file}" ]; then
@ -85,12 +85,12 @@ while read -r lib; do
echo -e "libcurl4-gnutls-dev:i386" >> "${tmpdir}/.depdetect_ubuntu_list"
echo -e "libcurl4-gnutls-dev:i386" >> "${tmpdir}/.depdetect_debian_list"
libdetected=1
elif [ "${lib}" == "libspeex.so.1" ]||[ "${lib}" == "libspeexdsp.so.1" ]; then
elif [ "${lib}" == "libspeex.so.1" ] || [ "${lib}" == "libspeexdsp.so.1" ]; then
echo -e "speex.i686" >> "${tmpdir}/.depdetect_centos_list"
echo -e "speex:i386" >> "${tmpdir}/.depdetect_ubuntu_list"
echo -e "speex:i386" >> "${tmpdir}/.depdetect_debian_list"
libdetected=1
elif [ "${lib}" == "./libSDL-1.2.so.0" ]||[ "${lib}" == "libSDL-1.2.so.0" ]; then
elif [ "${lib}" == "./libSDL-1.2.so.0" ] || [ "${lib}" == "libSDL-1.2.so.0" ]; then
echo -e "SDL.i686" >> "${tmpdir}/.depdetect_centos_list"
echo -e "libsdl1.2debian" >> "${tmpdir}/.depdetect_ubuntu_list"
echo -e "libsdl1.2debian" >> "${tmpdir}/.depdetect_debian_list"

33
lgsm/functions/command_dev_detect_glibc.sh

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

26
lgsm/functions/command_dev_detect_ldd.sh

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

283
lgsm/functions/command_dev_query_raw.sh

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

67
lgsm/functions/command_fastdl.sh

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

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

22
lgsm/functions/command_mods_install.sh

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

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"

14
lgsm/functions/command_mods_update.sh

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

184
lgsm/functions/command_monitor.sh

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

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"

31
lgsm/functions/command_start.sh

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

30
lgsm/functions/command_stop.sh

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

26
lgsm/functions/command_wipe.sh

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

92
lgsm/functions/core_dl.sh

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

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

912
lgsm/functions/core_functions.sh

File diff suppressed because it is too large

159
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[@]}" )
currentopt+=("${cmd_validate[@]}" "${cmd_check_update[@]}")
fi
# Backup.
currentopt+=( "${cmd_backup[@]}" )
currentopt+=("${cmd_backup[@]}")
# Console & Debug.
currentopt+=( "${cmd_console[@]}" "${cmd_debug[@]}" )
currentopt+=("${cmd_console[@]}" "${cmd_debug[@]}")
# Console send.
if [ "${consoleinteract}" == "yes" ]; then
currentopt+=( "${cmd_send[@]}" )
currentopt+=("${cmd_send[@]}")
fi
## Game server exclusive commands.
# FastDL command.
if [ "${engine}" == "source" ]; then
currentopt+=( "${cmd_fastdl[@]}" )
currentopt+=("${cmd_fastdl[@]}")
fi
# TeamSpeak exclusive.
if [ "${shortname}" == "ts3" ]; then
currentopt+=( "${cmd_change_password[@]}" )
currentopt+=("${cmd_change_password[@]}")
fi
# Unreal exclusive.
if [ "${shortname}" == "rust" ]; then
currentopt+=( "${cmd_fullwipe[@]}" "${cmd_mapwipe[@]}" )
currentopt+=("${cmd_fullwipe[@]}" "${cmd_mapwipe[@]}")
fi
if [ "${engine}" == "unreal2" ]; then
if [ "${shortname}" == "ut2k4" ]; then
currentopt+=( "${cmd_install_cdkey[@]}" "${cmd_map_compressor_u2[@]}" )
currentopt+=("${cmd_install_cdkey[@]}" "${cmd_map_compressor_u2[@]}")
else
currentopt+=( "${cmd_map_compressor_u2[@]}" )
currentopt+=("${cmd_map_compressor_u2[@]}")
fi
fi
if [ "${engine}" == "unreal" ]; then
currentopt+=( "${cmd_map_compressor_u99[@]}" )
currentopt+=("${cmd_map_compressor_u99[@]}")
fi
# DST exclusive.
if [ "${shortname}" == "dst" ]; then
currentopt+=( "${cmd_install_dst_token[@]}" )
currentopt+=("${cmd_install_dst_token[@]}")
fi
# MTA exclusive.
if [ "${shortname}" == "mta" ]; then
currentopt+=( "${cmd_install_default_resources[@]}" )
currentopt+=("${cmd_install_default_resources[@]}")
fi
# Squad license exclusive.
if [ "${shortname}" == "squad" ]; then
currentopt+=( "${cmd_install_squad_license[@]}" )
currentopt+=("${cmd_install_squad_license[@]}")
fi
## Mods commands.
if [ "${engine}" == "source" ]||[ "${shortname}" == "rust" ]||[ "${shortname}" == "hq" ]||[ "${shortname}" == "sdtd" ]||[ "${shortname}" == "cs" ]||[ "${shortname}" == "dod" ]||[ "${shortname}" == "tfc" ]||[ "${shortname}" == "ns" ]||[ "${shortname}" == "ts" ]||[ "${shortname}" == "hldm" ]||[ "${shortname}" == "vh" ]; then
currentopt+=( "${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}" )
if [ "${engine}" == "source" ] || [ "${shortname}" == "rust" ] || [ "${shortname}" == "hq" ] || [ "${shortname}" == "sdtd" ] || [ "${shortname}" == "cs" ] || [ "${shortname}" == "dod" ] || [ "${shortname}" == "tfc" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "hldm" ] || [ "${shortname}" == "vh" ]; then
currentopt+=("${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}")
fi
## Installer.
currentopt+=( "${cmd_install[@]}" "${cmd_auto_install[@]}" )
currentopt+=("${cmd_install[@]}" "${cmd_auto_install[@]}")
## Developer commands.
currentopt+=( "${cmd_dev_debug[@]}" )
currentopt+=("${cmd_dev_debug[@]}")
if [ -f ".dev-debug" ]; then
currentopt+=( "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_functions[@]}" )
currentopt+=("${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_functions[@]}")
fi
## Donate.
currentopt+=( "${cmd_donate[@]}" )
currentopt+=("${cmd_donate[@]}")
### Build list of available commands.
optcommands=()
index="0"
for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
cmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
for ((cmdindex=1; cmdindex <= cmdamount; cmdindex++)); do
optcommands+=( "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')" )
for ((cmdindex = 1; cmdindex <= cmdamount; cmdindex++)); do
optcommands+=("$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')")
done
done
# Shows LinuxGSM usage.
fn_opt_usage(){
fn_opt_usage() {
echo -e "Usage: $0 [option]"
echo -e ""
echo -e "LinuxGSM - ${gamename} - Version ${version}"
@ -171,12 +170,12 @@ fn_opt_usage(){
# Display available commands.
index="0"
{
for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
# Hide developer commands.
if [ "${currentopt[index+2]}" != "DEVCOMMAND" ]; then
echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index+2]}"
fi
done
for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
# Hide developer commands.
if [ "${currentopt[index + 2]}" != "DEVCOMMAND" ]; then
echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}"
fi
done
} | column -s $'\t' -t
fn_script_log_pass "Display commands"
core_exit.sh
@ -188,15 +187,15 @@ if [ -z "${getopt}" ]; then
fi
# If command exists.
for i in "${optcommands[@]}"; do
if [ "${i}" == "${getopt}" ] ; then
if [ "${i}" == "${getopt}" ]; then
# Seek and run command.
index="0"
for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
currcmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
for ((currcmdindex=1; currcmdindex <= currcmdamount; currcmdindex++)); do
for ((currcmdindex = 1; currcmdindex <= currcmdamount; currcmdindex++)); do
if [ "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
# Run command.
eval "${currentopt[index+1]}"
eval "${currentopt[index + 1]}"
# Exit should occur in modules. Should this not happen print an error
fn_print_error2_nl "Command did not exit correctly: ${getopt}"
fn_script_log_error "Command did not exit correctly: ${getopt}"

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

150
lgsm/functions/core_messages.sh

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

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

64
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,12 +32,12 @@ fn_fix_msg_end(){
}
# Fixes that are run on start.
if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then
if [ "${commandname}" != "INSTALL" ] && [ -z "${fixbypass}" ]; then
if [ "${appid}" ]; then
fix_steamcmd.sh
fi
if [ "${shortname}" == "arma3" ]; then
if [ "${shortname}" == "arma3" ]; then
fix_arma3.sh
elif [ "${shortname}" == "armar" ]; then
fix_armar.sh
@ -96,32 +96,32 @@ fi
# Fixes that are run on install only.
if [ "${commandname}" == "INSTALL" ]; then
if [ "${shortname}" == "av" ]||[ "${shortname}" == "cmw" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "lo" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "samp" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then
echo -e ""
echo -e "${lightyellow}Applying Post-Install Fixes${default}"
echo -e "================================="
fn_sleep_time
postinstall=1
if [ "${shortname}" == "av" ]; then
fix_av.sh
elif [ "${shortname}" == "kf" ]; then
fix_kf.sh
elif [ "${shortname}" == "kf2" ]; then
fix_kf2.sh
elif [ "${shortname}" == "lo" ]; then
fix_lo.sh
elif [ "${shortname}" == "ro" ]; then
fix_ro.sh
elif [ "${shortname}" == "samp" ]; then
fix_samp.sh
elif [ "${shortname}" == "ut2k4" ]; then
fix_ut2k4.sh
elif [ "${shortname}" == "ut" ]; then
fix_ut.sh
elif [ "${shortname}" == "ut3" ]; then
fix_ut3.sh
else
fn_print_information_nl "No fixes required."
fi
if [ "${shortname}" == "av" ] || [ "${shortname}" == "cmw" ] || [ "${shortname}" == "kf" ] || [ "${shortname}" == "kf2" ] || [ "${shortname}" == "lo" ] || [ "${shortname}" == "onset" ] || [ "${shortname}" == "ro" ] || [ "${shortname}" == "samp" ] || [ "${shortname}" == "ut2k4" ] || [ "${shortname}" == "ut" ] || [ "${shortname}" == "ut3" ]; then
echo -e ""
echo -e "${lightyellow}Applying Post-Install Fixes${default}"
echo -e "================================="
fn_sleep_time
postinstall=1
if [ "${shortname}" == "av" ]; then
fix_av.sh
elif [ "${shortname}" == "kf" ]; then
fix_kf.sh
elif [ "${shortname}" == "kf2" ]; then
fix_kf2.sh
elif [ "${shortname}" == "lo" ]; then
fix_lo.sh
elif [ "${shortname}" == "ro" ]; then
fix_ro.sh
elif [ "${shortname}" == "samp" ]; then
fix_samp.sh
elif [ "${shortname}" == "ut2k4" ]; then
fix_ut2k4.sh
elif [ "${shortname}" == "ut" ]; then
fix_ut.sh
elif [ "${shortname}" == "ut3" ]; then
fix_ut3.sh
else
fn_print_information_nl "No fixes required."
fi
fi
fi

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"

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"

10
lgsm/functions/fix_lo.sh

@ -8,10 +8,10 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
local APPID_FILE=${executabledir}/steam_appid.txt
if [ ! -f "${APPID_FILE}" ]; then
fn_print_information "adding ${APPID_FILE} to ${gamename} server."
fn_sleep_time
echo "903950" > "${APPID_FILE}"
fn_print_information "adding ${APPID_FILE} to ${gamename} server."
fn_sleep_time
echo "903950" > "${APPID_FILE}"
else
fn_print_information "${APPID_FILE} already exists. No action to be taken."
fn_sleep_time
fn_print_information "${APPID_FILE} already exists. No action to be taken."
fn_sleep_time
fi

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"

4
lgsm/functions/fix_samp.sh

@ -9,14 +9,14 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -f "${servercfgfullpath}" ]; then
# check if default password is set "changeme"
currentpass=$(grep -E "^rcon_password" "${servercfgfullpath}" | sed 's/^rcon_password //' )
currentpass=$(grep -E "^rcon_password" "${servercfgfullpath}" | sed 's/^rcon_password //')
defaultpass="changeme"
# check if default password is set
if [ "${currentpass}" == "${defaultpass}" ]; then
fixname="change default rcon password"
fn_fix_msg_start
fn_script_log_info "changing rcon/admin password."
random=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs)
random=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs)
rconpass="admin${random}"
sed -i "s/rcon_password changeme/rcon_password ${rconpass}/g" "${servercfgfullpath}"
fn_fix_msg_end

2
lgsm/functions/fix_squad.sh

@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# As the server base dir changed for the game, we need to migrate the default config from the old to the new location
oldservercfg="${serverfiles}/Squad/ServerConfig/${servercfg}"
if [ -f "${oldservercfg}" ]&&[ -f "${servercfgfullpath}" ]; then
if [ -f "${oldservercfg}" ] && [ -f "${servercfgfullpath}" ]; then
# diff old and new config - if it is different move the old config over the new one
if [ "$(diff -c "${oldservercfg}" "${servercfgfullpath}" | wc -l)" -gt 0 ]; then
fixname="Migrate server config to new Game folder"

4
lgsm/functions/fix_steamcmd.sh

@ -10,7 +10,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# function to simplify the steamclient.so fix
# example
# fn_fix_steamclient_so 32|64 (bit) "${serverfiles}/linux32/"
fn_fix_steamclient_so(){
fn_fix_steamclient_so() {
# $1 type of fix 32 or 64 as possible values
# $2 as destination where the lib will be copied to
if [ "$1" == "32" ]; then
@ -132,7 +132,7 @@ elif [ "${shortname}" == "pvr" ]; then
fn_fix_steamclient_so "64" "${executabledir}"
elif [ "${shortname}" == "ss3" ]; then
fn_fix_steamclient_so "32" "${serverfiles}/Bin"
elif [ "${shortname}" == "tu" ];then
elif [ "${shortname}" == "tu" ]; then
fn_fix_steamclient_so "64" "${executabledir}"
elif [ "${shortname}" == "unt" ]; then
fn_fix_steamclient_so "64" "${serverfiles}"

2
lgsm/functions/fix_tf2.sh

@ -8,7 +8,7 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Fixes: Team Fortress 2 Segmentation fault for Red-Hat Distros #2062.
if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/bin/libcurl-gnutls.so.4" ]; then
if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/bin/libcurl-gnutls.so.4" ]; then
fixname="libcurl-gnutls.so.4"
fn_fix_msg_start
ln -s "/usr/lib/libcurl.so.4" "${serverfiles}/bin/libcurl-gnutls.so.4"

4
lgsm/functions/fix_ts3.sh

@ -17,9 +17,9 @@ fi
# Fixes: failed to register local accounting service: No such file or directory.
accountingfile="/dev/shm/7gbhujb54g8z9hu43jre8"
if [ -f "${accountingfile}" ]&&[ "${status}" == "0" ]; then
if [ -f "${accountingfile}" ] && [ "${status}" == "0" ]; then
# Check permissions for the file if the current user owns it, if not exit.
if [ "$( stat -c %U ${accountingfile})" == "$(whoami)" ]; then
if [ "$(stat -c %U ${accountingfile})" == "$(whoami)" ]; then
fixname="Delete file ${accountingfile}"
fn_fix_msg_start
rm -f "${accountingfile}"

6
lgsm/functions/fix_vh.sh

@ -12,10 +12,8 @@ export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
modsdir="${lgsmdir}/mods"
modsinstalledlistfullpath="${modsdir}/installed-mods.txt"
if [ -f "${modsinstalledlistfullpath}" ]; then
if grep -qE "^valheimplus" "${modsinstalledlistfullpath}"
then
if ! grep -qE "^executable=\"./start_server_bepinex.sh\"" "${configdirserver}/${selfname}.cfg"
then
if grep -qE "^valheimplus" "${modsinstalledlistfullpath}"; then
if ! grep -qE "^executable=\"./start_server_bepinex.sh\"" "${configdirserver}/${selfname}.cfg"; then
echo 'executable="./start_server_bepinex.sh"' >> "${configdirserver}/${selfname}.cfg"
executable="./start_server_bepinex.sh"
fi

67
lgsm/functions/info_distro.sh

@ -30,9 +30,9 @@ kernel="$(uname -r)"
# Distro Codename - xenial
# Gathers distro info from various sources filling in missing gaps.
distro_info_array=( os-release lsb_release hostnamectl debian_version redhat-release )
distro_info_array=(os-release lsb_release hostnamectl debian_version redhat-release)
for distro_info in "${distro_info_array[@]}"; do
if [ -f "/etc/os-release" ]&&[ "${distro_info}" == "os-release" ]; then
if [ -f "/etc/os-release" ] && [ "${distro_info}" == "os-release" ]; then
distroname="$(grep "PRETTY_NAME" /etc/os-release | awk -F\= '{gsub(/"/,"",$2);print $2}')"
distroversion="$(grep "VERSION_ID" /etc/os-release | awk -F\= '{gsub(/"/,"",$2);print $2}')"
# Special var for rhel like distros to removed point in number e.g 8.4 to just 8.
@ -40,8 +40,8 @@ for distro_info in "${distro_info_array[@]}"; do
distroid="$(grep "ID=" /etc/os-release | grep -v _ID | awk -F\= '{gsub(/"/,"",$2);print $2}')"
distroidlike="$(grep "ID_LIKE=" /etc/os-release | grep -v _ID | awk -F\= '{gsub(/"/,"",$2);print $2}')"
distrocodename="$(grep "VERSION_CODENAME" /etc/os-release | awk -F\= '{gsub(/"/,"",$2);print $2}')"
elif [ "$(command -v lsb_release 2>/dev/null)" ]&&[ "${distro_info}" == "lsb_release" ]; then
if [ -z "${distroname}" ];then
elif [ "$(command -v lsb_release 2> /dev/null)" ] && [ "${distro_info}" == "lsb_release" ]; then
if [ -z "${distroname}" ]; then
distroname="$(lsb_release -sd)"
elif [ -z "${distroversion}" ]; then
distroversion="$(lsb_release -sr)"
@ -50,11 +50,11 @@ for distro_info in "${distro_info_array[@]}"; do
elif [ -z "${distrocodename}" ]; then
distrocodename="$(lsb_release -sc)"
fi
elif [ "$(command -v hostnamectl 2>/dev/null)" ]&&[ "${distro_info}" == "hostnamectl" ]; then
if [ -z "${distroname}" ];then
elif [ "$(command -v hostnamectl 2> /dev/null)" ] && [ "${distro_info}" == "hostnamectl" ]; then
if [ -z "${distroname}" ]; then
distroname="$(hostnamectl | grep "Operating System" | sed 's/Operating System: //g')"
fi
elif [ -f "/etc/debian_version" ]&&[ "${distro_info}" == "debian_version" ]; then
elif [ -f "/etc/debian_version" ] && [ "${distro_info}" == "debian_version" ]; then
if [ -z "${distroname}" ]; then
distroname="Debian $(cat /etc/debian_version)"
elif [ -z "${distroversion}" ]; then
@ -62,7 +62,7 @@ for distro_info in "${distro_info_array[@]}"; do
elif [ -z "${distroid}" ]; then
distroid="debian"
fi
elif [ -f "/etc/redhat-release" ]&&[ "${distro_info}" == "redhat-release" ]; then
elif [ -f "/etc/redhat-release" ] && [ "${distro_info}" == "redhat-release" ]; then
if [ -z "${distroname}" ]; then
distroname="$(cat /etc/redhat-release)"
elif [ -z "${distroversion}" ]; then
@ -74,16 +74,16 @@ for distro_info in "${distro_info_array[@]}"; do
done
# some RHEL based distros use 8.4 instead of just 8.
if [[ "${distroidlike}" == *"rhel"* ]]||[ "${distroid}" == "rhel" ]; then
if [[ "${distroidlike}" == *"rhel"* ]] || [ "${distroid}" == "rhel" ]; then
distroversioncsv="${distroversionrh}"
else
distroversioncsv="${distroversion}"
fi
# Check if distro supported by distro vendor.
if [ "$(command -v distro-info 2>/dev/null)" ]; then
if [ "$(command -v distro-info 2> /dev/null)" ]; then
distrosunsupported="$(distro-info --unsupported)"
distrosunsupported_array=( "${distrosunsupported}" )
distrosunsupported_array=("${distrosunsupported}")
for distrounsupported in "${distrosunsupported_array[@]}"; do
if [ "${distrounsupported}" == "${distrocodename}" ]; then
distrosupport=unsupported
@ -102,7 +102,7 @@ glibcversion="$(ldd --version | sed -n '1s/.* //p')"
## tmux version
# e.g: tmux 1.6
if [ ! "$(command -V tmux 2>/dev/null)" ]; then
if [ ! "$(command -V tmux 2> /dev/null)" ]; then
tmuxv="${red}NOT INSTALLED!${default}"
tmuxvdigit="0"
else
@ -114,25 +114,25 @@ else
fi
fi
if [ "$(command -V java 2>/dev/null)" ]; then
if [ "$(command -V java 2> /dev/null)" ]; then
javaversion="$(java -version 2>&1 | grep "version")"
fi
if [ "$(command -v mono 2>/dev/null)" ]; then
if [ "$(command -v mono 2> /dev/null)" ]; then
monoversion="$(mono --version 2>&1 | grep -Po '(?<=version )\d')"
fi
## Uptime
uptime="$(</proc/uptime)"
uptime="$(< /proc/uptime)"
uptime=${uptime/[. ]*/}
minutes="$(( uptime/60%60 ))"
hours="$(( uptime/60/60%24 ))"
days="$(( uptime/60/60/24 ))"
minutes="$((uptime / 60 % 60))"
hours="$((uptime / 60 / 60 % 24))"
days="$((uptime / 60 / 60 / 24))"
### Performance information
## Average server load
load="$(uptime|awk -F 'load average: ' '{ print $2 }')"
load="$(uptime | awk -F 'load average: ' '{ print $2 }')"
## CPU information
cpumodel="$(awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')"
@ -140,7 +140,7 @@ cpucores="$(awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo)"
cpufreqency="$(awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')"
# CPU usage of the game server pid
if [ -n "${gameserverpid}" ]; then
cpuused="$(ps --forest -o pcpu -g "${gameserverpid}"|awk '{s+=$1} END {print s}')"
cpuused="$(ps --forest -o pcpu -g "${gameserverpid}" | awk '{s+=$1} END {print s}')"
cpuusedmhz="$(echo "${cpufreqency} * ${cpuused} / 100" | bc)"
fi
@ -148,7 +148,7 @@ fi
# Available RAM and swap.
# Newer distros can use numfmt to give more accurate results.
if [ "$(command -v numfmt 2>/dev/null)" ]; then
if [ "$(command -v numfmt 2> /dev/null)" ]; then
# Issue #2005 - Kernel 3.14+ contains MemAvailable which should be used. All others will be calculated.
# get the raw KB values of these fields.
@ -162,31 +162,34 @@ if [ "$(command -v numfmt 2>/dev/null)" ]; then
if grep -q ^MemAvailable /proc/meminfo; then
physmemactualfreekb="$(grep ^MemAvailable /proc/meminfo | awk '{print $2}')"
else
physmemactualfreekb="$((physmemfreekb+physmembufferskb+physmemcachedkb))"
physmemactualfreekb="$((physmemfreekb + physmembufferskb + physmemcachedkb))"
fi
# Available RAM and swap.
physmemtotalmb="$((physmemtotalkb/1024))"
physmemtotalmb="$((physmemtotalkb / 1024))"
physmemtotal="$(numfmt --to=iec --from=iec --suffix=B "${physmemtotalkb}K")"
physmemfree="$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")"
physmemused="$(numfmt --to=iec --from=iec --suffix=B "$((physmemtotalkb-physmemfreekb-physmembufferskb-physmemcachedkb-physmemreclaimablekb))K")"
physmemused="$(numfmt --to=iec --from=iec --suffix=B "$((physmemtotalkb - physmemfreekb - physmembufferskb - physmemcachedkb - physmemreclaimablekb))K")"
physmemavailable="$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")"
physmemcached="$(numfmt --to=iec --from=iec --suffix=B "$((physmemcachedkb+physmemreclaimablekb))K")"
physmemcached="$(numfmt --to=iec --from=iec --suffix=B "$((physmemcachedkb + physmemreclaimablekb))K")"
swaptotal="$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapTotal /proc/meminfo | awk '{print $2}')K")"
swapfree="$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapFree /proc/meminfo | awk '{print $2}')K")"
swapused="$(numfmt --to=iec --from=iec --suffix=B "$(($(grep ^SwapTotal /proc/meminfo | awk '{print $2}')-$(grep ^SwapFree /proc/meminfo | awk '{print $2}')))K")"
swapused="$(numfmt --to=iec --from=iec --suffix=B "$(($(grep ^SwapTotal /proc/meminfo | awk '{print $2}') - $(grep ^SwapFree /proc/meminfo | awk '{print $2}')))K")"
# RAM usage of the game server pid
# MB
if [ "${gameserverpid}" ]; then
memused="$(ps --forest -o rss -g "${gameserverpid}" | awk '{s+=$1} END {print s}'| awk '{$1/=1024;printf "%.0f",$1}{print $2}')"
# %
memused="$(ps --forest -o rss -g "${gameserverpid}" | awk '{s+=$1} END {print s}' | awk '{$1/=1024;printf "%.0f",$1}{print $2}')"
# %
pmemused="$(ps --forest -o %mem -g "${gameserverpid}" | awk '{s+=$1} END {print s}')"
fi
else
# Older distros will need to use free.
# Older versions of free do not support -h option.
if [ "$(free -h > /dev/null 2>&1; echo $?)" -ne "0" ]; then
if [ "$(
free -h > /dev/null 2>&1
echo $?
)" -ne "0" ]; then
humanreadable="-m"
else
humanreadable="-h"
@ -257,7 +260,7 @@ if [ -d "${backupdir}" ]; then
# date of most recent backup.
lastbackupdate="$(date -r "${lastbackup}")"
# no of days since last backup.
lastbackupdaysago="$(( ( $(date +'%s') - $(date -r "${lastbackup}" +'%s') )/60/60/24 ))"
lastbackupdaysago="$((($(date +'%s') - $(date -r "${lastbackup}" +'%s')) / 60 / 60 / 24))"
# size of most recent backup.
lastbackupsize="$(du -h "${lastbackup}" | awk '{print $1}')"
fi
@ -265,11 +268,11 @@ fi
# Network Interface name
netint=$(${ipcommand} -o addr | grep "${ip}" | awk '{print $2}')
netlink=$(${ethtoolcommand} "${netint}" 2>/dev/null| grep Speed | awk '{print $2}')
netlink=$(${ethtoolcommand} "${netint}" 2> /dev/null | grep Speed | awk '{print $2}')
# Sets the SteamCMD glibc requirement if the game server requirement is less or not required.
if [ "${appid}" ]; then
if [ "${glibc}" = "null" ]||[ -z "${glibc}" ]||[ "$(printf '%s\n'${glibc}'\n' "2.14" | sort -V | head -n 1)" != "2.14" ]; then
if [ "${glibc}" = "null" ] || [ -z "${glibc}" ] || [ "$(printf '%s\n'${glibc}'\n' "2.14" | sort -V | head -n 1)" != "2.14" ]; then
glibc="2.14"
fi
fi

282
lgsm/functions/info_game.sh

@ -14,7 +14,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# grep -v "foo" filter out lines that contain foo
# cut -f1 -d "/" remove everything after /
fn_info_game_ac(){
fn_info_game_ac() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
httpport="${zero}"
@ -26,7 +26,7 @@ fn_info_game_ac(){
httpport=$(grep "HTTP_PORT" "${servercfgfullpath}" | tr -cd '[:digit:]')
port=$(grep "TCP_PORT" "${servercfgfullpath}" | tr -cd '[:digit:]')
queryport="${httpport}"
servername=$(grep "NAME" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/NAME//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| head -n 1)
servername=$(grep "NAME" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/NAME//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | head -n 1)
adminpassword=$(grep "ADMIN_PASSWORD" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/ADMIN_PASSWORD//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
# Not set
@ -39,7 +39,7 @@ fn_info_game_ac(){
fi
}
fn_info_game_ark(){
fn_info_game_ark() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -60,11 +60,11 @@ fn_info_game_ark(){
port=${port:-"0"}
queryport=${queryport:-"0"}
rconport=${rconport:-"0"}
rawport=$((port+1))
rawport=$((port + 1))
maxplayers=${maxplayers:-"0"}
}
fn_info_game_arma3(){
fn_info_game_arma3() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -87,13 +87,13 @@ fn_info_game_arma3(){
# Parameters
port=${port:-"2302"}
voiceport=${port:-"2302"}
queryport=$((port+1))
steammasterport=$((port+2))
voiceunusedport=$((port+3))
battleeyeport=$((port+4))
queryport=$((port + 1))
steammasterport=$((port + 2))
voiceunusedport=$((port + 3))
battleeyeport=$((port + 4))
}
fn_info_game_armar(){
fn_info_game_armar() {
if [ -f "${servercfgfullpath}" ]; then
adminpassword=$(jq -r '.adminPassword' "${servercfgfullpath}")
configip=$(jq -r '.gameHostBindAddress' "${servercfgfullpath}")
@ -104,7 +104,6 @@ fn_info_game_armar(){
serverpassword=$(jq -r '.game.password' "${servercfgfullpath}")
battleeyeport=1376
# Not set
adminpassword=${adminpassword:-"NOT SET"}
configip=${configip:-"0.0.0.0"}
@ -138,9 +137,9 @@ fn_info_game_av() {
servername=$(grep "name=" "${servercfgfullpath}" | sed 's/name=//')
serverpassword=$(grep "password=" "${servercfgfullpath}" | sed 's/password=//')
port=$(grep "port=" "${servercfgfullpath}" | sed 's/port=//')
queryport=$((port+3))
steamqueryport=$((port+20))
steammasterport=$((port+21))
queryport=$((port + 3))
steamqueryport=$((port + 20))
steammasterport=$((port + 21))
rconport=$(grep "rconPort=" "${servercfgfullpath}" | sed 's/rconPort=//')
rconpassword=$(grep "rconPassword=" "${servercfgfullpath}" | sed 's/rconPassword=//')
@ -162,7 +161,7 @@ fn_info_game_av() {
fi
}
fn_info_game_bf1942(){
fn_info_game_bf1942() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -188,7 +187,7 @@ fn_info_game_bf1942(){
fi
}
fn_info_game_bfv(){
fn_info_game_bfv() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -214,7 +213,7 @@ fn_info_game_bfv(){
fi
}
fn_info_game_bo(){
fn_info_game_bo() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -226,7 +225,7 @@ fn_info_game_bo(){
servername=$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
serverpassword=$(grep "Password=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
port=$(grep "ServerPort=" "${servercfgfullpath}" | tr -cd '[:digit:]')
queryport=$((port+1))
queryport=$((port + 1))
maxplayers=$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')
# Not set
@ -238,7 +237,7 @@ fn_info_game_bo(){
fi
}
fn_info_game_bt(){
fn_info_game_bt() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -247,7 +246,7 @@ fn_info_game_bt(){
queryport="${zero}"
maxplayers="${unavailable}"
else
servername=$(grep -Po 'name="\K.*(?=")' "${servercfgfullpath}") # Assuming GNU grep is used
servername=$(grep -Po 'name="\K.*(?=")' "${servercfgfullpath}") # Assuming GNU grep is used
serverpassword=$(grep -Po 'password="\K.*(?=")' "${servercfgfullpath}") # Assuming GNU grep is used
port=$(grep " port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
queryport=$(grep "queryport=" "${servercfgfullpath}" | tr -cd '[:digit:]')
@ -262,7 +261,7 @@ fn_info_game_bt(){
fi
}
fn_info_game_bt1944(){
fn_info_game_bt1944() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -282,10 +281,10 @@ fn_info_game_bt1944(){
# Parameters
port=${port:-"0"}
queryport=${queryport:-"0"}
rconport=$((port+2))
rconport=$((port + 2))
}
fn_info_game_cd(){
fn_info_game_cd() {
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
port="${zero}"
@ -305,7 +304,7 @@ fn_info_game_cd(){
fi
}
fn_info_game_cmw(){
fn_info_game_cmw() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
adminpassword="${unavailable}"
@ -332,7 +331,7 @@ fn_info_game_cmw(){
queryport=${queryport:-"0"}
}
fn_info_game_cod(){
fn_info_game_cod() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -352,7 +351,7 @@ fn_info_game_cod(){
port=${port:-"0"}
}
fn_info_game_coduo(){
fn_info_game_coduo() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -373,9 +372,7 @@ fn_info_game_coduo(){
queryport=${port:-"28960"}
}
fn_info_game_cod2(){
fn_info_game_cod2() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -396,7 +393,7 @@ fn_info_game_cod2(){
queryport=${port:-"28960"}
}
fn_info_game_cod4(){
fn_info_game_cod4() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -419,7 +416,7 @@ fn_info_game_cod4(){
queryport=${port:-"28960"}
}
fn_info_game_codwaw(){
fn_info_game_codwaw() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -440,7 +437,7 @@ fn_info_game_codwaw(){
queryport=${port:-"28960"}
}
fn_info_game_col(){
fn_info_game_col() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -472,7 +469,7 @@ fn_info_game_col(){
fi
}
fn_info_game_dodr(){
fn_info_game_dodr() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
maxplayers="${zero}"
@ -489,7 +486,7 @@ fn_info_game_dodr(){
queryport=${queryport:-"27015"}
}
fn_info_game_dayz(){
fn_info_game_dayz() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -513,11 +510,11 @@ fn_info_game_dayz(){
# Parameters
port=${port:-"2302"}
steammasterport=$((port+2))
battleeyeport=$((port+4))
steammasterport=$((port + 2))
battleeyeport=$((port + 4))
}
fn_info_game_dst(){
fn_info_game_dst() {
# Config
if [ ! -f "${clustercfgfullpath}" ]; then
servername="${unavailable}"
@ -568,7 +565,7 @@ fn_info_game_dst(){
cave=${cave:-"NOT SET"}
}
fn_info_game_eco(){
fn_info_game_eco() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -597,7 +594,7 @@ fn_info_game_eco(){
fi
}
fn_info_game_etl(){
fn_info_game_etl() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -626,7 +623,7 @@ fn_info_game_etl(){
fi
}
fn_info_game_fctr(){
fn_info_game_fctr() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="Factorio Server"
@ -658,7 +655,7 @@ fn_info_game_fctr(){
rconpassword=${rconpassword:-"NOT SET"}
}
fn_info_game_jc2(){
fn_info_game_jc2() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -687,7 +684,7 @@ fn_info_game_jc2(){
fi
}
fn_info_game_hw(){
fn_info_game_hw() {
# Parameters
servername=${servername:-"NOT SET"}
port=${port:-"0"}
@ -697,7 +694,7 @@ fn_info_game_hw(){
creativemode=${creativemode:-"NOT SET"}
}
fn_info_game_inss(){
fn_info_game_inss() {
# Parameters
port=${port:-"0"}
queryport=${queryport:-"0"}
@ -709,7 +706,7 @@ fn_info_game_inss(){
maxplayers=${maxplayers:-"0"}
}
fn_info_game_jc3(){
fn_info_game_jc3() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -747,7 +744,7 @@ fn_info_game_jc3(){
fi
}
fn_info_game_jk2(){
fn_info_game_jk2() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -776,7 +773,7 @@ fn_info_game_jk2(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_kf(){
fn_info_game_kf() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -797,7 +794,7 @@ fn_info_game_kf(){
serverpassword=$(sed -nr 's/^GamePassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
adminpassword=$(sed -nr 's/^AdminPassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
port=$(sed -nr 's/^Port=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]')
queryport=$((port+1))
queryport=$((port + 1))
queryportgs=$(sed -nr 's/^OldQueryPortNumber=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]')
steamport="20560"
steammasterport="28852"
@ -827,7 +824,7 @@ fn_info_game_kf(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_kf2(){
fn_info_game_kf2() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -865,7 +862,7 @@ fn_info_game_kf2(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_lo(){
fn_info_game_lo() {
# Parameters
servername=${servername:-"NOT SET"}
port=${port:-"0"}
@ -873,7 +870,7 @@ fn_info_game_lo(){
maxplayers=${slots:-"0"}
}
fn_info_game_mc(){
fn_info_game_mc() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -914,7 +911,7 @@ fn_info_game_mc(){
fi
}
fn_info_game_mcb(){
fn_info_game_mcb() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -944,7 +941,7 @@ fn_info_game_mcb(){
fi
}
fn_info_game_mh(){
fn_info_game_mh() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -970,7 +967,7 @@ fn_info_game_mh(){
beaconport=${beaconport:-"0"}
}
fn_info_game_mohaa(){
fn_info_game_mohaa() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -996,7 +993,7 @@ fn_info_game_mohaa(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_mom(){
fn_info_game_mom() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1021,7 +1018,7 @@ fn_info_game_mom(){
beaconport=${queryport:-"15000"}
}
fn_info_game_mta(){
fn_info_game_mta() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
port=${zero}
@ -1033,7 +1030,7 @@ fn_info_game_mta(){
maxplayers="${zero}"
else
port=$(grep -m 1 "serverport" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<serverport>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]')
queryport=$((port+123))
queryport=$((port + 123))
httpport=$(grep -m 1 "httpport" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<httpport>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]')
servername=$(grep -m 1 "servername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<servername>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<")
serverpassword=$(grep -m 1 "password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/<password>//g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<")
@ -1057,7 +1054,7 @@ fn_info_game_mta(){
}
fn_info_game_mumble(){
fn_info_game_mumble() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
port="64738"
@ -1076,7 +1073,7 @@ fn_info_game_mumble(){
fi
}
fn_info_game_onset(){
fn_info_game_onset() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1085,11 +1082,11 @@ fn_info_game_onset(){
httpport="${zero}"
queryport="${zero}"
else
servername=$(grep -v "servername_short" "${servercfgfullpath}" | grep "servername" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/servername//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' )
servername=$(grep -v "servername_short" "${servercfgfullpath}" | grep "servername" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/servername//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
maxplayers=$(grep "maxplayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
port=$(grep "port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
httpport=$((port-2))
queryport=$((port-1))
httpport=$((port - 2))
queryport=$((port - 1))
# Not set
servername=${servername:-"NOT SET"}
@ -1100,7 +1097,7 @@ fn_info_game_onset(){
fi
}
fn_info_game_pc(){
fn_info_game_pc() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1127,7 +1124,7 @@ fn_info_game_pc(){
fi
}
fn_info_game_pc2(){
fn_info_game_pc2() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1154,7 +1151,7 @@ fn_info_game_pc2(){
fi
}
fn_info_game_pstbs(){
fn_info_game_pstbs() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1180,7 +1177,7 @@ fn_info_game_pstbs(){
# Not set
rconport=${rconport:-"0"}
if [ -z "${rconpassword}" ]||[ ${#rconpassword} == 1 ]; then
if [ -z "${rconpassword}" ] || [ ${#rconpassword} == 1 ]; then
rconpassword="NOT SET"
fi
fi
@ -1196,7 +1193,7 @@ fn_info_game_pstbs(){
reservedslots=${reservedslots:-"0"}
}
fn_info_game_pvr(){
fn_info_game_pvr() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1212,11 +1209,11 @@ fn_info_game_pvr(){
# Parameters
port=${port:-"0"}
port401=$((port+400))
port401=$((port + 400))
queryport=${port:-"0"}
}
fn_info_game_pz(){
fn_info_game_pz() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1228,7 +1225,7 @@ fn_info_game_pz(){
gameworld="${unavailable}"
else
servername=$(grep "PublicName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/PublicName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Password" | sed -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Password" | sed -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
rconpassword=$(grep "RCONPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/RCONPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
maxplayers=$(grep "MaxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
port=$(grep "DefaultPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
@ -1250,7 +1247,7 @@ fn_info_game_pz(){
}
fn_info_game_q2(){
fn_info_game_q2() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -1273,7 +1270,7 @@ fn_info_game_q2(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_q3(){
fn_info_game_q3() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -1299,7 +1296,7 @@ fn_info_game_q3(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_ql(){
fn_info_game_ql() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -1334,7 +1331,7 @@ fn_info_game_ql(){
fi
}
fn_info_game_qw(){
fn_info_game_qw() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -1358,7 +1355,7 @@ fn_info_game_qw(){
queryport=${port}
}
fn_info_game_ro(){
fn_info_game_ro() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1378,7 +1375,7 @@ fn_info_game_ro(){
serverpassword=$(sed -nr 's/^GamePassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
adminpassword=$(sed -nr 's/^AdminPassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
port=$(sed -nr 's/^Port=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]')
queryport=$((port+1))
queryport=$((port + 1))
steamport="20610"
steammasterport="28902"
lanport=$(grep "LANServerPort=" "${servercfgfullpath}" | tr -cd '[:digit:]')
@ -1406,7 +1403,7 @@ fn_info_game_ro(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_rtcw(){
fn_info_game_rtcw() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -1432,7 +1429,7 @@ fn_info_game_rtcw(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_rust(){
fn_info_game_rust() {
# Parameters
servername=${servername:-"NOT SET"}
port=${port:-"0"}
@ -1452,7 +1449,7 @@ fn_info_game_rust(){
salt=${salt:-"0"}
}
fn_info_game_rw(){
fn_info_game_rw() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1474,12 +1471,12 @@ fn_info_game_rw(){
rconport=$(grep "rcon_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
maxplayers=$(grep "settings_max_players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
port=$(grep "server_port" "${servercfgfullpath}" | grep -v "database_mysql_server_port" | grep -v "#" | tr -cd '[:digit:]')
port2=$((port+1))
port3=$((port+2))
port4=$((port+3))
port2=$((port + 1))
port3=$((port + 2))
port4=$((port + 3))
queryport="${port}"
httpqueryport=$((port-1))
gamemode=$(grep "settings_default_gamemode=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/settings_default_gamemode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
httpqueryport=$((port - 1))
gamemode=$(grep "settings_default_gamemode=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/settings_default_gamemode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
gameworld=$(grep "server_world_name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_world_name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
configip=$(grep "server_ip" "${servercfgfullpath}" | grep -v "database_mysql_server_ip" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/server_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
@ -1501,7 +1498,7 @@ fn_info_game_rw(){
fi
}
fn_info_game_samp(){
fn_info_game_samp() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="unnamed server"
@ -1527,7 +1524,7 @@ fn_info_game_samp(){
fi
}
fn_info_game_sb(){
fn_info_game_sb() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1560,7 +1557,7 @@ fn_info_game_sb(){
fi
}
fn_info_game_sbots(){
fn_info_game_sbots() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1583,7 +1580,7 @@ fn_info_game_sbots(){
maxplayers=${maxplayers:-"0"}
}
fn_info_game_scpsl(){
fn_info_game_scpsl() {
# Config
if [ -f "${servercfgfullpath}" ]; then
servername=$(sed -nr 's/^server_name: (.*)$/\1/p' "${servercfgfullpath}")
@ -1604,7 +1601,7 @@ fn_info_game_scpsl(){
queryport=${port}
}
fn_info_game_sdtd(){
fn_info_game_sdtd() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1626,7 +1623,7 @@ fn_info_game_sdtd(){
servername=$(grep "ServerName" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
serverpassword=$(grep "ServerPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
port=$(grep "ServerPort" "${servercfgfullpath}" | grep -Eo 'value="[0-9]+"' | tr -cd '[:digit:]')
port3=$((port+2))
port3=$((port + 2))
queryport=${port:-"0"}
webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
@ -1660,7 +1657,7 @@ fn_info_game_sdtd(){
fi
}
fn_info_game_sf(){
fn_info_game_sf() {
# Parameters
servername=${selfname:-"NOT SET"}
port=${port:-"0"}
@ -1668,7 +1665,7 @@ fn_info_game_sf(){
beaconport=${beaconport:-"0"}
}
fn_info_game_sof2(){
fn_info_game_sof2() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -1694,7 +1691,7 @@ fn_info_game_sof2(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_sol(){
fn_info_game_sol() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
adminpassword="${unavailable}"
@ -1708,7 +1705,7 @@ fn_info_game_sol(){
maxplayers=$(grep "Max_Players=" "${servercfgfullpath}" | tr -cd '[:digit:]')
port=$(grep "Port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
queryport="${port}"
filesport=$((port+10))
filesport=$((port + 10))
servername=$(grep "Server_Name=" "${servercfgfullpath}" | awk -F '=' '{print $2}')
serverpassword=$(grep "Game_Password=" "${servercfgfullpath}" | awk -F '=' '{print $2}')
@ -1722,7 +1719,7 @@ fn_info_game_sol(){
fi
}
fn_info_game_source(){
fn_info_game_source() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1748,16 +1745,16 @@ fn_info_game_source(){
clientport=${clientport:-"0"}
# Steamport can be between 26901-26910 and is normaly automatically set.
# Some servers might support -steamport parameter to set
if [ "${steamport}" == "0" ]||[ -v "${steamport}" ]; then
if [ "${steamport}" == "0" ] || [ -v "${steamport}" ]; then
steamport="$(echo "${ssinfo}" | grep "${srcdslinuxpid}" | awk '{print $5}' | grep ":269" | cut -d ":" -f2)"
fi
}
fn_info_game_spark(){
fn_info_game_spark() {
defaultmap=${defaultmap:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
port=${port:-"0"}
queryport=$((port+1))
queryport=$((port + 1))
servername=${servername:-"NOT SET"}
serverpassword=${serverpassword:-"NOT SET"}
webadminuser=${webadminuser:-"NOT SET"}
@ -1767,7 +1764,7 @@ fn_info_game_spark(){
#mods=${mods:-"NOT SET"}
}
fn_info_game_squad(){
fn_info_game_squad() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1788,7 +1785,7 @@ fn_info_game_squad(){
rconpassword=$(grep "Password=" "${servercfgdir}/Rcon.cfg" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
rconport=${rconport:-"0"}
if [ -z "${rconpassword}" ]||[ ${#rconpassword} == 1 ]; then
if [ -z "${rconpassword}" ] || [ ${#rconpassword} == 1 ]; then
rconpassword="NOT SET"
fi
@ -1799,7 +1796,7 @@ fn_info_game_squad(){
queryport=${queryport:-"0"}
}
fn_info_game_st(){
fn_info_game_st() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1829,7 +1826,7 @@ fn_info_game_st(){
worldname=${worldname:-"NOT SET"}
}
fn_info_game_terraria(){
fn_info_game_terraria() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1853,7 +1850,7 @@ fn_info_game_terraria(){
fi
}
fn_info_game_stn(){
fn_info_game_stn() {
# Config
if [ -f "${servercfgfullpath}" ]; then
servername=$(sed -nr 's/^ServerName="(.*)"/\1/p' "${servercfgfullpath}")
@ -1873,7 +1870,7 @@ fn_info_game_stn(){
fi
}
fn_info_game_ti(){
fn_info_game_ti() {
if [ -f "${servercfgfullpath}" ]; then
servername=$(sed -nr 's/^ServerName="(.*)"/\1/p' "${servercfgfullpath}")
maxplayers=$(sed -nr 's/^MaxPlayerCount=([0-9]+)/\1/' "${servercfgfullpath}")
@ -1883,7 +1880,7 @@ fn_info_game_ti(){
fi
}
fn_info_game_ts3(){
fn_info_game_ts3() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
dbplugin="${unavailable}"
@ -1918,7 +1915,7 @@ fn_info_game_ts3(){
fi
}
fn_info_game_tu(){
fn_info_game_tu() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1934,11 +1931,11 @@ fn_info_game_tu(){
# Parameters
port=${port:-"0"}
steamport=$((port+1))
steamport=$((port + 1))
queryport=${queryport:-"0"}
}
fn_info_game_tw(){
fn_info_game_tw() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="unnamed server"
@ -1965,7 +1962,7 @@ fn_info_game_tw(){
fi
}
fn_info_game_ut99(){
fn_info_game_ut99() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -1979,17 +1976,17 @@ fn_info_game_ut99(){
webadminuser="${unavailable}"
webadminpass="${unavailable}"
else
servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//')
serverpassword=$(grep "GamePassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/GamePassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//')
adminpassword=$(grep "AdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//')
servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//')
serverpassword=$(grep "GamePassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/GamePassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//')
adminpassword=$(grep "AdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//')
port=$(grep "Port" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Port" | grep -v "#" | tr -cd '[:digit:]')
queryport=$((port+1))
queryport=$((port + 1))
queryportgs=$(grep "OldQueryPortNumber" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
beaconport=$(grep "ServerBeaconPort" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
webadminenabled=$(grep "bEnabled" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bEnabled//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//')
webadminenabled=$(grep "bEnabled" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bEnabled//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//')
httpport=$(grep "ListenPort" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
webadminuser=$(grep "AdminUsername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminUsername//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//')
webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 4 | grep "AdminPassword" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//')
webadminuser=$(grep "AdminUsername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminUsername//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//')
webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 4 | grep "AdminPassword" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//')
# Not set
servername=${servername:-"NOT SET"}
@ -2009,7 +2006,7 @@ fn_info_game_ut99(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_unreal2(){
fn_info_game_unreal2() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -2027,7 +2024,7 @@ fn_info_game_unreal2(){
serverpassword=$(sed -nr 's/^GamePassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
adminpassword=$(sed -nr 's/^AdminPassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
port=$(sed -nr 's/^Port=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]')
queryport=$((port+1))
queryport=$((port + 1))
queryportgs=$(sed -nr 's/^OldQueryPortNumber=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]')
webadminenabled=$(sed -nr 's/^bEnabled=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
webadminport=$(sed -nr 's/^ListenPort=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]')
@ -2051,15 +2048,15 @@ fn_info_game_unreal2(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_unt(){
fn_info_game_unt() {
# Parameters
servername=${selfname:-"NOT SET"}
port=${port:-"0"}
queryport=${port}
steamport=$((port+1))
steamport=$((port + 1))
}
fn_info_game_ut(){
fn_info_game_ut() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -2072,10 +2069,10 @@ fn_info_game_ut(){
# Parameters
port=${port:-"0"}
queryport=$((port+1))
queryport=$((port + 1))
}
fn_info_game_unreal2k4(){
fn_info_game_unreal2k4() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -2094,7 +2091,7 @@ fn_info_game_unreal2k4(){
serverpassword=$(sed -nr 's/^GamePassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
adminpassword=$(sed -nr 's/^AdminPassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
port=$(sed -nr 's/^Port=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]')
queryport=$((port+1))
queryport=$((port + 1))
queryportgs=$(sed -nr 's/^OldQueryPortNumber=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]')
lanport=$(grep "LANServerPort=" "${servercfgfullpath}" | tr -cd '[:digit:]')
webadminenabled=$(sed -nr 's/^bEnabled=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//')
@ -2117,7 +2114,7 @@ fn_info_game_unreal2k4(){
fi
}
fn_info_game_ut3(){
fn_info_game_ut3() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -2155,12 +2152,12 @@ fn_info_game_ut3(){
defaultmap=${defaultmap:-"NOT SET"}
}
fn_info_game_vh(){
fn_info_game_vh() {
# Parameters
port=${port:-"0"}
# Query port only enabled if public server
if [ "${public}" != "0" ]; then
queryport=$((port+1))
queryport=$((port + 1))
else
querymode="1"
fi
@ -2169,7 +2166,7 @@ fn_info_game_vh(){
servername=${servername:-"NOT SET"}
}
fn_info_game_vints(){
fn_info_game_vints() {
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
maxplayers="${unavailable}"
@ -2190,7 +2187,7 @@ fn_info_game_vints(){
fi
}
fn_info_game_wet(){
fn_info_game_wet() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -2219,7 +2216,7 @@ fn_info_game_wet(){
fi
}
fn_info_game_wf(){
fn_info_game_wf() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -2242,8 +2239,7 @@ fn_info_game_wf(){
webadminport=${webadminport:-"0"}
}
fn_info_game_wmc(){
fn_info_game_wmc() {
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
maxplayers="${zero}"
@ -2259,7 +2255,7 @@ fn_info_game_wmc(){
maxplayers=$(sed -nr 's/^player_limit: ([-]*[0-9])/\1/p' "${servercfgfullpath}")
configip=$(sed -nr 's/^[ ]+host: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+):[0-9]+/\1/p' "${servercfgfullpath}")
if [ "${maxplayers}" == "-1" ]||[ "${maxplayers}" == "0" ]; then
if [ "${maxplayers}" == "-1" ] || [ "${maxplayers}" == "0" ]; then
maxplayers="UNLIMITED"
fi
@ -2271,7 +2267,7 @@ fn_info_game_wmc(){
fi
}
fn_info_game_wurm(){
fn_info_game_wurm() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
port="${zero}"
@ -2367,7 +2363,7 @@ elif [ "${shortname}" == "kf2" ]; then
fn_info_game_kf2
elif [ "${shortname}" == "lo" ]; then
fn_info_game_lo
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then
fn_info_game_mc
elif [ "${shortname}" == "mcb" ]; then
fn_info_game_mcb
@ -2389,7 +2385,7 @@ elif [ "${shortname}" == "pc2" ]; then
fn_info_game_pc2
elif [ "${shortname}" == "pstbs" ]; then
fn_info_game_pstbs
elif [ "${shortname}" == "pvr" ];then
elif [ "${shortname}" == "pvr" ]; then
fn_info_game_pvr
elif [ "${shortname}" == "pz" ]; then
fn_info_game_pz
@ -2415,7 +2411,7 @@ elif [ "${shortname}" == "sb" ]; then
fn_info_game_sb
elif [ "${shortname}" == "sbots" ]; then
fn_info_game_sbots
elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then
elif [ "${shortname}" == "scpsl" ] || [ "${shortname}" == "scpslsm" ]; then
fn_info_game_scpsl
elif [ "${shortname}" == "sdtd" ]; then
fn_info_game_sdtd
@ -2465,7 +2461,7 @@ elif [ "${shortname}" == "wmc" ]; then
fn_info_game_wmc
elif [ "${shortname}" == "wurm" ]; then
fn_info_game_wurm
elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then
elif [ "${engine}" == "source" ] || [ "${engine}" == "goldsrc" ]; then
fn_info_game_source
elif [ "${engine}" == "unreal2" ]; then
fn_info_game_unreal2
@ -2473,7 +2469,7 @@ fi
# External IP address
if [ -z "${extip}" ]; then
extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2>/dev/null)"
extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2> /dev/null)"
exitcode=$?
# Should ifconfig.co return an error will use last known IP.
if [ ${exitcode} -eq 0 ]; then
@ -2507,16 +2503,16 @@ fi
# Steam Master Server - checks if detected by master server.
# Checked after config init, as the queryport is needed
if [ -z "${displaymasterserver}" ]; then
if [ "$(command -v jq 2>/dev/null)" ]; then
if [ "${ip}" ]&&[ "${port}" ]; then
if [ "${steammaster}" == "true" ]||[ "${commandname}" == "DEV-QUERY-RAW" ]; then
if [ "$(command -v jq 2> /dev/null)" ]; then
if [ "${ip}" ] && [ "${port}" ]; then
if [ "${steammaster}" == "true" ] || [ "${commandname}" == "DEV-QUERY-RAW" ]; then
# Will query server IP addresses first.
for queryip in "${queryips[@]}"; do
masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${queryip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2>/dev/null)"
masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${queryip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2> /dev/null)"
done
# Should that not work it will try the external IP.
if [ "${masterserver}" == "0" ]; then
masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${extip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2>/dev/null)"
masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${extip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2> /dev/null)"
fi
if [ "${masterserver}" == "0" ]; then
displaymasterserver="false"

264
lgsm/functions/info_messages.sh

@ -8,7 +8,7 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Separator is different for details.
fn_messages_separator(){
fn_messages_separator() {
if [ "${commandname}" == "DETAILS" ]; then
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
else
@ -17,7 +17,7 @@ fn_messages_separator(){
}
# Removes the passwords form all but details.
fn_info_message_password_strip(){
fn_info_message_password_strip() {
if [ "${commandname}" != "DETAILS" ]; then
if [ "${serverpassword}" ]; then
serverpassword="********"
@ -55,7 +55,7 @@ fn_info_message_password_strip(){
# Alert Summary
# used with alertlog
fn_info_message_head(){
fn_info_message_head() {
echo -e ""
echo -e "${lightyellow}Alert Summary${default}"
fn_messages_separator
@ -75,7 +75,7 @@ fn_info_message_head(){
echo -e "${ip}:${port}"
}
fn_info_message_distro(){
fn_info_message_distro() {
#
# Distro Details
# =================================
@ -106,7 +106,7 @@ fn_info_message_distro(){
} | column -s $'\t' -t
}
fn_info_message_server_resource(){
fn_info_message_server_resource() {
#
# Server Resource
# =================================
@ -172,7 +172,7 @@ fn_info_message_server_resource(){
} | column -s $'\t' -t
}
fn_info_message_gameserver_resource(){
fn_info_message_gameserver_resource() {
#
# Game Server Resource Usage
# =================================
@ -188,7 +188,7 @@ fn_info_message_gameserver_resource(){
echo -e "${lightyellow}Game Server Resource Usage${default}"
fn_messages_separator
{
if [ "${status}" != "0" ]&&[ -v status ]; then
if [ "${status}" != "0" ] && [ -v status ]; then
if [ -n "${cpuused}" ]; then
echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}"
else
@ -204,7 +204,7 @@ fn_info_message_gameserver_resource(){
echo -e "${lightblue}Mem Used:\t${default}0%\t0MB${default}"
fi
} | column -s $'\t' -t
echo -e ""
echo -e ""
{
echo -e "${lightyellow}Storage${default}"
echo -e "${lightblue}Total:\t${default}${rootdirdu}"
@ -215,7 +215,7 @@ fn_info_message_gameserver_resource(){
} | column -s $'\t' -t
}
fn_info_message_gameserver(){
fn_info_message_gameserver() {
#
# Counter-Strike: Global Offensive Server Details
# =================================
@ -326,15 +326,15 @@ fn_info_message_gameserver(){
echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}"
fi
else
if [ -n "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
if [ -n "${gdplayers}" ] && [ -n "${gdmaxplayers}" ]; then
echo -e "${lightblue}Players:\t${default}${gdplayers}/${gdmaxplayers}"
elif [ -n "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then
elif [ -n "${gdplayers}" ] && [ -n "${maxplayers}" ]; then
echo -e "${lightblue}Players:\t${default}${gdplayers}/${maxplayers}"
elif [ -z "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
elif [ -z "${gdplayers}" ] && [ -n "${gdmaxplayers}" ]; then
echo -e "${lightblue}Players:\t${default}0/${gdmaxplayers}"
elif [ -n "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then
elif [ -n "${gdplayers}" ] && [ -z "${gdmaxplayers}" ]; then
echo -e "${lightblue}Players:\t${default}${gdplayers}/∞"
elif [ -z "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]&&[ -n "${maxplayers}" ]; then
elif [ -z "${gdplayers}" ] && [ -z "${gdmaxplayers}" ] && [ -n "${maxplayers}" ]; then
echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}"
fi
fi
@ -500,7 +500,7 @@ fn_info_message_gameserver(){
echo -e ""
}
fn_info_message_script(){
fn_info_message_script() {
# csgoserver Script Details
# =================================
# Script name: csgoserver
@ -596,7 +596,7 @@ fn_info_message_script(){
} | column -s $'\t' -t
}
fn_info_message_backup(){
fn_info_message_backup() {
#
# Backups
# =================================
@ -609,7 +609,7 @@ fn_info_message_backup(){
echo -e ""
echo -e "${lightgreen}Backups${default}"
fn_messages_separator
if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
if [ ! -d "${backupdir}" ] || [ "${backupcount}" == "0" ]; then
echo -e "No Backups created"
else
{
@ -628,7 +628,7 @@ fn_info_message_backup(){
fi
}
fn_info_message_commandlineparms(){
fn_info_message_commandlineparms() {
#
# Command-line Parameters
# =================================
@ -645,7 +645,7 @@ fn_info_message_commandlineparms(){
echo -e "${preexecutable} ${executable} ${startparameters}"
}
fn_info_message_ports_edit(){
fn_info_message_ports_edit() {
#
# Ports
# =================================
@ -658,20 +658,20 @@ fn_info_message_ports_edit(){
startparameterslocation="${red}UNKNOWN${default}"
# engines/games that require editing in the config file.
local ports_edit_array=( "ac" "arma3" "armar" "bo" "bt" "cd" "dst" "eco" "idtech2" "idtech3" "idtech3_ql" "jc2" "jc3" "lwjgl2" "mcb" "mumble" "pc" "pc2" "pz" "qw" "refractor" "renderware" "rw" "sb" "sdtd" "st" "stn" "ts3" "tw" "terraria" "unreal" "unreal2" "unreal3" "vints" "wurm")
local ports_edit_array=("ac" "arma3" "armar" "bo" "bt" "cd" "dst" "eco" "idtech2" "idtech3" "idtech3_ql" "jc2" "jc3" "lwjgl2" "mcb" "mumble" "pc" "pc2" "pz" "qw" "refractor" "renderware" "rw" "sb" "sdtd" "st" "stn" "ts3" "tw" "terraria" "unreal" "unreal2" "unreal3" "vints" "wurm")
for port_edit in "${ports_edit_array[@]}"; do
if [ "${shortname}" == "ut3" ]; then
startparameterslocation="${servercfgdir}/UTWeb.ini"
elif [ "${shortname}" == "kf2" ]; then
startparameterslocation="${servercfgdir}/LinuxServer-KFEngine.ini\n${servercfgdir}/KFWeb.ini"
elif [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then
elif [ "${engine}" == "${port_edit}" ] || [ "${gamename}" == "${port_edit}" ] || [ "${shortname}" == "${port_edit}" ]; then
startparameterslocation="${servercfgfullpath}"
fi
done
# engines/games that require editing the start parameters.
local ports_edit_array=( "av" "col" "fctr" "goldsrc" "hw" "iw3.0" "ioquake3" "qfusion" "rust" "scpsl" "scpslsm" "sol" "spark" "source" "unreal4" "arma3" "dayz" "unt" "vh" )
local ports_edit_array=("av" "col" "fctr" "goldsrc" "hw" "iw3.0" "ioquake3" "qfusion" "rust" "scpsl" "scpslsm" "sol" "spark" "source" "unreal4" "arma3" "dayz" "unt" "vh")
for port_edit in "${ports_edit_array[@]}"; do
if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then
if [ "${engine}" == "${port_edit}" ] || [ "${gamename}" == "${port_edit}" ] || [ "${shortname}" == "${port_edit}" ]; then
startparameterslocation="${configdirserver}"
fi
done
@ -679,7 +679,7 @@ fn_info_message_ports_edit(){
echo -e ""
}
fn_info_message_ports(){
fn_info_message_ports() {
echo -e "${lightblue}Useful port diagnostic command:${default}"
if [ "${shortname}" == "armar" ]; then
echo -e "ss -tuplwn | grep enfMain"
@ -687,7 +687,7 @@ fn_info_message_ports(){
echo -e "ss -tuplwn | grep AvorionServer"
elif [ "${shortname}" == "bf1942" ]; then
echo -e "ss -tuplwn | grep bf1942_lnxded"
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "rw" ]||[ "${shortname}" == "wmc" ]; then
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "rw" ] || [ "${shortname}" == "wmc" ]; then
echo -e "ss -tuplwn | grep java"
elif [ "${shortname}" == "terraria" ]; then
echo -e "ss -tuplwn | grep Main"
@ -702,7 +702,7 @@ fn_info_message_ports(){
echo -e ""
}
fn_info_message_statusbottom(){
fn_info_message_statusbottom() {
echo -e ""
if [ "${status}" == "0" ]; then
echo -e "${lightblue}Status:\t${red}STOPPED${default}"
@ -712,7 +712,7 @@ fn_info_message_statusbottom(){
echo -e ""
}
fn_info_logs(){
fn_info_logs() {
echo -e ""
echo -e "${selfname} Logs"
echo -e "================================="
@ -750,7 +750,7 @@ fn_info_logs(){
else
echo -e "${gamelogdir}"
# dos2unix sed 's/\r//'
tail "${gamelogdir}"/* 2>/dev/null | grep -v "==>" | sed '/^$/d' | sed 's/\r//' | tail -25
tail "${gamelogdir}"/* 2> /dev/null | grep -v "==>" | sed '/^$/d' | sed 's/\r//' | tail -25
fi
echo -e ""
fi
@ -766,7 +766,7 @@ fn_info_logs(){
# Query 27015 udp 1
# RCON 27020 tcp 1
fn_port(){
fn_port() {
if [ "${1}" == "header" ]; then
echo -e "${lightblue}DESCRIPTION\tPORT\tPROTOCOL\tLISTEN${default}"
else
@ -777,7 +777,7 @@ fn_port(){
fi
}
fn_info_message_ac(){
fn_info_message_ac() {
{
fn_port "header"
fn_port "Game" port udp
@ -787,7 +787,7 @@ fn_info_message_ac(){
} | column -s $'\t' -t
}
fn_info_message_ark(){
fn_info_message_ark() {
{
fn_port "header"
fn_port "Game" port udp
@ -797,7 +797,7 @@ fn_info_message_ark(){
} | column -s $'\t' -t
}
fn_info_message_arma3(){
fn_info_message_arma3() {
{
fn_port "header"
fn_port "Game" port udp
@ -809,7 +809,7 @@ fn_info_message_arma3(){
} | column -s $'\t' -t
}
fn_info_message_armar(){
fn_info_message_armar() {
{
fn_port "header"
fn_port "Game" port udp
@ -818,7 +818,7 @@ fn_info_message_armar(){
} | column -s $'\t' -t
}
fn_info_message_av(){
fn_info_message_av() {
{
fn_port "header"
fn_port "Game" port udp
@ -829,7 +829,7 @@ fn_info_message_av(){
} | column -s $'\t' -t
}
fn_info_message_bf1942(){
fn_info_message_bf1942() {
{
fn_port "header"
fn_port "Game" port udp
@ -837,7 +837,7 @@ fn_info_message_bf1942(){
} | column -s $'\t' -t
}
fn_info_message_bfv(){
fn_info_message_bfv() {
{
fn_port "header"
fn_port "Game" port udp
@ -845,7 +845,7 @@ fn_info_message_bfv(){
} | column -s $'\t' -t
}
fn_info_message_bo(){
fn_info_message_bo() {
{
fn_port "header"
fn_port "Game" port udp
@ -853,7 +853,7 @@ fn_info_message_bo(){
} | column -s $'\t' -t
}
fn_info_message_bt(){
fn_info_message_bt() {
{
fn_port "header"
fn_port "Game" port udp
@ -861,7 +861,7 @@ fn_info_message_bt(){
} | column -s $'\t' -t
}
fn_info_message_bt1944(){
fn_info_message_bt1944() {
{
fn_port "header"
fn_port "Game" port udp
@ -870,7 +870,7 @@ fn_info_message_bt1944(){
} | column -s $'\t' -t
}
fn_info_messages_cd(){
fn_info_messages_cd() {
{
fn_port "header"
fn_port "Game" port udp
@ -879,7 +879,7 @@ fn_info_messages_cd(){
} | column -s $'\t' -t
}
fn_info_message_cmw(){
fn_info_message_cmw() {
fn_info_message_password_strip
{
fn_port "header"
@ -889,7 +889,7 @@ fn_info_message_cmw(){
} | column -s $'\t' -t
}
fn_info_message_cod(){
fn_info_message_cod() {
{
fn_port "header"
fn_port "Game" port udp
@ -897,7 +897,7 @@ fn_info_message_cod(){
} | column -s $'\t' -t
}
fn_info_message_coduo(){
fn_info_message_coduo() {
{
fn_port "header"
fn_port "Game" port udp
@ -905,7 +905,7 @@ fn_info_message_coduo(){
} | column -s $'\t' -t
}
fn_info_message_cod2(){
fn_info_message_cod2() {
{
fn_port "header"
fn_port "Game" port udp
@ -913,7 +913,7 @@ fn_info_message_cod2(){
} | column -s $'\t' -t
}
fn_info_message_cod4(){
fn_info_message_cod4() {
{
fn_port "header"
fn_port "Game" port udp
@ -921,7 +921,7 @@ fn_info_message_cod4(){
} | column -s $'\t' -t
}
fn_info_message_codwaw(){
fn_info_message_codwaw() {
{
fn_port "header"
fn_port "Game" port udp
@ -929,7 +929,7 @@ fn_info_message_codwaw(){
} | column -s $'\t' -t
}
fn_info_message_col(){
fn_info_message_col() {
{
fn_port "header"
fn_port "Game" port udp
@ -938,7 +938,7 @@ fn_info_message_col(){
} | column -s $'\t' -t
}
fn_info_message_csgo(){
fn_info_message_csgo() {
{
fn_port "header"
fn_port "Game" port udp
@ -949,7 +949,7 @@ fn_info_message_csgo(){
} | column -s $'\t' -t
}
fn_info_message_dayz(){
fn_info_message_dayz() {
{
fn_port "header"
fn_port "Game" port udp
@ -959,7 +959,7 @@ fn_info_message_dayz(){
} | column -s $'\t' -t
}
fn_info_message_dodr(){
fn_info_message_dodr() {
{
fn_port "header"
fn_port "Game" port udp
@ -967,7 +967,7 @@ fn_info_message_dodr(){
} | column -s $'\t' -t
}
fn_info_message_dst(){
fn_info_message_dst() {
{
fn_port "header"
fn_port "Game: Server" port udp
@ -977,7 +977,7 @@ fn_info_message_dst(){
} | column -s $'\t' -t
}
fn_info_message_eco(){
fn_info_message_eco() {
{
fn_port "header"
fn_port "Game" port udp
@ -985,7 +985,7 @@ fn_info_message_eco(){
} | column -s $'\t' -t
}
fn_info_message_etl(){
fn_info_message_etl() {
{
fn_port "header"
fn_port "Game" port udp
@ -993,7 +993,7 @@ fn_info_message_etl(){
} | column -s $'\t' -t
}
fn_info_message_fctr(){
fn_info_message_fctr() {
{
fn_port "header"
fn_port "Game" port udp
@ -1001,7 +1001,7 @@ fn_info_message_fctr(){
} | column -s $'\t' -t
}
fn_info_message_goldsrc(){
fn_info_message_goldsrc() {
{
fn_port "header"
fn_port "Game" port udp
@ -1009,7 +1009,7 @@ fn_info_message_goldsrc(){
} | column -s $'\t' -t
}
fn_info_message_hw(){
fn_info_message_hw() {
{
fn_port "header"
fn_port "Game" port udp
@ -1017,7 +1017,7 @@ fn_info_message_hw(){
} | column -s $'\t' -t
}
fn_info_message_ins(){
fn_info_message_ins() {
{
fn_port "header"
fn_port "Game" port udp
@ -1028,7 +1028,7 @@ fn_info_message_ins(){
} | column -s $'\t' -t
}
fn_info_message_inss(){
fn_info_message_inss() {
{
fn_port "header"
fn_port "Game" port udp
@ -1037,7 +1037,7 @@ fn_info_message_inss(){
} | column -s $'\t' -t
}
fn_info_message_jc2(){
fn_info_message_jc2() {
{
fn_port "header"
fn_port "Game" port udp
@ -1045,7 +1045,7 @@ fn_info_message_jc2(){
} | column -s $'\t' -t
}
fn_info_message_jc3(){
fn_info_message_jc3() {
{
fn_port "header"
fn_port "Game" port udp
@ -1055,23 +1055,23 @@ fn_info_message_jc3(){
} | column -s $'\t' -t
}
fn_info_message_jk2(){
fn_info_message_jk2() {
{
fn_port "header"
fn_port "Game" port udp
} | column -s $'\t' -t
}
fn_info_message_kf(){
fn_info_message_kf() {
{
fn_port "header"
fn_port "Game" port udp
fn_port "Query" queryport udp
fn_port "Query (GameSpy)" queryportgs udp
fn_port "Web Admin" webadminport tcp
fn_port "LAN" lanport udp
fn_port "Steam" steamport udp
fn_port "Steam Master" steammasterport udp
fn_port "header"
fn_port "Game" port udp
fn_port "Query" queryport udp
fn_port "Query (GameSpy)" queryportgs udp
fn_port "Web Admin" webadminport tcp
fn_port "LAN" lanport udp
fn_port "Steam" steamport udp
fn_port "Steam Master" steammasterport udp
} | column -s $'\t' -t
echo -e ""
echo -e "${lightgreen}${servername} Web Admin${default}"
@ -1084,7 +1084,7 @@ fn_info_message_kf(){
} | column -s $'\t' -t
}
fn_info_message_kf2(){
fn_info_message_kf2() {
fn_info_message_password_strip
{
fn_port "header"
@ -1103,7 +1103,7 @@ fn_info_message_kf2(){
} | column -s $'\t' -t
}
fn_info_message_lo(){
fn_info_message_lo() {
{
fn_port "header"
fn_port "Game" port udp
@ -1111,7 +1111,7 @@ fn_info_message_lo(){
} | column -s $'\t' -t
}
fn_info_message_mc(){
fn_info_message_mc() {
{
fn_port "header"
fn_port "Game" port tcp
@ -1120,7 +1120,7 @@ fn_info_message_mc(){
} | column -s $'\t' -t
}
fn_info_message_mcb(){
fn_info_message_mcb() {
{
fn_port "header"
fn_port "Game" port udp
@ -1128,7 +1128,7 @@ fn_info_message_mcb(){
} | column -s $'\t' -t
}
fn_info_message_mh(){
fn_info_message_mh() {
{
fn_port "header"
fn_port "Game" port udp
@ -1137,14 +1137,14 @@ fn_info_message_mh(){
} | column -s $'\t' -t
}
fn_info_message_mohaa(){
fn_info_message_mohaa() {
{
fn_port "header"
fn_port "Game" port udp
} | column -s $'\t' -t
}
fn_info_message_mom(){
fn_info_message_mom() {
{
fn_port "header"
fn_port "Game" port udp
@ -1152,7 +1152,7 @@ fn_info_message_mom(){
} | column -s $'\t' -t
}
fn_info_message_mta(){
fn_info_message_mta() {
{
fn_port "header"
fn_port "Game" port udp
@ -1163,7 +1163,7 @@ fn_info_message_mta(){
} | column -s $'\t' -t
}
fn_info_message_mumble(){
fn_info_message_mumble() {
{
fn_port "header"
fn_port "Voice" port udp
@ -1171,7 +1171,7 @@ fn_info_message_mumble(){
} | column -s $'\t' -t
}
fn_info_message_onset(){
fn_info_message_onset() {
{
fn_port "header"
fn_port "Game" port udp
@ -1180,7 +1180,7 @@ fn_info_message_onset(){
} | column -s $'\t' -t
}
fn_info_message_pc(){
fn_info_message_pc() {
{
fn_port "header"
fn_port "Game" port udp
@ -1189,7 +1189,7 @@ fn_info_message_pc(){
} | column -s $'\t' -t
}
fn_info_message_pc2(){
fn_info_message_pc2() {
{
fn_port "header"
fn_port "Game" port udp
@ -1198,7 +1198,7 @@ fn_info_message_pc2(){
} | column -s $'\t' -t
}
fn_info_message_pstbs(){
fn_info_message_pstbs() {
{
fn_port "header"
fn_port "Game" port udp
@ -1207,7 +1207,7 @@ fn_info_message_pstbs(){
} | column -s $'\t' -t
}
fn_info_message_pvr(){
fn_info_message_pvr() {
{
fn_port "header"
fn_port "Game" port udp
@ -1217,7 +1217,7 @@ fn_info_message_pvr(){
} | column -s $'\t' -t
}
fn_info_message_pz(){
fn_info_message_pz() {
{
fn_port "header"
fn_port "Game" port udp
@ -1225,28 +1225,28 @@ fn_info_message_pz(){
} | column -s $'\t' -t
}
fn_info_message_qw(){
fn_info_message_qw() {
{
fn_port "header"
fn_port "Game" port udp
} | column -s $'\t' -t
}
fn_info_message_q2(){
fn_info_message_q2() {
{
fn_port "header"
fn_port "Game" port udp
} | column -s $'\t' -t
}
fn_info_message_q3(){
fn_info_message_q3() {
{
fn_port "header"
fn_port "Game" port udp
} | column -s $'\t' -t
}
fn_info_message_ql(){
fn_info_message_ql() {
{
fn_port "header"
fn_port "Game" port udp
@ -1256,7 +1256,7 @@ fn_info_message_ql(){
} | column -s $'\t' -t
}
fn_info_message_ro(){
fn_info_message_ro() {
{
fn_port "header"
fn_port "Game" port udp
@ -1277,14 +1277,14 @@ fn_info_message_ro(){
} | column -s $'\t' -t
}
fn_info_message_rtcw(){
fn_info_message_rtcw() {
{
fn_port "header"
fn_port "Game" port udp
} | column -s $'\t' -t
}
fn_info_message_rust(){
fn_info_message_rust() {
{
fn_port "header"
fn_port "Game" port udp
@ -1294,7 +1294,7 @@ fn_info_message_rust(){
} | column -s $'\t' -t
}
fn_info_message_rw(){
fn_info_message_rw() {
{
fn_port "header"
fn_port "Game" port udp
@ -1310,7 +1310,7 @@ fn_info_message_rw(){
} | column -s $'\t' -t
}
fn_info_message_samp(){
fn_info_message_samp() {
{
fn_port "header"
fn_port "Game" port udp
@ -1318,7 +1318,7 @@ fn_info_message_samp(){
} | column -s $'\t' -t
}
fn_info_message_sb(){
fn_info_message_sb() {
{
fn_port "header"
fn_port "Game" port udp
@ -1327,7 +1327,7 @@ fn_info_message_sb(){
} | column -s $'\t' -t
}
fn_info_message_sbots(){
fn_info_message_sbots() {
{
fn_port "header"
fn_port "Game" port udp
@ -1335,14 +1335,14 @@ fn_info_message_sbots(){
} | column -s $'\t' -t
}
fn_info_message_scpsl(){
fn_info_message_scpsl() {
{
fn_port "header"
fn_port "Game" port tcp
} | column -s $'\t' -t
}
fn_info_message_sdtd(){
fn_info_message_sdtd() {
fn_info_message_password_strip
{
fn_port "header"
@ -1371,7 +1371,7 @@ fn_info_message_sdtd(){
} | column -s $'\t' -t
}
fn_info_message_sf(){
fn_info_message_sf() {
{
fn_port "header"
fn_port "Game" port udp
@ -1380,7 +1380,7 @@ fn_info_message_sf(){
} | column -s $'\t' -t
}
fn_info_message_sof2(){
fn_info_message_sof2() {
{
fn_port "header"
fn_port "Game" port udp
@ -1388,7 +1388,7 @@ fn_info_message_sof2(){
} | column -s $'\t' -t
}
fn_info_message_sol(){
fn_info_message_sol() {
{
fn_port "header"
fn_port "Game" port udp
@ -1396,7 +1396,7 @@ fn_info_message_sol(){
fn_port "Files" filesport tcp
} | column -s $'\t' -t
}
fn_info_message_source(){
fn_info_message_source() {
{
fn_port "header"
fn_port "Game" port udp
@ -1404,14 +1404,14 @@ fn_info_message_source(){
fn_port "RCON" rconport tcp
fn_port "SourceTV" sourcetvport udp
# Will not show if unaviable
if [ "${steamport}" == "0" ]||[ -v "${steamport}" ]; then
if [ "${steamport}" == "0" ] || [ -v "${steamport}" ]; then
fn_port "Steam" steamport udp
fi
fn_port "Client" clientport udp
} | column -s $'\t' -t
}
fn_info_message_spark(){
fn_info_message_spark() {
fn_info_message_password_strip
{
fn_port "header"
@ -1429,7 +1429,7 @@ fn_info_message_spark(){
} | column -s $'\t' -t
}
fn_info_message_squad(){
fn_info_message_squad() {
{
fn_port "header"
fn_port "Game" port udp
@ -1438,7 +1438,7 @@ fn_info_message_squad(){
} | column -s $'\t' -t
}
fn_info_message_st(){
fn_info_message_st() {
{
fn_port "header"
fn_port "Game" port udp
@ -1453,7 +1453,7 @@ fn_info_message_st(){
} | column -s $'\t' -t
}
fn_info_message_ti(){
fn_info_message_ti() {
{
fn_port "header"
fn_port "Game" port udp
@ -1461,7 +1461,7 @@ fn_info_message_ti(){
} | column -s $'\t' -t
}
fn_info_message_ts3(){
fn_info_message_ts3() {
{
fn_port "header"
fn_port "Voice" port udp
@ -1474,7 +1474,7 @@ fn_info_message_ts3(){
} | column -s $'\t' -t
}
fn_info_message_tw(){
fn_info_message_tw() {
{
fn_port "header"
fn_port "Game" port udp
@ -1482,7 +1482,7 @@ fn_info_message_tw(){
} | column -s $'\t' -t
}
fn_info_message_terraria(){
fn_info_message_terraria() {
{
fn_port "header"
fn_port "Game" port tcp
@ -1490,7 +1490,7 @@ fn_info_message_terraria(){
} | column -s $'\t' -t
}
fn_info_message_tu(){
fn_info_message_tu() {
{
fn_port "header"
fn_port "Game" port udp
@ -1499,7 +1499,7 @@ fn_info_message_tu(){
} | column -s $'\t' -t
}
fn_info_message_unreal(){
fn_info_message_unreal() {
fn_info_message_password_strip
{
fn_port "header"
@ -1519,14 +1519,14 @@ fn_info_message_unreal(){
} | column -s $'\t' -t
}
fn_info_message_ut2k4(){
fn_info_message_ut2k4() {
{
fn_port "header"
fn_port "Game" port udp
fn_port "Query" queryport udp
fn_port "Query (GameSpy)" queryportgs udp
fn_port "Web Admin" webadminport tcp
fn_port "LAN" lanport udp
fn_port "header"
fn_port "Game" port udp
fn_port "Query" queryport udp
fn_port "Query (GameSpy)" queryportgs udp
fn_port "Web Admin" webadminport tcp
fn_port "LAN" lanport udp
} | column -s $'\t' -t
echo -e ""
echo -e "${lightgreen}${servername} Web Admin${default}"
@ -1539,7 +1539,7 @@ fn_info_message_ut2k4(){
} | column -s $'\t' -t
}
fn_info_message_unreal(){
fn_info_message_unreal() {
fn_info_message_password_strip
{
fn_port "header"
@ -1559,7 +1559,7 @@ fn_info_message_unreal(){
} | column -s $'\t' -t
}
fn_info_message_unt(){
fn_info_message_unt() {
{
fn_port "header"
fn_port "Game" port udp
@ -1568,7 +1568,7 @@ fn_info_message_unt(){
} | column -s $'\t' -t
}
fn_info_message_ut(){
fn_info_message_ut() {
{
fn_port "header"
fn_port "Game" port udp
@ -1576,7 +1576,7 @@ fn_info_message_ut(){
} | column -s $'\t' -t
}
fn_info_message_ut3(){
fn_info_message_ut3() {
fn_info_message_password_strip
{
fn_port "header"
@ -1595,7 +1595,7 @@ fn_info_message_ut3(){
} | column -s $'\t' -t
}
fn_info_message_vh(){
fn_info_message_vh() {
{
fn_port "header"
fn_port "Game" port udp
@ -1603,14 +1603,14 @@ fn_info_message_vh(){
} | column -s $'\t' -t
}
fn_info_message_vints(){
fn_info_message_vints() {
{
fn_port "header"
fn_port "Game" port tcp
} | column -s $'\t' -t
}
fn_info_message_wet(){
fn_info_message_wet() {
{
fn_port "header"
fn_port "Game" port udp
@ -1618,7 +1618,7 @@ fn_info_message_wet(){
} | column -s $'\t' -t
}
fn_info_message_wf(){
fn_info_message_wf() {
{
fn_port "header"
fn_port "Game" port udp
@ -1626,7 +1626,7 @@ fn_info_message_wf(){
} | column -s $'\t' -t
}
fn_info_message_wurm(){
fn_info_message_wurm() {
{
fn_port "header"
fn_port "Game" port tcp
@ -1634,7 +1634,7 @@ fn_info_message_wurm(){
} | column -s $'\t' -t
}
fn_info_message_stn(){
fn_info_message_stn() {
{
fn_port "header"
fn_port "Game" port udp
@ -1642,7 +1642,7 @@ fn_info_message_stn(){
} | column -s $'\t' -t
}
fn_info_message_select_engine(){
fn_info_message_select_engine() {
# Display details depending on game or engine.
if [ "${shortname}" == "ac" ]; then
fn_info_message_ac
@ -1712,7 +1712,7 @@ fn_info_message_select_engine(){
fn_info_message_kf2
elif [ "${shortname}" == "lo" ]; then
fn_info_message_lo
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "wmc" ]; then
fn_info_message_mc
elif [ "${shortname}" == "mcb" ]; then
fn_info_message_mcb
@ -1756,7 +1756,7 @@ fn_info_message_select_engine(){
fn_info_message_sb
elif [ "${shortname}" == "sbots" ]; then
fn_info_message_sbots
elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then
elif [ "${shortname}" == "scpsl" ] || [ "${shortname}" == "scpslsm" ]; then
fn_info_message_scpsl
elif [ "${shortname}" == "sdtd" ]; then
fn_info_message_sdtd

6
lgsm/functions/info_stats.sh

@ -20,7 +20,7 @@ fi
# to allow human readable uuid's.
# e.g angry_proskuriakova_38a9ef76-4ae3-46a6-a895-7af474831eba
if [ ! -f "${datadir}/uuid-${selfname}.txt" ]||[ ! -f "${datadir}/uuid-install.txt" ]; then
if [ ! -f "${datadir}/uuid-${selfname}.txt" ] || [ ! -f "${datadir}/uuid-install.txt" ]; then
# download dictionary words
if [ ! -f "${datadir}/name-left.csv" ]; then
fn_fetch_file_github "lgsm/data" "name-left.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nohash"
@ -30,7 +30,7 @@ if [ ! -f "${datadir}/uuid-${selfname}.txt" ]||[ ! -f "${datadir}/uuid-install.t
fi
# generate instance uuid
if [ -n "$(command -v uuidgen 2>/dev/null)" ]; then
if [ -n "$(command -v uuidgen 2> /dev/null)" ]; then
uuid="$(uuidgen)"
else
uuid="$(cat /proc/sys/kernel/random/uuid)"
@ -40,7 +40,7 @@ if [ ! -f "${datadir}/uuid-${selfname}.txt" ]||[ ! -f "${datadir}/uuid-install.t
nameright="$(shuf -n 1 "${datadir}/name-right.csv")"
echo "instance_${nameleft}_${nameright}_${uuid}" > "${datadir}/uuid-${selfname}.txt"
# generate install uuid if missing
if [ ! -f "${datadir}/uuid-install.txt" ];then
if [ ! -f "${datadir}/uuid-install.txt" ]; then
echo "${nameleft}_${nameright}_${uuid}" > "${datadir}/uuid-install.txt"
fi
fi

238
lgsm/functions/install_config.sh

@ -8,7 +8,7 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Checks if server cfg dir exists, creates it if it doesn't.
fn_check_cfgdir(){
fn_check_cfgdir() {
if [ ! -d "${servercfgdir}" ]; then
echo -e "creating ${servercfgdir} config directory."
fn_script_log_info "creating ${servercfgdir} config directory."
@ -17,7 +17,7 @@ fn_check_cfgdir(){
}
# Downloads default configs from Game-Server-Configs repo to lgsm/config-default.
fn_fetch_default_config(){
fn_fetch_default_config() {
echo -e ""
echo -e "${lightyellow}Downloading ${gamename} Configs${default}"
echo -e "================================="
@ -31,7 +31,7 @@ fn_fetch_default_config(){
}
# Copys default configs from Game-Server-Configs repo to server config location.
fn_default_config_remote(){
fn_default_config_remote() {
for config in "${array_configs[@]}"; do
# every config is copied
echo -e "copying ${config} config file."
@ -39,10 +39,10 @@ fn_default_config_remote(){
if [ "${config}" == "${servercfgdefault}" ]; then
mkdir -p "${servercfgdir}"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}"
elif [ "${shortname}" == "arma3" ]&&[ "${config}" == "${networkcfgdefault}" ]; then
elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then
mkdir -p "${servercfgdir}"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}"
elif [ "${shortname}" == "dst" ]&&[ "${config}" == "${clustercfgdefault}" ]; then
elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then
cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}"
else
mkdir -p "${servercfgdir}"
@ -53,7 +53,7 @@ fn_default_config_remote(){
}
# Copys local default config to server config location.
fn_default_config_local(){
fn_default_config_local() {
echo -e "copying ${servercfgdefault} config file."
cp -nv "${servercfgdir}/${servercfgdefault}" "${servercfgfullpath}"
fn_sleep_time
@ -62,7 +62,7 @@ fn_default_config_local(){
# Changes some variables within the default configs.
# SERVERNAME to LinuxGSM
# PASSWORD to random password
fn_set_config_vars(){
fn_set_config_vars() {
if [ -f "${servercfgfullpath}" ]; then
random=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs)
servername="LinuxGSM"
@ -71,9 +71,9 @@ fn_set_config_vars(){
fn_script_log_info "changing hostname."
fn_sleep_time
# prevents var from being overwritten with the servername.
if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2>/dev/null; then
if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then
sed -i "s/SERVERNAME=SERVERNAME/SERVERNAME=${servername}/g" "${servercfgfullpath}"
elif grep -q "SERVERNAME=\"SERVERNAME\"" "${lgsmdir}/config-default/config-game/${config}" 2>/dev/null; then
elif grep -q "SERVERNAME=\"SERVERNAME\"" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then
sed -i "s/SERVERNAME=\"SERVERNAME\"/SERVERNAME=\"${servername}\"/g" "${servercfgfullpath}"
else
sed -i "s/SERVERNAME/${servername}/g" "${servercfgfullpath}"
@ -94,7 +94,7 @@ fn_set_config_vars(){
}
# Changes some variables within the default Don't Starve Together configs.
fn_set_dst_config_vars(){
fn_set_dst_config_vars() {
## cluster.ini
if grep -Fq "SERVERNAME" "${clustercfgfullpath}"; then
echo -e "changing server name."
@ -144,7 +144,7 @@ fn_set_dst_config_vars(){
}
# Lists local config file locations
fn_list_config_locations(){
fn_list_config_locations() {
echo -e ""
echo -e "${lightyellow}Config File Locations${default}"
echo -e "================================="
@ -167,21 +167,21 @@ if [ "${shortname}" == "sdtd" ]; then
fn_list_config_locations
elif [ "${shortname}" == "ac" ]; then
gamedirname="AssettoCorsa"
array_configs+=( server_cfg.ini )
array_configs+=(server_cfg.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ahl" ]; then
gamedirname="ActionHalfLife"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ahl2" ]; then
gamedirname="ActionSource"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -189,7 +189,7 @@ elif [ "${shortname}" == "ahl2" ]; then
elif [ "${shortname}" == "ark" ]; then
gamedirname="ARKSurvivalEvolved"
fn_check_cfgdir
array_configs+=( GameUserSettings.ini )
array_configs+=(GameUserSettings.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -197,7 +197,7 @@ elif [ "${shortname}" == "ark" ]; then
elif [ "${shortname}" == "arma3" ]; then
gamedirname="Arma3"
fn_check_cfgdir
array_configs+=( server.cfg network.cfg )
array_configs+=(server.cfg network.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -205,21 +205,21 @@ elif [ "${shortname}" == "arma3" ]; then
elif [ "${shortname}" == "armar" ]; then
gamedirname="ArmaReforger"
fn_check_cfgdir
array_configs+=( server.json )
array_configs+=(server.json)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "bo" ]; then
gamedirname="BallisticOverkill"
array_configs+=( config.txt )
array_configs+=(config.txt)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "bo" ]; then
gamedirname="BaseDefense"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -227,7 +227,7 @@ elif [ "${shortname}" == "bo" ]; then
elif [ "${shortname}" == "bt" ]; then
gamedirname="Barotrauma"
fn_check_cfgdir
array_configs+=( serversettings.xml )
array_configs+=(serversettings.xml)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -235,133 +235,133 @@ elif [ "${shortname}" == "bt" ]; then
elif [ "${shortname}" == "bt1944" ]; then
gamedirname="Battalion1944"
fn_check_cfgdir
array_configs+=( DefaultGame.ini )
array_configs+=(DefaultGame.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "bf1942" ]; then
gamedirname="Battlefield1942"
array_configs+=( serversettings.con )
array_configs+=(serversettings.con)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "bfv" ]; then
gamedirname="BattlefieldVietnam"
array_configs+=( serversettings.con )
array_configs+=(serversettings.con)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "bs" ]; then
gamedirname="BladeSymphony"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "bb" ]; then
gamedirname="BrainBread"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "bb2" ]; then
gamedirname="BrainBread2"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "bmdm" ]; then
gamedirname="BlackMesa"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "cd" ]; then
gamedirname="CraftingDead"
array_configs+=( properties.json )
array_configs+=(properties.json)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "cod" ]; then
gamedirname="CallOfDuty"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "coduo" ]; then
gamedirname="CallOfDutyUnitedOffensive"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "cod2" ]; then
gamedirname="CallOfDuty2"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "cod4" ]; then
gamedirname="CallOfDuty4"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "codwaw" ]; then
gamedirname="CallOfDutyWorldAtWar"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "cc" ]; then
gamedirname="CodenameCURE"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "col" ]; then
gamedirname="ColonySurvival"
array_configs+=( colserver.json )
array_configs+=(colserver.json)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "cs" ]; then
gamedirname="CounterStrike"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "cscz" ]; then
gamedirname="CounterStrikeConditionZero"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "csgo" ]; then
gamedirname="CounterStrikeGlobalOffensive"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "css" ]; then
gamedirname="CounterStrikeSource"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -369,41 +369,41 @@ elif [ "${shortname}" == "css" ]; then
elif [ "${shortname}" == "dayz" ]; then
gamedirname="DayZ"
fn_check_cfgdir
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "dod" ]; then
gamedirname="DayOfDefeat"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "dodr" ]; then
gamedirname="DayOfDragons"
array_configs+=( Game.ini )
array_configs+=(Game.ini)
fn_fetch_default_config
fn_default_config_remote
fn_list_config_locations
elif [ "${shortname}" == "dods" ]; then
gamedirname="DayOfDefeatSource"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "doi" ]; then
gamedirname="DayOfInfamy"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "dmc" ]; then
gamedirname="DeathmatchClassic"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -411,154 +411,154 @@ elif [ "${shortname}" == "dmc" ]; then
elif [ "${shortname}" == "dst" ]; then
gamedirname="DontStarveTogether"
fn_check_cfgdir
array_configs+=( cluster.ini server.ini )
array_configs+=(cluster.ini server.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_dst_config_vars
fn_list_config_locations
elif [ "${shortname}" == "dab" ]; then
gamedirname="DoubleActionBoogaloo"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "dys" ]; then
gamedirname="Dystopia"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "eco" ]; then
gamedirname="Eco"
array_configs+=( Network.eco )
array_configs+=(Network.eco)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "etl" ]; then
gamedirname="ETLegacy"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "fctr" ]; then
gamedirname="Factorio"
array_configs+=( server-settings.json )
array_configs+=(server-settings.json)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "fof" ]; then
gamedirname="FistfulofFrags"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "gmod" ]; then
gamedirname="GarrysMod"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "hldm" ]; then
gamedirname="HalfLifeDeathmatch"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "hldms" ]; then
gamedirname="HalfLifeDeathmatchSource"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "opfor" ]; then
gamedirname="OpposingForce"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "hl2dm" ]; then
gamedirname="HalfLife2Deathmatch"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ins" ]; then
gamedirname="Insurgency"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ios" ]; then
gamedirname="IOSoccer"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "jc2" ]; then
gamedirname="JustCause2"
array_configs+=( config.lua )
array_configs+=(config.lua)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "jc3" ]; then
gamedirname="JustCause3"
array_configs+=( config.json )
array_configs+=(config.json)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "kf" ]; then
gamedirname="KillingFloor"
array_configs+=( Default.ini )
array_configs+=(Default.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "l4d" ]; then
gamedirname="Left4Dead"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "l4d2" ]; then
gamedirname="Left4Dead2"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then
gamedirname="Minecraft"
array_configs+=( server.properties )
array_configs+=(server.properties)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "mcb" ]; then
gamedirname="MinecraftBedrock"
array_configs+=( server.properties )
array_configs+=(server.properties)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "mohaa" ]; then
gamedirname="MedalOfHonorAlliedAssault"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -566,28 +566,28 @@ elif [ "${shortname}" == "mohaa" ]; then
elif [ "${shortname}" == "mh" ]; then
gamedirname="Mordhau"
fn_check_cfgdir
array_configs+=( Game.ini )
array_configs+=(Game.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ns" ]; then
gamedirname="NaturalSelection"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "nmrih" ]; then
gamedirname="NoMoreRoominHell"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "nd" ]; then
gamedirname="NuclearDawn"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -595,33 +595,33 @@ elif [ "${shortname}" == "nd" ]; then
elif [ "${shortname}" == "mta" ]; then
gamedirname="MultiTheftAuto"
fn_check_cfgdir
array_configs+=( acl.xml mtaserver.conf vehiclecolors.conf )
array_configs+=(acl.xml mtaserver.conf vehiclecolors.conf)
fn_fetch_default_config
fn_default_config_remote
fn_list_config_locations
elif [ "${shotname}" == "mom" ];then
elif [ "${shotname}" == "mom" ]; then
gamedirname="MemoriesofMars"
array_configs+=( DedicatedServerConfig.cfg)
array_configs+=(DedicatedServerConfig.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "mumble" ]; then
gamedirname="Mumble"
array_configs+=( murmur.ini )
array_configs+=(murmur.ini)
fn_fetch_default_config
fn_default_config_remote
fn_list_config_locations
elif [ "${shortname}" == "pvr" ]; then
gamedirname="PavlovVR"
fn_check_cfgdir
array_configs+=( Game.ini )
array_configs+=(Game.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${shortname}" == "pvkii" ]; then
gamedirname="PiratesVikingandKnightsII"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -629,14 +629,14 @@ elif [ "${shortname}" == "pvkii" ]; then
elif [ "${shortname}" == "pz" ]; then
gamedirname="ProjectZomboid"
fn_check_cfgdir
array_configs+=( server.ini )
array_configs+=(server.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "pc" ]; then
gamedirname="ProjectCars"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -647,48 +647,48 @@ elif [ "${shortname}" == "pc2" ]; then
fn_list_config_locations
elif [ "${shortname}" == "q2" ]; then
gamedirname="Quake2"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "q3" ]; then
gamedirname="Quake3Arena"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ql" ]; then
gamedirname="QuakeLive"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "jk2" ]; then
gamedirname="JediKnightIIJediOutcast"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${shortname}" == "qw" ]; then
gamedirname="QuakeWorld"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ricochet" ]; then
gamedirname="Ricochet"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "rtcw" ]; then
gamedirname="ReturnToCastleWolfenstein"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -696,124 +696,124 @@ elif [ "${shortname}" == "rtcw" ]; then
elif [ "${shortname}" == "rust" ]; then
gamedirname="Rust"
fn_check_cfgdir
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_list_config_locations
elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then
elif [ "${shortname}" == "scpsl" ] || [ "${shortname}" == "scpslsm" ]; then
gamedirname="SCPSecretLaboratory"
array_configs+=( config_gameplay.txt config_localadmin.txt )
array_configs+=(config_gameplay.txt config_localadmin.txt)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "sf" ]; then
gamedirname="Satisfactory"
array_configs+=( GameUserSettings.ini )
array_configs+=(GameUserSettings.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "sol" ]; then
gamedirname="Soldat"
array_configs+=( soldat.ini )
array_configs+=(soldat.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "sof2" ]; then
gamedirname="SoldierOfFortune2Gold"
array_configs+=( server.cfg mapcycle.txt)
array_configs+=(server.cfg mapcycle.txt)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "sfc" ]; then
gamedirname="SourceFortsClassic"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "squad" ]; then
gamedirname="Squad"
array_configs+=( Admins.cfg Bans.cfg License.cfg Server.cfg Rcon.cfg )
array_configs+=(Admins.cfg Bans.cfg License.cfg Server.cfg Rcon.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "sb" ]; then
gamedirname="Starbound"
array_configs+=( starbound_server.config )
array_configs+=(starbound_server.config)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "st" ]; then
gamedirname="Stationeers"
array_configs+=( default.ini )
array_configs+=(default.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "stn" ]; then
gamedirname="SurvivetheNights"
array_configs+=( ServerConfig.txt ServerUsers.txt TpPresets.json UserPermissions.json )
array_configs+=(ServerConfig.txt ServerUsers.txt TpPresets.json UserPermissions.json)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "sven" ]; then
gamedirname="SvenCoop"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "tf2" ]; then
gamedirname="TeamFortress2"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "tfc" ]; then
gamedirname="TeamFortressClassic"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ti" ]; then
gamedirname="TheIsle"
array_configs+=( Game.ini )
array_configs+=(Game.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ts" ]; then
gamedirname="TheSpecialists"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ts3" ]; then
gamedirname="TeamSpeak3"
array_configs+=( ts3server.ini )
array_configs+=(ts3server.ini)
fn_fetch_default_config
fn_default_config_remote
fn_list_config_locations
elif [ "${shortname}" == "tw" ]; then
gamedirname="Teeworlds"
array_configs+=( server.cfg ctf.cfg dm.cfg duel.cfg tdm.cfg )
array_configs+=(server.cfg ctf.cfg dm.cfg duel.cfg tdm.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "terraria" ]; then
gamedirname="Terraria"
array_configs+=( serverconfig.txt )
array_configs+=(serverconfig.txt)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
@ -821,90 +821,90 @@ elif [ "${shortname}" == "terraria" ]; then
elif [ "${shortname}" == "tu" ]; then
gamedirname="TowerUnite"
fn_check_cfgdir
array_configs+=( TowerServer.ini )
array_configs+=(TowerServer.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ut" ]; then
gamedirname="UnrealTournament"
array_configs+=( Game.ini Engine.ini )
array_configs+=(Game.ini Engine.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ut2k4" ]; then
gamedirname="UnrealTournament2004"
array_configs+=( UT2004.ini )
array_configs+=(UT2004.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "ut99" ]; then
gamedirname="UnrealTournament99"
array_configs+=( Default.ini )
array_configs+=(Default.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "unt" ]; then
gamedirname="Unturned"
array_configs+=( Config.json )
array_configs+=(Config.json)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "vints" ]; then
gamedirname="VintageStory"
array_configs+=( serverconfig.json )
array_configs+=(serverconfig.json)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "vs" ]; then
gamedirname="VampireSlayer"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "wet" ]; then
gamedirname="WolfensteinEnemyTerritory"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "wf" ]; then
gamedirname="Warfork"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "wmc" ]; then
gamedirname="Waterfall"
array_configs+=( config.yml )
array_configs+=(config.yml)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${shortname}" == "wurm" ]; then
gamedirname="WurmUnlimited"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "zmr" ]; then
gamedirname="ZombieMasterReborn"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "zps" ]; then
gamedirname="ZombiePanicSource"
array_configs+=( server.cfg )
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars

4
lgsm/functions/install_eula.sh

@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ "${shortname}" == "ts3" ]; then
eulaurl="https://www.teamspeak.com/en/privacy-and-terms"
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then
eulaurl="https://account.mojang.com/documents/minecraft_eula"
elif [ "${shortname}" == "ut" ]; then
eulaurl="https://www.epicgames.com/unrealtournament/unreal-tournament-pre-alpha-test-development-build-eula"
@ -41,7 +41,7 @@ fi
if [ "${shortname}" == "ts3" ]; then
touch "${executabledir}/.ts3server_license_accepted"
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then
touch "${serverfiles}/eula.txt"
echo -e "eula=true" > "${serverfiles}/eula.txt"
elif [ "${shortname}" == "ut" ]; then

2
lgsm/functions/install_gslt.sh

@ -11,7 +11,7 @@ echo -e ""
echo -e "${lightyellow}Game Server Login Token${default}"
echo -e "================================="
fn_sleep_time
if [ "${shortname}" == "csgo" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "bs" ]; then
if [ "${shortname}" == "csgo" ] || [ "${shortname}" == "css" ] || [ "${shortname}" == "nmrih" ] || [ "${shortname}" == "bs" ]; then
echo -e "GSLT is required to run a public ${gamename} server"
fn_script_log_info "GSLT is required to run a public ${gamename} server"
else

2
lgsm/functions/install_logs.sh

@ -59,7 +59,7 @@ if [ "${consolelogdir}" ]; then
fi
# Create Game logs.
if [ "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then
if [ "${gamelogdir}" ] && [ ! -d "${gamelogdir}" ]; then
echo -en "installing game log dir: ${gamelogdir}..."
if ! mkdir -p "${gamelogdir}"; then
fn_print_fail_eol_nl

3
lgsm/functions/install_retry.sh

@ -8,7 +8,8 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if fn_prompt_yn "Retry install?" Y; then
command_install.sh; core_exit.sh
command_install.sh
core_exit.sh
else
exitcode=0
core_exit.sh

195
lgsm/functions/install_server_files.sh

@ -7,61 +7,196 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_install_server_files(){
fn_install_server_files() {
if [ "${shortname}" == "ahl" ]; then
remote_fileurl="http://linuxgsm.download/ActionHalfLife/action_halflife-1.0.tar.xz"; local_filedir="${tmpdir}"; local_filename="action_halflife-1.0.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="61d7b79fd714888b6d65944fdaafa94a"
remote_fileurl="http://linuxgsm.download/ActionHalfLife/action_halflife-1.0.tar.xz"
local_filedir="${tmpdir}"
local_filename="action_halflife-1.0.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="61d7b79fd714888b6d65944fdaafa94a"
elif [ "${shortname}" == "bf1942" ]; then
remote_fileurl="http://linuxgsm.download/BattleField1942/bf1942_lnxded-1.61-hacked-to-1.612.full.tar.xz"; local_filedir="${tmpdir}"; local_filename="bf1942_lnxded-1.61-hacked-to-1.612.full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="4223bf4ed85f5162c24b2cba51249b9e"
elif [ "${shortname}" == "bfv" ];then
remote_fileurl="http://linuxgsm.download/BattlefieldVietnam/bfv_linded-v1.21-20041207_patch.tar.xz"; local_filedir="${tmpdir}"; local_filename="bfv_linded-v1.21-20041207_patch.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="e3b4962cdd9d41e23c6fed65101bccde"
remote_fileurl="http://linuxgsm.download/BattleField1942/bf1942_lnxded-1.61-hacked-to-1.612.full.tar.xz"
local_filedir="${tmpdir}"
local_filename="bf1942_lnxded-1.61-hacked-to-1.612.full.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="4223bf4ed85f5162c24b2cba51249b9e"
elif [ "${shortname}" == "bfv" ]; then
remote_fileurl="http://linuxgsm.download/BattlefieldVietnam/bfv_linded-v1.21-20041207_patch.tar.xz"
local_filedir="${tmpdir}"
local_filename="bfv_linded-v1.21-20041207_patch.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="e3b4962cdd9d41e23c6fed65101bccde"
elif [ "${shortname}" == "bb" ]; then
remote_fileurl="http://linuxgsm.download/BrainBread/brainbread-v1.2-linuxserver.tar.xz"; local_filedir="${tmpdir}"; local_filename="brainbread-v1.2-linuxserver.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="55f227183b736397806d5b6db6143f15"
remote_fileurl="http://linuxgsm.download/BrainBread/brainbread-v1.2-linuxserver.tar.xz"
local_filedir="${tmpdir}"
local_filename="brainbread-v1.2-linuxserver.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="55f227183b736397806d5b6db6143f15"
elif [ "${shortname}" == "cod" ]; then
remote_fileurl="http://linuxgsm.download/CallOfDuty/cod-lnxded-1.5b-full.tar.xz"; local_filedir="${tmpdir}"; local_filename="cod-lnxded-1.5-large.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="ee0ad1ccbfa1fd27fde01a4a431a5c2f"
remote_fileurl="http://linuxgsm.download/CallOfDuty/cod-lnxded-1.5b-full.tar.xz"
local_filedir="${tmpdir}"
local_filename="cod-lnxded-1.5-large.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="ee0ad1ccbfa1fd27fde01a4a431a5c2f"
elif [ "${shortname}" == "coduo" ]; then
remote_fileurl="http://linuxgsm.download/CallOfDutyUnitedOffensive/coduo-lnxded-1.51b-full.tar.xz"; local_filedir="${tmpdir}"; local_filename="coduo-lnxded-1.51b-full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="35cabccd67adcda44aaebc59405915b9"
remote_fileurl="http://linuxgsm.download/CallOfDutyUnitedOffensive/coduo-lnxded-1.51b-full.tar.xz"
local_filedir="${tmpdir}"
local_filename="coduo-lnxded-1.51b-full.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="35cabccd67adcda44aaebc59405915b9"
elif [ "${shortname}" == "cod2" ]; then
remote_fileurl="http://linuxgsm.download/CallOfDuty2/cod2-lnxded-1.3-full.tar.xz"; local_filedir="${tmpdir}"; local_filename="cod2-lnxded-1.3-full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="b8c4c611f01627dd43348e78478a3d41"
remote_fileurl="http://linuxgsm.download/CallOfDuty2/cod2-lnxded-1.3-full.tar.xz"
local_filedir="${tmpdir}"
local_filename="cod2-lnxded-1.3-full.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="b8c4c611f01627dd43348e78478a3d41"
elif [ "${shortname}" == "cod4" ]; then
remote_fileurl="http://linuxgsm.download/CallOfDuty4/cod4x18_1790_lnxded.tar.xz"; local_filedir="${tmpdir}"; local_filename="cod4x18_1790_lnxded.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="30609db2afde09d22498fbab3a427d11"
remote_fileurl="http://linuxgsm.download/CallOfDuty4/cod4x18_1790_lnxded.tar.xz"
local_filedir="${tmpdir}"
local_filename="cod4x18_1790_lnxded.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="30609db2afde09d22498fbab3a427d11"
elif [ "${shortname}" == "codwaw" ]; then
remote_fileurl="http://linuxgsm.download/CallOfDutyWorldAtWar/codwaw-lnxded-1.7-full.tar.xz"; local_filedir="${tmpdir}"; local_filename="codwaw-lnxded-1.7-full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2c6be1bb66ea631b9b2e7ae6216c6680"
remote_fileurl="http://linuxgsm.download/CallOfDutyWorldAtWar/codwaw-lnxded-1.7-full.tar.xz"
local_filedir="${tmpdir}"
local_filename="codwaw-lnxded-1.7-full.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="2c6be1bb66ea631b9b2e7ae6216c6680"
elif [ "${shortname}" == "etl" ]; then
remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/etlegacy-v2.78.1-i386-et-260b.tar.xz"; local_filedir="${tmpdir}"; local_filename="etlegacy-v2.78.1-i386-et-260b.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="7c08b52cb09b30eadb98ea05ef780fc7"
remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/etlegacy-v2.78.1-i386-et-260b.tar.xz"
local_filedir="${tmpdir}"
local_filename="etlegacy-v2.78.1-i386-et-260b.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="7c08b52cb09b30eadb98ea05ef780fc7"
elif [ "${shortname}" == "mohaa" ]; then
remote_fileurl="http://linuxgsm.download/MedalofHonorAlliedAssault/moh_revival_v1.12_RC3.5.1.tar.xz"; local_filedir="${tmpdir}"; local_filename="moh_revival_v1.12_RC3.5.1.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="7c664538999252eeaf2b6d9949416480"
remote_fileurl="http://linuxgsm.download/MedalofHonorAlliedAssault/moh_revival_v1.12_RC3.5.1.tar.xz"
local_filedir="${tmpdir}"
local_filename="moh_revival_v1.12_RC3.5.1.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="7c664538999252eeaf2b6d9949416480"
elif [ "${shortname}" == "ns" ]; then
remote_fileurl="http://linuxgsm.download/NaturalSelection/ns_dedicated_server_v32.tar.xz"; local_filedir="${tmpdir}"; local_filename="ns_dedicated_server_v32.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="23ec3cadd93d8bb1c475bad5b9cce370"
remote_fileurl="http://linuxgsm.download/NaturalSelection/ns_dedicated_server_v32.tar.xz"
local_filedir="${tmpdir}"
local_filename="ns_dedicated_server_v32.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="23ec3cadd93d8bb1c475bad5b9cce370"
elif [ "${shortname}" == "q2" ]; then
remote_fileurl="http://linuxgsm.download/Quake2/quake2-3.20-glibc-i386-full-linux2.0.tar.xz"; local_filedir="${tmpdir}"; local_filename="quake2-3.20-glibc-i386-full-linux2.0.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2908164a32d4808bb720f2161f6b0c82"
remote_fileurl="http://linuxgsm.download/Quake2/quake2-3.20-glibc-i386-full-linux2.0.tar.xz"
local_filedir="${tmpdir}"
local_filename="quake2-3.20-glibc-i386-full-linux2.0.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="2908164a32d4808bb720f2161f6b0c82"
elif [ "${shortname}" == "q3" ]; then
remote_fileurl="http://linuxgsm.download/Quake3/quake3-1.32c-x86-full-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="quake3-1.32c-x86-full-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="b0e26d8919fe9313fb9d8ded2360f3db"
remote_fileurl="http://linuxgsm.download/Quake3/quake3-1.32c-x86-full-linux.tar.xz"
local_filedir="${tmpdir}"
local_filename="quake3-1.32c-x86-full-linux.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="b0e26d8919fe9313fb9d8ded2360f3db"
elif [ "${shortname}" == "qw" ]; then
remote_fileurl="http://linuxgsm.download/QuakeWorld/nquake.server.linux.190506.full.tar.xz"; local_filedir="${tmpdir}"; local_filename="nquake.server.linux.190506.full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="82055b7d973206c13a606db8ba288d03"
remote_fileurl="http://linuxgsm.download/QuakeWorld/nquake.server.linux.190506.full.tar.xz"
local_filedir="${tmpdir}"
local_filename="nquake.server.linux.190506.full.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="82055b7d973206c13a606db8ba288d03"
elif [ "${shortname}" == "rtcw" ]; then
remote_fileurl="http://linuxgsm.download/ReturnToCastleWolfenstein/iortcw-1.51c-x86_64-server-linux-20190507.tar.xz"; local_filedir="${tmpdir}"; local_filename="iortcw-1.51c-x86_64-server-linux-20190507.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="df6ff664d37dd0d22787848bdb3cac5f"
remote_fileurl="http://linuxgsm.download/ReturnToCastleWolfenstein/iortcw-1.51c-x86_64-server-linux-20190507.tar.xz"
local_filedir="${tmpdir}"
local_filename="iortcw-1.51c-x86_64-server-linux-20190507.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="df6ff664d37dd0d22787848bdb3cac5f"
elif [ "${shortname}" == "sfc" ]; then
remote_fileurl="http://linuxgsm.download/SourceFortsClassic/SFClassic-1.0-RC7-fix.tar.xz"; local_filedir="${tmpdir}"; local_filename="SFClassic-1.0-RC7-fix.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="70077137185700e28fe6bbb6021d12bc"
remote_fileurl="http://linuxgsm.download/SourceFortsClassic/SFClassic-1.0-RC7-fix.tar.xz"
local_filedir="${tmpdir}"
local_filename="SFClassic-1.0-RC7-fix.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="70077137185700e28fe6bbb6021d12bc"
elif [ "${shortname}" == "sof2" ]; then
remote_fileurl="http://linuxgsm.download/SoldierOfFortune2/sof2gold-1.03.tar.xz"; local_filedir="${tmpdir}"; local_filename="sof2gold-1.03.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="201e23bab04207d00ce813d001c483d9"
remote_fileurl="http://linuxgsm.download/SoldierOfFortune2/sof2gold-1.03.tar.xz"
local_filedir="${tmpdir}"
local_filename="sof2gold-1.03.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="201e23bab04207d00ce813d001c483d9"
elif [ "${shortname}" == "ts" ]; then
remote_fileurl="http://linuxgsm.download/TheSpecialists/ts-3-linux-final.tar.xz"; local_filedir="${tmpdir}"; local_filename="ts-3-linux-final.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="3c66ecff6e3644f7ac88015732a0fb93"
remote_fileurl="http://linuxgsm.download/TheSpecialists/ts-3-linux-final.tar.xz"
local_filedir="${tmpdir}"
local_filename="ts-3-linux-final.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="3c66ecff6e3644f7ac88015732a0fb93"
elif [ "${shortname}" == "ut2k4" ]; then
remote_fileurl="http://linuxgsm.download/UnrealTournament2004/ut2004-server-3369-3-ultimate-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="ut2004-server-3369-3-ultimate-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="9fceaab68554749f4b45be66613b9a15"
remote_fileurl="http://linuxgsm.download/UnrealTournament2004/ut2004-server-3369-3-ultimate-linux.tar.xz"
local_filedir="${tmpdir}"
local_filename="ut2004-server-3369-3-ultimate-linux.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="9fceaab68554749f4b45be66613b9a15"
elif [ "${shortname}" == "ut99" ]; then
remote_fileurl="http://linuxgsm.download/UnrealTournament99/ut99-server-469b-ultimate-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="ut99-server-469b-ultimate-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="dba3f1122a5e60ee45ece7422fcf78f5"
remote_fileurl="http://linuxgsm.download/UnrealTournament99/ut99-server-469b-ultimate-linux.tar.xz"
local_filedir="${tmpdir}"
local_filename="ut99-server-469b-ultimate-linux.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="dba3f1122a5e60ee45ece7422fcf78f5"
elif [ "${shortname}" == "ut" ]; then
remote_fileurl="http://linuxgsm.download/UnrealTournament/UnrealTournament-Server-XAN-3525360-Linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="UnrealTournament-Server-XAN-3525360-Linux.tar.xz"; chmodx="noexecute" run="norun"; force="noforce"; md5="41dd92015713a78211eaccf503b72393"
remote_fileurl="http://linuxgsm.download/UnrealTournament/UnrealTournament-Server-XAN-3525360-Linux.tar.xz"
local_filedir="${tmpdir}"
local_filename="UnrealTournament-Server-XAN-3525360-Linux.tar.xz"
chmodx="noexecute" run="norun"
force="noforce"
md5="41dd92015713a78211eaccf503b72393"
elif [ "${shortname}" == "ut3" ]; then
remote_fileurl="http://linuxgsm.download/UnrealTournament3/UT3-linux-server-2.1.tar.xz"; local_filedir="${tmpdir}"; local_filename="UT3-linux-server-2.1.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="8876cca61e3f83ea08db25208bde6ac6"
remote_fileurl="http://linuxgsm.download/UnrealTournament3/UT3-linux-server-2.1.tar.xz"
local_filedir="${tmpdir}"
local_filename="UT3-linux-server-2.1.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="8876cca61e3f83ea08db25208bde6ac6"
elif [ "${shortname}" == "vs" ]; then
remote_fileurl="http://linuxgsm.download/VampireSlayer/vs_l-6.0_full.tar.xz"; local_filedir="${tmpdir}"; local_filename="vs_l-6.0_full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="b322f79e0abd31847493c52acf802667"
remote_fileurl="http://linuxgsm.download/VampireSlayer/vs_l-6.0_full.tar.xz"
local_filedir="${tmpdir}"
local_filename="vs_l-6.0_full.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="b322f79e0abd31847493c52acf802667"
elif [ "${shortname}" == "wet" ]; then
remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/enemy-territory.260b.tar.xz"; local_filedir="${tmpdir}"; local_filename="enemy-territory.260b.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="581a333cc7eacda2f56d5a00fe11eafa"
remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/enemy-territory.260b.tar.xz"
local_filedir="${tmpdir}"
local_filename="enemy-territory.260b.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="581a333cc7eacda2f56d5a00fe11eafa"
elif [ "${shortname}" == "samp" ]; then
remote_fileurl="https://files.sa-mp.com/samp037svr_R2-1.tar.gz"; local_filedir="${tmpdir}"; local_filename="samp037svr_R2-1.tar.gz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="93705e165550c97484678236749198a4"
remote_fileurl="https://files.sa-mp.com/samp037svr_R2-1.tar.gz"
local_filedir="${tmpdir}"
local_filename="samp037svr_R2-1.tar.gz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="93705e165550c97484678236749198a4"
elif [ "${shortname}" == "zmr" ]; then
remote_fileurl="http://linuxgsm.download/ZombieMasterReborn/zombie_master_reborn_b5_2.tar.xz"; local_filedir="${tmpdir}"; local_filename="zombie_master_reborn_b5_2.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="4b9b9832e863d03981a40c26065792a6"
remote_fileurl="http://linuxgsm.download/ZombieMasterReborn/zombie_master_reborn_b5_2.tar.xz"
local_filedir="${tmpdir}"
local_filename="zombie_master_reborn_b5_2.tar.xz"
chmodx="nochmodx" run="norun"
force="noforce"
md5="4b9b9832e863d03981a40c26065792a6"
fi
fn_fetch_file "${remote_fileurl}" "" "" "" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}"
@ -100,7 +235,7 @@ elif [ "${shortname}" == "jk2" ]; then
update_jediknight2.sh
elif [ "${shortname}" == "vints" ]; then
update_vintagestory.sh
elif [ -z "${appid}" ]||[ "${shortname}" == "ahl" ]||[ "${shortname}" == "bd" ]||[ "${shortname}" == "bb" ]||[ "${shortname}" == "ns" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "ts" ]||[ "${shortname}" == "vs" ]||[ "${shortname}" == "zmr" ]; then
elif [ -z "${appid}" ] || [ "${shortname}" == "ahl" ] || [ "${shortname}" == "bd" ] || [ "${shortname}" == "bb" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "sfc" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "vs" ] || [ "${shortname}" == "zmr" ]; then
if [ "${shortname}" == "ut" ]; then
install_eula.sh
fi

18
lgsm/functions/install_ts3db.sh

@ -7,7 +7,7 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_install_ts3db_mariadb(){
fn_install_ts3db_mariadb() {
if [ ! -f "${serverfiles}/libts3db_mariadb.so" ]; then
echo -e "copying libmariadb.so.2...\c"
cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}"
@ -34,13 +34,13 @@ fn_install_ts3db_mariadb(){
read -rp "Enter MariaDB socket path: " mariadbsocket
{
echo -e "[config]"
echo -e "host='${mariahostname}'"
echo -e "port='${mariaport}'"
echo -e "username='${mariausername}'"
echo -e "password='${mariapassword}'"
echo -e "database='${mariadbname}'"
echo -e "socket='${mariadbsocket}'"
echo -e "[config]"
echo -e "host='${mariahostname}'"
echo -e "port='${mariaport}'"
echo -e "username='${mariausername}'"
echo -e "password='${mariapassword}'"
echo -e "database='${mariadbname}'"
echo -e "socket='${mariadbsocket}'"
} >> "${servercfgdir}/ts3db_mariadb.ini"
sed -i "s/dbplugin=ts3db_sqlite3/dbplugin=ts3db_mariadb/g" "${servercfgfullpath}"
sed -i "s/dbpluginparameter=/dbpluginparameter=ts3db_mariadb.ini/g" "${servercfgfullpath}"
@ -58,7 +58,7 @@ if [ -z "${autoinstall}" ]; then
fn_install_ts3db_mariadb
fi
else
fn_print_information_nl "./${selfname} auto-install is uses sqlite. For MariaDB use ./${selfname} install"
fn_print_information_nl "./${selfname} auto-install is uses sqlite. For MariaDB use ./${selfname} install"
fi
install_eula.sh

142
lgsm/functions/mods_core.sh

@ -17,7 +17,7 @@ modsinstalledlistfullpath="${modsdir}/${modsinstalledlist}"
## Installation.
# Download management.
fn_mod_install_files(){
fn_mod_install_files() {
fn_fetch_file "${modurl}" "" "" "" "${modstmpdir}" "${modfilename}"
# Check if variable is valid checking if file has been downloaded and exists.
if [ ! -f "${modstmpdir}/${modfilename}" ]; then
@ -32,7 +32,7 @@ fn_mod_install_files(){
}
# Convert mod files to lowercase if needed.
fn_mod_lowercase(){
fn_mod_lowercase() {
# Checking lowercase settings from mods array definition
if [ "${modlowercase}" == "LowercaseOn" ]; then
echo -en "converting ${modprettyname} files to lowercase..."
@ -63,13 +63,13 @@ fn_mod_lowercase(){
core_exit.sh
fi
fi
done < <(find "${extractdir}" -depth -name '*[[:upper:]]*')
fn_print_ok_eol_nl
fi
done < <(find "${extractdir}" -depth -name '*[[:upper:]]*')
fn_print_ok_eol_nl
fi
}
# Create ${modcommand}-files.txt containing the full extracted file/directory list.
fn_mod_create_filelist(){
fn_mod_create_filelist() {
echo -en "building ${modcommand}-files.txt..."
fn_sleep_time
# ${modsdir}/${modcommand}-files.txt.
@ -90,7 +90,7 @@ fn_mod_create_filelist(){
}
# Copy the mod into serverfiles.
fn_mod_copy_destination(){
fn_mod_copy_destination() {
echo -en "copying ${modprettyname} to ${modinstalldir}..."
fn_sleep_time
cp -Rf "${extractdir}/." "${modinstalldir}/"
@ -105,7 +105,7 @@ fn_mod_copy_destination(){
}
# Add the mod to the installed-mods.txt.
fn_mod_add_list(){
fn_mod_add_list() {
if [ -z "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
echo -e "${modcommand}" >> "${modsinstalledlistfullpath}"
fn_script_log_info "${modcommand} added to ${modsinstalledlist}"
@ -113,7 +113,7 @@ fn_mod_add_list(){
}
# Prevent sensitive directories from being erased upon uninstall by removing them from: ${modcommand}-files.txt.
fn_mod_tidy_files_list(){
fn_mod_tidy_files_list() {
# Check file list validity.
fn_check_mod_files_list
# Output to the user
@ -126,7 +126,7 @@ fn_mod_tidy_files_list(){
# generate elements to remove from list.
removefromlistamount=$(echo -e "${removefromlist}" | awk -F ';' '{ print NF }')
# Test all subvalue of "removefromlist" using the ";" separator.
for ((filesindex=1; filesindex < removefromlistamount; filesindex++)); do
for ((filesindex = 1; filesindex < removefromlistamount; filesindex++)); do
# Put current file into test variable.
removefilevar=$(echo -e "${removefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }')
# Delete line(s) matching exactly.
@ -193,15 +193,15 @@ fn_mod_tidy_files_list(){
## Information Gathering.
# Get details of a mod any (relevant and unique, such as full mod name or install command) value.
fn_mod_get_info(){
fn_mod_get_info() {
# Variable to know when job is done.
modinfocommand="0"
# Find entry in global array.
for ((index=0; index <= ${#mods_global_array[@]}; index++)); do
for ((index = 0; index <= ${#mods_global_array[@]}; index++)); do
# When entry is found.
if [ "${mods_global_array[index]}" == "${currentmod}" ]; then
# Go back to the previous "MOD" separator.
for ((index=index; index <= ${#mods_global_array[@]}; index--)); do
for ((index = index; index <= ${#mods_global_array[@]}; index--)); do
# When "MOD" is found.
if [ "${mods_global_array[index]}" == "MOD" ]; then
# Get info.
@ -226,31 +226,31 @@ fn_mod_get_info(){
}
# Define all variables for a mod at once when index is set to a separator.
fn_mods_define(){
if [ -z "$index" ]; then
fn_script_log_fatal "index variable not set. Please report an issue."
fn_print_error "index variable not set. Please report an issue."
echo -e "* https://github.com/GameServerManagers/LinuxGSM/issues"
core_exit.sh
fi
modcommand="${mods_global_array[index+1]}"
modprettyname="${mods_global_array[index+2]}"
modurl="${mods_global_array[index+3]}"
modfilename="${mods_global_array[index+4]}"
modsubdirs="${mods_global_array[index+5]}"
modlowercase="${mods_global_array[index+6]}"
modinstalldir="${mods_global_array[index+7]}"
modkeepfiles="${mods_global_array[index+8]}"
modengines="${mods_global_array[index+9]}"
modgames="${mods_global_array[index+10]}"
modexcludegames="${mods_global_array[index+11]}"
modsite="${mods_global_array[index+12]}"
moddescription="${mods_global_array[index+13]}"
fn_mods_define() {
if [ -z "$index" ]; then
fn_script_log_fatal "index variable not set. Please report an issue."
fn_print_error "index variable not set. Please report an issue."
echo -e "* https://github.com/GameServerManagers/LinuxGSM/issues"
core_exit.sh
fi
modcommand="${mods_global_array[index + 1]}"
modprettyname="${mods_global_array[index + 2]}"
modurl="${mods_global_array[index + 3]}"
modfilename="${mods_global_array[index + 4]}"
modsubdirs="${mods_global_array[index + 5]}"
modlowercase="${mods_global_array[index + 6]}"
modinstalldir="${mods_global_array[index + 7]}"
modkeepfiles="${mods_global_array[index + 8]}"
modengines="${mods_global_array[index + 9]}"
modgames="${mods_global_array[index + 10]}"
modexcludegames="${mods_global_array[index + 11]}"
modsite="${mods_global_array[index + 12]}"
moddescription="${mods_global_array[index + 13]}"
}
# Builds list of installed mods.
# using installed-mods.txt grabing mod info from mods_list.sh.
fn_mods_installed_list(){
fn_mods_installed_list() {
fn_mods_count_installed
# Set/reset variables.
installedmodsline="1"
@ -265,7 +265,7 @@ fn_mods_installed_list(){
# Get mod info to make sure mod exists.
fn_mod_get_info
# Add the mod to available commands.
installedmodslist+=( "${modcommand}" )
installedmodslist+=("${modcommand}")
# Increment line check.
((installedmodsline++))
done
@ -275,13 +275,13 @@ fn_mods_installed_list(){
}
# Loops through mods_global_array to define available mods & provide available commands for mods installation.
fn_mods_available(){
fn_mods_available() {
# First, reset variables.
compatiblemodslist=()
availablemodscommands=()
# Find compatible games.
# Find separators through the global array.
for ((index="0"; index <= ${#mods_global_array[@]}; index++)); do
for ((index = "0"; index <= ${#mods_global_array[@]}; index++)); do
# If current value is a separator; then.
if [ "${mods_global_array[index]}" == "${modseparator}" ]; then
# Set mod variables.
@ -291,9 +291,9 @@ fn_mods_available(){
# If game is compatible.
if [ "${modcompatibility}" == "1" ]; then
# Put it into an array to prepare user output.
compatiblemodslist+=( "${modprettyname}" "${modcommand}" "${modsite}" "${moddescription}" )
compatiblemodslist+=("${modprettyname}" "${modcommand}" "${modsite}" "${moddescription}")
# Keep available commands in an array to make life easier.
availablemodscommands+=( "${modcommand}" )
availablemodscommands+=("${modcommand}")
fi
fi
done
@ -302,7 +302,7 @@ fn_mods_available(){
## Mod compatibility check.
# Find out if a game is compatible with a mod from a modgames (list of games supported by a mod) variable.
fn_compatible_mod_games(){
fn_compatible_mod_games() {
# Reset test value.
modcompatiblegame="0"
# If value is set to GAMES (ignore).
@ -310,9 +310,9 @@ fn_compatible_mod_games(){
# How many games we need to test.
gamesamount=$(echo -e "${modgames}" | awk -F ';' '{ print NF }')
# Test all subvalue of "modgames" using the ";" separator.
for ((gamevarindex=1; gamevarindex < gamesamount; gamevarindex++)); do
for ((gamevarindex = 1; gamevarindex < gamesamount; gamevarindex++)); do
# Put current game name into modtest variable.
gamemodtest=$( echo -e "${modgames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )
gamemodtest=$(echo -e "${modgames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }')
# If game name matches.
if [ "${gamemodtest}" == "${gamename}" ]; then
# Mod is compatible.
@ -323,7 +323,7 @@ fn_compatible_mod_games(){
}
# Find out if an engine is compatible with a mod from a modengines (list of engines supported by a mod) variable.
fn_compatible_mod_engines(){
fn_compatible_mod_engines() {
# Reset test value.
modcompatibleengine="0"
# If value is set to ENGINES (ignore).
@ -331,9 +331,9 @@ fn_compatible_mod_engines(){
# How many engines we need to test.
enginesamount=$(echo -e "${modengines}" | awk -F ';' '{ print NF }')
# Test all subvalue of "modengines" using the ";" separator.
for ((gamevarindex=1; gamevarindex < ${enginesamount}; gamevarindex++)); do
for ((gamevarindex = 1; gamevarindex < ${enginesamount}; gamevarindex++)); do
# Put current engine name into modtest variable.
enginemodtest=$( echo -e "${modengines}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )
enginemodtest=$(echo -e "${modengines}" | awk -F ';' -v x=${gamevarindex} '{ print $x }')
# If engine name matches.
if [ "${enginemodtest}" == "${engine}" ]; then
# Mod is compatible.
@ -344,7 +344,7 @@ fn_compatible_mod_engines(){
}
# Find out if a game is not compatible with a mod from a modnotgames (list of games not supported by a mod) variable.
fn_not_compatible_mod_games(){
fn_not_compatible_mod_games() {
# Reset test value.
modeincompatiblegame="0"
# If value is set to NOTGAMES (ignore).
@ -352,9 +352,9 @@ fn_not_compatible_mod_games(){
# How many engines we need to test.
excludegamesamount=$(echo -e "${modexcludegames}" | awk -F ';' '{ print NF }')
# Test all subvalue of "modexcludegames" using the ";" separator.
for ((gamevarindex=1; gamevarindex < excludegamesamount; gamevarindex++)); do
for ((gamevarindex = 1; gamevarindex < excludegamesamount; gamevarindex++)); do
# Put current engine name into modtest variable.
excludegamemodtest=$( echo -e "${modexcludegames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )
excludegamemodtest=$(echo -e "${modexcludegames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }')
# If engine name matches.
if [ "${excludegamemodtest}" == "${gamename}" ]; then
# Mod is compatible.
@ -365,14 +365,14 @@ fn_not_compatible_mod_games(){
}
# Sums up if a mod is compatible or not with modcompatibility=0/1.
fn_mod_compatible_test(){
fn_mod_compatible_test() {
# Test game and engine compatibility.
fn_compatible_mod_games
fn_compatible_mod_engines
fn_not_compatible_mod_games
if [ "${modeincompatiblegame}" == "1" ]; then
modcompatibility="0"
elif [ "${modcompatibleengine}" == "1" ]||[ "${modcompatiblegame}" == "1" ]; then
elif [ "${modcompatibleengine}" == "1" ] || [ "${modcompatiblegame}" == "1" ]; then
modcompatibility="1"
else
modcompatibility="0"
@ -382,7 +382,7 @@ fn_mod_compatible_test(){
## Directory management.
# Create mods files and directories if it doesn't exist.
fn_create_mods_dir(){
fn_create_mods_dir() {
# Create lgsm data modsdir.
if [ ! -d "${modsdir}" ]; then
echo -en "creating LinuxGSM mods data directory ${modsdir}..."
@ -420,7 +420,7 @@ fn_create_mods_dir(){
}
# Create tmp download mod directory.
fn_mods_create_tmp_dir(){
fn_mods_create_tmp_dir() {
if [ ! -d "${modstmpdir}" ]; then
mkdir -p "${modstmpdir}"
exitcode=$?
@ -437,7 +437,7 @@ fn_mods_create_tmp_dir(){
}
# Remove the tmp mod download directory when finished.
fn_mods_clear_tmp_dir(){
fn_mods_clear_tmp_dir() {
if [ -d "${modstmpdir}" ]; then
echo -en "clearing mod download directory ${modstmpdir}..."
rm -fr "${modstmpdir:?}"
@ -459,7 +459,7 @@ fn_mods_clear_tmp_dir(){
}
# Counts how many mods were installed.
fn_mods_count_installed(){
fn_mods_count_installed() {
if [ -f "${modsinstalledlistfullpath}" ]; then
installedmodscount=$(wc -l < "${modsinstalledlistfullpath}")
else
@ -468,7 +468,7 @@ fn_mods_count_installed(){
}
# Exits if no mods were installed.
fn_mods_check_installed(){
fn_mods_check_installed() {
# Count installed mods.
fn_mods_count_installed
# If no mods are found.
@ -482,10 +482,10 @@ fn_mods_check_installed(){
}
# Checks that mod files list exists and isn't empty.
fn_check_mod_files_list(){
fn_check_mod_files_list() {
# File list must exist and be valid before any operation on it.
if [ -f "${modsdir}/${modcommand}-files.txt" ]; then
# How many lines is the file list.
# How many lines is the file list.
modsfilelistsize=$(wc -l < "${modsdir}/${modcommand}-files.txt")
# If file list is empty.
if [ "${modsfilelistsize}" -eq 0 ]; then
@ -501,7 +501,7 @@ fn_check_mod_files_list(){
fi
}
fn_mod_exist(){
fn_mod_exist() {
modreq=$1
# requires one parameter, the mod
if [ -f "${modsdir}/${modreq}-files.txt" ]; then
@ -516,7 +516,7 @@ fn_mod_exist(){
fi
}
fn_mod_required_fail_exist(){
fn_mod_required_fail_exist() {
modreq=$1
# requires one parameter, the mod
fn_script_log_fatal "${modreq}-files.txt is empty: unable to find ${modreq} installed"
@ -525,7 +525,7 @@ fn_mod_required_fail_exist(){
core_exit.sh
}
fn_mod_liblist_gam_filenames(){
fn_mod_liblist_gam_filenames() {
# clear variables just in case
moddll=""
modso=""
@ -537,37 +537,37 @@ fn_mod_liblist_gam_filenames(){
moddll="mp.dll"
modso="cs.so"
moddylib="cs.dylib"
;;
;;
"Day of Defeat")
moddll="dod.dll"
modso="dod.so"
moddylib="dod.dylib"
;;
;;
"Team Fortress Classic")
moddll="tfc.dll"
modso="tfc.so"
moddylib="tfc.dylib"
;;
;;
"Natural Selection")
moddll="ns.dll"
modso="ns_i386.so"
moddylib=""
;;
;;
"The Specialists")
moddll="mp.dll"
modso="ts_i386.so"
moddylib=""
;;
;;
"Half-Life: Deathmatch")
moddll="hl.dll"
modso="hl.so"
moddylib="hl.dylib"
;;
;;
esac
}
# modifers for liblist.gam to add/remote metamod binaries
fn_mod_install_liblist_gam_file(){
fn_mod_install_liblist_gam_file() {
fn_mod_liblist_gam_filenames
@ -625,7 +625,7 @@ fn_mod_install_liblist_gam_file(){
fi
}
fn_mod_remove_liblist_gam_file(){
fn_mod_remove_liblist_gam_file() {
fn_mod_liblist_gam_filenames
@ -683,7 +683,7 @@ fn_mod_remove_liblist_gam_file(){
fi
}
fn_mod_install_amxmodx_file(){
fn_mod_install_amxmodx_file() {
# does plugins.ini exist?
if [ -f "${modinstalldir}/addons/metamod/plugins.ini" ]; then
# since it does exist, is the entry already in plugins.ini
@ -718,9 +718,9 @@ fn_mod_install_amxmodx_file(){
fi
}
fn_mod_remove_amxmodx_file(){
fn_mod_remove_amxmodx_file() {
if [ -f "${modinstalldir}/addons/metamod/plugins.ini" ]; then
# since it does exist, is the entry already in plugins.ini
# since it does exist, is the entry already in plugins.ini
logentry="line (linux addons/amxmodx/dlls/amxmodx_mm_i386.so) removed from ${modinstalldir}/addons/metamod/plugins.ini"
echo -en "removing amxmodx_mm_i386.so in plugins.ini..."
grep -q "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" "${modinstalldir}/addons/metamod/plugins.ini"

106
lgsm/functions/mods_list.sh

@ -92,7 +92,7 @@ movementapilatestlink="https://github.com/danzayau/MovementAPI/releases/download
# Oxide
oxiderustlatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/OxideMod/Oxide.Rust/releases/latest | jq -r '.assets[]|select(.browser_download_url | contains("linux")) | .browser_download_url')
oxidehurtworldlatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/OxideMod/Oxide.Hurtworld/releases/latest | jq -r '.assets[].browser_download_url')
oxidesdtdlatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/OxideMod/Oxide.SevenDaysToDie/releases/latest | jq -r '.assets[]|select(.browser_download_url | contains("linux")) | .browser_download_url' )
oxidesdtdlatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/OxideMod/Oxide.SevenDaysToDie/releases/latest | jq -r '.assets[]|select(.browser_download_url | contains("linux")) | .browser_download_url')
# Valheim Plus
valeimpluslatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/valheimPlus/ValheimPlus/releases/latest | jq -r '.assets[]|select(.browser_download_url | contains("UnixServer.tar.gz")) | .browser_download_url')
@ -122,77 +122,77 @@ modseparator="MOD"
# [13] | "Short Description" a description showed to the user upon installation/removal
# Half-life 1 Engine Mods
mod_info_metamod=( MOD "metamod" "Metamod" "${metamodurl}" "${metamodlatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/metamod/plugins.ini;" "ENGINES" "Counter-Strike 1.6;Day of Defeat;Team Fortress Classic;Natural Selection;The Specialists;Half-Life: Deathmatch;" "NOTGAMES" "https://github.com/alliedmodders/metamod-hl1" "Plugins Framework" )
mod_info_base_amxx=( MOD "amxmodx" "AMX Mod X: Base" "${amxxbaseurl}" "${amxxbaselatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Counter-Strike 1.6;Day of Defeat;Team Fortress Classic;Natural Selection;The Specialists;Half-Life: Deathmatch;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod)" )
mod_info_metamod=(MOD "metamod" "Metamod" "${metamodurl}" "${metamodlatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/metamod/plugins.ini;" "ENGINES" "Counter-Strike 1.6;Day of Defeat;Team Fortress Classic;Natural Selection;The Specialists;Half-Life: Deathmatch;" "NOTGAMES" "https://github.com/alliedmodders/metamod-hl1" "Plugins Framework")
mod_info_base_amxx=(MOD "amxmodx" "AMX Mod X: Base" "${amxxbaseurl}" "${amxxbaselatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Counter-Strike 1.6;Day of Defeat;Team Fortress Classic;Natural Selection;The Specialists;Half-Life: Deathmatch;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod)")
# CS 1.6 (HL1) Engine Mods
mod_info_cs_amxx=( MOD "amxmodxcs" "AMX Mod X: Counter-Strike" "${amxxcsurl}" "${amxxcslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Counter-Strike 1.6;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" )
mod_info_cs_amxx=(MOD "amxmodxcs" "AMX Mod X: Counter-Strike" "${amxxcsurl}" "${amxxcslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Counter-Strike 1.6;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)")
# DOD (HL1) Engine Mods
mod_info_dod_amxx=( MOD "amxmodxdod" "AMX Mod X: Day of Defeat" "${amxxdodurl}" "${amxxdodlatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Day of Defeat;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" )
mod_info_dod_amxx=(MOD "amxmodxdod" "AMX Mod X: Day of Defeat" "${amxxdodurl}" "${amxxdodlatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Day of Defeat;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)")
# TFC (HL1) Engine Mods
mod_info_tfc_amxx=( MOD "amxmodxtfc" "AMX Mod X: Team Fortress Classic" "${amxxtfcurl}" "${amxxtfclatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Team Fortress Classic;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" )
mod_info_tfc_amxx=(MOD "amxmodxtfc" "AMX Mod X: Team Fortress Classic" "${amxxtfcurl}" "${amxxtfclatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Team Fortress Classic;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)")
# NS (Natural Selection) (HL1) Engine Mods
mod_info_ns_amxx=( MOD "amxmodxns" "AMX Mod X: Natural Selection" "${amxxnsurl}" "${amxxnslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Natural Selection;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" )
mod_info_ns_amxx=(MOD "amxmodxns" "AMX Mod X: Natural Selection" "${amxxnsurl}" "${amxxnslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Natural Selection;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)")
# TS (The Specialists) (HL1) Engine Mods
mod_info_ts_amxx=( MOD "amxmodxts" "AMX Mod X: The Specialists" "${amxxtsurl}" "${amxxtslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "The Specialists;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" )
mod_info_ts_amxx=(MOD "amxmodxts" "AMX Mod X: The Specialists" "${amxxtsurl}" "${amxxtslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "The Specialists;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)")
# Source mods
mod_info_metamodsource=( MOD "metamodsource" "Metamod: Source" "${metamodsourceurl}" "${metamodsourcelatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/metamod/metaplugins.ini;" "source;" "GAMES" "NOTGAMES" "https://www.sourcemm.net" "Plugins Framework" )
mod_info_sourcemod=( MOD "sourcemod" "SourceMod" "${sourcemodurl}" "${sourcemodlatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "source;" "GAMES" "NOTGAMES" "http://www.sourcemod.net" "Admin Features (requires Metamod: Source)" )
mod_info_steamworks=( MOD "steamworks" "SteamWorks" "${steamworksurl}" "${steamworkslatestfile}" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/KyleSanderson/SteamWorks" "Exposing SteamWorks functions to SourcePawn" )
mod_info_stripper=( MOD "stripper" "Stripper Source" "http://www.bailopan.net/stripper/snapshots/1.2/stripper-1.2.2-git129-linux.tar.gz" "stripper-1.2.2-git129-linux.tar.gz" "0" "LowercaseOff" "${systemdir}" "addons/stripper/maps;" "ENGINES" "Counter-Strike: Global Offensive;Counter-Strike: Source;Day of Defeat: Source;Half Life: Deathmatch;Half Life 2: Deathmatch;Insurgency;Left 4 Dead;Left 4 Dead 2;Nuclear Dawn;Team Fortress 2;" "NOTGAMES" "http://www.bailopan.net/stripper/" "Add or remove objects from map (requires MetaMod)")
mod_info_metamodsource=(MOD "metamodsource" "Metamod: Source" "${metamodsourceurl}" "${metamodsourcelatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/metamod/metaplugins.ini;" "source;" "GAMES" "NOTGAMES" "https://www.sourcemm.net" "Plugins Framework")
mod_info_sourcemod=(MOD "sourcemod" "SourceMod" "${sourcemodurl}" "${sourcemodlatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "source;" "GAMES" "NOTGAMES" "http://www.sourcemod.net" "Admin Features (requires Metamod: Source)")
mod_info_steamworks=(MOD "steamworks" "SteamWorks" "${steamworksurl}" "${steamworkslatestfile}" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/KyleSanderson/SteamWorks" "Exposing SteamWorks functions to SourcePawn")
mod_info_stripper=(MOD "stripper" "Stripper Source" "http://www.bailopan.net/stripper/snapshots/1.2/stripper-1.2.2-git129-linux.tar.gz" "stripper-1.2.2-git129-linux.tar.gz" "0" "LowercaseOff" "${systemdir}" "addons/stripper/maps;" "ENGINES" "Counter-Strike: Global Offensive;Counter-Strike: Source;Day of Defeat: Source;Half Life: Deathmatch;Half Life 2: Deathmatch;Insurgency;Left 4 Dead;Left 4 Dead 2;Nuclear Dawn;Team Fortress 2;" "NOTGAMES" "http://www.bailopan.net/stripper/" "Add or remove objects from map (requires MetaMod)")
# CS:GO Mods
mod_info_gokz=( MOD "gokz" "GOKZ" "${gokzlatestlink}" "${gokzlatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/KZGlobalTeam/gokz" "GOKZ ${gokzlatestversion} - Implements the KZ game mode (requires SourceMod and MetaMod)" )
mod_info_ttt=( MOD "ttt" "Trouble in Terrorist Town" "https://csgottt.com/downloads/ttt-latest-dev-${sourcemodversion}.zip" "ttt-latest.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/Bara/TroubleinTerroristTown" "Implements the TTT game mode (requires SourceMod and MetaMod)" )
mod_info_get5=( MOD "get5" "Get 5" "${get5url}" "${get5latestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/get5" "Plugin for competitive matches/scrims (requires SourceMod and MetaMod)" )
mod_info_prac=( MOD "prac" "csgo practice mode" "${csgopracticelatestlink}" "${csgopracticelatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/csgo-practice-mode" "Practice Mode is a sourcemod plugin for helping players/teams run practices." )
mod_info_pug=( MOD "pug" "PUG" "${csgopuglatestlink}" "${csgopuglatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/csgo-pug-setup" "plugin for setting up private pug/10man games" )
mod_info_dhook=( MOD "dhook" "dhook" "https://forums.alliedmods.net/attachment.php?attachmentid=190123&d=1625050030" "dhooks-2.2.0d17.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://forums.alliedmods.net/showpost.php?p=2588686&postcount=589" "DHooks 2.2.0 - Required for GOKZ" )
mod_info_movement=( MOD "movementapi" "movementapi" "${movementapilatestlink}" "${movementapilatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/danzayau/MovementAPI" "Movement API ${movementapilatestversion} - Required for GOKZ" )
mod_info_cleaner=( MOD "cleaner" "cleaner" "https://github.com/e54385991/console-cleaner/archive/refs/heads/master.zip" "console-cleaner.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/e54385991/console-cleaner" "Console Cleaner - Optional for GOKZ" )
mod_info_gokz=(MOD "gokz" "GOKZ" "${gokzlatestlink}" "${gokzlatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/KZGlobalTeam/gokz" "GOKZ ${gokzlatestversion} - Implements the KZ game mode (requires SourceMod and MetaMod)")
mod_info_ttt=(MOD "ttt" "Trouble in Terrorist Town" "https://csgottt.com/downloads/ttt-latest-dev-${sourcemodversion}.zip" "ttt-latest.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/Bara/TroubleinTerroristTown" "Implements the TTT game mode (requires SourceMod and MetaMod)")
mod_info_get5=(MOD "get5" "Get 5" "${get5url}" "${get5latestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/get5" "Plugin for competitive matches/scrims (requires SourceMod and MetaMod)")
mod_info_prac=(MOD "prac" "csgo practice mode" "${csgopracticelatestlink}" "${csgopracticelatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/csgo-practice-mode" "Practice Mode is a sourcemod plugin for helping players/teams run practices.")
mod_info_pug=(MOD "pug" "PUG" "${csgopuglatestlink}" "${csgopuglatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/csgo-pug-setup" "plugin for setting up private pug/10man games")
mod_info_dhook=(MOD "dhook" "dhook" "https://forums.alliedmods.net/attachment.php?attachmentid=190123&d=1625050030" "dhooks-2.2.0d17.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://forums.alliedmods.net/showpost.php?p=2588686&postcount=589" "DHooks 2.2.0 - Required for GOKZ")
mod_info_movement=(MOD "movementapi" "movementapi" "${movementapilatestlink}" "${movementapilatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/danzayau/MovementAPI" "Movement API ${movementapilatestversion} - Required for GOKZ")
mod_info_cleaner=(MOD "cleaner" "cleaner" "https://github.com/e54385991/console-cleaner/archive/refs/heads/master.zip" "console-cleaner.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/e54385991/console-cleaner" "Console Cleaner - Optional for GOKZ")
# Garry's Mod Addons
mod_info_ulib=( MOD "ulib" "ULib" "https://codeload.github.com/TeamUlysses/ulib/zip/master" "ulib-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Complete Framework" )
mod_info_ulx=( MOD "ulx" "ULX" "https://codeload.github.com/TeamUlysses/ulx/zip/master" "ulx-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Admin Panel (requires ULib)" )
mod_info_utime=( MOD "utime" "UTime" "https://github.com/TeamUlysses/utime/archive/master.zip" "utime-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Keep track of players play time" )
mod_info_uclip=( MOD "uclip" "UClip" "https://github.com/TeamUlysses/uclip/archive/master.zip" "uclip-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "An alternative to noclip" )
mod_info_acf=( MOD "acf" "Armoured Combat Framework" "https://github.com/nrlulz/ACF/archive/master.zip" "acf-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "acf-master/lua/acf/shared/guns;" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/nrlulz/ACF" "Realistic Wepons & Engines" )
mod_info_acf_missiles=( MOD "acfmissiles" "ACF Missiles" "https://github.com/Bubbus/ACF-Missiles/archive/master.zip" "acf-missiles-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Bubbus/ACF-Missiles" "More missiles for ACF" )
mod_info_advdupe2=( MOD "advdupe2" "Advanced Duplicator 2" "https://github.com/wiremod/advdupe2/archive/master.zip" "advdupe2-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://www.wiremod.com" "Save your constructions. Second version" )
mod_info_pac3=( MOD "pac3" "PAC3" "https://github.com/CapsAdmin/pac3/archive/master.zip" "pac3-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/CapsAdmin/pac3" "Advanced player model customization" )
mod_info_wiremod=( MOD "wiremod" "Wiremod" "https://github.com/wiremod/wire/archive/master.zip" "wire-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/wire" "Base Wiremod Addon")
mod_info_wiremodextras=( MOD "wiremod-extras" "Wiremod Extras" "https://github.com/wiremod/wire-extras/archive/master.zip" "wire-extras-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/wire-extras/" "Addition to Wiremod, Extra Content")
mod_info_advduplicator=( MOD "advdupe1" "Advanced Duplicator 1" "https://github.com/wiremod/advduplicator/archive/master.zip" "advduplicator-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/advduplicator" "Save your constructions. First version" )
mod_info_trackassemblytool=( MOD "trackassemblytool" "Track Assembly Tool" "https://github.com/dvdvideo1234/trackassemblytool/archive/master.zip" "trackassemblytool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/TrackAssemblyTool" "Assembles segmented track. Supports wire" )
mod_info_physpropertiesadv=( MOD "physpropertiesadv" "Phys Properties Adv" "https://github.com/dvdvideo1234/physpropertiesadv/archive/master.zip" "physpropertiesadv-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/PhysPropertiesAdv" "Advanced configurable properties" )
mod_info_controlsystemse2=( MOD "controlsystemse2" "Control Systems E2" "https://github.com/dvdvideo1234/controlsystemse2/archive/master.zip" "controlsystemse2-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/ControlSystemsE2" "PID controllers and fast traces for E2. Minor included in wire-extas" )
mod_info_e2pistontiming=( MOD "e2pistontiming" "E2 Piston Timing" "https://github.com/dvdvideo1234/e2pistontiming/archive/master.zip" "e2pistontiming-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/E2PistonTiming" "Routine driven piston engine timings for E2" )
mod_info_propcannontool=( MOD "propcannontool" "Prop Cannon Tool" "https://github.com/dvdvideo1234/propcannontool/archive/master.zip" "propcannontool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/PropCannonTool" "Cannon entity that can fire props. Supports wire" )
mod_info_gearassemblytool=( MOD "gearassemblytool" "Gear Assembly Tool" "https://github.com/dvdvideo1234/gearassemblytool/archive/master.zip" "gearassemblytool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/GearAssemblyTool" "Assembles segmented gearbox" )
mod_info_spinnertool=( MOD "spinnertool" "Spinner Tool" "https://github.com/dvdvideo1234/spinnertool/archive/master.zip" "spinnertool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/SpinnerTool" "Torque lever controlled spinner. Supports wire" )
mod_info_surfacefrictiontool=( MOD "surfacefrictiontool" "Surface Friction Tool" "https://github.com/dvdvideo1234/surfacefrictiontool/archive/master.zip" "surfacefrictiontool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/SurfaceFrictionTool" "Controls the surface friction of a prop" )
mod_info_magneticdipole=( MOD "magneticdipole" "Magnetic Dipole" "https://github.com/dvdvideo1234/magneticdipole/archive/master.zip" "magneticdipole-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/MagneticDipole" "Magnet entity that runs forces on its poles. Supports wire" )
mod_info_environmentorganizer=( MOD "environmentorganizer" "Environment Organizer" "https://github.com/dvdvideo1234/environmentorganizer/archive/master.zip" "environmentorganizer-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/EnvironmentOrganizer" "Installs routines designed for server settings adjustment" )
mod_info_precision_alignment=( MOD "precision-alignment" "Precision Alignment" "https://github.com/Mista-Tea/precision-alignment/archive/master.zip" "precision-alignment-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/precision-alignment" "Creates precise constraints and aligments" )
mod_info_improved_stacker=( MOD "improved-stacker" "Improved Stacker" "https://github.com/Mista-Tea/improved-stacker/archive/master.zip" "improved-stacker-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-stacker" "Stacks entities in the direction chosen" )
mod_info_improved_weight=( MOD "improved-weight" "Improved Weight" "https://github.com/Mista-Tea/improved-weight/archive/master.zip" "improved-weight-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-weight" "Weight tool but with more features" )
mod_info_improved_antinoclip=( MOD "improved-antinoclip" "Improved Antinoclip" "https://github.com/Mista-Tea/improved-antinoclip/archive/master.zip" "improved-antinoclip-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-antinoclip" "Controls clipping trough an object" )
mod_info_darkrp=( MOD "darkrp" "DarkRP" "https://github.com/FPtje/DarkRP/archive/master.zip" "darkrp-master.zip" "0" "LowercaseOn" "${systemdir}/gamemodes" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Most popular gamemode" )
mod_info_darkrpmodification=( MOD "darkrpmodification" "DarkRP Modification" "https://github.com/FPtje/darkrpmodification/archive/master.zip" "darkrpmodification-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "NOUPDATE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Customize DarkRP settings" )
mod_info_laserstool=( MOD "laserstool" "Laser STool" "https://github.com/dvdvideo1234/laserstool/archive/main.zip" "laserstool-main.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/LaserSTool" "Scripted tool that spawns laser entities, simulates light rays and even kill players" )
mod_info_ulib=(MOD "ulib" "ULib" "https://codeload.github.com/TeamUlysses/ulib/zip/master" "ulib-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Complete Framework")
mod_info_ulx=(MOD "ulx" "ULX" "https://codeload.github.com/TeamUlysses/ulx/zip/master" "ulx-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Admin Panel (requires ULib)")
mod_info_utime=(MOD "utime" "UTime" "https://github.com/TeamUlysses/utime/archive/master.zip" "utime-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Keep track of players play time")
mod_info_uclip=(MOD "uclip" "UClip" "https://github.com/TeamUlysses/uclip/archive/master.zip" "uclip-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "An alternative to noclip")
mod_info_acf=(MOD "acf" "Armoured Combat Framework" "https://github.com/nrlulz/ACF/archive/master.zip" "acf-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "acf-master/lua/acf/shared/guns;" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/nrlulz/ACF" "Realistic Wepons & Engines")
mod_info_acf_missiles=(MOD "acfmissiles" "ACF Missiles" "https://github.com/Bubbus/ACF-Missiles/archive/master.zip" "acf-missiles-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Bubbus/ACF-Missiles" "More missiles for ACF")
mod_info_advdupe2=(MOD "advdupe2" "Advanced Duplicator 2" "https://github.com/wiremod/advdupe2/archive/master.zip" "advdupe2-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://www.wiremod.com" "Save your constructions. Second version")
mod_info_pac3=(MOD "pac3" "PAC3" "https://github.com/CapsAdmin/pac3/archive/master.zip" "pac3-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/CapsAdmin/pac3" "Advanced player model customization")
mod_info_wiremod=(MOD "wiremod" "Wiremod" "https://github.com/wiremod/wire/archive/master.zip" "wire-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/wire" "Base Wiremod Addon")
mod_info_wiremodextras=(MOD "wiremod-extras" "Wiremod Extras" "https://github.com/wiremod/wire-extras/archive/master.zip" "wire-extras-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/wire-extras/" "Addition to Wiremod, Extra Content")
mod_info_advduplicator=(MOD "advdupe1" "Advanced Duplicator 1" "https://github.com/wiremod/advduplicator/archive/master.zip" "advduplicator-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/advduplicator" "Save your constructions. First version")
mod_info_trackassemblytool=(MOD "trackassemblytool" "Track Assembly Tool" "https://github.com/dvdvideo1234/trackassemblytool/archive/master.zip" "trackassemblytool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/TrackAssemblyTool" "Assembles segmented track. Supports wire")
mod_info_physpropertiesadv=(MOD "physpropertiesadv" "Phys Properties Adv" "https://github.com/dvdvideo1234/physpropertiesadv/archive/master.zip" "physpropertiesadv-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/PhysPropertiesAdv" "Advanced configurable properties")
mod_info_controlsystemse2=(MOD "controlsystemse2" "Control Systems E2" "https://github.com/dvdvideo1234/controlsystemse2/archive/master.zip" "controlsystemse2-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/ControlSystemsE2" "PID controllers and fast traces for E2. Minor included in wire-extas")
mod_info_e2pistontiming=(MOD "e2pistontiming" "E2 Piston Timing" "https://github.com/dvdvideo1234/e2pistontiming/archive/master.zip" "e2pistontiming-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/E2PistonTiming" "Routine driven piston engine timings for E2")
mod_info_propcannontool=(MOD "propcannontool" "Prop Cannon Tool" "https://github.com/dvdvideo1234/propcannontool/archive/master.zip" "propcannontool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/PropCannonTool" "Cannon entity that can fire props. Supports wire")
mod_info_gearassemblytool=(MOD "gearassemblytool" "Gear Assembly Tool" "https://github.com/dvdvideo1234/gearassemblytool/archive/master.zip" "gearassemblytool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/GearAssemblyTool" "Assembles segmented gearbox")
mod_info_spinnertool=(MOD "spinnertool" "Spinner Tool" "https://github.com/dvdvideo1234/spinnertool/archive/master.zip" "spinnertool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/SpinnerTool" "Torque lever controlled spinner. Supports wire")
mod_info_surfacefrictiontool=(MOD "surfacefrictiontool" "Surface Friction Tool" "https://github.com/dvdvideo1234/surfacefrictiontool/archive/master.zip" "surfacefrictiontool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/SurfaceFrictionTool" "Controls the surface friction of a prop")
mod_info_magneticdipole=(MOD "magneticdipole" "Magnetic Dipole" "https://github.com/dvdvideo1234/magneticdipole/archive/master.zip" "magneticdipole-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/MagneticDipole" "Magnet entity that runs forces on its poles. Supports wire")
mod_info_environmentorganizer=(MOD "environmentorganizer" "Environment Organizer" "https://github.com/dvdvideo1234/environmentorganizer/archive/master.zip" "environmentorganizer-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/EnvironmentOrganizer" "Installs routines designed for server settings adjustment")
mod_info_precision_alignment=(MOD "precision-alignment" "Precision Alignment" "https://github.com/Mista-Tea/precision-alignment/archive/master.zip" "precision-alignment-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/precision-alignment" "Creates precise constraints and aligments")
mod_info_improved_stacker=(MOD "improved-stacker" "Improved Stacker" "https://github.com/Mista-Tea/improved-stacker/archive/master.zip" "improved-stacker-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-stacker" "Stacks entities in the direction chosen")
mod_info_improved_weight=(MOD "improved-weight" "Improved Weight" "https://github.com/Mista-Tea/improved-weight/archive/master.zip" "improved-weight-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-weight" "Weight tool but with more features")
mod_info_improved_antinoclip=(MOD "improved-antinoclip" "Improved Antinoclip" "https://github.com/Mista-Tea/improved-antinoclip/archive/master.zip" "improved-antinoclip-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-antinoclip" "Controls clipping trough an object")
mod_info_darkrp=(MOD "darkrp" "DarkRP" "https://github.com/FPtje/DarkRP/archive/master.zip" "darkrp-master.zip" "0" "LowercaseOn" "${systemdir}/gamemodes" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Most popular gamemode")
mod_info_darkrpmodification=(MOD "darkrpmodification" "DarkRP Modification" "https://github.com/FPtje/darkrpmodification/archive/master.zip" "darkrpmodification-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "NOUPDATE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Customize DarkRP settings")
mod_info_laserstool=(MOD "laserstool" "Laser STool" "https://github.com/dvdvideo1234/laserstool/archive/main.zip" "laserstool-main.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/LaserSTool" "Scripted tool that spawns laser entities, simulates light rays and even kill players")
# Oxidemod
mod_info_rustoxide=( MOD "rustoxide" "Oxide for Rust" "${oxiderustlatestlink}" "Oxide.Rust-linux.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Rust;" "NOTGAMES" "https://umod.org/games/rust" "Allows for the use of plugins" )
mod_info_hwoxide=( MOD "hwoxide" "Oxide for Hurtworld" "${oxidehurtworldlatestlink}" "Oxide.Hurtworld.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Hurtworld;" "NOTGAMES" "https://umod.org/games/hurtworld" "Allows for the use of plugins" )
mod_info_sdtdoxide=( MOD "sdtdoxide" "Oxide for 7 Days To Die" "${oxidesdtdlatestlink}" "Oxide.SevenDaysToDie.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "7 Days To Die;" "NOTGAMES" "https://umod.org/games/7-days-to-die" "Allows for the use of plugins" )
mod_info_rustoxide=(MOD "rustoxide" "Oxide for Rust" "${oxiderustlatestlink}" "Oxide.Rust-linux.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Rust;" "NOTGAMES" "https://umod.org/games/rust" "Allows for the use of plugins")
mod_info_hwoxide=(MOD "hwoxide" "Oxide for Hurtworld" "${oxidehurtworldlatestlink}" "Oxide.Hurtworld.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Hurtworld;" "NOTGAMES" "https://umod.org/games/hurtworld" "Allows for the use of plugins")
mod_info_sdtdoxide=(MOD "sdtdoxide" "Oxide for 7 Days To Die" "${oxidesdtdlatestlink}" "Oxide.SevenDaysToDie.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "7 Days To Die;" "NOTGAMES" "https://umod.org/games/7-days-to-die" "Allows for the use of plugins")
# ValheimPlus
mod_info_valheimplus=( MOD "valheimplus" "Valheim PLUS" "${valeimpluslatestlink}" "ValheimPlus.tar.gz" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Valheim;" "NOTGAMES" "https://github.com/valheimPlus/ValheimPlus" "Mod to improve Valheim gameplay")
mod_info_valheimplus=(MOD "valheimplus" "Valheim PLUS" "${valeimpluslatestlink}" "ValheimPlus.tar.gz" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Valheim;" "NOTGAMES" "https://github.com/valheimPlus/ValheimPlus" "Mod to improve Valheim gameplay")
# REQUIRED: Set all mods info into the global array
mods_global_array=( "${mod_info_metamod[@]}" "${mod_info_base_amxx[@]}" "${mod_info_cs_amxx[@]}" "${mod_info_dod_amxx[@]}" "${mod_info_tfc_amxx[@]}" "${mod_info_ns_amxx[@]}" "${mod_info_ts_amxx[@]}" "${mod_info_metamodsource[@]}" "${mod_info_sourcemod[@]}" "${mod_info_steamworks[@]}" "${mod_info_gokz[@]}" "${mod_info_ttt[@]}" "${mod_info_get5[@]}" "${mod_info_prac[@]}" "${mod_info_pug[@]}" "${mod_info_dhook[@]}" "${mod_info_movement[@]}" "${mod_info_cleaner[@]}" "${mod_info_ulib[@]}" "${mod_info_ulx[@]}" "${mod_info_utime[@]}" "${mod_info_uclip[@]}" "${mod_info_acf[@]}" "${mod_info_acf_missiles[@]}" "${mod_info_acf_sweps[@]}" "${mod_info_advdupe2[@]}" "${mod_info_pac3[@]}" "${mod_info_wiremod[@]}" "${mod_info_wiremodextras[@]}" "${mod_info_darkrp[@]}" "${mod_info_darkrpmodification[@]}" "${mod_info_rustoxide[@]}" "${mod_info_hwoxide[@]}" "${mod_info_sdtdoxide[@]}" "${mod_info_advduplicator[@]}" "${mod_info_trackassemblytool[@]}" "${mod_info_physpropertiesadv[@]}" "${mod_info_controlsystemse2[@]}" "${mod_info_e2pistontiming[@]}" "${mod_info_propcannontool[@]}" "${mod_info_gearassemblytool[@]}" "${mod_info_spinnertool[@]}" "${mod_info_surfacefrictiontool[@]}" "${mod_info_magneticdipole[@]}" "${mod_info_environmentorganizer[@]}" "${mod_info_precision_alignment[@]}" "${mod_info_improved_stacker[@]}" "${mod_info_improved_weight[@]}" "${mod_info_improved_antinoclip[@]}" "${mod_info_laserstool[@]}" "${mod_info_valheimplus[@]}" )
mods_global_array=("${mod_info_metamod[@]}" "${mod_info_base_amxx[@]}" "${mod_info_cs_amxx[@]}" "${mod_info_dod_amxx[@]}" "${mod_info_tfc_amxx[@]}" "${mod_info_ns_amxx[@]}" "${mod_info_ts_amxx[@]}" "${mod_info_metamodsource[@]}" "${mod_info_sourcemod[@]}" "${mod_info_steamworks[@]}" "${mod_info_gokz[@]}" "${mod_info_ttt[@]}" "${mod_info_get5[@]}" "${mod_info_prac[@]}" "${mod_info_pug[@]}" "${mod_info_dhook[@]}" "${mod_info_movement[@]}" "${mod_info_cleaner[@]}" "${mod_info_ulib[@]}" "${mod_info_ulx[@]}" "${mod_info_utime[@]}" "${mod_info_uclip[@]}" "${mod_info_acf[@]}" "${mod_info_acf_missiles[@]}" "${mod_info_acf_sweps[@]}" "${mod_info_advdupe2[@]}" "${mod_info_pac3[@]}" "${mod_info_wiremod[@]}" "${mod_info_wiremodextras[@]}" "${mod_info_darkrp[@]}" "${mod_info_darkrpmodification[@]}" "${mod_info_rustoxide[@]}" "${mod_info_hwoxide[@]}" "${mod_info_sdtdoxide[@]}" "${mod_info_advduplicator[@]}" "${mod_info_trackassemblytool[@]}" "${mod_info_physpropertiesadv[@]}" "${mod_info_controlsystemse2[@]}" "${mod_info_e2pistontiming[@]}" "${mod_info_propcannontool[@]}" "${mod_info_gearassemblytool[@]}" "${mod_info_spinnertool[@]}" "${mod_info_surfacefrictiontool[@]}" "${mod_info_magneticdipole[@]}" "${mod_info_environmentorganizer[@]}" "${mod_info_precision_alignment[@]}" "${mod_info_improved_stacker[@]}" "${mod_info_improved_weight[@]}" "${mod_info_improved_antinoclip[@]}" "${mod_info_laserstool[@]}" "${mod_info_valheimplus[@]}")

8
lgsm/functions/query_gamedig.sh

@ -9,7 +9,7 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Check if gamedig and jq are installed.
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
# will bypass query if server offline.
check_status.sh
@ -49,7 +49,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
fi
if [ "${gdplayers}" == "null" ]; then
unset gdplayers
elif [ "${gdplayers}" == "[]" ]||[ "${gdplayers}" == "-1" ]; then
elif [ "${gdplayers}" == "[]" ] || [ "${gdplayers}" == "-1" ]; then
gdplayers=0
fi
@ -75,7 +75,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
# numbots.
gdbots=$(echo "${gamedigraw}" | jq -re '.bots | length')
if [ "${gdbots}" == "null" ]||[ "${gdbots}" == "0" ]; then
if [ "${gdbots}" == "null" ] || [ "${gdbots}" == "0" ]; then
unset gdbots
fi
@ -86,7 +86,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
gdversion=$(echo "${gamedigraw}" | jq -re '.raw.version')
fi
if [ "${gdversion}" == "null" ]||[ "${gdversion}" == "0" ]; then
if [ "${gdversion}" == "null" ] || [ "${gdversion}" == "0" ]; then
unset gdversion
fi
fi

14
lgsm/functions/update_factorio.sh

@ -7,7 +7,7 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_update_factorio_dl(){
fn_update_factorio_dl() {
fn_fetch_file "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" "" "" "" "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" "" "norun" "noforce" "nohash"
fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" "${tmpdir}"
echo -e "copying to ${serverfiles}...\c"
@ -25,7 +25,7 @@ fn_update_factorio_dl(){
fi
}
fn_update_factorio_localbuild(){
fn_update_factorio_localbuild() {
# Gets local build info.
fn_print_dots "Checking local build: ${remotelocation}"
# Uses executable to find local build.
@ -41,13 +41,13 @@ fn_update_factorio_localbuild(){
fi
}
fn_update_factorio_remotebuild(){
fn_update_factorio_remotebuild() {
# Gets remote build info.
remotebuild=$(curl -s "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" | grep -o '[0-9]\.[0-9]\{1,\}\.[0-9]\{1,\}' | head -1)
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
@ -57,7 +57,7 @@ fn_update_factorio_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
@ -65,13 +65,13 @@ fn_update_factorio_remotebuild(){
fi
}
fn_update_factorio_compare(){
fn_update_factorio_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Removes dots so if statement can compare version numbers.
fn_print_dots "Checking for update: ${remotelocation}"
localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]')
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "Update available"

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

Loading…
Cancel
Save