Browse Source

fix (alerts): Alerts on update uses the old game server version not the new one (#4854)

* feat: refactor update comparison output for consistency and clarity

- Replaced direct echo statements with fn_print functions for uniformity in output formatting across multiple update scripts.
- Ensured lockfile creation uses the correct syntax for variable expansion.
- Moved lock file to the same location to ensure monitor doesnt reboot at the wrong time
- Updated remote build information display to enhance readability and maintain consistency in logging.
- Removed unnecessary echo commands to streamline the output process.

* Refactor remote build version handling across multiple modules

- Updated variable names from 'remotebuildversion' to 'remotebuild' for consistency.
- Adjusted logic to check for remote build availability using the new variable name.
- Modified output messages to reflect the change in variable naming.
- Ensured all modules (update_mc.sh, update_mcb.sh, update_mta.sh, update_pmc.sh, update_ts3.sh, update_ut99.sh, update_vints.sh, update_xnt.sh) are aligned with the new naming convention for better readability and maintainability.

* fix(alert): resolve issue with servername not always being listed in title

* Moved `info_distro.sh`, `info_game.sh`, and `info_messages.sh` calls to the top of the `fn_alert_log` function for better clarity.
* Updated `alerticon` assignment to maintain consistency in alert information handling.

* fix(alert_discord): remove "More info" field from Discord alert JSON

* Eliminated the "More info" field to streamline the alert message.
* This change enhances the clarity of the alert by focusing on essential information.

* fix(alert): improve update alert messaging for clarity

* Updated alert messages in `fn_alert_update` and `fn_alert_update_failed` for better readability.
* Changed alert action from `update-request` to `update-restart-request` in `fn_monitor_check_update_source`.

* remove inline

* fix(alert): Correct grammar in update alert message

* Changed "an LinuxGSM update" to "a LinuxGSM update" for grammatical accuracy.

* typo

* fix(alert_discord): Add inline property to "Is my Game Server Online?" field

* Ensures proper formatting of the Discord alert message.
* Improves the display of the server status information.

* fix(pd): increase timeout for termbin.com connection

* fix(alert_discord): reorder fields in Discord alert JSON

* Changed the order of fields in the Discord alert JSON structure.
* Updated the "More info" and "Is my Game Server Online?" fields for better clarity.

* revert back to factorio.com

Co-authored-by: Copilot <[email protected]>

* Standardizes alert messages across platforms

Ensures consistency in alert messages across Discord, NTFY,
Pushover, Rocketchat, Slack, and Telegram.

Updates Discord alerts to include server hostname and time,
removes redundant formatting.

Standardizes plain-text alert formatting for NTFY.

Refactors Pushover messages to use consistent HTML formatting.

Streamlines Rocketchat and Slack messages by removing duplicate
server info and adding optional link support.

* Removes Hostname from alert messages

Removes the Hostname field from various alert messages (Discord, Gotify, IFTTT, ntfy, Pushbullet, Pushover, Rocketchat, Slack, Telegram).

The hostname was deemed redundant or unnecessary in the context of these alerts.

Relates to #4696

* Configures shellcheckrc filename

Configures the Super-Linter action to use `.shellcheckrc` as the
BASH_FILE_NAME. This ensures that shellcheck uses the correct
configuration file for bash script linting.

Fixes #4696

* Disables shellcheck errors and removes variable

Disables specific shellcheck errors to allow certain coding
patterns and removes an unused variable from the super-linter
workflow. This improves the linter's signal-to-noise ratio
and reduces unnecessary checks.

Relates to #4696

* Fixes and improves server list validation scripts

Addresses issues in the server list validation scripts:

- Fixes potential issues with parsing curl custom arguments in telegram alerts.
- Corrects the shortname array generation.
- Implements more robust checks for validating game icons.
- Ensures the consistency of server counts across different CSV files.

* Fixes glibc check and mod selection logic

Corrects glibc version comparison to properly handle version strings.

Improves mod installation and removal by validating user input
against available options, providing a more robust selection process.
This prevents errors caused by invalid mod names and enhances the
user experience.

Updates arithmetic expression syntax for better compatibility.

* Fixes cache control for dev-debug mode

Updates the handling of cache control headers in dev-debug mode.
The `nocache` variable is changed to an array to correctly pass multiple headers to `curl`.
This resolves issues with cached versions of files being used when dev-debug is enabled, ensuring that the latest versions are always fetched.

Fixes #4696

* Allows spaces in steamcmdcommand variable

Parses steamcmdcommand as an array to allow spaces in the
variable.

This prevents issues when the user wants to pass arguments
with spaces to the steamcmd executable.

* Addresses various script improvements

Addresses multiple improvements across various scripts:

- Fixes Valheim unstripped_corlib override by commenting out the lines in the config files.
- Improves process identification for source and goldsrc engines using `pgrep`.
- Enhances backup file identification using `find` with `-maxdepth 1` and `-type f`.
- Fixes glibc version comparison logic in multiple files.
- Improves UT2K4 key installation script by using printf for writing the key to the file.
- Corrects the mod info extraction logic to correctly identify mod entries.
- Improves amxmodx file installation/removal logic to prevent duplicate entries.
- Fixes server info retrieval to handle spaces in the server list.

Relates to #4696

* Fixes mono repo install exit code check

Corrects the mono repo install exit code check to use the dedicated monorepoexitcode variable, ensuring accurate error detection.

Updates the exit trap to preserve the original exit status, preventing potential loss of information when handling script termination.

* Refactors and reorders core modules

Improves module loading by reordering and refactoring the core modules.

This change addresses inconsistencies and improves the overall structure
of how core modules are handled within the system.
Some fix scripts were renamed to match the module name.

* Makes scripts executable

Changes file permissions to make shell scripts executable.
This ensures that the scripts can be run directly.

Addresses a pre-existing issue.
Related to #4696

* Adds explicit permissions to workflows

Specifies explicit permissions for GitHub Actions workflows to enhance security and control access to resources.

This ensures that each workflow only has the necessary permissions, following the principle of least privilege.

* Fixes output redirection and URL parsing

Corrects output redirection in GitHub Actions workflows by enclosing the $GITHUB_OUTPUT variable in quotes, preventing potential issues with variable expansion.

Ensures proper URL parsing in workflows by enclosing the URL within quotes, addressing potential parsing errors.

Fixes #4696

* Applies code formatting for consistency

Applies Prettier formatting to the codebase for improved
readability and consistency.

Addresses minor code style inconsistencies across several files.

* Fixes minor formatting and logic issues

Addresses various minor issues including:

- Standardizes indentation in `.editorconfig` for different file types.
- Simplifies Prettier configuration.
- Updates image links in `README.md`.
- Ensures newline character at end of `.csv` files.
- Corrects a conditional statement in `command_fastdl.sh`.
- Corrects a conditional statement in `info_messages.sh`.
- Updates server query protocols in `query_gsquery.py`.

* Configures and disables linters

Adds YAML linting configuration and disables unnecessary
linters to streamline the CI/CD process and reduce
noise from irrelevant checks.

* Improves documentation and linting

Updates documentation links to be enclosed in angle brackets, preventing markdown rendering issues.

Configures markdownlint to align with repository standards and avoid common false positives.

The updated links in the documentation ensure they are correctly interpreted by markdown parsers, improving user experience.

The markdownlint configuration fine-tunes linting rules to better match the project's existing style and conventions, reducing noise from irrelevant warnings.

* Fixes typos and improves code consistency

Addresses various typos and inconsistencies across multiple files,
enhancing code readability and maintainability.

Adds codespell and flake8 configurations for linting.

Relates to #4696

* Excludes workflow files from Prettier formatting

Prevents Prettier from formatting workflow files due to GitHub token restrictions, as the token used by the Prettier auto-commit action lacks permissions to update files within the `.github/workflows/` directory.

* chore(prettier): format code

* Updates Super-Linter configuration

Improves Super-Linter's reliability by switching to linting the entire codebase instead of relying on git history. This change also addresses potential transient fetch failures from GitHub.

Additionally, this commit expands the ignored paths in codespell and disables some linters to improve performance and reduce false positives.

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: dgibbs64 <[email protected]>
pull/4895/head
Daniel Gibbs 3 months ago
committed by GitHub
parent
commit
fef128fb7d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 17
      .editorconfig
  2. 11
      .github/linters/.codespellrc
  3. 2
      .github/linters/.flake8
  4. 23
      .github/linters/.markdown-lint.yml
  5. 1
      .github/linters/.shellcheckrc
  6. 25
      .github/linters/.yaml-lint.yml
  7. 4
      .github/pull_request_template.md
  8. 8
      .github/workflows/action-super-linter.yml
  9. 2
      .github/workflows/add-to-project.yml
  10. 10
      .github/workflows/details-check-generate-matrix.sh
  11. 7
      .github/workflows/details-check.yml
  12. 2
      .github/workflows/git-sync.yml
  13. 4
      .github/workflows/potential-duplicates.yml
  14. 12
      .github/workflows/serverlist-validate-game-icons.sh
  15. 9
      .github/workflows/serverlist-validate.sh
  16. 3
      .github/workflows/serverlist-validate.yml
  17. 2
      .github/workflows/trigger-docker-build.yml
  18. 4
      .github/workflows/update-check.yml
  19. 4
      .github/workflows/update-copyright-years-in-license-file.yml
  20. 0
      .github/workflows/version-check.sh
  21. 3
      .prettierignore
  22. 2
      .shellcheckrc
  23. 5
      CONTRIBUTING.md
  24. 2
      lgsm/config-default/config-lgsm/armarserver/_default.cfg
  25. 2
      lgsm/config-default/config-lgsm/necserver/_default.cfg
  26. 2
      lgsm/config-default/config-lgsm/ns2cserver/_default.cfg
  27. 2
      lgsm/config-default/config-lgsm/ns2server/_default.cfg
  28. 59
      lgsm/modules/alert.sh
  29. 21
      lgsm/modules/alert_discord.sh
  30. 0
      lgsm/modules/alert_email.sh
  31. 2
      lgsm/modules/alert_gotify.sh
  32. 2
      lgsm/modules/alert_ifttt.sh
  33. 26
      lgsm/modules/alert_ntfy.sh
  34. 2
      lgsm/modules/alert_pushbullet.sh
  35. 4
      lgsm/modules/alert_pushover.sh
  36. 66
      lgsm/modules/alert_rocketchat.sh
  37. 96
      lgsm/modules/alert_slack.sh
  38. 10
      lgsm/modules/alert_telegram.sh
  39. 0
      lgsm/modules/check.sh
  40. 0
      lgsm/modules/check_config.sh
  41. 6
      lgsm/modules/check_deps.sh
  42. 0
      lgsm/modules/check_executable.sh
  43. 0
      lgsm/modules/check_gamedig.sh
  44. 2
      lgsm/modules/check_glibc.sh
  45. 0
      lgsm/modules/check_ip.sh
  46. 1
      lgsm/modules/check_last_update.sh
  47. 0
      lgsm/modules/check_logs.sh
  48. 2
      lgsm/modules/check_permissions.sh
  49. 0
      lgsm/modules/check_root.sh
  50. 0
      lgsm/modules/check_status.sh
  51. 0
      lgsm/modules/check_steamcmd.sh
  52. 0
      lgsm/modules/check_system_dir.sh
  53. 2
      lgsm/modules/check_system_requirements.sh
  54. 0
      lgsm/modules/check_tmuxception.sh
  55. 0
      lgsm/modules/check_version.sh
  56. 0
      lgsm/modules/command_backup.sh
  57. 0
      lgsm/modules/command_check_update.sh
  58. 0
      lgsm/modules/command_console.sh
  59. 2
      lgsm/modules/command_debug.sh
  60. 2
      lgsm/modules/command_details.sh
  61. 0
      lgsm/modules/command_dev_clear_modules.sh
  62. 0
      lgsm/modules/command_dev_debug.sh
  63. 0
      lgsm/modules/command_dev_detect_deps.sh
  64. 2
      lgsm/modules/command_dev_detect_glibc.sh
  65. 0
      lgsm/modules/command_dev_detect_ldd.sh
  66. 0
      lgsm/modules/command_dev_parse_distro_details.sh
  67. 0
      lgsm/modules/command_dev_parse_game_details.sh
  68. 8
      lgsm/modules/command_dev_query_raw.sh
  69. 0
      lgsm/modules/command_dev_ui.sh
  70. 0
      lgsm/modules/command_fastdl.sh
  71. 0
      lgsm/modules/command_install.sh
  72. 0
      lgsm/modules/command_install_resources_mta.sh
  73. 21
      lgsm/modules/command_mods_install.sh
  74. 19
      lgsm/modules/command_mods_remove.sh
  75. 0
      lgsm/modules/command_mods_update.sh
  76. 4
      lgsm/modules/command_monitor.sh
  77. 4
      lgsm/modules/command_postdetails.sh
  78. 0
      lgsm/modules/command_restart.sh
  79. 0
      lgsm/modules/command_send.sh
  80. 4
      lgsm/modules/command_skeleton.sh
  81. 0
      lgsm/modules/command_start.sh
  82. 4
      lgsm/modules/command_stop.sh
  83. 0
      lgsm/modules/command_test_alert.sh
  84. 0
      lgsm/modules/command_ts3_server_pass.sh
  85. 0
      lgsm/modules/command_update.sh
  86. 39
      lgsm/modules/command_update_linuxgsm.sh
  87. 0
      lgsm/modules/command_validate.sh
  88. 0
      lgsm/modules/command_wipe.sh
  89. 0
      lgsm/modules/compress_unreal_maps.sh
  90. 38
      lgsm/modules/core_dl.sh
  91. 0
      lgsm/modules/core_exit.sh
  92. 0
      lgsm/modules/core_getopt.sh
  93. 0
      lgsm/modules/core_github.sh
  94. 2
      lgsm/modules/core_legacy.sh
  95. 0
      lgsm/modules/core_logs.sh
  96. 2
      lgsm/modules/core_messages.sh
  97. 204
      lgsm/modules/core_modules.sh
  98. 22
      lgsm/modules/core_steamcmd.sh
  99. 6
      lgsm/modules/core_trap.sh
  100. 0
      lgsm/modules/fix.sh

17
.editorconfig

@ -12,6 +12,21 @@ insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
# BASH Files # BASH Files
[*.{.sh}] [*.sh]
indent_size = 4 indent_size = 4
indent_style = tab indent_style = tab
# JSON Files (Biome formatting)
[*.json]
indent_style = tab
indent_size = 2
# Steam appmanifest files (Valve ACF format)
[*.acf]
indent_style = tab
indent_size = 4
# Python
[*.py]
indent_style = space
indent_size = 4

11
.github/linters/.codespellrc

@ -0,0 +1,11 @@
[codespell]
# Skip data tables that contain many short server identifiers (e.g. "fof", "nd")
skip =
lgsm/data/*.csv,
package-lock.json,
*/package-lock.json,
node_modules,
*/node_modules/*
# Ignore common identifiers/acronyms and extensions used throughout LinuxGSM
ignore-words-list = distroname,fof,nd,sav,parms,ThirdParty

2
.github/linters/.flake8

@ -0,0 +1,2 @@
[flake8]
max-line-length = 120

23
.github/linters/.markdown-lint.yml

@ -0,0 +1,23 @@
# Configuration for markdownlint (used by Super Linter)
# MD041: README starts with HTML badges in this repo.
MD041: false
# MD051: GitHub heading anchor generation can differ (emoji, punctuation).
MD051: false
# MD013: The project documentation frequently contains long URLs/commands.
MD013: false
# MD033: The main README uses inline HTML for badges.
MD033: false
# Match existing list formatting in this repo.
MD007:
indent: 4
MD030:
ul_single: 3
ol_single: 2
ul_multi: 3
ol_multi: 2

1
.github/linters/.shellcheckrc

@ -0,0 +1 @@
disable=SC2154,SC2034

25
.github/linters/.yaml-lint.yml

@ -0,0 +1,25 @@
extends: default
rules:
document-start: disable
truthy: disable
line-length:
max: 200
level: warning
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
braces:
min-spaces-inside: 0
max-spaces-inside: 1
min-spaces-inside-empty: 0
max-spaces-inside-empty: 0
empty-lines:
max: 2
max-start: 0
max-end: 0
comments:
min-spaces-from-content: 1

4
.github/pull_request_template.md

@ -29,7 +29,7 @@ PR will not be merged until all steps are complete.
If documentation does need updating either update it by creating a PR (preferred) or request a documentation update. 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 - User docs: <https://github.com/GameServerManagers/LinuxGSM-Docs>
- Dev docs: https://github.com/GameServerManagers/LinuxGSM-Dev-Docs - Dev docs: <https://github.com/GameServerManagers/LinuxGSM-Dev-Docs>
**Thank you for your Pull Request!** **Thank you for your Pull Request!**

8
.github/workflows/action-super-linter.yml

@ -27,9 +27,10 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v6 uses: actions/checkout@v6
with: with:
# super-linter needs the full git history to get the # Shallow clone reduces transient fetch failures (HTTP 500) from GitHub.
# list of files that changed across commits # We lint the whole codebase instead of relying on git history.
fetch-depth: 0 fetch-depth: 1
fetch-tags: false
persist-credentials: false persist-credentials: false
- name: Install Prettier plugins (for summary formatting) - name: Install Prettier plugins (for summary formatting)
@ -48,6 +49,7 @@ jobs:
VALIDATE_JSON_PRETTIER: false VALIDATE_JSON_PRETTIER: false
VALIDATE_MARKDOWN_PRETTIER: false VALIDATE_MARKDOWN_PRETTIER: false
VALIDATE_NATURAL_LANGUAGE: false VALIDATE_NATURAL_LANGUAGE: false
VALIDATE_PYTHON_RUFF_FORMAT: false
VALIDATE_SHELL_SHFMT: false VALIDATE_SHELL_SHFMT: false
VALIDATE_TRIVY: false VALIDATE_TRIVY: false
VALIDATE_YAML_PRETTIER: false VALIDATE_YAML_PRETTIER: false

2
.github/workflows/add-to-project.yml

@ -5,6 +5,8 @@ on:
- opened - opened
- labeled - labeled
permissions: {}
jobs: jobs:
add-to-project: add-to-project:
if: github.repository_owner == 'GameServerManagers' if: github.repository_owner == 'GameServerManagers'

10
.github/workflows/details-check-generate-matrix.sh

@ -14,10 +14,12 @@ while read -r line; do
export gamename export gamename
distro=$(echo "$line" | awk -F, '{ print $4 }') distro=$(echo "$line" | awk -F, '{ print $4 }')
export distro export distro
echo -n "{" >> "shortnamearray.json" {
echo -n "\"shortname\":" >> "shortnamearray.json" echo -n "{";
echo -n "\"${shortname}\"" >> "shortnamearray.json" echo -n "\"shortname\":";
echo -n "}," >> "shortnamearray.json" echo -n "\"${shortname}\"";
echo -n "},";
} >> "shortnamearray.json"
done < <(tail -n +2 serverlist.csv) done < <(tail -n +2 serverlist.csv)
sed -i '$ s/.$//' "shortnamearray.json" sed -i '$ s/.$//' "shortnamearray.json"
echo -n "]" >> "shortnamearray.json" echo -n "]" >> "shortnamearray.json"

7
.github/workflows/details-check.yml

@ -6,6 +6,9 @@ on:
branches: branches:
- develop - develop
permissions:
contents: read
concurrency: concurrency:
group: details-check-${{ github.ref_name }} group: details-check-${{ github.ref_name }}
cancel-in-progress: true cancel-in-progress: true
@ -28,7 +31,7 @@ jobs:
run: | run: |
shortnamearray=$(cat shortnamearray.json) shortnamearray=$(cat shortnamearray.json)
echo "${shortnamearray}" echo "${shortnamearray}"
echo -n "matrix=${shortnamearray}" >> $GITHUB_OUTPUT echo -n "matrix=${shortnamearray}" >> "$GITHUB_OUTPUT"
details-check: details-check:
if: github.repository_owner == 'GameServerManagers' if: github.repository_owner == 'GameServerManagers'
@ -41,7 +44,7 @@ jobs:
steps: steps:
- name: Download linuxgsm.sh - name: Download linuxgsm.sh
run: wget https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/linuxgsm.sh; chmod +x linuxgsm.sh run: wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/linuxgsm.sh"; chmod +x linuxgsm.sh
- name: Install dependencies - name: Install dependencies
run: sudo apt-get install libxml2-utils jq run: sudo apt-get install libxml2-utils jq

2
.github/workflows/git-sync.yml

@ -7,6 +7,8 @@ on:
- master - master
- develop - develop
permissions: {}
jobs: jobs:
gitHub-to-bitbucket: gitHub-to-bitbucket:
if: github.repository_owner == 'GameServerManagers' if: github.repository_owner == 'GameServerManagers'

4
.github/workflows/potential-duplicates.yml

@ -3,6 +3,10 @@ on:
issues: issues:
types: types:
- opened - opened
permissions:
issues: write
jobs: jobs:
potential-duplicates: potential-duplicates:
if: github.repository_owner == 'GameServerManagers' if: github.repository_owner == 'GameServerManagers'

12
.github/workflows/serverlist-validate-game-icons.sh

@ -2,6 +2,8 @@
cd "${datadir}" || exit cd "${datadir}" || exit
exitcode=0
echo "" echo ""
echo "Checking that all the game servers listed in serverlist.csv have a shortname-icon.png file" echo "Checking that all the game servers listed in serverlist.csv have a shortname-icon.png file"
for shortname in $(tail -n +2 serverlist.csv | cut -d ',' -f1); do for shortname in $(tail -n +2 serverlist.csv | cut -d ',' -f1); do
@ -16,9 +18,11 @@ done
echo "" echo ""
echo "Checking if an unexpected gameicon exists" echo "Checking if an unexpected gameicon exists"
for gameicon in $(ls -1 gameicons); do shopt -s nullglob
for gameiconpath in gameicons/*; do
gameicon="$(basename "${gameiconpath}")"
# check if $gameicon is in serverlist.csv # check if $gameicon is in serverlist.csv
if ! grep -q "${gameicon%-icon.png}" serverlist.csv; then if ! grep -q -F "${gameicon%-icon.png}" serverlist.csv; then
echo "ERROR: gameicon ${gameicon} is not in serverlist.csv" echo "ERROR: gameicon ${gameicon} is not in serverlist.csv"
exitcode=1 exitcode=1
else else
@ -28,7 +32,7 @@ done
echo "" echo ""
echo "Checking that the number of gameicons matches the number of servers in serverlist.csv" echo "Checking that the number of gameicons matches the number of servers in serverlist.csv"
gameiconcount="$(ls -1 gameicons | wc -l)" gameiconcount="$(find gameicons -mindepth 1 -maxdepth 1 -type f | wc -l)"
serverlistcount="$(tail -n +2 serverlist.csv | wc -l)" serverlistcount="$(tail -n +2 serverlist.csv | wc -l)"
if [ "${gameiconcount}" -ne "${serverlistcount}" ]; then if [ "${gameiconcount}" -ne "${serverlistcount}" ]; then
echo "ERROR: game icons (${gameiconcount}) does not match serverlist.csv ($serverlistcount)" echo "ERROR: game icons (${gameiconcount}) does not match serverlist.csv ($serverlistcount)"
@ -37,4 +41,4 @@ else
echo "OK: gameiconcount ($gameiconcount) matches serverlistcount ($serverlistcount)" echo "OK: gameiconcount ($gameiconcount) matches serverlistcount ($serverlistcount)"
fi fi
exit ${exitcode} exit "${exitcode}"

9
.github/workflows/serverlist-validate.sh

@ -3,12 +3,15 @@ echo "Checking that all the game servers are listed in all csv files"
echo "this check will ensure serverlist.csv has the same number of lines (-2 lines) as the other csv files" echo "this check will ensure serverlist.csv has the same number of lines (-2 lines) as the other csv files"
# count the number of lines in the serverlist.csv # count the number of lines in the serverlist.csv
cd "${datadir}" || exit cd "${datadir}" || exit
exitcode=0
serverlistcount="$(tail -n +2 serverlist.csv | wc -l)" serverlistcount="$(tail -n +2 serverlist.csv | wc -l)"
echo "serverlistcount: $serverlistcount" echo "serverlistcount: $serverlistcount"
# get list of all csv files starting with ubunutu debian centos # get list of all csv files starting with ubunutu debian centos
csvlist="$(ls -1 | grep -E '^(ubuntu|debian|centos|rhel|almalinux|rocky).*\.csv$')" shopt -s nullglob
csvlist=(ubuntu*.csv debian*.csv centos*.csv rhel*.csv almalinux*.csv rocky*.csv)
# loop though each csv file and make sure the number of lines is the same as the serverlistcount # loop though each csv file and make sure the number of lines is the same as the serverlistcount
for csv in $csvlist; do for csv in "${csvlist[@]}"; do
csvcount="$(wc -l < "${csv}")" csvcount="$(wc -l < "${csv}")"
csvcount=$((csvcount - 2)) csvcount=$((csvcount - 2))
if [ "$csvcount" -ne "$serverlistcount" ]; then if [ "$csvcount" -ne "$serverlistcount" ]; then
@ -35,4 +38,4 @@ for shortname in $(tail -n +2 serverlist.csv | cut -d ',' -f1); do
fi fi
done done
exit ${exitcode} exit "${exitcode}"

3
.github/workflows/serverlist-validate.yml

@ -3,6 +3,9 @@ on:
workflow_dispatch: workflow_dispatch:
push: push:
permissions:
contents: read
jobs: jobs:
serverlist-validate: serverlist-validate:
if: github.repository_owner == 'GameServerManagers' if: github.repository_owner == 'GameServerManagers'

2
.github/workflows/trigger-docker-build.yml

@ -6,6 +6,8 @@ on:
types: types:
- published - published
permissions: {}
jobs: jobs:
trigger_build_docker-linuxgsm: trigger_build_docker-linuxgsm:
if: github.repository_owner == 'GameServerManagers' if: github.repository_owner == 'GameServerManagers'

4
.github/workflows/update-check.yml

@ -6,6 +6,8 @@ on:
branches: branches:
- develop - develop
permissions: {}
concurrency: concurrency:
group: update-check-${{ github.ref_name }} group: update-check-${{ github.ref_name }}
cancel-in-progress: true cancel-in-progress: true
@ -22,7 +24,7 @@ jobs:
steps: steps:
- name: Download linuxgsm.sh - name: Download linuxgsm.sh
run: wget https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/linuxgsm.sh; chmod +x linuxgsm.sh run: wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/linuxgsm.sh"; chmod +x linuxgsm.sh
- name: Install dependencies - name: Install dependencies
run: sudo dpkg --add-architecture i386; sudo apt-get update; run: sudo dpkg --add-architecture i386; sudo apt-get update;

4
.github/workflows/update-copyright-years-in-license-file.yml

@ -4,6 +4,10 @@ on:
schedule: schedule:
- cron: "0 3 1 1 *" # 03:00 AM on January 1 - cron: "0 3 1 1 *" # 03:00 AM on January 1
permissions:
contents: write
pull-requests: write
jobs: jobs:
update-license-year: update-license-year:
if: github.repository_owner == 'GameServerManagers' if: github.repository_owner == 'GameServerManagers'

0
.github/workflows/version-check.sh

3
.prettierignore

@ -0,0 +1,3 @@
# Prettier auto-commit runs with GITHUB_TOKEN (GitHub App).
# GitHub blocks that token from creating/updating anything under .github/workflows.
.github/workflows/**

2
.shellcheckrc

@ -1 +1 @@
disable=SC2154 disable=SC2154,SC2034

5
CONTRIBUTING.md

@ -154,9 +154,8 @@ Notice how this doesn’t work for the other non-imperative forms:
Below is an example of the subject line for a pull request: Below is an example of the subject line for a pull request:
**feat(alerts): add slack support to alerts** - feat(alerts): add slack support to alerts
- fix(csgoserver): remove SteamCMD auth requirement 32-bit workaround
**fix(csgoserver): remove SteamCMD auth requirement 32-bit workaround**
### Testing ### Testing

2
lgsm/config-default/config-lgsm/armarserver/_default.cfg

@ -9,7 +9,7 @@
#### Game Server Settings #### #### Game Server Settings ####
# https://community.bistudio.com/wiki/Arma_Reforger:Server_Hosting # https://community.bistudio.com/wiki/Arma_Reforger:Server_Hosting
# MaxFPS to limit the used Server resouces # MaxFPS to limit the used Server resources
maxfps="60" maxfps="60"
# Profile Name # Profile Name

2
lgsm/config-default/config-lgsm/necserver/_default.cfg

@ -8,7 +8,7 @@
#### Game Server Settings #### #### Game Server Settings ####
## Pre-defined Paramters | https://docs.linuxgsm.com/configuration/start-parameters#predefined-parameters ## Pre-defined Parameters | https://docs.linuxgsm.com/configuration/start-parameters#predefined-parameters
worldname="MyWorld" worldname="MyWorld"
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters

2
lgsm/config-default/config-lgsm/ns2cserver/_default.cfg

@ -19,7 +19,7 @@ httppassword="CHANGE_ME"
httpport="8080" httpport="8080"
mods="" mods=""
serverpassword="" serverpassword=""
# Add the following line to the parms if you want a private server. Ensuring # Add the following line to the params if you want a private server. Ensuring
# that the password variable above is not left empty. # that the password variable above is not left empty.
# -password \"${serverpassword}\" # -password \"${serverpassword}\"

2
lgsm/config-default/config-lgsm/ns2server/_default.cfg

@ -20,7 +20,7 @@ httppassword="CHANGE_ME"
httpport="8080" httpport="8080"
modserverport="27031" modserverport="27031"
serverpassword="" serverpassword=""
# Add the following line to the parms if you want a private server. Ensuring # Add the following line to the params if you want a private server. Ensuring
# that the password variable above is not left empty. # that the password variable above is not left empty.
# -password '${serverpassword}' # -password '${serverpassword}'

59
lgsm/modules/alert.sh

@ -10,13 +10,9 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Generates alert log of the details at the time of the alert. # Generates alert log of the details at the time of the alert.
# Used with email alerts. # Used with email alerts.
fn_alert_log() { fn_alert_log() {
info_distro.sh
info_game.sh
info_messages.sh
if [ -f "${alertlog}" ]; then if [ -f "${alertlog}" ]; then
rm -f "${alertlog:?}" rm -f "${alertlog:?}"
fi fi
{ {
fn_info_messages_head fn_info_messages_head
fn_info_messages_distro fn_info_messages_distro
@ -97,45 +93,66 @@ fn_alert_monitor_query() {
# Update alerts # Update alerts
fn_alert_update() { fn_alert_update() {
fn_script_log_info "Sending alert: ${selfname} has received a game server update: ${localbuild}" # If previousbuild is set show transition, else fallback to single version.
if [ -n "${previousbuild:-}" ] && [ -n "${localbuild:-}" ]; then
fn_script_log_info "Sending alert: ${selfname} updated: ${previousbuild} -> ${localbuild}"
alertmessage="${selfname} updated: ${previousbuild} -> ${localbuild}."
else
fn_script_log_info "Sending alert: ${selfname} updated to ${localbuild}"
alertmessage="${selfname} updated to ${localbuild}."
fi
alertaction="Updated" alertaction="Updated"
alertemoji="🎉" alertemoji="🎉"
alertsound="1" alertsound="1"
alertmessage="${selfname} has received a game server update: ${localbuild}."
# Green # Green
alertcolourhex="#00cd00" alertcolourhex="#00cd00"
alertcolourdec="52480" alertcolourdec="52480"
} }
fn_alert_update_request() { # Update failure alert
fn_script_log_info "Sending alert: ${selfname} has requested an update and needs to be restarted." fn_alert_update_failed() {
alertaction="Updating" # Expect updatefailureexpected (target version) and updatefailuregot (actual localbuild) if set
local updateexpected="${updatefailureexpected:-${remotebuild:-unknown}}"
local updategot="${updatefailuregot:-${localbuild:-unknown}}"
fn_script_log_error "Sending alert: ${selfname} update failed: expected ${updateexpected}, got ${updategot}"
alertaction="Update Failed"
alertemoji="❌"
alertsound="2"
alertmessage="${selfname} update failed: expected ${updateexpected}, got ${updategot}. Manual intervention required."
# Red
alertcolourhex="#cd0000"
alertcolourdec="13434880"
}
fn_alert_update_restart_request() {
fn_script_log_info "Sending alert: ${selfname} restart requested"
alertaction="Restart Requested"
alertemoji="🎉" alertemoji="🎉"
alertsound="1" alertsound="1"
alertmessage="${selfname} has requested an update and needs to be restarted." alertmessage="${selfname} has requested a restart for an update to be applied. Restarting now."
# Blue # Blue
alertcolourhex="#1e90ff" alertcolourhex="#1e90ff"
alertcolourdec="2003199" alertcolourdec="2003199"
} }
fn_alert_check_update() { fn_alert_check_update() {
fn_script_log_info "Sending alert: ${gamename} update available: ${remotebuildversion}" fn_script_log_info "Sending alert: ${gamename} update available: ${localbuild} -> ${remotebuild}"
alertaction="Update available" alertaction="Update Available"
alertemoji="🎉" alertemoji="🎉"
alertsound="1" alertsound="1"
alertmessage="${gamename} update available: ${remotebuildversion}" alertmessage="${gamename} update available: ${localbuild} -> ${remotebuild}"
# Blue # Blue
alertcolourhex="#1e90ff" alertcolourhex="#1e90ff"
alertcolourdec="2003199" alertcolourdec="2003199"
} }
fn_alert_update_linuxgsm() { fn_alert_update_linuxgsm() {
fn_script_log_info "Sending alert: ${selfname} has received an LinuxGSM update" fn_script_log_info "Sending alert: ${selfname} has received a LinuxGSM update"
alertaction="Updated" alertaction="Updated"
alertemoji="🎉" alertemoji="🎉"
alertsound="1" alertsound="1"
alertbody="${gamename} update available" alertbody="${gamename} update available"
alertmessage="${selfname} has received an LinuxGSM update and been restarted." alertmessage="${selfname} has received a LinuxGSM update and been restarted."
# Green # Green
alertcolourhex="#00cd00" alertcolourhex="#00cd00"
alertcolourdec="52480" alertcolourdec="52480"
@ -197,8 +214,9 @@ fn_alert_info() {
alertcolourdec="2003199" alertcolourdec="2003199"
} }
# Images info_distro.sh
alerticon="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/gameicons/${shortname}-icon.png" info_game.sh
info_messages.sh
if [ "${alert}" == "permissions" ]; then if [ "${alert}" == "permissions" ]; then
fn_alert_permissions fn_alert_permissions
@ -210,8 +228,10 @@ elif [ "${alert}" == "test" ]; then
fn_alert_test fn_alert_test
elif [ "${alert}" == "update" ]; then elif [ "${alert}" == "update" ]; then
fn_alert_update fn_alert_update
elif [ "${alert}" == "update-request" ]; then elif [ "${alert}" == "update-failed" ]; then
fn_alert_update_request fn_alert_update_failed
elif [ "${alert}" == "update-restart-request" ]; then
fn_alert_update_restart_request
elif [ "${alert}" == "check-update" ]; then elif [ "${alert}" == "check-update" ]; then
fn_alert_check_update fn_alert_check_update
elif [ "${alert}" == "config" ]; then elif [ "${alert}" == "config" ]; then
@ -237,6 +257,7 @@ else
fi fi
alerttitle="${alertemoji} ${alertaction} - ${servername} ${alertemoji}" alerttitle="${alertemoji} ${alertaction} - ${servername} ${alertemoji}"
alerticon="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/gameicons/${shortname}-icon.png"
# Generate alert log. # Generate alert log.
fn_alert_log fn_alert_log

21
lgsm/modules/alert_discord.sh

@ -43,39 +43,38 @@ json=$(
"inline": true "inline": true
}, },
{ {
"name": "Server Time", "name": "Server IP",
"value": "$(date)", "value": "\`${alertip}:${port}\`",
"inline": true "inline": true
}, },
{ {
"name": "More info", "name": "Server Time",
"value": "${alerturl}", "value": "$(date)",
"inline": true "inline": true
} }
EOF EOF
) )
if [ -n "${querytype}" ]; then if [ -n "${alerturl}" ]; then
json+=$( json+=$(
cat << EOF cat << EOF
, ,
{ {
"name": "Is my Game Server Online?", "name": "More info",
"value": "https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}", "value": "${alerturl}",
"inline": true "inline": true
} }
EOF EOF
) )
fi fi
if [ -n "${alerturl}" ]; then if [ -n "${querytype}" ]; then
json+=$( json+=$(
cat << EOF cat << EOF
, ,
{ {
"name": "More info", "name": "Is my Game Server Online?",
"value": "${alerturl}", "value": "https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}"
"inline": true
} }
EOF EOF
) )

0
lgsm/modules/alert_email.sh

2
lgsm/modules/alert_gotify.sh

@ -11,7 +11,7 @@ json=$(
cat << EOF cat << EOF
{ {
"title": "${alerttitle}", "title": "${alerttitle}",
"message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n "message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\n
EOF EOF
) )

2
lgsm/modules/alert_ifttt.sh

@ -12,7 +12,7 @@ json=$(
{ {
"value1": "${selfname}", "value1": "${selfname}",
"value2": "${alerttitle}", "value2": "${alerttitle}",
"value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n "value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\n
EOF EOF
) )

26
lgsm/modules/alert_ntfy.sh

@ -35,23 +35,31 @@ else
tags="${alertemoji}" tags="${alertemoji}"
fi fi
# Construct the message body # Construct the message body (keep formatting consistent with other plain-text alerts)
message="Server Name: ${servername} message="Server Name
Information: ${alertmessage} ${servername}
Game: ${gamename}
Server IP: ${alertip}:${port} Information
Hostname: ${HOSTNAME} ${alertmessage}
Server Time: $(date)"
Game
${gamename}
Server IP
${alertip}:${port}
Server Time
$(date)"
# Add optional links if available # Add optional links if available
if [ -n "${querytype}" ]; then if [ -n "${querytype}" ]; then
message+="\nIs my Game Server Online?: https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}" message+="\n\nIs my Game Server Online?\nhttps://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}"
fi fi
# Use alerturl for the click action if available # Use alerturl for the click action if available
clickurl="" clickurl=""
if [ -n "${alerturl}" ]; then if [ -n "${alerturl}" ]; then
message+="\nMore info: ${alerturl}" message+="\n\nMore info\n${alerturl}"
clickurl="${alerturl}" clickurl="${alerturl}"
fi fi

2
lgsm/modules/alert_pushbullet.sh

@ -13,7 +13,7 @@ json=$(
"channel_tag": "${channeltag}", "channel_tag": "${channeltag}",
"type": "note", "type": "note",
"title": "${alerttitle}", "title": "${alerttitle}",
"body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n "body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\n
EOF EOF
) )

4
lgsm/modules/alert_pushover.sh

@ -22,7 +22,7 @@ else
alertpriority="0" alertpriority="0"
fi fi
message=" <b>Server name</b><br>${servername}<br><br><b>Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br>" message=" <b>Server Name</b><br>${servername}<br><br><b>Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<br><br>"
if [ -n "${querytype}" ]; then if [ -n "${querytype}" ]; then
message+="<b>Is my Game Server Online?</b><br><a href='https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}'>Check here</a><br><br>" message+="<b>Is my Game Server Online?</b><br><a href='https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}'>Check here</a><br><br>"
@ -32,7 +32,7 @@ if [ -n "${alerturl}" ]; then
message+="<b>More info</b><br><a href='${alerturl}'>${alerturl}</a><br><br>" message+="<b>More info</b><br><a href='${alerturl}'>${alerturl}</a><br><br>"
fi fi
message+="Server Time<br>$(date)" message+="<b>Server Time</b><br>$(date)"
pushoversend=$(curl --connect-timeout 3 -sS \ pushoversend=$(curl --connect-timeout 3 -sS \
-F token="${pushovertoken}" \ -F token="${pushovertoken}" \

66
lgsm/modules/alert_rocketchat.sh

@ -40,26 +40,7 @@ json=$(
{ {
"short": false, "short": false,
"title": "Server IP", "title": "Server IP",
"value": "${alertip}:${port}" "value": "\`${alertip}:${port}\`"
},
{
"short": false,
"title": "Hostname",
"value": "${HOSTNAME}"
},
{
"short": false,
"title": "More info",
"value": "${alerturl}"
},
{
"short": false,
"title": "Server Time",
"value": "$(date)"
}
]
}
]
} }
EOF EOF
) )
@ -67,11 +48,12 @@ EOF
if [ -n "${querytype}" ]; then if [ -n "${querytype}" ]; then
json+=$( json+=$(
cat << EOF cat << EOF
,
{ {
"short": false, "short": false,
"title": "Is my Game Server Online?", "title": "Is my Game Server Online?",
"value": "<https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}|Check here>" "value": "<https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}|Check here>"
}, }
EOF EOF
) )
fi fi
@ -79,55 +61,19 @@ fi
if [ -n "${alerturl}" ]; then if [ -n "${alerturl}" ]; then
json+=$( json+=$(
cat << EOF cat << EOF
,
{ {
"short": false, "short": false,
"title": "More info", "title": "More info",
"value": "${alerturl}" "value": "${alerturl}"
}, }
EOF EOF
) )
fi fi
json+=$( json+=$(
cat << EOF cat << EOF
{ ,
"alias": "LinuxGSM",
"text": "*${alerttitle}*",
"attachments": [
{
"title": "",
"color": "${alertcolourhex}",
"author_name": "LinuxGSM Alert",
"author_link": "https://linuxgsm.com",
"author_icon": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"thumb_url": "${alerticon}",
"text": "",
"fields": [
{
"short": false,
"title": "Server Name",
"value": "${servername}"
},
{
"short": false,
"title": "Information",
"value": "${alertmessage}"
},
{
"short": false,
"title": "Game",
"value": "${gamename}"
},
{
"short": false,
"title": "Server IP",
"value": "${alertip}:${port}"
},
{
"short": false,
"title": "Hostname",
"value": "${HOSTNAME}"
},
{ {
"short": false, "short": false,
"title": "Server Time", "title": "Server Time",

96
lgsm/modules/alert_slack.sh

@ -50,10 +50,6 @@ json=$(
"type": "mrkdwn", "type": "mrkdwn",
"text": "*Server IP*\n\`${alertip}:${port}\`" "text": "*Server IP*\n\`${alertip}:${port}\`"
}, },
{
"type": "mrkdwn",
"text": "*Hostname*\n${HOSTNAME}"
},
{ {
"type": "mrkdwn", "type": "mrkdwn",
"text": "*Server Time*\n$(date)" "text": "*Server Time*\n$(date)"
@ -62,27 +58,7 @@ json=$(
"accessory": { "accessory": {
"type": "image", "type": "image",
"image_url": "${alerticon}", "image_url": "${alerticon}",
"alt_text": "cute cat" "alt_text": "LinuxGSM game icon"
}
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"alt_text": "LinuxGSM icon"
},
{
"type": "plain_text",
"text": "Sent by LinuxGSM ${version}",
"emoji": true
}
]
}
]
}
]
} }
EOF EOF
) )
@ -90,13 +66,14 @@ EOF
if [ -n "${querytype}" ]; then if [ -n "${querytype}" ]; then
json+=$( json+=$(
cat << EOF cat << EOF
,
{ {
"type": "section", "type": "section",
"text": { "text": {
"type": "mrkdwn", "type": "mrkdwn",
"text": "*Is my Game Server Online?*\n<https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}|Check here>" "text": "*Is my Game Server Online?*\n<https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}|Check here>"
} }
}, }
EOF EOF
) )
fi fi
@ -104,82 +81,21 @@ fi
if [ -n "${alerturl}" ]; then if [ -n "${alerturl}" ]; then
json+=$( json+=$(
cat << EOF cat << EOF
,
{ {
"type": "section", "type": "section",
"text": { "text": {
"type": "mrkdwn", "type": "mrkdwn",
"text": "*More info*\n<${alerturl}|${alerturl}>" "text": "*More info*\n<${alerturl}|${alerturl}>"
} }
}, }
EOF EOF
) )
fi fi
json+=$( json+=$(
cat << EOF cat << EOF
{ ,
"attachments": [
{
"color": "${alertcolourhex}",
"blocks": [
{
"type": "header",
"text": {
"type": "mrkdwn",
"text": "${alerttitle}",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Server Name*\n${servername}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Information*\n${alertmessage}"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Game*\n${gamename}"
},
{
"type": "mrkdwn",
"text": "*Server IP*\n\`${alertip}:${port}\`"
},
{
"type": "mrkdwn",
"text": "*Hostname*\n${HOSTNAME}"
},
{
"type": "mrkdwn",
"text": "*Server Time*\n$(date)"
}
],
"accessory": {
"type": "image",
"image_url": "${alerticon}",
"alt_text": "cute cat"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Server Time*\n${alertmessage}"
}
},
{ {
"type": "context", "type": "context",
"elements": [ "elements": [

10
lgsm/modules/alert_telegram.sh

@ -14,7 +14,7 @@ json=$(
"message_thread_id": "${telegramthreadid}", "message_thread_id": "${telegramthreadid}",
"parse_mode": "HTML", "parse_mode": "HTML",
"disable_notification": "${telegramdisablenotification}", "disable_notification": "${telegramdisablenotification}",
"text": "<b>${alerttitle}</b>\n\n<b>Server name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n "text": "<b>${alerttitle}</b>\n\n<b>Server Name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n
EOF EOF
) )
@ -43,7 +43,13 @@ EOF
) )
fn_print_dots "Sending Telegram alert" fn_print_dots "Sending Telegram alert"
telegramsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" ${curlcustomstring} "https://${telegramapi}/bot${telegramtoken}/sendMessage" | grep "error_code")
curlcustomargs=()
if [ -n "${curlcustomstring}" ]; then
read -r -a curlcustomargs <<< "${curlcustomstring}"
fi
telegramsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${curlcustomargs[@]}" "https://${telegramapi}/bot${telegramtoken}/sendMessage" | grep "error_code")
if [ -n "${telegramsend}" ]; then if [ -n "${telegramsend}" ]; then
fn_print_fail_nl "Sending Telegram alert: ${telegramsend}" fn_print_fail_nl "Sending Telegram alert: ${telegramsend}"

0
lgsm/modules/check.sh

0
lgsm/modules/check_config.sh

6
lgsm/modules/check_deps.sh

@ -75,11 +75,11 @@ fn_install_mono_repo() {
# Run the mono repo install. # Run the mono repo install.
eval "${cmd}" eval "${cmd}"
monorepoexitcode=$?
# Did Mono repo install correctly? # Did Mono repo install correctly?
if [ "${monoautoinstall}" != "1" ]; then if [ "${monoautoinstall}" != "1" ]; then
exitcode=$? if [ "${monorepoexitcode}" -ne 0 ]; then
if [ "${exitcode}" -ne 0 ]; then
fn_print_failure_nl "Unable to install Mono repository." fn_print_failure_nl "Unable to install Mono repository."
fn_script_log_fail "Unable to install Mono repository." fn_script_log_fail "Unable to install Mono repository."
else else
@ -234,7 +234,7 @@ fn_install_missing_deps() {
} }
fn_check_loop() { fn_check_loop() {
# Loop though required depenencies checking if they are installed. # Loop though required dependencies checking if they are installed.
for deptocheck in "${array_deps_required[@]}"; do for deptocheck in "${array_deps_required[@]}"; do
fn_deps_detector fn_deps_detector
done done

0
lgsm/modules/check_executable.sh

0
lgsm/modules/check_gamedig.sh

2
lgsm/modules/check_glibc.sh

@ -17,7 +17,7 @@ elif [ -z "${glibc}" ]; then
fn_print_error_nl "Checking glibc: requirement unknown" fn_print_error_nl "Checking glibc: requirement unknown"
fn_script_log_error "Checking glibc: requirement unknown" fn_script_log_error "Checking glibc: requirement unknown"
fn_sleep_time_5 fn_sleep_time_5
elif [ "$(printf '%s\n'${glibc}'\n' "${glibcversion}" | sort -V | head -n 1)" != "${glibc}" ]; then elif [ "$(printf '%s\n' "${glibc}" "${glibcversion}" | sort -V | head -n 1)" != "${glibc}" ]; then
fn_print_dots "Checking glibc" fn_print_dots "Checking glibc"
fn_print_error_nl "Checking glibc: requirements not met" fn_print_error_nl "Checking glibc: requirements not met"
fn_script_log_error "Checking glibc: requirements not met" fn_script_log_error "Checking glibc: requirements not met"

0
lgsm/modules/check_ip.sh

1
lgsm/modules/check_last_update.sh

@ -11,6 +11,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -f "${lockdir}/${selfname}-last-started.lock" ]; then if [ -f "${lockdir}/${selfname}-last-started.lock" ]; then
laststart=$(cat "${lockdir}/${selfname}-last-started.lock") laststart=$(cat "${lockdir}/${selfname}-last-started.lock")
fi fi
if [ -f "${lockdir}/last-updated.lock" ]; then if [ -f "${lockdir}/last-updated.lock" ]; then
lastupdate=$(cat "${lockdir}/last-updated.lock") lastupdate=$(cat "${lockdir}/last-updated.lock")
fi fi

0
lgsm/modules/check_logs.sh

2
lgsm/modules/check_permissions.sh

@ -249,7 +249,7 @@ fn_sys_perm_error_process() {
fi fi
} }
## Run permisions checks when not root. ## Run permissions checks when not root.
if [ "$(whoami)" != "root" ]; then if [ "$(whoami)" != "root" ]; then
fn_check_ownership fn_check_ownership
fn_check_permissions fn_check_permissions

0
lgsm/modules/check_root.sh

0
lgsm/modules/check_status.sh

0
lgsm/modules/check_steamcmd.sh

0
lgsm/modules/check_system_dir.sh

2
lgsm/modules/check_system_requirements.sh

@ -71,7 +71,7 @@ fi
if [ "${ramrequirementgb}" ]; then if [ "${ramrequirementgb}" ]; then
if (($(echo "${physmemtotalgb} < ${ramrequirementgb}" | bc -l))); then if (($(echo "${physmemtotalgb} < ${ramrequirementgb}" | bc -l))); then
fn_print_dots "Checking RAM" fn_print_dots "Checking RAM"
fn_print_warn_nl "Checking RAM: Minumum RAM requirements not met" fn_print_warn_nl "Checking RAM: Minimum RAM requirements not met"
fn_print_nl "* ${ramrequirementgb}G is required, but only ${physmemtotal} is available." fn_print_nl "* ${ramrequirementgb}G is required, but only ${physmemtotal} is available."
fn_print_nl "* ${gamename} server may fail to run or experience poor performance." fn_print_nl "* ${gamename} server may fail to run or experience poor performance."
fn_sleep_time_5 fn_sleep_time_5

0
lgsm/modules/check_tmuxception.sh

0
lgsm/modules/check_version.sh

0
lgsm/modules/command_backup.sh

0
lgsm/modules/command_check_update.sh

0
lgsm/modules/command_console.sh

2
lgsm/modules/command_debug.sh

@ -49,7 +49,7 @@ if [ -n "${glibc}" ]; then
: :
elif [ -z "${glibc}" ]; then elif [ -z "${glibc}" ]; then
echo -e "${lightblue}glibc required:\t${red}UNKNOWN${default}" echo -e "${lightblue}glibc required:\t${red}UNKNOWN${default}"
elif [ "$(printf '%s\n'${glibc}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibc}" ]; then elif [ "$(printf '%s\n' "${glibc}" "${glibcversion}" | sort -V | head -n 1)" != "${glibc}" ]; then
echo -e "${lightblue}glibc required:\t${red}${glibc} ${default}(${red}distro glibc ${glibcversion} too old${default})" echo -e "${lightblue}glibc required:\t${red}${glibc} ${default}(${red}distro glibc ${glibcversion} too old${default})"
else else
echo -e "${lightblue}glibc required:\t${green}${glibc}${default}" echo -e "${lightblue}glibc required:\t${green}${glibc}${default}"

2
lgsm/modules/command_details.sh

@ -29,7 +29,7 @@ fn_info_messages_gameserver_resource
fn_info_messages_gameserver fn_info_messages_gameserver
fn_info_messages_script fn_info_messages_script
fn_info_messages_backup fn_info_messages_backup
# Some game servers do not have parms. # Some game servers do not have params.
if [ "${shortname}" != "jc2" ] && [ "${shortname}" != "dst" ] && [ "${shortname}" != "pz" ] && [ "${engine}" != "renderware" ]; then if [ "${shortname}" != "jc2" ] && [ "${shortname}" != "dst" ] && [ "${shortname}" != "pz" ] && [ "${engine}" != "renderware" ]; then
fn_info_messages_commandlineparms fn_info_messages_commandlineparms
fi fi

0
lgsm/modules/command_dev_clear_modules.sh

0
lgsm/modules/command_dev_debug.sh

0
lgsm/modules/command_dev_detect_deps.sh

2
lgsm/modules/command_dev_detect_glibc.sh

@ -63,7 +63,7 @@ for glibc_check_var in "${glibc_check_dir_array[@]}"; do
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 ""
echo -e "Files requiring GLIBC" echo -e "Files requiring GLIBC"
echo -e "Highest verion required: filename" echo -e "Highest version required: filename"
cat "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp" cat "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp"
echo -e "" echo -e ""
echo -e "All required GLIBC versions" echo -e "All required GLIBC versions"

0
lgsm/modules/command_dev_detect_ldd.sh

0
lgsm/modules/command_dev_parse_distro_details.sh

0
lgsm/modules/command_dev_parse_game_details.sh

8
lgsm/modules/command_dev_query_raw.sh

@ -249,9 +249,9 @@ echo -e "${bold}${lightyellow}Query Port (${queryport}) - TCP Output${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
for queryip in "${queryips[@]}"; do for queryip in "${queryips[@]}"; do
echo -e "${italic}bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}''${default}" echo -e "${italic}bash -c 'exec 3<> /dev/tcp/'\"${queryip}\"'/'\"${queryport}\"''${default}"
echo -e "" echo -e ""
timeout 3 bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}'' timeout 3 bash -c 'exec 3<> /dev/tcp/'"${queryip}"'/'"${queryport}"''
querystatus="$?" querystatus="$?"
echo -e "" echo -e ""
if [ "${querystatus}" == "0" ]; then if [ "${querystatus}" == "0" ]; then
@ -268,9 +268,9 @@ echo -e "${lightgreen}TCP Raw Output${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
for queryip in "${queryips[@]}"; do for queryip in "${queryips[@]}"; do
echo -e "${italic}bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${port}''${default}" echo -e "${italic}bash -c 'exec 3<> /dev/tcp/'\"${queryip}\"'/'\"${port}\"''${default}"
echo -e "" echo -e ""
timeout 3 bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${port}'' timeout 3 bash -c 'exec 3<> /dev/tcp/'"${queryip}"'/'"${port}"''
querystatus="$?" querystatus="$?"
echo -e "" echo -e ""
if [ "${querystatus}" == "0" ]; then if [ "${querystatus}" == "0" ]; then

0
lgsm/modules/command_dev_ui.sh

0
lgsm/modules/command_fastdl.sh

0
lgsm/modules/command_install.sh

0
lgsm/modules/command_install_resources_mta.sh

21
lgsm/modules/command_mods_install.sh

@ -47,7 +47,7 @@ while [ "${compatiblemodslistindex}" -lt "${#compatiblemodslist[@]}" ]; do
echo -e "${displayedmodname} - ${displayedmoddescription} - ${displayedmodsite}" echo -e "${displayedmodname} - ${displayedmoddescription} - ${displayedmodsite}"
echo -e " * ${cyan}${displayedmodcommand}${default}" echo -e " * ${cyan}${displayedmodcommand}${default}"
# Increment index from the amount of values we just displayed. # Increment index from the amount of values we just displayed.
let "compatiblemodslistindex+=4" ((compatiblemodslistindex += 4))
((totalmodsavailable++)) ((totalmodsavailable++))
done done
@ -61,16 +61,29 @@ fn_script_log_info "${totalmodsavailable} addons/mods are available for install"
## User selects a mod. ## User selects a mod.
echo -e "" echo -e ""
while [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; do
while :; do
echo -en "Enter an ${cyan}addon/mod${default} to ${green}install${default} (or exit to abort): " echo -en "Enter an ${cyan}addon/mod${default} to ${green}install${default} (or exit to abort): "
read -r usermodselect read -r usermodselect
# Exit if user says exit or abort. # Exit if user says exit or abort.
if [ "${usermodselect}" == "exit" ] || [ "${usermodselect}" == "abort" ]; then if [ "${usermodselect}" == "exit" ] || [ "${usermodselect}" == "abort" ]; then
core_exit.sh core_exit.sh
fi
validselection=0
for availablemodcommand in "${availablemodscommands[@]}"; do
if [ "${availablemodcommand}" == "${usermodselect}" ]; then
validselection=1
break
fi
done
if [ "${validselection}" -eq 1 ]; then
break
fi
# Supplementary output upon invalid user input. # Supplementary output upon invalid user input.
elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
fn_print_error2_nl "${usermodselect} is not a valid addon/mod." fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
fi
done done
# Get mod info. # Get mod info.
currentmod="${usermodselect}" currentmod="${usermodselect}"

19
lgsm/modules/command_mods_remove.sh

@ -32,16 +32,29 @@ done
echo -e "" echo -e ""
# Keep prompting as long as the user input doesn't correspond to an available mod. # Keep prompting as long as the user input doesn't correspond to an available mod.
while [[ ! " ${installedmodslist[@]} " =~ " ${usermodselect} " ]]; do
while :; do
echo -en "Enter an ${cyan}addon/mod${default} to ${red}remove${default} (or exit to abort): " echo -en "Enter an ${cyan}addon/mod${default} to ${red}remove${default} (or exit to abort): "
read -r usermodselect read -r usermodselect
# Exit if user says exit or abort. # Exit if user says exit or abort.
if [ "${usermodselect}" == "exit" ] || [ "${usermodselect}" == "abort" ]; then if [ "${usermodselect}" == "exit" ] || [ "${usermodselect}" == "abort" ]; then
core_exit.sh core_exit.sh
fi
validselection=0
for installedmodcommand in "${installedmodslist[@]}"; do
if [ "${installedmodcommand}" == "${usermodselect}" ]; then
validselection=1
break
fi
done
if [ "${validselection}" -eq 1 ]; then
break
fi
# Supplementary output upon invalid user input. # Supplementary output upon invalid user input.
elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
fn_print_error2_nl "${usermodselect} is not a valid addon/mod." fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
fi
done done
fn_print_warning_nl "You are about to remove ${cyan}${usermodselect}${default}." fn_print_warning_nl "You are about to remove ${cyan}${usermodselect}${default}."

0
lgsm/modules/command_mods_update.sh

4
lgsm/modules/command_monitor.sh

@ -164,8 +164,8 @@ fn_monitor_check_update_source() {
fn_script_log_info "Checking update: CHECKING" fn_script_log_info "Checking update: CHECKING"
fn_print_ok "Checking update" fn_print_ok "Checking update"
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_info "Checking update: ${selfname} has requested an update and needs to be restarted" fn_script_log_info "Checking update: ${selfname} has requested a restart for an update to be applied"
alert="update-request" alert="update-restart-request"
alert.sh alert.sh
command_restart.sh command_restart.sh
core_exit.sh core_exit.sh

4
lgsm/modules/command_postdetails.sh

@ -46,7 +46,7 @@ else
fn_info_messages_gameserver fn_info_messages_gameserver
fn_info_messages_script fn_info_messages_script
fn_info_messages_backup fn_info_messages_backup
# Some game servers do not have parms. # Some game servers do not have params.
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_messages_commandlineparms fn_info_messages_commandlineparms
fi fi
@ -59,7 +59,7 @@ fi
fn_print_dots "termbin.com" fn_print_dots "termbin.com"
link=$(cat "${postdetailslog}" | { link=$(cat "${postdetailslog}" | {
nc -w 3 termbin.com 9999 nc -w 10 termbin.com 9999
echo $? > /tmp/nc_exit_status echo $? > /tmp/nc_exit_status
} | tr -d '\n\0') } | tr -d '\n\0')
nc_exit_status=$(cat /tmp/nc_exit_status) nc_exit_status=$(cat /tmp/nc_exit_status)

0
lgsm/modules/command_restart.sh

0
lgsm/modules/command_send.sh

4
lgsm/modules/command_skeleton.sh

@ -3,7 +3,7 @@
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib # Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Creates an copy of a game servers directorys. # Description: Creates an copy of a game servers directories.
commandname="SKELETON" commandname="SKELETON"
commandaction="Skeleton" commandaction="Skeleton"
@ -13,7 +13,7 @@ fn_firstcommand_set
fn_print_dots "Creating skeleton directory" fn_print_dots "Creating skeleton directory"
check.sh check.sh
# Find all directorys and create them in the skel directory # Find all directories 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=$? exitcode=$?
if [ "${exitcode}" -ne 0 ]; then if [ "${exitcode}" -ne 0 ]; then

0
lgsm/modules/command_start.sh

4
lgsm/modules/command_stop.sh

@ -16,7 +16,7 @@ fn_stop_graceful_ctrlc() {
fn_script_log_info "Graceful: CTRL+c" fn_script_log_info "Graceful: CTRL+c"
# Sends CTRL+c. # Sends CTRL+c.
tmux -L "${socketname}" send-keys -t "${sessionname}" C-c > /dev/null 2>&1 tmux -L "${socketname}" send-keys -t "${sessionname}" C-c > /dev/null 2>&1
# Waits up to 30 seconds giving the server time to shutdown gracefuly. # Waits up to 30 seconds giving the server time to shutdown gracefully.
for seconds in {1..30}; do for seconds in {1..30}; do
check_status.sh check_status.sh
if [ "${status}" == "0" ]; then if [ "${status}" == "0" ]; then
@ -293,7 +293,7 @@ fn_stop_graceful_avorion() {
fn_sleep_time_5 fn_sleep_time_5
# Sends /quit. # Sends /quit.
tmux -L "${socketname}" send-keys -t "${sessionname}" /stop ENTER > /dev/null 2>&1 tmux -L "${socketname}" send-keys -t "${sessionname}" /stop ENTER > /dev/null 2>&1
# Waits up to 30 seconds giving the server time to shutdown gracefuly. # Waits up to 30 seconds giving the server time to shutdown gracefully.
for seconds in {1..30}; do for seconds in {1..30}; do
check_status.sh check_status.sh
if [ "${status}" == "0" ]; then if [ "${status}" == "0" ]; then

0
lgsm/modules/command_test_alert.sh

0
lgsm/modules/command_ts3_server_pass.sh

0
lgsm/modules/command_update.sh

39
lgsm/modules/command_update_linuxgsm.sh

@ -16,8 +16,9 @@ info_distro.sh
info_game.sh info_game.sh
# Prevent github from using a cached version of the file if dev-debug is enabled. # Prevent github from using a cached version of the file if dev-debug is enabled.
nocache=()
if [ -f "${rootdir}/.dev-debug" ]; then if [ -f "${rootdir}/.dev-debug" ]; then
nocache="-H \"Cache-Control: no-cache\" -H \"Pragma: no-cache\"" nocache=(-H "Cache-Control: no-cache" -H "Pragma: no-cache")
fi fi
fn_script_log_info "Updating LinuxGSM" fn_script_log_info "Updating LinuxGSM"
@ -26,10 +27,10 @@ fn_print_dots "Selecting repo"
fn_script_log_info "Selecting repo" fn_script_log_info "Selecting repo"
# Select remotereponame # Select remotereponame
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
exitcode=$? exitcode=$?
if [ "${exitcode}" -ne "0" ]; then if [ "${exitcode}" -ne "0" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null
exitcode=$? exitcode=$?
if [ "${exitcode}" -ne "0" ]; then if [ "${exitcode}" -ne "0" ]; then
fn_print_fail_nl "Selecting repo: Unable to to access GitHub or Bitbucket repositories" fn_print_fail_nl "Selecting repo: Unable to to access GitHub or Bitbucket repositories"
@ -47,9 +48,9 @@ fi
# Check linuxsm.sh # Check linuxsm.sh
echo -en "checking ${remotereponame} script [ ${italic}linuxgsm.sh${default} ]\c" echo -en "checking ${remotereponame} script [ ${italic}linuxgsm.sh${default} ]\c"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
else else
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null
fi fi
exitcode=$? exitcode=$?
if [ "${exitcode}" -ne 0 ]; then if [ "${exitcode}" -ne 0 ]; then
@ -60,9 +61,9 @@ if [ "${exitcode}" -ne 0 ]; then
fi fi
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh")) tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl "${nocache[@]}" --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh"))
else else
tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh")) tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl "${nocache[@]}" --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh"))
fi fi
if [ "${tmp_script_diff}" != "" ]; then if [ "${tmp_script_diff}" != "" ]; then
@ -130,9 +131,9 @@ fi
echo -en "checking ${remotereponame} config [ ${italic}_default.cfg${default} ]\c" echo -en "checking ${remotereponame} config [ ${italic}_default.cfg${default} ]\c"
fn_script_log_info "Checking ${remotereponame} config _default.cfg" fn_script_log_info "Checking ${remotereponame} config _default.cfg"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null
else else
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null
fi fi
exitcode=$? exitcode=$?
if [ "${exitcode}" -ne 0 ]; then if [ "${exitcode}" -ne 0 ]; then
@ -143,9 +144,9 @@ if [ "${exitcode}" -ne 0 ]; then
fi fi
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg")) config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl "${nocache[@]}" --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
else else
config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg")) config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl "${nocache[@]}" --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
fi fi
if [ "${config_file_diff}" != "" ]; then if [ "${config_file_diff}" != "" ]; then
@ -165,9 +166,9 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
echo -en "checking ${remotereponame} config [ ${italic}${distroid}-${distroversioncsv}.csv${default} ]\c" echo -en "checking ${remotereponame} config [ ${italic}${distroid}-${distroversioncsv}.csv${default} ]\c"
fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
else else
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
fi fi
exitcode=$? exitcode=$?
if [ "${exitcode}" -ne 0 ]; then if [ "${exitcode}" -ne 0 ]; then
@ -178,9 +179,9 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
fi fi
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv")) config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl "${nocache[@]}" --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv"))
else else
config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv")) config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl "${nocache[@]}" --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv"))
fi fi
if [ "${config_file_diff}" != "" ]; then if [ "${config_file_diff}" != "" ]; then
@ -204,9 +205,9 @@ if [ -n "${modulesdir}" ]; then
echo -en "checking ${remotereponame} module [ ${italic}${modulefile}${default} ]\c" echo -en "checking ${remotereponame} module [ ${italic}${modulefile}${default} ]\c"
github_file_url_dir="lgsm/modules" github_file_url_dir="lgsm/modules"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null
else else
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null curl "${nocache[@]}" --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null
fi fi
exitcode=$? exitcode=$?
if [ "${exitcode}" -ne 0 ]; then if [ "${exitcode}" -ne 0 ]; then
@ -224,9 +225,9 @@ if [ -n "${modulesdir}" ]; then
else else
# compare file # compare file
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}")) module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl "${nocache[@]}" --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}"))
else else
module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}")) module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl "${nocache[@]}" --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}"))
fi fi
# results # results

0
lgsm/modules/command_validate.sh

0
lgsm/modules/command_wipe.sh

0
lgsm/modules/compress_unreal_maps.sh

38
lgsm/modules/core_dl.sh

@ -46,6 +46,18 @@ fn_dl_steamcmd() {
validate="validate" validate="validate"
fi fi
# steamcmdcommand can contain multiple arguments; treat it as an argv array.
steamcmdcommandarray=()
read -r -a steamcmdcommandarray <<< "${steamcmdcommand}"
unbuffercommand=()
if [ -n "${unbuffer}" ]; then
unbuffercommand=("${unbuffer}")
fi
validateparam=()
if [ -n "${validate}" ]; then
validateparam=("${validate}")
fi
# To do error checking for SteamCMD the output of steamcmd will be saved to a log. # To do error checking for SteamCMD the output of steamcmd will be saved to a log.
steamcmdlog="${lgsmlogdir}/${selfname}-steamcmd.log" steamcmdlog="${lgsmlogdir}/${selfname}-steamcmd.log"
@ -61,29 +73,29 @@ fn_dl_steamcmd() {
if [ "${appid}" == "90" ]; then if [ "${appid}" == "90" ]; then
# If using a specific branch. # 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}" "${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
elif [ -n "${branch}" ]; then 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}" "${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
else else
${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" "${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
fi fi
# Force Windows Platform type. # Force Windows Platform type.
elif [ "${steamcmdforcewindows}" == "yes" ]; then 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}" "${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
elif [ -n "${branch}" ]; then 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}" "${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
else else
${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" "${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
fi fi
# All other servers. # All other servers.
else 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}" "${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
elif [ -n "${branch}" ]; then 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}" "${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
else else
${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" "${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
fi fi
fi fi
@ -132,9 +144,9 @@ fn_dl_steamcmd() {
fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Corrupt update files" fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Corrupt update files"
fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Corrupt update files" fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Corrupt update files"
else else
fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured" fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Unknown error occurred"
fn_print_nl "Please provide content log to LinuxGSM developers https://linuxgsm.com/steamcmd-error" fn_print_nl "Please provide content log to LinuxGSM developers https://linuxgsm.com/steamcmd-error"
fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured" fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Unknown error occurred"
fi fi
elif [ "${exitcode}" -ne 0 ]; then elif [ "${exitcode}" -ne 0 ]; then
fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}" fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}"
@ -188,8 +200,8 @@ fn_dl_hash() {
hashbin="sha512sum" hashbin="sha512sum"
hashtype="SHA512" hashtype="SHA512"
else else
fn_script_log_error "hash lengh not known for hash type" fn_script_log_error "hash length not known for hash type"
fn_print_error_nl "hash lengh not known for hash type" fn_print_error_nl "hash length not known for hash type"
core_exit.sh core_exit.sh
fi fi
echo -en "verifying ${local_filename} with ${hashtype}..." echo -en "verifying ${local_filename} with ${hashtype}..."

0
lgsm/modules/core_exit.sh

0
lgsm/modules/core_getopt.sh

0
lgsm/modules/core_github.sh

2
lgsm/modules/core_legacy.sh

@ -3,7 +3,7 @@
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib # Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Code for backwards compatability with older versions of LinuxGSM. # Description: Code for backwards compatibility with older versions of LinuxGSM.
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

0
lgsm/modules/core_logs.sh

2
lgsm/modules/core_messages.sh

@ -560,7 +560,7 @@ fn_print_restart_warning() {
} }
# Functions below are used to ensure that logs and UI correctly reflect the command it is actually running. # Functions below are used to ensure that logs and UI correctly reflect the command it is actually running.
# Useful when a command has to call upon another command causing the other command to overrite commandname variables # Useful when a command has to call upon another command causing the other command to overwrite commandname variables
# Used to remember the command that ran first. # Used to remember the command that ran first.
fn_firstcommand_set() { fn_firstcommand_set() {

204
lgsm/modules/core_modules.sh

@ -21,24 +21,6 @@ core_dl.sh() {
fi fi
} }
core_messages.sh() {
modulefile="${FUNCNAME[0]}"
if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
fn_fetch_core_dl "lgsm/modules" "core_messages.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
else
fn_bootstrap_fetch_file_github "lgsm/modules" "core_messages.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
fi
}
core_legacy.sh() {
modulefile="${FUNCNAME[0]}"
if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
fn_fetch_core_dl "lgsm/modules" "core_legacy.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
else
fn_bootstrap_fetch_file_github "lgsm/modules" "core_legacy.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
fi
}
core_exit.sh() { core_exit.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
@ -54,17 +36,35 @@ core_getopt.sh() {
fn_fetch_module fn_fetch_module
} }
core_trap.sh() { core_github.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
core_legacy.sh() {
modulefile="${FUNCNAME[0]}"
if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then
fn_fetch_core_dl "lgsm/modules" "core_legacy.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
else
fn_bootstrap_fetch_file_github "lgsm/modules" "core_legacy.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
fi
}
core_messages.sh() {
modulefile="${FUNCNAME[0]}"
if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then
fn_fetch_core_dl "lgsm/modules" "core_messages.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
else
fn_bootstrap_fetch_file_github "lgsm/modules" "core_messages.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
fi
}
core_steamcmd.sh() { core_steamcmd.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
core_github.sh() { core_trap.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -91,87 +91,87 @@ command_details.sh() {
fn_fetch_module fn_fetch_module
} }
command_sponsor.sh() { command_fastdl.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_postdetails.sh() { command_install.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_test_alert.sh() { command_install_resources_mta.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_monitor.sh() { command_mods_install.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_start.sh() { command_mods_remove.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_stop.sh() { command_mods_update.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_validate.sh() { command_monitor.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_install.sh() { command_postdetails.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_install_resources_mta.sh() { command_restart.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
install_squad_license.sh() { command_send.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_mods_install.sh() { command_skeleton.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_mods_update.sh() { command_sponsor.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_mods_remove.sh() { command_start.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_fastdl.sh() { command_stop.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_ts3_server_pass.sh() { command_test_alert.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_restart.sh() { command_ts3_server_pass.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_skeleton.sh() { command_validate.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -181,7 +181,7 @@ command_wipe.sh() {
fn_fetch_module fn_fetch_module
} }
command_send.sh() { install_squad_license.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -277,12 +277,12 @@ compress_unreal2_maps.sh() {
# Mods # Mods
mods_list.sh() { mods_core.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
mods_core.sh() { mods_list.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -299,37 +299,37 @@ command_dev_debug.sh() {
fn_fetch_module fn_fetch_module
} }
command_dev_parse_game_details.sh() { command_dev_detect_deps.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_dev_parse_distro_details.sh() { command_dev_detect_glibc.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_dev_detect_deps.sh() { command_dev_detect_ldd.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_dev_detect_glibc.sh() { command_dev_parse_distro_details.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_dev_detect_ldd.sh() { command_dev_parse_game_details.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_dev_ui.sh() { command_dev_query_raw.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_dev_query_raw.sh() { command_dev_ui.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -346,27 +346,27 @@ fix_ark.sh() {
fn_fetch_module fn_fetch_module
} }
fix_av.sh() { fix_arma3.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_arma3.sh() { fix_armar.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_armar.sh() { fix_av.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_bt.sh() { fix_bo.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_bo.sh() { fix_bt.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -446,67 +446,62 @@ fix_rw.sh() {
fn_fetch_module fn_fetch_module
} }
fix_sfc.sh() { fix_samp.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
}
fix_sm.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_st.sh() { fix_sfc.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_steamcmd.sh() { fix_sm.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_terraria.sh() { fix_sof2.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_tf2.sh() { fix_squad.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_ut3.sh() { fix_st.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_rust.sh() { fix_steamcmd.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_samp.sh() { fix_terraria.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_sdtd.sh() { fix_tf2.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_sof2.sh() { fix_ts3.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_squad.sh() { fix_unt.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fix_ts3.sh() { fix_ut.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -516,12 +511,7 @@ fix_ut2k4.sh() {
fn_fetch_module fn_fetch_module
} }
fix_ut.sh() { fix_ut3.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
}
fix_unt.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -585,27 +575,27 @@ alert_email.sh() {
fn_fetch_module fn_fetch_module
} }
alert_ifttt.sh() { alert_gotify.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
alert_pushbullet.sh() { alert_ifttt.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
alert_pushover.sh() { alert_ntfy.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
alert_gotify.sh() { alert_pushbullet.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
alert_telegram.sh() { alert_pushover.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -620,10 +610,11 @@ alert_slack.sh() {
fn_fetch_module fn_fetch_module
} }
alert_ntfy.sh() { alert_telegram.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
# Logs # Logs
core_logs.sh() { core_logs.sh() {
@ -639,58 +630,57 @@ query_gamedig.sh() {
} }
# Update # Update
command_check_update.sh() {
command_update_modules.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_update_linuxgsm.sh() { command_update.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_update.sh() { command_update_linuxgsm.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
command_check_update.sh() { command_update_modules.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
update_ts3.sh() { fn_update_modules.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
update_mc.sh() { update_fctr.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
update_mcb.sh() { update_jk2.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
update_pmc.sh() { update_mc.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
update_mta.sh() { update_mcb.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
update_fctr.sh() { update_mta.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
update_jk2.sh() { update_pmc.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -700,7 +690,7 @@ update_steamcmd.sh() {
fn_fetch_module fn_fetch_module
} }
update_vints.sh() { update_ts3.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -710,12 +700,12 @@ update_ut99.sh() {
fn_fetch_module fn_fetch_module
} }
update_xnt.sh() { update_vints.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
fn_update_modules.sh() { update_xnt.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -723,6 +713,10 @@ fn_update_modules.sh() {
# #
## Installer modules ## Installer modules
# #
check_gamedig.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
}
fn_autoinstall() { fn_autoinstall() {
autoinstall=1 autoinstall=1
@ -739,32 +733,32 @@ install_config.sh() {
fn_fetch_module fn_fetch_module
} }
install_factorio_save.sh() { install_dl_ut2k4.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
check_gamedig.sh() { install_dst_token.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
install_dst_token.sh() { install_eula.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
install_eula.sh() { install_factorio_save.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
install_gsquery.sh() { install_gslt.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
install_gslt.sh() { install_gsquery.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
@ -788,6 +782,7 @@ install_server_dir.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
} }
install_server_files.sh() { install_server_files.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module
@ -818,11 +813,6 @@ install_ut2k4.sh() {
fn_fetch_module fn_fetch_module
} }
install_dl_ut2k4.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
}
install_ut2k4_key.sh() { install_ut2k4_key.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module

22
lgsm/modules/core_steamcmd.sh

@ -185,12 +185,12 @@ fn_update_steamcmd_remotebuild() {
fi fi
# password for branch not needed to check the buildid # password for branch not needed to check the buildid
remotebuildversion=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_request "${appid}" +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed -e '/"branches"/,/^}/!d' | sed -n "/\"${branch}\"/,/}/p" | grep -m 1 buildid | tr -cd '[:digit:]') remotebuild=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_request "${appid}" +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed -e '/"branches"/,/^}/!d' | sed -n "/\"${branch}\"/,/}/p" | grep -m 1 buildid | tr -cd '[:digit:]')
if [ "${firstcommandname}" != "INSTALL" ]; then if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}" fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set. # Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}" fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build" fn_script_log_fail "Checking remote build"
core_exit.sh core_exit.sh
@ -200,7 +200,7 @@ fn_update_steamcmd_remotebuild() {
fi fi
else else
# Checks if remotebuild variable has been set. # Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build" fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build" fn_script_log_fail "Unable to get remote build"
core_exit.sh core_exit.sh
@ -211,14 +211,14 @@ fn_update_steamcmd_remotebuild() {
fn_update_steamcmd_compare() { fn_update_steamcmd_compare() {
fn_print_dots "Checking for update: ${remotelocation}" fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update. # Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile. # Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock" date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n" fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available" fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}" fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}" fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}" fn_print_nl "* Branch: ${branch}"
fi fi
@ -229,16 +229,17 @@ fn_update_steamcmd_compare() {
fn_print "\n" fn_print "\n"
fn_script_log_info "Update available" fn_script_log_info "Update available"
fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}" fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}" fn_script_log_info "Branch: ${branch}"
fi fi
if [ -n "${betapassword}" ]; then if [ -n "${betapassword}" ]; then
fn_script_log_info "Branch password: ${betapassword}" fn_script_log_info "Branch password: ${betapassword}"
fi fi
fn_script_log_info "${localbuild} > ${remotebuildversion}" fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
unset updateonstart unset updateonstart
check_status.sh check_status.sh
# If server stopped. # If server stopped.
@ -257,7 +258,6 @@ fn_update_steamcmd_compare() {
fn_firstcommand_reset fn_firstcommand_reset
fi fi
unset exitbypass unset exitbypass
date +%s > "${lockdir:?}/last-updated.lock"
alert="update" alert="update"
elif [ "${commandname}" == "CHECK-UPDATE" ]; then elif [ "${commandname}" == "CHECK-UPDATE" ]; then
alert="check-update" alert="check-update"
@ -268,7 +268,7 @@ fn_update_steamcmd_compare() {
fn_print "\n" fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available" fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}" fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}" fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}" fn_print_nl "* Branch: ${branch}"
fi fi
@ -279,7 +279,7 @@ fn_update_steamcmd_compare() {
fn_print "\n" fn_print "\n"
fn_script_log_info "No update available" fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}" fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}" fn_script_log_info "Branch: ${branch}"
fi fi

6
lgsm/modules/core_trap.sh

@ -8,10 +8,12 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_exit_trap() { fn_exit_trap() {
local saved_exit_status=$?
echo -e ""
if [ -z "${exitcode}" ]; then if [ -z "${exitcode}" ]; then
exitcode=$? exitcode=${saved_exit_status}
fi fi
echo -e ""
if [ -z "${exitcode}" ]; then if [ -z "${exitcode}" ]; then
exitcode=0 exitcode=0
fi fi

0
lgsm/modules/fix.sh

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

Loading…
Cancel
Save