diff --git a/.editorconfig b/.editorconfig index ef3ef8bd98..f20e02e1c9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,3 +11,18 @@ indent_size = 4 trim_trailing_whitespace = true end_of_line = lf insert_final_newline = true + +# YAML Files +[*.{yml,yaml}] +indent_size = 2 +indent_style = space + +# JSON Files +[*.{json,json5,webmanifest}] +indent_size = 2 +indent_style = space + +# BASH Files +[*.{.sh}] +indent_style = tab +indent_size = 4 diff --git a/.gitattributes b/.gitattributes index bbe6490d1f..cfa570e678 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,16 +7,16 @@ *.so.6 binary # Custom for Visual Studio -*.cs diff=csharp +*.cs diff=csharp # Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain +*.doc diff=astextplain +*.DOC diff=astextplain *.docx diff=astextplain *.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 31d08d206e..f0b0717539 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -2,25 +2,26 @@ name: Bug Report about: Found a bug? Raise a report. title: "[BUG]" -labels: 'type: bug' -assignees: '' - +labels: "type: bug" +assignees: "" --- Issues raised here are **ONLY** for: -* LinuxGSM bugs. -* Feature suggestions. -* Code contributions. + +- LinuxGSM bugs. +- Feature suggestions. +- Code contributions. Issues raised here are **NOT** for: -* General support. -* Specific game server issues (e.g CS:GO, TF2). -* Dedicated server issues (e.g Ubuntu, CentOS). -* Anything not directly related to LinuxGSM development. + +- General support. +- Specific game server issues (e.g CS:GO, TF2). +- Dedicated server issues (e.g Ubuntu, CentOS). +- Anything not directly related to LinuxGSM development. For general support visit the **[LinuxGSM-Support](https://linuxgsm.com/support)**. -***Please use the template below, deleting the above text*** +**_Please use the template below, deleting the above text_** ## User Story @@ -28,10 +29,10 @@ As a [user description], I want [desired action] so that [desired outcome]. ## Basic info -* **Distro:** [Ubuntu 18.04] -* **Game:** [Garry's Mod] -* **Command:** [Monitor] -* **LinuxGSM version:** [v20.1.3] +- **Distro:** [Ubuntu 18.04] +- **Game:** [Garry's Mod] +- **Command:** [Monitor] +- **LinuxGSM version:** [v20.1.3] ## Further Information @@ -40,6 +41,7 @@ A clear description of what the bug is and any ideas on how to resolve it. Plus ## To Reproduce Steps to reproduce the behaviour: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index 8ba27fa9f8..992178f073 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -2,25 +2,26 @@ name: Feature Request about: Suggest an idea for LinuxGSM. title: "[FEATURE]" -labels: 'type: feature request' -assignees: '' - +labels: "type: feature request" +assignees: "" --- Issues raised here are **ONLY** for: -* LinuxGSM bugs. -* Feature suggestions. -* Code contributions. + +- LinuxGSM bugs. +- Feature suggestions. +- Code contributions. Issues raised here are **NOT** for: -* General support. -* Specific game server issues (e.g CS:GO, TF2). -* Dedicated server issues (e.g Ubuntu, CentOS). -* Anything not directly related to LinuxGSM development. + +- General support. +- Specific game server issues (e.g CS:GO, TF2). +- Dedicated server issues (e.g Ubuntu, CentOS). +- Anything not directly related to LinuxGSM development. For general support visit the **[LinuxGSM Support](https://linuxgsm.com/support)** page. -***Please use the template below, deleting the above text*** +**_Please use the template below, deleting the above text_** ## User Story @@ -28,10 +29,10 @@ As a [user description], I want [desired action] so that [desired outcome]. ## Basic info -* **Distro:** [Ubuntu 20.04] -* **Game:** [Garry's Mod] -* **Command:** [Monitor] -* **LinuxGSM version:** [v20.1.3] +- **Distro:** [Ubuntu 20.04] +- **Game:** [Garry's Mod] +- **Command:** [Monitor] +- **LinuxGSM version:** [v20.1.3] ## Further Information diff --git a/.github/ISSUE_TEMPLATE/new-server-request.md b/.github/ISSUE_TEMPLATE/new-server-request.md index 57bee9cbee..bedc4f5063 100644 --- a/.github/ISSUE_TEMPLATE/new-server-request.md +++ b/.github/ISSUE_TEMPLATE/new-server-request.md @@ -2,9 +2,8 @@ name: New Server Request about: Suggest a new game server to be added. title: "[Server Request]" -labels: 'type: game server request' -assignees: '' - +labels: "type: game server request" +assignees: "" --- ## What game server would you like to add? @@ -17,8 +16,8 @@ Provide any useful documentation or resources that might help. ## Is the server on Steam? -* [ ] Yes -* [ ] No +- [ ] Yes +- [ ] No If yes Use SteamDB to get the appid. (https://steamdb.info). @@ -28,5 +27,5 @@ If yes Use SteamDB to get the appid. (https://steamdb.info). We only support Linux servers and do **not** support Wine. -* [ ] Yes -* [ ] No +- [ ] Yes +- [ ] No diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c39f10ad4d..443cf3becc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,6 @@ # Set update schedule for GitHub Actions version: 2 updates: - - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/.github/labeler.yml b/.github/labeler.yml index 5cd6740d41..0ceeeae72f 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,98 +1,98 @@ # Add/remove 'critical' label if issue contains the words 'urgent' or 'critical' # Type "type: game server request": - - '/(Server Request)/i' + - "/(Server Request)/i" "type: bug": - - '/(bug)/i' + - "/(bug)/i" "type: feature request": - - '/(feature)/i' + - "/(feature)/i" # Commands "command: backup": - - '/(backup)/i' + - "/(backup)/i" "command: console": - - '/(console|tmux)/i' + - "/(console|tmux)/i" "command: debug": - - '/(debug)/i' + - "/(debug)/i" "command: details": - - '/(details)/i' + - "/(details)/i" "command: fast-dl": - - '/(fast-dl|fastdl)/i' + - "/(fast-dl|fastdl)/i" "command: install": - - '/(install)/i' + - "/(install)/i" "command: mods": - - '/(mods)/i' + - "/(mods)/i" "command: monitor": - - '/(monitor)/i' + - "/(monitor)/i" "command: post-details": - - '/(post-details)/i' + - "/(post-details)/i" "command: restart": - - '/(restart)/i' + - "/(restart)/i" "command: send": - - '/(send)/i' + - "/(send)/i" "command: skeleton": - - '/(skeleton)/i' + - "/(skeleton)/i" "command: start": - - '/(start)/i' + - "/(start)/i" "command: stop": - - '/(stop)/i' + - "/(stop)/i" "command: update-lgsm": - - '/(update-lgsm)/i' + - "/(update-lgsm)/i" "command: update": - - '/(update)/i' + - "/(update)/i" "command: validate": - - '/(validate)/i' + - "/(validate)/i" "command: wipe": - - '/(wipe)/i' + - "/(wipe)/i" # Distros "distro: AlmaLinux": - - '/(Alma)/i' + - "/(Alma)/i" "distro: Arch Linux": - - '/(Arch)/i' + - "/(Arch)/i" "distro: CentOS": - - '/(CentOS)/i' + - "/(CentOS)/i" "distro: Debian": - - '/(Debian)/i' + - "/(Debian)/i" "distro: Fedora": - - '/(Fedora)/i' + - "/(Fedora)/i" "distro: openSUSE": - - '/(openSUSE|suse)/i' + - "/(openSUSE|suse)/i" "distro: Rocky Linux": - - '/(Rocky)/i' + - "/(Rocky)/i" "distro: Slackware": - - '/(Slackware)/i' + - "/(Slackware)/i" "distro: Ubuntu": - - '/(Ubuntu)/i' + - "/(Ubuntu)/i" # Info "info: alerts": - - '/(alert)/i' + - "/(alert)/i" "info: dependency": - - '/(dependency|deps)/i' + - "/(dependency|deps)/i" "info: docker": - - '/(docker)/i' + - "/(docker)/i" "info: docs": - - '/(documentation|docs)/i' + - "/(documentation|docs)/i" "info: email": - - '/(postfix|sendmail|exim|smtp)/i' + - "/(postfix|sendmail|exim|smtp)/i" "info: query": - - '/(gamedig|gsquery)/i' + - "/(gamedig|gsquery)/i" "info: steamcmd": - - '/(steamcmd)/i' + - "/(steamcmd)/i" "info: systemd": - - '/(systemd)/i' + - "/(systemd)/i" "info: tmux": - - '/(tmux)/i' + - "/(tmux)/i" "info: website": - - '/(website)/i' + - "/(website)/i" # Games "game: Ark: Survival Evolved": - - '/(Ark: Survival Evolved|Ark)/i' + - "/(Ark: Survival Evolved|Ark)/i" "game: ARMA 3": - - '/(ARMA 3)/i' + - "/(ARMA 3)/i" "game: Assetto Corsa": - - '/(Assetto Corsa)/i' + - "/(Assetto Corsa)/i" "game: Avorion": - - '/(Avorion)/i' + - "/(Avorion)/i" "game: Ballistic Overkill": - - '/(Ballistic Overkill)/i' + - "/(Ballistic Overkill)/i" "game: Barotrauma": - - '/(Barotrauma)/i' + - "/(Barotrauma)/i" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index af1c7fabad..a0c40a1508 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,29 +6,30 @@ Fixes #[issue] ## Type of change -* [ ] Bug fix (a change which fixes an issue). -* [ ] New feature (change which adds functionality). -* [ ] New Server (new server added). -* [ ] Refactor (restructures existing code). -* [ ] Comment update (typo, spelling, explanation, examples, etc). +- [ ] Bug fix (a change which fixes an issue). +- [ ] New feature (change which adds functionality). +- [ ] New Server (new server added). +- [ ] Refactor (restructures existing code). +- [ ] Comment update (typo, spelling, explanation, examples, etc). ## Checklist PR will not be merged until all steps are complete. -* [ ] This pull request links to an issue. -* [ ] This pull request uses the `develop` branch as its base. -* [ ] This pull request Subject follows the Conventional Commits standard. -* [ ] This code follows the style guidelines of this project. -* [ ] I have performed a self-review of my code. -* [ ] I have checked that this code is commented where required. -* [ ] I have provided a detailed with enough description of this PR. -* [ ] I have checked If documentation needs updating. +- [ ] This pull request links to an issue. +- [ ] This pull request uses the `develop` branch as its base. +- [ ] This pull request Subject follows the Conventional Commits standard. +- [ ] This code follows the style guidelines of this project. +- [ ] I have performed a self-review of my code. +- [ ] I have checked that this code is commented where required. +- [ ] I have provided a detailed with enough description of this PR. +- [ ] I have checked If documentation needs updating. ## Documentation If documentation does need updating either update it by creating a PR (preferred) or request a documentation update. -* User docs: https://github.com/GameServerManagers/LinuxGSM-Docs -* Dev docs: https://github.com/GameServerManagers/LinuxGSM-Dev-Docs + +- User docs: https://github.com/GameServerManagers/LinuxGSM-Docs +- Dev docs: https://github.com/GameServerManagers/LinuxGSM-Dev-Docs **Thank you for your Pull Request!** diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 44e841ec12..ad5a88a7d3 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -11,8 +11,8 @@ permissions: jobs: update_release_draft: permissions: - contents: write # for release-drafter/release-drafter to create a github release - pull-requests: write # for release-drafter/release-drafter to add label to PR + contents: write # for release-drafter/release-drafter to create a github release + pull-requests: write # for release-drafter/release-drafter to add label to PR runs-on: ubuntu-latest steps: # Drafts your next Release notes as Pull Requests are merged into "master" diff --git a/.github/workflows/git-sync.yml b/.github/workflows/git-sync.yml index fb0b3c477c..b43996dc64 100644 --- a/.github/workflows/git-sync.yml +++ b/.github/workflows/git-sync.yml @@ -10,16 +10,16 @@ jobs: GitHub-to-Bitbucket: runs-on: ubuntu-latest steps: - - name: webfactory/ssh-agent@v0.5.4 - uses: webfactory/ssh-agent@v0.5.4 - with: - ssh-private-key: ${{ secrets.BITBUCKET_SECRET }} + - name: webfactory/ssh-agent@v0.5.4 + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.BITBUCKET_SECRET }} - - name: wei/git-sync@v3.0.0 - uses: wei/git-sync@v3.0.0 - with: - ssh_private_key: ${{ secrets.BITBUCKET_SECRET }} - source_repo: "https://github.com/GameServerManagers/LinuxGSM" - source_branch: "refs/heads/*" - destination_repo: "git@bitbucket.org:GameServerManagers/linuxgsm.git" - destination_branch: "refs/heads/*" + - name: wei/git-sync@v3.0.0 + uses: wei/git-sync@v3.0.0 + with: + ssh_private_key: ${{ secrets.BITBUCKET_SECRET }} + source_repo: "https://github.com/GameServerManagers/LinuxGSM" + source_branch: "refs/heads/*" + destination_repo: "git@bitbucket.org:GameServerManagers/linuxgsm.git" + destination_branch: "refs/heads/*" diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index ba69d5e19d..7526d2ce6a 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -9,8 +9,8 @@ permissions: jobs: triage: permissions: - contents: read # for github/issue-labeler to get repo contents - issues: write # for github/issue-labeler to create or remove labels + contents: read # for github/issue-labeler to get repo contents + issues: write # for github/issue-labeler to create or remove labels runs-on: ubuntu-latest steps: - uses: github/issue-labeler@v2.5 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000000..7f34c51b6a --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,55 @@ +--- +################################# +################################# +## Super Linter GitHub Actions ## +################################# +################################# +name: Lint Code Base + +# +# Documentation: +# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions +# + +############################# +# Start the job on all push # +############################# +on: + push: + branches-ignore: [master, main] + # Remove the line above to run when pushing to master + pull_request: + +############### +# Set the Job # +############### +jobs: + build: + # Name the Job + name: Lint Code Base + # Set the agent to run on + runs-on: ubuntu-latest + + ################## + # Load all steps # + ################## + steps: + ########################## + # Checkout the code base # + ########################## + - name: Checkout Code + uses: actions/checkout@v2 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + ################################ + # Run Linter against code base # + ################################ + - name: Lint Code Base + uses: github/super-linter@v4 + env: + VALIDATE_ALL_CODEBASE: false + # Change to 'master' if your main branch differs + DEFAULT_BRANCH: main + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 7c17c56bf3..320b851a14 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -1,8 +1,8 @@ -name: 'Lock Threads' +name: "Lock Threads" on: schedule: - - cron: '0 0 * * *' + - cron: "0 0 * * *" permissions: contents: read @@ -10,8 +10,8 @@ permissions: jobs: lock: permissions: - issues: write # for dessant/lock-threads to lock issues - pull-requests: write # for dessant/lock-threads to lock PRs + issues: write # for dessant/lock-threads to lock issues + pull-requests: write # for dessant/lock-threads to lock PRs runs-on: ubuntu-latest steps: - uses: dessant/lock-threads@v3 diff --git a/.github/workflows/potential-duplicates.yml b/.github/workflows/potential-duplicates.yml index 8c9fe7cc73..47356dba8f 100644 --- a/.github/workflows/potential-duplicates.yml +++ b/.github/workflows/potential-duplicates.yml @@ -12,9 +12,9 @@ jobs: # Issue title filter work with anymatch https://www.npmjs.com/package/anymatch. # Any matched issue will stop detection immediately. # You can specify multi filters in each line. - filter: '' + filter: "" # Exclude keywords in title before detecting. - exclude: '' + exclude: "" # Label to set, when potential duplicates are detected. label: potential-duplicate # Get issues with state to compare. Supported state: 'all', 'closed', 'open'. diff --git a/.github/workflows/update-copyright-years-in-license-file.yml b/.github/workflows/update-copyright-years-in-license-file.yml new file mode 100644 index 0000000000..01af6dd3c8 --- /dev/null +++ b/.github/workflows/update-copyright-years-in-license-file.yml @@ -0,0 +1,17 @@ +--- +name: Update copyright year(s) in license file + +on: + schedule: + - cron: "0 3 1 1 *" # 03:00 AM on January 1 + +jobs: + update-license-year: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: FantasticFiasco/action-update-license-year@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/version-check.sh b/.github/workflows/version-check.sh index 44215385d8..f470fd02b9 100644 --- a/.github/workflows/version-check.sh +++ b/.github/workflows/version-check.sh @@ -1,5 +1,5 @@ -version=$(grep "version=" linuxgsm.sh | sed -e 's/version//g'| tr -d '="') -modulesversion=$(grep "modulesversion=" lgsm/functions/core_functions.sh | sed -e 's/modulesversion//g'| tr -d '="') +version=$(grep "version=" linuxgsm.sh | sed -e 's/version//g' | tr -d '="') +modulesversion=$(grep "modulesversion=" lgsm/functions/core_functions.sh | sed -e 's/modulesversion//g' | tr -d '="') if [ "${version}" != "${modulesversion}" ]; then echo "Error! LinuxGSM version mismatch" diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml index 4c06d86d77..b2aac2f870 100644 --- a/.github/workflows/version-check.yml +++ b/.github/workflows/version-check.yml @@ -18,9 +18,9 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 - # Runs a single command using the runners shell - - name: compare versions - run: chmod +x .github/workflows/version-check.sh; .github/workflows/version-check.sh + # Runs a single command using the runners shell + - name: compare versions + run: chmod +x .github/workflows/version-check.sh; .github/workflows/version-check.sh diff --git a/.gitignore b/.gitignore index 12218bea33..8bb6a5b32c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.db .idea +/node_modules diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000000..02d542d509 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "plugins": ["prettier-plugin-sh"] +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..0ceb990881 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + "recommendations": [ + "ms-python.python", + "editorconfig.editorconfig", + "yzhang.markdown-all-in-one", + "esbenp.prettier-vscode", + "timonwong.shellcheck", + "foxundermoon.shell-format", + "redhat.vscode-yaml" + ] +} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 65a0143f5f..a693252811 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,4 +1,3 @@ - # Contributor Covenant Code of Conduct ## Our Pledge @@ -18,24 +17,24 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the - overall community +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or - advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email - address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting ## Enforcement Responsibilities @@ -107,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within @@ -120,14 +119,14 @@ version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. Community Impact Guidelines were inspired by -[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. +[Mozilla's code of conduct enforcement ladder][mozilla coc]. For answers to common questions about this code of conduct, see the FAQ at -[https://www.contributor-covenant.org/faq][FAQ]. Translations are available +[https://www.contributor-covenant.org/faq][faq]. Translations are available at [https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html -[Mozilla CoC]: https://github.com/mozilla/diversity -[FAQ]: https://www.contributor-covenant.org/faq +[mozilla coc]: https://github.com/mozilla/diversity +[faq]: https://www.contributor-covenant.org/faq [translations]: https://www.contributor-covenant.org/translations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1a2d7a3c81..7b549c795b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,32 +6,33 @@ The following is a set of guidelines for contributing to LinuxGSM, which are hos ## Table of Contents - [Contributing to LinuxGSM](#contributing-to-linuxgsm) - * [Table of Contents](#table-of-contents) - * [Code of Conduct](#code-of-conduct) - * [🎉 Bug/Enhancement Contributions 🐛](#bug-enhancement-contributions) - + [🐛Reporting Bugs](#reporting-bugs) - - [Before Submitting A Bug Report](#before-submitting-a-bug-report) - - [How Do I Submit A (Good) Bug Report?](#how-do-i-submit-a--good--bug-report-) - + [🎉Suggesting Features](#suggesting-features) - - [Before Submitting An Feature Suggestion](#before-submitting-an-feature-suggestion) - - [How Do I Submit A (Good) Feature Suggestion?](#how-do-i-submit-a--good--feature-suggestion-) - + [🎮 Game Server Requests](#game-server-requests) - - [Before Submitting a Game Server Request](#before-submitting-a-game-server-request) - - [How Do I Submit A (Good) Game Server Request?](#how-do-i-submit-a--good--game-server-request-) - + [🎮 Game Server Specific Issues](#game-server-specific-issues) - * [💻 Code Contributions](#code-contributions) - + [Pull Requests](#pull-requests) - - [Pull Request naming convention](#pull-request-naming-convention) - + [Testing](#testing) - - [Pull Request Status Checks](#pull-request-status-checks) - - [Test Environment](#test-environment) - + [:wine_glass: Styleguides](#-wine-glass--styleguides) - - [Git Commit Messages](#git-commit-messages) - - [BASH Styleguide](#bash-styleguide) - * [:blue_book: Document Contributions](#-blue-book--document-contributions) - + [Documentation Styleguide](#documentation-styleguide) - * [Issue and Pull Request Labels](#issue-and-pull-request-labels) +[Contributing to LinuxGSM](#contributing-to-linuxgsm) + +- [Table of Contents](#table-of-contents) +- [Code of Conduct](#code-of-conduct) +- [🎉 Bug/Enhancement Contributions 🐛](#bug-enhancement-contributions) + - [🐛Reporting Bugs](#reporting-bugs) + - [Before Submitting A Bug Report](#before-submitting-a-bug-report) + - [How Do I Submit A (Good) Bug Report?](#how-do-i-submit-a--good--bug-report-) + - [🎉Suggesting Features](#suggesting-features) + - [Before Submitting An Feature Suggestion](#before-submitting-an-feature-suggestion) + - [How Do I Submit A (Good) Feature Suggestion?](#how-do-i-submit-a--good--feature-suggestion-) + - [🎮 Game Server Requests](#game-server-requests) + - [Before Submitting a Game Server Request](#before-submitting-a-game-server-request) + - [How Do I Submit A (Good) Game Server Request?](#how-do-i-submit-a--good--game-server-request-) + - [🎮 Game Server Specific Issues](#game-server-specific-issues) +- [💻 Code Contributions](#code-contributions) + - [Pull Requests](#pull-requests) + - [Pull Request naming convention](#pull-request-naming-convention) + - [Testing](#testing) + - [Pull Request Status Checks](#pull-request-status-checks) + - [Test Environment](#test-environment) + - [:wine_glass: Styleguides](#-wine-glass--styleguides) + - [Git Commit Messages](#git-commit-messages) + - [BASH Styleguide](#bash-styleguide) +- [:blue_book: Document Contributions](#-blue-book--document-contributions) + - [Documentation Styleguide](#documentation-styleguide) +- [Issue and Pull Request Labels](#issue-and-pull-request-labels) ## Code of Conduct @@ -43,24 +44,24 @@ This project and everyone participating in it is governed by the [LinuxGSM Code This section guides you through submitting a bug report for LinuxGSM. Following these guidelines help maintainers and the community understand your report 📝, reproduce the behaviour💻, and find any related reports 🔎. -Before creating bug reports, please check [this list](https://github.com/GameServerManagers/linuxgsm/blob/master/CONTRIBUTING.md#before-submitting-a-bug-report) as you might find out that you don’t need to create one. When you are creating a bug report, please [include as many details as possible](https://github.com/GameServerManagers/linuxgsm/blob/master/CONTRIBUTING.md#how-do-i-submit-a-good-bug-report). Fill out [the required template]([https://github.com/GameServerManagers/LinuxGSM/issues/new/choose](https://github.com/GameServerManagers/LinuxGSM/issues/new/choose)), the information it asks for helps us resolve issues faster. +Before creating bug reports, please check [this list](https://github.com/GameServerManagers/linuxgsm/blob/master/CONTRIBUTING.md#before-submitting-a-bug-report) as you might find out that you don’t need to create one. When you are creating a bug report, please [include as many details as possible](https://github.com/GameServerManagers/linuxgsm/blob/master/CONTRIBUTING.md#how-do-i-submit-a-good-bug-report). Fill out [the required template](<[https://github.com/GameServerManagers/LinuxGSM/issues/new/choose](https://github.com/GameServerManagers/LinuxGSM/issues/new/choose)>), the information it asks for helps us resolve issues faster. #### Before Submitting A Bug Report -* **Check the [documentation](https://docs.linuxgsm.com).** You might be able to find the cause of the problem and fix things yourself. -* **Check the** [**support page**](https://linuxgsm.com/support) for links to other support options. -* **Perform a** [**cursory search**](https://github.com/search?q=org:GameServerManagers%20type:issues&type=Issues) to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue and give it a thumbs up instead of opening a new one. +- **Check the [documentation](https://docs.linuxgsm.com).** You might be able to find the cause of the problem and fix things yourself. +- **Check the** [**support page**](https://linuxgsm.com/support) for links to other support options. +- **Perform a** [**cursory search**](https://github.com/search?q=org:GameServerManagers%20type:issues&type=Issues) to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue and give it a thumbs up instead of opening a new one. #### How Do I Submit A (Good) Bug Report? Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). Create an issue and provide the following information by filling in [the issues form](https://github.com/GameServerManagers/LinuxGSM/issues/new/choose). -* **Use a clear and descriptive title** for the issue to identify the problem. -* **Complete the user story** to give a summary of the issue. -* **Provide basic info** to help us understand the context of the issue. -* **Provide further info** to give specifics and more detail. -* **Give steps to reproduce** the issue, allowing developers to follow steps that lead to the issue. -* **Explain what you expect** to happen, so we know what you think should occur. +- **Use a clear and descriptive title** for the issue to identify the problem. +- **Complete the user story** to give a summary of the issue. +- **Provide basic info** to help us understand the context of the issue. +- **Provide further info** to give specifics and more detail. +- **Give steps to reproduce** the issue, allowing developers to follow steps that lead to the issue. +- **Explain what you expect** to happen, so we know what you think should occur. ### 🎉Suggesting Features @@ -68,31 +69,34 @@ This section guides you through submitting a feature suggestion for LinuxGSM, in #### Before Submitting An Feature Suggestion -* **Check the** [**documentation**](https://docs.linuxgsm.com/%5D(https://docs.linuxgsm.com/)) to confirm that the enhancement doesn’t already exist. -* **Check your** [**LinuxGSM version**](https://docs.linuxgsm.com/commands/update-lgsm)**.** A newer version of LinuxGSM may already have your enhancement. -* **Perform a** [**cursory search**](https://github.com/search?q=org:GameServerManagers%20type:issues&type=Issues) to see if the enhancement has already been suggested. If it has **and the enhancement is still open**, add a comment to the existing issue and give it a thumbs up instead of opening a new one. +- **Check the** [**documentation**]() to confirm that the enhancement doesn’t already exist. +- **Check your** [**LinuxGSM version**](https://docs.linuxgsm.com/commands/update-lgsm)**.** A newer version of LinuxGSM may already have your enhancement. +- **Perform a** [**cursory search**](https://github.com/search?q=org:GameServerManagers%20type:issues&type=Issues) to see if the enhancement has already been suggested. If it has **and the enhancement is still open**, add a comment to the existing issue and give it a thumbs up instead of opening a new one. #### How Do I Submit A (Good) Feature Suggestion? Features are tracked as [GitHub issues](https://guides.github.com/features/issues/). Create an issue and provide the following information by filling in [the issues form](https://github.com/GameServerManagers/LinuxGSM/issues/new/choose). -* **Use a clear and descriptive title** for the issue to identify the problem. -* **Complete the user story** to give a summary of the issue. -* **Provide basic info** to help us understand the context of the enhancement. -* **Provide further info** to give specifics and more detail. -* **Provide any further reading** materials that might assist in developing the enhancement. +- **Use a clear and descriptive title** for the issue to identify the problem. +- **Complete the user story** to give a summary of the issue. +- **Provide basic info** to help us understand the context of the enhancement. +- **Provide further info** to give specifics and more detail. +- **Provide any further reading** materials that might assist in developing the enhancement. ### 🎮 Game Server Requests This section guides you through submitting a game server request for LinuxGSM, Following these guidelines help maintainers and the community understand your game server request 📝. + #### Before Submitting a Game Server Request -* **Check for existing** [**game server requests**](https://github.com/GameServerManagers/LinuxGSM/labels/type%3A%20game%20server%20request) to see if the new game server has already been suggested. If it has **and if the new game server is still open**, give it a thumbs up. -* **Check the game server is supported on Linux**, this does not include Wine servers which we do not support. +- **Check for existing** [**game server requests**](https://github.com/GameServerManagers/LinuxGSM/labels/type%3A%20game%20server%20request) to see if the new game server has already been suggested. If it has **and if the new game server is still open**, give it a thumbs up. +- **Check the game server is supported on Linux**, this does not include Wine servers which we do not support. + #### How Do I Submit A (Good) Game Server Request? -* The title should be as follows: **[Server Request] Game Name** -* **Provide Steam App ID** if applicable -* **Supply any documentation/how-to guides** for the game server. + +- The title should be as follows: **[Server Request] Game Name** +- **Provide Steam App ID** if applicable +- **Supply any documentation/how-to guides** for the game server. ### 🎮 Game Server Specific Issues @@ -110,10 +114,10 @@ A [list](https://docs.linuxgsm.com/support/game-server) of known game developer The process described here has several goals: -* Maintain LinuxGSM quality. -* Fix problems that are important to users. -* Engage the community in working toward the best possible LinuxGSM. -* Enable a sustainable system for LinuxGSM maintainers to review contributions. +- Maintain LinuxGSM quality. +- Fix problems that are important to users. +- Engage the community in working toward the best possible LinuxGSM. +- Enable a sustainable system for LinuxGSM maintainers to review contributions. Please follow these steps to have your contribution considered by the maintainers: @@ -135,18 +139,18 @@ If applied, this commit will _your subject line here_ For example: -* If applied, this commit will **refactor subsystem X for readability** -* If applied, this commit will **update getting started documentation** -* If applied, this commit will **remove deprecated methods** -* If applied, this commit will **release version 1.0.0** -* If applied, this commit will **merge pull request #123 from user/branch** +- If applied, this commit will **refactor subsystem X for readability** +- If applied, this commit will **update getting started documentation** +- If applied, this commit will **remove deprecated methods** +- If applied, this commit will **release version 1.0.0** +- If applied, this commit will **merge pull request #123 from user/branch** Notice how this doesn’t work for the other non-imperative forms: -* If applied, this commit will **fixed bug with Y** -* If applied, this commit will **change the behaviour of X** -* If applied, this commit will **more fixes for broken stuff** -* If applied, this commit will **sweet new API methods** +- If applied, this commit will **fixed bug with Y** +- If applied, this commit will **change the behaviour of X** +- If applied, this commit will **more fixes for broken stuff** +- If applied, this commit will **sweet new API methods** Below is an example of the subject line for a pull request: @@ -157,10 +161,13 @@ Below is an example of the subject line for a pull request: ### Testing #### Pull Request Status Checks -When a Pull Request is submitted, a series of status check tests are conducted. These tests will assess the code quality, complete CI tests etc. To get your PR merged these status checks must pass. + +When a Pull Request is submitted, a series of status check tests are conducted. These tests will assess the code quality, complete CI tests etc. To get your PR merged these status checks must pass. #### Test Environment + It is recommended that you have a testing environment available to test your code during development. To test your own code you must change some variables within the `linuxgsm.sh` file. This will force the use of your own code branch. + ```bash ## GitHub Branch Select # Allows for the use of different function files @@ -203,10 +210,11 @@ Highlights the LinuxGSM command the Issue/PR relates to. Labels to help pinpoint what the issue or PR relates to. variants: -* _distro_ -* _engine_ -* _game_ -* _info_ + +- _distro_ +- _engine_ +- _game_ +- _info_ **outcome** Labels Labels that identify why an issue was closed. diff --git a/LICENSE b/LICENSE index bda7cb6ee5..88c1caac54 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -MIT License +# The MIT License (MIT) -Copyright (c) 2012-2021 Daniel Gibbs +Copyright (c) 2012-2022 Daniel Gibbs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 5164e0b86d..70f3b9365d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ LinuxGSM -[![LinuxGSM](https://img.shields.io/badge/-LinuxGSM-2b2b2b.svg?logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAACsAAABACAYAAACDbo5ZAAAGD0lEQVR4AcWYa2wUVRvHz75c2vJ2disXoUBEVIioRAx%2BMIFA1IRwUS6KCCiIKBrvhEYiiGm5iBgk8QOGEgUUDYTttmVZWFr2UmwURS6iYAoCtmisElSsdHdbkT7%2BTzoNy%2BGc2dm54C%2F5Rdkz85x%2FZ86ZOXOYXYhIg3Phx%2FA4PAcv6f%2Btg5vhHJjP3EcZsgsshufJHH%2FAJbDztQ7aG35J1vgCXn%2BtgvrgEbLHYei9FmE3kDOUuh10OGwjZ7gEh7kZ9gNyllK3gnrg7%2BQs56DHjbCDyB0GuRF2ArnDeDfCziF3mO1G2FfJHRa4EXYpuUOxG2GXkzuUuBH2TXKH5W6ELSV3eM%2BNsOUk5yQcAY8p2uvgSPitor3MjbB1UOQXOFBvHwpbhPYWOExvL4SNUOQ7p4P2JTlzhOPmCu0vCu1PQpE2WOhk2MdJjk9y7HNwP1wEPUJbAcmZ6WTYrYolnifbxZBiibnFySHQCkUaLdY7C0V4%2FT5OhF1JcuIW6%2B0lOcvsBi2Ezao3j8Ov7Quwj52w60jNKIs1R5GatVaDDoEXSU4D7GSxbidYT3IuwjusFK0mNUVMwaZNNbl%2B%2F87hoVCom0HthaQmnG3QB0lNPcxlCvz%2B0GtlZTuorCxYYlA%2FDzbY%2FnrAgV3hCVLzCDMgEAi9wMMi9IIM%2FUwnNXWwi5mwRaSmmmXA798xq%2F3Khp420VeE1LyS6eQeBhttSXgzywCCToIUCOyYZvKLOWWwkdfd6ORVpGYJM0F5efDe9mEQHGty2BWTmhVGO4PNBmOoKzMBxmo%2FhD25dWvljSbD5hjMkb9gT9lJq63Mzi1bKkbjloc7xBWtwiRrDASCVRi%2FRxA8if%2BvrawMTzYI%2FACpeUv2KFFtDcUyTKilCHcis8G1Ga7wHpLzG8wVFs1K7jaeUKHZfIxmkj9%2FM4S9x9RGiMEudo0QbCVu9Xqn5PWEwLUk5%2FP0iaXac53I0kAH9Sau4m54lo%2FdTMfyekLYKQZ7ub34AbMMlmw5irC2VYTN0fuVMYMf8JHxJ7L7YYXAlSRnI2%2F8RtH4siTsDMz%2BZ5yS15OEXUxyDjGD1%2BvEq8MG16CDzY6JepKwT6geYbzxb0XjGMl7vwGSgzZIwo4nOa1M8Yr9Afb%2Fj8L21%2FsXaeaNZ2A6KTiEASph%2F0vF80cn4tokqu79fzfCUk2vfF4%2FFdFGEjGPHvg2yWrsDG%2F4%2BqpZB8jPOiXjWk0y5iXdM3XhKUvxBTA9UvHuvNPh%2Bzb%2BWj10z6nwuHWBbQFMvNCjKnn7qd1jS%2Fnx9VX3b6jC%2BbwOr5eMe3%2B83IcW4%2F3qgT%2BUTbA9srGaiHsn8AKiF6Ld%2FxF%2FOx6eeAJXabvK78MTTornNMd6XJTVR7%2Fj9bBjhFxV%2FMc1kJOAy2AeA%2FgrV4mFVDZFCqm8rEJ6qysCAWqK9iaztRJRbWXa4moFTELOav7jY%2FqAvoXp0Gc9NX7bIZl17%2FZl0rC1wRLeno0NvP%2B0CTcYNnS8wW6CtzNANaxzKqo9hRNOQ8rGo7tmSsMe2zWdt2frqVRcm5s2fofCgawDNHRNxnyfqgsYez4y4ADCjRM9H73hsNWafILTQdaFiSTj%2BQ%2FxA6yH7d%2BCmR8XbYr0a7VTF2N4siSsb5qdos3R6%2FjGxpULFfw7EfORnbrI9TAToX0sD40%2F2ylcGdh2Rdhg%2BSf2gka9jRTqK9%2BGwgHz7RTfVbHxirDhivdthYUvMRX8aYAD9lstvi%2B0aDL2DUZ0eCBUNNVG0IP65FLTWqPdiqdC0koHTVXe7iyNRG23QotBEy1RbTAzQyrmnYUT2rLsoA13JpcB4eVC2daBM1g2JGLekmwf5On7EJfngfZTNnVSce8bFjaTmQdvs%2FXmO%2FJVpoXdx3RSUe9O00Fj3nUdy0RLgRHiHXOPGW1h2uKZ07c9rG%2Bxyefp23pQeyBIEQoavYlakrG8fnrY5yHn2fbxXzAgw7m8bT5zkkSk4C7cpmOK21esB%2FXAQ5DzFfTo43%2BF%2FDzf0eZ4wZ3MDSjMcvD6nIeOahGgia%2FyU3HforTPkWkwnakdn0cI9jqfbPjD%2FuQLJr6644snlgX%2FApOMoyd1R5%2FxAAAAAElFTkSuQmCC)](https://linuxgsm.com) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/d19c5234dc3743d8a8a14093711ca52d)](https://www.codacy.com/gh/GameServerManagers/LinuxGSM/dashboard?utm_source=github.com&utm_medium=referral&utm_content=GameServerManagers/LinuxGSM&utm_campaign=Badge_Grade) [![Backup Repo](https://github.com/GameServerManagers/LinuxGSM/workflows/Backup%20Repo/badge.svg)](https://bitbucket.org/GameServerManagers/linuxgsm) [![Discord](https://discordapp.com/api/guilds/127498813903601664/widget.png?style=shield)](https://linuxgsm.com/discord) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://github.com/GameServerManagers/LinuxGSM/blob/master/LICENSE) [![made-with-bash](https://img.shields.io/badge/-Made%20with%20Bash-1f425f.svg?logo=image%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkE3MDg2QTAyQUZCMzExRTVBMkQxRDMzMkJDMUQ4RDk3IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkE3MDg2QTAzQUZCMzExRTVBMkQxRDMzMkJDMUQ4RDk3Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTcwODZBMDBBRkIzMTFFNUEyRDFEMzMyQkMxRDhEOTciIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTcwODZBMDFBRkIzMTFFNUEyRDFEMzMyQkMxRDhEOTciLz4gPC9yZGY6RGVzY3JpcHRpb24%2BIDwvcmRmOlJERj4gPC94OnhtcG1ldGE%2BIDw%2FeHBhY2tldCBlbmQ9InIiPz6lm45hAAADkklEQVR42qyVa0yTVxzGn7d9Wy03MS2ii8s%2BeokYNQSVhCzOjXZOFNF4jx%2BMRmPUMEUEqVG36jo2thizLSQSMd4N8ZoQ8RKjJtooaCpK6ZoCtRXKpRempbTv5ey83bhkAUphz8fznvP8znn%2B%2F3NeEEJgNBoRRSmz0ub%2FfuxEacBg%2FDmYtiCjgo5NG2mBXq%2BH5I1ogMRk9Zbd%2BQU2e1ML6VPLOyf5tvBQ8yT1lG10imxsABm7SLs898GTpyYynEzP60hO3trHDKvMigUwdeaceacqzp7nOI4n0SSIIjl36ao4Z356OV07fSQAk6xJ3XGg%2BLCr1d1OYlVHp4eUHPnerU79ZA%2F1kuv1JQMAg%2BE4O2P23EumF3VkvHprsZKMzKwbRUXFEyTvSIEmTVbrysp%2BWr8wfQHGK6WChVa3bKUmdWou%2BjpArdGkzZ41c1zG%2Fu5uGH4swzd561F%2BuhIT4%2BLnSuPsv9%2BJKIpjNr9dXYOyk7%2FBZrcjIT4eCnoKgedJP4BEqhG77E3NKP31FO7cfQA5K0dSYuLgz2TwCWJSOBzG6crzKK%2BohNfni%2Bx6OMUMMNe%2Fgf7ocbw0v0acKg6J8Ql0q%2BT%2FAXR5PNi5dz9c71upuQqCKFAD%2BYhrZLEAmpodaHO3Qy6TI3NhBpbrshGtOWKOSMYwYGQM8nJzoFJNxP2HjyIQho4PewK6hBktoDcUwtIln4PjOWzflQ%2Be5yl0yCCYgYikTclGlxadio%2BBQCSiW1UXoVGrKYwH4RgMrjU1HAB4vR6LzWYfFUCKxfS8Ftk5qxHoCUQAUkRJaSEokkV6Y%2F%2BJUOC4hn6A39NVXVBYeNP8piH6HeA4fPbpdBQV5KOx0QaL1YppX3Jgk0TwH2Vg6S3u%2BdB91%2B%2FpuNYPYFl5uP5V7ZqvsrX7jxqMXR6ff3gCQSTzFI0a1TX3wIs8ul%2Bq4HuWAAiM39vhOuR1O1fQ2gT%2F26Z8Z5vrl2OHi9OXZn995nLV9aFfS6UC9JeJPfuK0NBohWpCHMSAAsFe74WWP%2BvT25wtP9Bpob6uGqqyDnOtaeumjRu%2ByFu36VntK%2FPA5umTJeUtPWZSU9BCgud661odVp3DZtkc7AnYR33RRC708PrVi1larW7XwZIjLnd7R6SgSqWSNjU1B3F72pz5TZbXmX5vV81Yb7Lg7XT%2FUXriu8XLVqw6c6XqWnBKiiYU%2BMt3wWF7u7i91XlSEITwSAZ%2FCzAAHsJVbwXYFFEAAAAASUVORK5CYII%3D)](https://www.gnu.org/software/bash/) +[![LinuxGSM](https://img.shields.io/badge/-LinuxGSM-2b2b2b.svg?logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAACsAAABACAYAAACDbo5ZAAAGD0lEQVR4AcWYa2wUVRvHz75c2vJ2disXoUBEVIioRAx%2BMIFA1IRwUS6KCCiIKBrvhEYiiGm5iBgk8QOGEgUUDYTttmVZWFr2UmwURS6iYAoCtmisElSsdHdbkT7%2BTzoNy%2BGc2dm54C%2F5Rdkz85x%2FZ86ZOXOYXYhIg3Phx%2FA4PAcv6f%2Btg5vhHJjP3EcZsgsshufJHH%2FAJbDztQ7aG35J1vgCXn%2BtgvrgEbLHYei9FmE3kDOUuh10OGwjZ7gEh7kZ9gNyllK3gnrg7%2BQs56DHjbCDyB0GuRF2ArnDeDfCziF3mO1G2FfJHRa4EXYpuUOxG2GXkzuUuBH2TXKH5W6ELSV3eM%2BNsOUk5yQcAY8p2uvgSPitor3MjbB1UOQXOFBvHwpbhPYWOExvL4SNUOQ7p4P2JTlzhOPmCu0vCu1PQpE2WOhk2MdJjk9y7HNwP1wEPUJbAcmZ6WTYrYolnifbxZBiibnFySHQCkUaLdY7C0V4%2FT5OhF1JcuIW6%2B0lOcvsBi2Ezao3j8Ov7Quwj52w60jNKIs1R5GatVaDDoEXSU4D7GSxbidYT3IuwjusFK0mNUVMwaZNNbl%2B%2F87hoVCom0HthaQmnG3QB0lNPcxlCvz%2B0GtlZTuorCxYYlA%2FDzbY%2FnrAgV3hCVLzCDMgEAi9wMMi9IIM%2FUwnNXWwi5mwRaSmmmXA798xq%2F3Khp420VeE1LyS6eQeBhttSXgzywCCToIUCOyYZvKLOWWwkdfd6ORVpGYJM0F5efDe9mEQHGty2BWTmhVGO4PNBmOoKzMBxmo%2FhD25dWvljSbD5hjMkb9gT9lJq63Mzi1bKkbjloc7xBWtwiRrDASCVRi%2FRxA8if%2BvrawMTzYI%2FACpeUv2KFFtDcUyTKilCHcis8G1Ga7wHpLzG8wVFs1K7jaeUKHZfIxmkj9%2FM4S9x9RGiMEudo0QbCVu9Xqn5PWEwLUk5%2FP0iaXac53I0kAH9Sau4m54lo%2FdTMfyekLYKQZ7ub34AbMMlmw5irC2VYTN0fuVMYMf8JHxJ7L7YYXAlSRnI2%2F8RtH4siTsDMz%2BZ5yS15OEXUxyDjGD1%2BvEq8MG16CDzY6JepKwT6geYbzxb0XjGMl7vwGSgzZIwo4nOa1M8Yr9Afb%2Fj8L21%2FsXaeaNZ2A6KTiEASph%2F0vF80cn4tokqu79fzfCUk2vfF4%2FFdFGEjGPHvg2yWrsDG%2F4%2BqpZB8jPOiXjWk0y5iXdM3XhKUvxBTA9UvHuvNPh%2Bzb%2BWj10z6nwuHWBbQFMvNCjKnn7qd1jS%2Fnx9VX3b6jC%2BbwOr5eMe3%2B83IcW4%2F3qgT%2BUTbA9srGaiHsn8AKiF6Ld%2FxF%2FOx6eeAJXabvK78MTTornNMd6XJTVR7%2Fj9bBjhFxV%2FMc1kJOAy2AeA%2FgrV4mFVDZFCqm8rEJ6qysCAWqK9iaztRJRbWXa4moFTELOav7jY%2FqAvoXp0Gc9NX7bIZl17%2FZl0rC1wRLeno0NvP%2B0CTcYNnS8wW6CtzNANaxzKqo9hRNOQ8rGo7tmSsMe2zWdt2frqVRcm5s2fofCgawDNHRNxnyfqgsYez4y4ADCjRM9H73hsNWafILTQdaFiSTj%2BQ%2FxA6yH7d%2BCmR8XbYr0a7VTF2N4siSsb5qdos3R6%2FjGxpULFfw7EfORnbrI9TAToX0sD40%2F2ylcGdh2Rdhg%2BSf2gka9jRTqK9%2BGwgHz7RTfVbHxirDhivdthYUvMRX8aYAD9lstvi%2B0aDL2DUZ0eCBUNNVG0IP65FLTWqPdiqdC0koHTVXe7iyNRG23QotBEy1RbTAzQyrmnYUT2rLsoA13JpcB4eVC2daBM1g2JGLekmwf5On7EJfngfZTNnVSce8bFjaTmQdvs%2FXmO%2FJVpoXdx3RSUe9O00Fj3nUdy0RLgRHiHXOPGW1h2uKZ07c9rG%2Bxyefp23pQeyBIEQoavYlakrG8fnrY5yHn2fbxXzAgw7m8bT5zkkSk4C7cpmOK21esB%2FXAQ5DzFfTo43%2BF%2FDzf0eZ4wZ3MDSjMcvD6nIeOahGgia%2FyU3HforTPkWkwnakdn0cI9jqfbPjD%2FuQLJr6644snlgX%2FApOMoyd1R5%2FxAAAAAElFTkSuQmCC)](https://linuxgsm.com) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/d19c5234dc3743d8a8a14093711ca52d)](https://www.codacy.com/gh/GameServerManagers/LinuxGSM/dashboard?utm_source=github.com&utm_medium=referral&utm_content=GameServerManagers/LinuxGSM&utm_campaign=Badge_Grade) [![Backup Repo](https://github.com/GameServerManagers/LinuxGSM/workflows/Backup%20Repo/badge.svg)](https://bitbucket.org/GameServerManagers/linuxgsm) [![Discord](https://discordapp.com/api/guilds/127498813903601664/widget.png?style=shield)](https://linuxgsm.com/discord) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://github.com/GameServerManagers/LinuxGSM/blob/master/LICENSE) [![made-with-bash](https://img.shields.io/badge/-Made%20with%20Bash-1f425f.svg?logo=image%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkE3MDg2QTAyQUZCMzExRTVBMkQxRDMzMkJDMUQ4RDk3IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkE3MDg2QTAzQUZCMzExRTVBMkQxRDMzMkJDMUQ4RDk3Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTcwODZBMDBBRkIzMTFFNUEyRDFEMzMyQkMxRDhEOTciIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTcwODZBMDFBRkIzMTFFNUEyRDFEMzMyQkMxRDhEOTciLz4gPC9yZGY6RGVzY3JpcHRpb24%2BIDwvcmRmOlJERj4gPC94OnhtcG1ldGE%2BIDw%2FeHBhY2tldCBlbmQ9InIiPz6lm45hAAADkklEQVR42qyVa0yTVxzGn7d9Wy03MS2ii8s%2BeokYNQSVhCzOjXZOFNF4jx%2BMRmPUMEUEqVG36jo2thizLSQSMd4N8ZoQ8RKjJtooaCpK6ZoCtRXKpRempbTv5ey83bhkAUphz8fznvP8znn%2B%2F3NeEEJgNBoRRSmz0ub%2FfuxEacBg%2FDmYtiCjgo5NG2mBXq%2BH5I1ogMRk9Zbd%2BQU2e1ML6VPLOyf5tvBQ8yT1lG10imxsABm7SLs898GTpyYynEzP60hO3trHDKvMigUwdeaceacqzp7nOI4n0SSIIjl36ao4Z356OV07fSQAk6xJ3XGg%2BLCr1d1OYlVHp4eUHPnerU79ZA%2F1kuv1JQMAg%2BE4O2P23EumF3VkvHprsZKMzKwbRUXFEyTvSIEmTVbrysp%2BWr8wfQHGK6WChVa3bKUmdWou%2BjpArdGkzZ41c1zG%2Fu5uGH4swzd561F%2BuhIT4%2BLnSuPsv9%2BJKIpjNr9dXYOyk7%2FBZrcjIT4eCnoKgedJP4BEqhG77E3NKP31FO7cfQA5K0dSYuLgz2TwCWJSOBzG6crzKK%2BohNfni%2Bx6OMUMMNe%2Fgf7ocbw0v0acKg6J8Ql0q%2BT%2FAXR5PNi5dz9c71upuQqCKFAD%2BYhrZLEAmpodaHO3Qy6TI3NhBpbrshGtOWKOSMYwYGQM8nJzoFJNxP2HjyIQho4PewK6hBktoDcUwtIln4PjOWzflQ%2Be5yl0yCCYgYikTclGlxadio%2BBQCSiW1UXoVGrKYwH4RgMrjU1HAB4vR6LzWYfFUCKxfS8Ftk5qxHoCUQAUkRJaSEokkV6Y%2F%2BJUOC4hn6A39NVXVBYeNP8piH6HeA4fPbpdBQV5KOx0QaL1YppX3Jgk0TwH2Vg6S3u%2BdB91%2B%2FpuNYPYFl5uP5V7ZqvsrX7jxqMXR6ff3gCQSTzFI0a1TX3wIs8ul%2Bq4HuWAAiM39vhOuR1O1fQ2gT%2F26Z8Z5vrl2OHi9OXZn995nLV9aFfS6UC9JeJPfuK0NBohWpCHMSAAsFe74WWP%2BvT25wtP9Bpob6uGqqyDnOtaeumjRu%2ByFu36VntK%2FPA5umTJeUtPWZSU9BCgud661odVp3DZtkc7AnYR33RRC708PrVi1larW7XwZIjLnd7R6SgSqWSNjU1B3F72pz5TZbXmX5vV81Yb7Lg7XT%2FUXriu8XLVqw6c6XqWnBKiiYU%2BMt3wWF7u7i91XlSEITwSAZ%2FCzAAHsJVbwXYFFEAAAAASUVORK5CYII%3D)](https://www.gnu.org/software/bash/) [LinuxGSM](https://linuxgsm.com) is the command-line tool for quick, simple deployment and management of Linux dedicated game servers. @@ -15,21 +15,21 @@ Traditionally game servers are not easy to manage yourself. Admins often have to 100+ game servers supported -* :truck: Installer -* :mag: Monitor -* :phone: Alerts -* :cloud: Updater -* :blue_book: Server Details -* :floppy_disk: Backup -* :computer: Console +- :truck: Installer +- :mag: Monitor +- :phone: Alerts +- :cloud: Updater +- :blue_book: Server Details +- :floppy_disk: Backup +- :computer: Console ## :penguin: Compatibility LinuxGSM will run on popular distros as long as the minimum requirements are met. -* Ubuntu -* Debian -* CentOS +- Ubuntu +- Debian +- CentOS Other distros are likely to work but are not fully tested. diff --git a/lgsm/config-default/config-lgsm/emserver/_default.cfg b/lgsm/config-default/config-lgsm/emserver/_default.cfg index f10a8a437f..16db942a4e 100644 --- a/lgsm/config-default/config-lgsm/emserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/emserver/_default.cfg @@ -13,7 +13,7 @@ ip="0.0.0.0" port="27015" clientport="27005" sourcetvport="27020" -defaultmap="emp_district" +defaultmap="con_district402" maxplayers="62" ## Game Server Login Token (GSLT): Optional diff --git a/lgsm/config-default/config-lgsm/squadserver/_default.cfg b/lgsm/config-default/config-lgsm/squadserver/_default.cfg index 85affef381..0a343cfdf0 100644 --- a/lgsm/config-default/config-lgsm/squadserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/squadserver/_default.cfg @@ -163,7 +163,7 @@ systemdir="${serverfiles}/SquadGame" executabledir="${serverfiles}" executable="./SquadGameServer.sh" servercfgdir="${systemdir}/ServerConfig" -servercfg="${selfname}.cfg" +servercfg="Server.cfg" servercfgdefault="Server.cfg" servercfgfullpath="${servercfgdir}/${servercfg}" diff --git a/lgsm/config-default/config-lgsm/stserver/_default.cfg b/lgsm/config-default/config-lgsm/stserver/_default.cfg index 8c0f0dbf9b..26da17f432 100644 --- a/lgsm/config-default/config-lgsm/stserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/stserver/_default.cfg @@ -10,16 +10,17 @@ ## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters ip="0.0.0.0" +servername="LinuxGSM" port="27500" queryport="27015" worldtype="Moon" +maxplayers="10" autosaveinterval=300 -clearinterval=60 worldname="moon_save" ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters # Edit with care -startparameters="-batchmode -nographics -autostart -gameport=${port} -updateport=${queryport} -worldtype=${worldtype} -loadworld=${worldname} -worldname=${worldname} -autosaveinterval=${autosaveinterval} -clearallinterval=${clearinterval}" +startparameters="-LOADLATEST ${worldname} ${worldtype} -settings ServerName ${servername} StartLocalHost true ServerVisible true ServerMaxPlayers ${maxplayers} GamePort ${port} UpdatePort ${queryport} UPNPEnabled true AutoSave true SaveInterval ${autosaveinterval}" #### LinuxGSM Settings #### @@ -139,7 +140,7 @@ steammaster="false" # 9: GoldSrc # 10: Avorion # 11: end -stopmode="2" +stopmode="3" ## Query mode # 1: session only @@ -168,8 +169,8 @@ systemdir="${serverfiles}" executabledir="${serverfiles}" executable="./rocketstation_DedicatedServer.x86_64" servercfgdir="${systemdir}" -servercfg="default.ini" -servercfgdefault="default.ini" +servercfg="setting.xml" +servercfgdefault="setting.xml" servercfgfullpath="${servercfgdir}/${servercfg}" ## Backup Directory diff --git a/lgsm/config-default/config-lgsm/vpmcserver/_default.cfg b/lgsm/config-default/config-lgsm/vpmcserver/_default.cfg new file mode 100644 index 0000000000..6755e0e51e --- /dev/null +++ b/lgsm/config-default/config-lgsm/vpmcserver/_default.cfg @@ -0,0 +1,179 @@ +################################## +######## Default Settings ######## +################################## +# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN! +# Copy settings from here and use them in either: +# common.cfg - applies settings to every instance. +# [instance].cfg - applies settings to a specific instance. + +#### Game Server Settings #### + +## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters +javaram="1024" # -Xmx$1024M + +## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +startparameters="" + +## Release Settings | https://docs.linuxgsm.com/game-servers/minecraft#release-settings +# Version (latest|3.1.1) +mcversion="latest" + +#### LinuxGSM Settings #### + +## LinuxGSM Stats +# Send useful stats to LinuxGSM developers. +# https://docs.linuxgsm.com/configuration/linuxgsm-stats +# (on|off) +stats="off" + +## Notification Alerts +# (on|off) + +# Display IP | https://docs.linuxgsm.com/alerts#display-ip +displayip="" + +# More info | https://docs.linuxgsm.com/alerts#more-info +postalert="off" + +# Discord Alerts | https://docs.linuxgsm.com/alerts/discord +discordalert="off" +discordwebhook="webhook" + +# Email Alerts | https://docs.linuxgsm.com/alerts/email +emailalert="off" +email="email@example.com" +emailfrom="" + +# Gotify Alerts | https://docs.linuxgsm.com/alerts/gotify +gotifyalert="off" +gotifytoken="token" +gotifywebhook="webhook" + +# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt +iftttalert="off" +ifttttoken="accesstoken" +iftttevent="linuxgsm_alert" + +# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun +mailgunalert="off" +mailgunapiregion="us" +mailguntoken="accesstoken" +mailgundomain="example.com" +mailgunemailfrom="alert@example.com" +mailgunemail="email@myemail.com" + +# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet +pushbulletalert="off" +pushbullettoken="accesstoken" +channeltag="" + +# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover +pushoveralert="off" +pushovertoken="accesstoken" +pushoveruserkey="userkey" + +# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat +rocketchatalert="off" +rocketchatwebhook="webhook" +rocketchattoken="" + +# Slack Alerts | https://docs.linuxgsm.com/alerts/slack +slackalert="off" +slackwebhook="webhook" + +# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram +# You can add a custom cURL string eg proxy (useful in Russia) in "curlcustomstring". +# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help". +telegramapi="api.telegram.org" +telegramalert="off" +telegramtoken="accesstoken" +telegramchatid="" +curlcustomstring="" + +## Updating | https://docs.linuxgsm.com/commands/update +updateonstart="off" + +## Backup | https://docs.linuxgsm.com/commands/backup +maxbackups="4" +maxbackupdays="30" +stoponbackup="on" + +## Logging | https://docs.linuxgsm.com/features/logging +consolelogging="on" +logdays="7" + +## Monitor | https://docs.linuxgsm.com/commands/monitor +# Query delay time +querydelay="1" + +## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors +ansi="on" + +#### Advanced Settings #### + +## Message Display Time | https://docs.linuxgsm.com/features/message-display-time +sleeptime="0.5" + +## Stop Mode | https://docs.linuxgsm.com/features/stop-mode +# 1: tmux kill +# 2: CTRL+c +# 3: quit +# 4: quit 120s +# 5: stop +# 6: q +# 7: exit +# 8: 7 Days to Die +# 9: GoldSrc +# 10: Avorion +# 11: end +# 12: shutdown +stopmode="12" + +## Query mode +# 1: session only +# 2: gamedig (gsquery fallback) +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="2" +querytype="minecraft" + +## Console type +consoleverbose="yes" +consoleinteract="yes" + +## Game Server Details +# Do not edit +gamename="Velocity Proxy" +engine="lwjgl2" +glibc="null" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}" +executabledir="${serverfiles}" +preexecutable="java -Xmx${javaram}M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -jar" +executable="./velocity.jar" +servercfgdir="${systemdir}" +servercfg="velocity.toml" +servercfgdefault="velocity.toml" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${systemdir}/logs" +lgsmlogdir="${logdir}/script" +consolelogdir="${logdir}/console" +lgsmlog="${lgsmlogdir}/${selfname}-script.log" +consolelog="${consolelogdir}/${selfname}-console.log" +alertlog="${lgsmlogdir}/${selfname}-alert.log" +postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log" + +## Logs Naming +lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log" +consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log" diff --git a/lgsm/data/almalinux-8.csv b/lgsm/data/almalinux-8.csv index 067b583788..9910acb8d8 100644 --- a/lgsm/data/almalinux-8.csv +++ b/lgsm/data/almalinux-8.csv @@ -1,4 +1,4 @@ -all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz steamcmd,glibc.i686,libstdc++.i686 ac ahl @@ -119,6 +119,7 @@ ut99 vh,glibc-devel vs vints,mono-complete +vpmc,java-11-openjdk wet wf wmc,java-11-openjdk diff --git a/lgsm/data/centos-7.csv b/lgsm/data/centos-7.csv index e8dc0a885e..3d4b0a3663 100644 --- a/lgsm/data/centos-7.csv +++ b/lgsm/data/centos-7.csv @@ -1,4 +1,4 @@ -all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python3,tar,tmux,unzip,util-linux,wget,xz +all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python3,tar,tmux,unzip,util-linux,wget,xz steamcmd,glibc.i686,libstdc++.i686 ac ahl diff --git a/lgsm/data/centos-8.csv b/lgsm/data/centos-8.csv index 116d83bea4..7d3095ba41 100644 --- a/lgsm/data/centos-8.csv +++ b/lgsm/data/centos-8.csv @@ -1,4 +1,4 @@ -all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz steamcmd,glibc.i686,libstdc++.i686 ac ahl @@ -118,6 +118,7 @@ ut99 vh,glibc-devel vs vints,mono-complete +vpmc,java-11-openjdk wet wf wmc,java-11-openjdk diff --git a/lgsm/data/debian-10.csv b/lgsm/data/debian-10.csv index 30ca2df10e..443c35cf04 100644 --- a/lgsm/data/debian-10.csv +++ b/lgsm/data/debian-10.csv @@ -119,6 +119,7 @@ ut99 vh,libc6-dev vs vints,mono-complete +vpmc,openjdk-11-jre wet wf wmc,openjdk-11-jre diff --git a/lgsm/data/debian-11.csv b/lgsm/data/debian-11.csv index f96d488626..58db537623 100644 --- a/lgsm/data/debian-11.csv +++ b/lgsm/data/debian-11.csv @@ -119,6 +119,7 @@ ut99 vh,libc6-dev vs vints,mono-complete +vpmc,openjdk-11-jre wet wf wmc,openjdk-17-jre diff --git a/lgsm/data/rhel-7.csv b/lgsm/data/rhel-7.csv index d4d3fbd30c..968c4dc980 100644 --- a/lgsm/data/rhel-7.csv +++ b/lgsm/data/rhel-7.csv @@ -1,4 +1,4 @@ -all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz steamcmd,glibc.i686,libstdc++.i686 ac ahl @@ -119,6 +119,7 @@ ut99 vh,glibc-devel vs vints,mono-complete +vpmc,java-11-openjdk wet wf wmc,java-11-openjdk diff --git a/lgsm/data/rhel-8.csv b/lgsm/data/rhel-8.csv index 5e7b622e9a..002db75fd6 100644 --- a/lgsm/data/rhel-8.csv +++ b/lgsm/data/rhel-8.csv @@ -1,4 +1,4 @@ -all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz steamcmd,glibc.i686,libstdc++.i686 ac ahl @@ -119,6 +119,7 @@ ut99 vh,glibc-devel vs vints,mono-complete +vpmc,java-11-openjdk wet wf wmc,java-11-openjdk diff --git a/lgsm/data/rocky-8.csv b/lgsm/data/rocky-8.csv index 067b583788..9910acb8d8 100644 --- a/lgsm/data/rocky-8.csv +++ b/lgsm/data/rocky-8.csv @@ -1,4 +1,4 @@ -all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +all,bc,binutils,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz steamcmd,glibc.i686,libstdc++.i686 ac ahl @@ -119,6 +119,7 @@ ut99 vh,glibc-devel vs vints,mono-complete +vpmc,java-11-openjdk wet wf wmc,java-11-openjdk diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index f5463cd842..4c80f538a7 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -117,6 +117,7 @@ ut3,ut3server,Unreal Tournament 3 ut99,ut99server,Unreal Tournament 99 vh,vhserver,Valheim vints,vintsserver,Vintage Story +vpmc,vpmcserver,Velocity Proxy MC vs,vsserver,Vampire Slayer wet,wetserver,Wolfenstein: Enemy Territory wf,wfserver,Warfork diff --git a/lgsm/data/ubuntu-18.04.csv b/lgsm/data/ubuntu-18.04.csv index 30ca2df10e..443c35cf04 100644 --- a/lgsm/data/ubuntu-18.04.csv +++ b/lgsm/data/ubuntu-18.04.csv @@ -119,6 +119,7 @@ ut99 vh,libc6-dev vs vints,mono-complete +vpmc,openjdk-11-jre wet wf wmc,openjdk-11-jre diff --git a/lgsm/data/ubuntu-20.04.csv b/lgsm/data/ubuntu-20.04.csv index ccb1ca703f..49f64348d5 100644 --- a/lgsm/data/ubuntu-20.04.csv +++ b/lgsm/data/ubuntu-20.04.csv @@ -79,7 +79,7 @@ pmc,openjdk-17-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz,openjdk-16-jre,rng-tools +pz,openjdk-17-jre,rng-tools q2 q3 ql @@ -88,7 +88,7 @@ ricochet ro rtcw rust,lib32z1 -rw,openjdk-16-jre +rw,openjdk-17-jre samp sb sbots @@ -119,6 +119,7 @@ ut99 vh,libc6-dev vs vints,mono-complete +vpmc,openjdk-11-jre wet wf wmc,openjdk-17-jre diff --git a/lgsm/data/ubuntu-21.04.csv b/lgsm/data/ubuntu-21.04.csv index b2a2773061..f1b28acd2e 100644 --- a/lgsm/data/ubuntu-21.04.csv +++ b/lgsm/data/ubuntu-21.04.csv @@ -79,7 +79,7 @@ pmc,openjdk-17-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz,openjdk-16-jre,rng-tools +pz,openjdk-17-jre,rng-tools q2 q3 ql @@ -88,7 +88,7 @@ ricochet ro rtcw rust,lib32z1 -rw,openjdk-16-jre +rw,openjdk-17-jre samp sb sbots @@ -119,6 +119,7 @@ ut99 vh,libc6-dev vs vints,mono-complete +vpmc,openjdk-11-jre wet wf wmc,openjdk-17-jre diff --git a/lgsm/data/ubuntu-21.10.csv b/lgsm/data/ubuntu-21.10.csv index 836dfe53f1..1ced64fc70 100644 --- a/lgsm/data/ubuntu-21.10.csv +++ b/lgsm/data/ubuntu-21.10.csv @@ -77,7 +77,7 @@ pmc,openjdk-17-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz,openjdk-16-jre,rng-tools +pz,openjdk-17-jre,rng-tools q2 q3 ql @@ -86,7 +86,7 @@ ricochet ro rtcw rust,lib32z1 -rw,openjdk-16-jre +rw,openjdk-17-jre samp sb sbots @@ -117,6 +117,7 @@ ut99 vh,libc6-dev vs vints,mono-complete +vpmc,openjdk-11-jre wet wf wmc,openjdk-17-jre diff --git a/lgsm/data/ubuntu-22.04.csv b/lgsm/data/ubuntu-22.04.csv index 836dfe53f1..dd567bf7be 100644 --- a/lgsm/data/ubuntu-22.04.csv +++ b/lgsm/data/ubuntu-22.04.csv @@ -77,7 +77,7 @@ pmc,openjdk-17-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz,openjdk-16-jre,rng-tools +pz,openjdk-17-jre,rng-tools5 q2 q3 ql @@ -86,7 +86,7 @@ ricochet ro rtcw rust,lib32z1 -rw,openjdk-16-jre +rw,openjdk-17-jre samp sb sbots @@ -117,6 +117,7 @@ ut99 vh,libc6-dev vs vints,mono-complete +vpmc,openjdk-11-jre wet wf wmc,openjdk-17-jre diff --git a/lgsm/functions/README.md b/lgsm/functions/README.md index c1c823fac3..de008ecfa3 100755 --- a/lgsm/functions/README.md +++ b/lgsm/functions/README.md @@ -3,14 +3,15 @@ These modules are scripts that are called upon by the primary script linuxgsm.sh ## Module Names + Modules have been named to give an idea of what the function does. -* core: Essential modules that will always run first. -* command: Primary command function. -* check: Runs checks that will either halt on or fix an issue. -* dev: development modules. -* fix: Applies a game server specific fix. -* info: retrieves information from a source such as config file or the OS. -* install: modules related to the installer. -* monitor: modules related to monitor. -* update: modules that update the game server. +- core: Essential modules that will always run first. +- command: Primary command function. +- check: Runs checks that will either halt on or fix an issue. +- dev: development modules. +- fix: Applies a game server specific fix. +- info: retrieves information from a source such as config file or the OS. +- install: modules related to the installer. +- monitor: modules related to monitor. +- update: modules that update the game server. diff --git a/lgsm/functions/alert.sh b/lgsm/functions/alert.sh index c62c655566..8460209c40 100755 --- a/lgsm/functions/alert.sh +++ b/lgsm/functions/alert.sh @@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Generates alert log of the details at the time of the alert. # Used with email alerts. -fn_alert_log(){ +fn_alert_log() { info_distro.sh info_game.sh info_messages.sh @@ -24,10 +24,10 @@ fn_alert_log(){ fn_info_message_gameserver_resource fn_info_message_gameserver fn_info_logs - } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${alertlog}" > /dev/null 2>&1 + } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a "${alertlog}" > /dev/null 2>&1 } -fn_alert_test(){ +fn_alert_test() { fn_script_log_info "Sending test alert" alertsubject="Alert - ${selfname} - Test" alertemoji="🚧" @@ -36,7 +36,7 @@ fn_alert_test(){ alertbody="Testing LinuxGSM Alert. No action to be taken." } -fn_alert_restart(){ +fn_alert_restart() { fn_script_log_info "Sending alert: Restarted: ${executable} not running" alertsubject="Alert - ${selfname} - Restarted" alertemoji="🚨" @@ -45,7 +45,7 @@ fn_alert_restart(){ alertbody="${selfname} ${executable} not running" } -fn_alert_restart_query(){ +fn_alert_restart_query() { fn_script_log_info "Sending alert: Restarted: ${selfname}" alertsubject="Alert - ${selfname} - Restarted" alertemoji="🚨" @@ -54,7 +54,7 @@ fn_alert_restart_query(){ alertbody="Unable to query: ${selfname}" } -fn_alert_update(){ +fn_alert_update() { fn_script_log_info "Sending alert: Updated" alertsubject="Alert - ${selfname} - Updated" alertemoji="🎮" @@ -63,7 +63,7 @@ fn_alert_update(){ alertbody="${gamename} received update" } -fn_alert_check_update(){ +fn_alert_check_update() { fn_script_log_info "Sending alert: Update available" alertsubject="Alert - ${selfname} - Update available" alertemoji="🎮" @@ -72,7 +72,7 @@ fn_alert_check_update(){ alertbody="${gamename} update available" } -fn_alert_permissions(){ +fn_alert_permissions() { fn_script_log_info "Sending alert: Permissions error" alertsubject="Alert - ${selfname}: Permissions error" alertemoji="❗" @@ -81,7 +81,7 @@ fn_alert_permissions(){ alertbody="${selfname} has permissions issues" } -fn_alert_config(){ +fn_alert_config() { fn_script_log_info "Sending alert: New _default.cfg" alertsubject="Alert - ${selfname} - New _default.cfg" alertemoji="🎮" @@ -110,128 +110,128 @@ fi fn_alert_log # Generates the more info link. -if [ "${postalert}" == "on" ]&&[ -n "${postalert}" ]; then +if [ "${postalert}" == "on" ] && [ -n "${postalert}" ]; then exitbypass=1 command_postdetails.sh fn_firstcommand_reset unset exitbypass -elif [ "${postalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${postalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "More Info not enabled" fn_script_log_warn "More Info alerts not enabled" fi -if [ "${discordalert}" == "on" ]&&[ -n "${discordalert}" ]; then +if [ "${discordalert}" == "on" ] && [ -n "${discordalert}" ]; then alert_discord.sh -elif [ "${discordalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${discordalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Discord alerts not enabled" fn_script_log_warn "Discord alerts not enabled" -elif [ -z "${discordtoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${discordtoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Discord token not set" echo -e "* https://docs.linuxgsm.com/alerts/discord" fn_script_error "Discord token not set" fi -if [ "${emailalert}" == "on" ]&&[ -n "${email}" ]; then +if [ "${emailalert}" == "on" ] && [ -n "${email}" ]; then alert_email.sh -elif [ "${emailalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${emailalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Email alerts not enabled" fn_script_log_warn "Email alerts not enabled" -elif [ -z "${email}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${email}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Email not set" fn_script_log_error "Email not set" fi -if [ "${gotifyalert}" == "on" ]&&[ -n "${gotifyalert}" ]; then +if [ "${gotifyalert}" == "on" ] && [ -n "${gotifyalert}" ]; then alert_gotify.sh -elif [ "${gotifyalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${gotifyalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Gotify alerts not enabled" fn_script_log_warn "Gotify alerts not enabled" -elif [ -z "${gotifytoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${gotifytoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Gotify token not set" echo -e "* https://docs.linuxgsm.com/alerts/gotify" fn_script_error "Gotify token not set" -elif [ -z "${gotifywebhook}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${gotifywebhook}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Gotify webhook not set" echo -e "* https://docs.linuxgsm.com/alerts/gotify" fn_script_error "Gotify webhook not set" fi -if [ "${iftttalert}" == "on" ]&&[ -n "${iftttalert}" ]; then +if [ "${iftttalert}" == "on" ] && [ -n "${iftttalert}" ]; then alert_ifttt.sh -elif [ "${iftttalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${iftttalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "IFTTT alerts not enabled" fn_script_log_warn "IFTTT alerts not enabled" -elif [ -z "${ifttttoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${ifttttoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "IFTTT token not set" echo -e "* https://docs.linuxgsm.com/alerts/ifttt" fn_script_error "IFTTT token not set" fi -if [ "${mailgunalert}" == "on" ]&&[ -n "${mailgunalert}" ]; then +if [ "${mailgunalert}" == "on" ] && [ -n "${mailgunalert}" ]; then alert_mailgun.sh -elif [ "${mailgunalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${mailgunalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Mailgun alerts not enabled" fn_script_log_warn "Mailgun alerts not enabled" -elif [ -z "${mailguntoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${mailguntoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Mailgun token not set" echo -e "* https://docs.linuxgsm.com/alerts/mailgun" fn_script_error "Mailgun token not set" fi -if [ "${pushbulletalert}" == "on" ]&&[ -n "${pushbullettoken}" ]; then +if [ "${pushbulletalert}" == "on" ] && [ -n "${pushbullettoken}" ]; then alert_pushbullet.sh -elif [ "${pushbulletalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${pushbulletalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Pushbullet alerts not enabled" fn_script_log_warn "Pushbullet alerts not enabled" -elif [ -z "${pushbullettoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${pushbullettoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Pushbullet token not set" echo -e "* https://docs.linuxgsm.com/alerts/pushbullet" fn_script_error "Pushbullet token not set" fi -if [ "${pushoveralert}" == "on" ]&&[ -n "${pushoveralert}" ]; then +if [ "${pushoveralert}" == "on" ] && [ -n "${pushoveralert}" ]; then alert_pushover.sh -elif [ "${pushoveralert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${pushoveralert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Pushover alerts not enabled" fn_script_log_warn "Pushover alerts not enabled" -elif [ -z "${pushovertoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${pushovertoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Pushover token not set" echo -e "* https://docs.linuxgsm.com/alerts/pushover" fn_script_error "Pushover token not set" fi -if [ "${telegramalert}" == "on" ]&&[ -n "${telegramtoken}" ]; then +if [ "${telegramalert}" == "on" ] && [ -n "${telegramtoken}" ]; then alert_telegram.sh -elif [ "${telegramalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${telegramalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Telegram Messages not enabled" fn_script_log_warn "Telegram Messages not enabled" -elif [ -z "${telegramtoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${telegramtoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Telegram token not set." echo -e "* https://docs.linuxgsm.com/alerts/telegram" fn_script_error "Telegram token not set." -elif [ -z "${telegramchatid}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${telegramchatid}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Telegram chat id not set." echo -e "* https://docs.linuxgsm.com/alerts/telegram" fn_script_error "Telegram chat id not set." fi -if [ "${rocketchatalert}" == "on" ]&&[ -n "${rocketchatalert}" ]; then +if [ "${rocketchatalert}" == "on" ] && [ -n "${rocketchatalert}" ]; then alert_rocketchat.sh -elif [ "${rocketchatalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${rocketchatalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Rocketchat alerts not enabled" fn_script_log_warn "Rocketchat alerts not enabled" -elif [ -z "${rocketchattoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${rocketchattoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Rocketchat token not set" #echo -e "* https://docs.linuxgsm.com/alerts/slack" fn_script_error "Rocketchat token not set" fi -if [ "${slackalert}" == "on" ]&&[ -n "${slackalert}" ]; then +if [ "${slackalert}" == "on" ] && [ -n "${slackalert}" ]; then alert_slack.sh -elif [ "${slackalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ "${slackalert}" != "on" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Slack alerts not enabled" fn_script_log_warn "Slack alerts not enabled" -elif [ -z "${slacktoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then +elif [ -z "${slacktoken}" ] && [ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Slack token not set" echo -e "* https://docs.linuxgsm.com/alerts/slack" fn_script_error "Slack token not set" diff --git a/lgsm/functions/alert_discord.sh b/lgsm/functions/alert_discord.sh index 9db56da3f8..7708175163 100755 --- a/lgsm/functions/alert_discord.sh +++ b/lgsm/functions/alert_discord.sh @@ -7,7 +7,8 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -json=$(cat </dev/null)" ]; then - array_deps_required+=( mailutils postfix ) - elif [ "$(command -v rpm 2>/dev/null)" ]; then - array_deps_required+=( mailx postfix ) + array_deps_required+=(sendmail) + elif [ "$(command -v dpkg-query 2> /dev/null)" ]; then + array_deps_required+=(mailutils postfix) + elif [ "$(command -v rpm 2> /dev/null)" ]; then + array_deps_required+=(mailx postfix) fi else - if [ "$(command -v dpkg-query 2>/dev/null)" ]; then - array_deps_required+=( mailutils postfix ) - elif [ "$(command -v rpm 2>/dev/null)" ]; then - array_deps_required+=( mailx postfix ) + if [ "$(command -v dpkg-query 2> /dev/null)" ]; then + array_deps_required+=(mailutils postfix) + elif [ "$(command -v rpm 2> /dev/null)" ]; then + array_deps_required+=(mailx postfix) fi fi fi } -fn_install_missing_deps(){ +fn_install_missing_deps() { # If any dependencies are not installed. if [ "${#array_deps_missing[*]}" != "0" ]; then if [ "${commandname}" == "INSTALL" ]; then @@ -143,9 +143,8 @@ fn_install_missing_deps(){ fi fi - # Add sudo dpkg --add-architecture i386 if using i386 packages. - if [ "$(command -v dpkg-query 2>/dev/null)" ]; then + if [ "$(command -v dpkg-query 2> /dev/null)" ]; then if printf '%s\n' "${array_deps_required[@]}" | grep -q -P 'i386'; then i386installcommand="sudo dpkg --add-architecture i386; " fi @@ -162,13 +161,13 @@ fn_install_missing_deps(){ echo -en "...\r" sleep 1 echo -en " \r" - if [ "$(command -v dpkg-query 2>/dev/null)" ]; then + if [ "$(command -v dpkg-query 2> /dev/null)" ]; then cmd="echo steamcmd steam/question select \"I AGREE\" | sudo debconf-set-selections; echo steamcmd steam/license note '' | sudo debconf-set-selections; ${i386installcommand}sudo apt-get update; sudo apt-get -y install ${array_deps_missing[*]}" eval "${cmd}" - elif [ "$(command -v dnf 2>/dev/null)" ]; then + elif [ "$(command -v dnf 2> /dev/null)" ]; then cmd="sudo dnf -y install ${array_deps_missing[*]}" eval "${cmd}" - elif [ "$(command -v yum 2>/dev/null)" ]; then + elif [ "$(command -v yum 2> /dev/null)" ]; then cmd="sudo yum -y install ${array_deps_missing[*]}" eval "${cmd}" fi @@ -182,11 +181,11 @@ fn_install_missing_deps(){ # If automatic dependency install is unavailable. if [ "${autodepinstall}" != "0" ]; then - if [ "$(command -v dpkg-query 2>/dev/null)" ]; then + if [ "$(command -v dpkg-query 2> /dev/null)" ]; then echo -e "${i386installcommand}sudo apt update; sudo apt install ${array_deps_missing[*]}" - elif [ "$(command -v dnf 2>/dev/null)" ]; then + elif [ "$(command -v dnf 2> /dev/null)" ]; then echo -e "sudo dnf install ${array_deps_missing[*]}" - elif [ "$(command -v yum 2>/dev/null)" ]; then + elif [ "$(command -v yum 2> /dev/null)" ]; then echo -e "sudo yum install ${array_deps_missing[*]}" fi fi @@ -210,7 +209,7 @@ fn_install_missing_deps(){ fi } -fn_check_loop(){ +fn_check_loop() { # Loop though required depenencies checking if they are installed. for deptocheck in ${array_deps_required[*]}; do fn_deps_detector @@ -221,21 +220,21 @@ fn_check_loop(){ } # Checks if dependency is installed or not. -fn_deps_detector(){ +fn_deps_detector() { ## Check. # SteamCMD: Will be removed from required array if no appid is present or non-free repo is not available. # This will cause SteamCMD to be installed using tar. - if [ "${deptocheck}" == "libsdl2-2.0-0:i386" ]&&[ -z "${appid}" ]; then - array_deps_required=( "${array_deps_required[@]/libsdl2-2.0-0:i386}" ) + if [ "${deptocheck}" == "libsdl2-2.0-0:i386" ] && [ -z "${appid}" ]; then + array_deps_required=("${array_deps_required[@]/libsdl2-2.0-0:i386/}") steamcmdstatus=1 - elif [ "${deptocheck}" == "steamcmd" ]&&[ -z "${appid}" ]; then - array_deps_required=( "${array_deps_required[@]/steamcmd}" ) + elif [ "${deptocheck}" == "steamcmd" ] && [ -z "${appid}" ]; then + array_deps_required=("${array_deps_required[@]/steamcmd/}") steamcmdstatus=1 - elif [ "${deptocheck}" == "steamcmd" ]&&[ "${distroid}" == "debian" ]&& ! grep -qE "^deb .*non-free" /etc/apt/sources.list; then - array_deps_required=( "${array_deps_required[@]/steamcmd}" ) + elif [ "${deptocheck}" == "steamcmd" ] && [ "${distroid}" == "debian" ] && ! grep -qE "^deb .*non-free" /etc/apt/sources.list; then + array_deps_required=("${array_deps_required[@]/steamcmd/}") steamcmdstatus=1 # Java: Added for users using Oracle JRE to bypass check. - elif [[ ${deptocheck} == "openjdk"* ]]||[[ ${deptocheck} == "java"* ]]; then + elif [[ ${deptocheck} == "openjdk"* ]] || [[ ${deptocheck} == "java"* ]]; then # Is java already installed? if [ -n "${javaversion}" ]; then # Added for users using Oracle JRE to bypass check. @@ -246,7 +245,7 @@ fn_deps_detector(){ fi # Mono: A Mono repo needs to be installed. elif [ "${deptocheck}" == "mono-complete" ]; then - if [ -n "${monoversion}" ]&&[ "${monoversion}" -ge "5" ]; then + if [ -n "${monoversion}" ] && [ "${monoversion}" -ge "5" ]; then # Mono >= 5.0.0 already installed. depstatus=0 monostatus=0 @@ -255,13 +254,13 @@ fn_deps_detector(){ depstatus=1 monostatus=1 fi - elif [ "$(command -v dpkg-query 2>/dev/null)" ]; then - dpkg-query -W -f='${Status}' "${deptocheck}" 2>/dev/null | grep -q -P '^install ok installed' + elif [ "$(command -v dpkg-query 2> /dev/null)" ]; then + dpkg-query -W -f='${Status}' "${deptocheck}" 2> /dev/null | grep -q -P '^install ok installed' depstatus=$? - elif [ "$(command -v dnf 2>/dev/null)" ]; then + elif [ "$(command -v dnf 2> /dev/null)" ]; then dnf list installed "${deptocheck}" > /dev/null 2>&1 depstatus=$? - elif [ "$(command -v rpm 2>/dev/null)" ]; then + elif [ "$(command -v rpm 2> /dev/null)" ]; then rpm -q "${deptocheck}" > /dev/null 2>&1 depstatus=$? fi @@ -286,11 +285,11 @@ fn_deps_detector(){ fi # If SteamCMD requirements are not met install will fail. if [ -n "${appid}" ]; then - for steamcmddeptocheck in ${array_deps_required_steamcmd[*]}; do - if [ "${deptocheck}" != "steamcmd" ]&&[ "${deptocheck}" == "${steamcmddeptocheck}" ]; then - steamcmdfail=1 - fi - done + for steamcmddeptocheck in ${array_deps_required_steamcmd[*]}; do + if [ "${deptocheck}" != "steamcmd" ] && [ "${deptocheck}" == "${steamcmddeptocheck}" ]; then + steamcmdfail=1 + fi + done fi fi unset depstatus @@ -326,10 +325,10 @@ fi info_distro.sh -if [ ! -f "${tmpdir}/dependency-no-check.tmp" ]&&[ ! -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then +if [ ! -f "${tmpdir}/dependency-no-check.tmp" ] && [ ! -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then # Check that the distro dependency csv file exists. fn_check_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" - if [ -n "${checkflag}" ]&&[ "${checkflag}" == "0" ]; then + if [ -n "${checkflag}" ] && [ "${checkflag}" == "0" ]; then fn_fetch_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" "lgsm/data" "chmodx" "norun" "noforce" "nohash" fi fi @@ -338,7 +337,7 @@ fi if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then depall=$(awk -F, '$1=="all" {$1=""; print $0}' "${datadir}/${distroid}-${distroversioncsv}.csv") depsteamcmd=$(awk -F, '$1=="steamcmd" {$1=""; print $0}' "${datadir}/${distroid}-${distroversioncsv}.csv") - depshortname=$(awk -v shortname="$shortname" -F, '$1==shortname {$1=""; print $0}' "${datadir}/${distroid}-${distroversioncsv}.csv") + depshortname=$(awk -v shortname="$shortname" -F, '$1==shortname {$1=""; print $0}' "${datadir}/${distroid}-${distroversioncsv}.csv") # Generate array of missing deps. array_deps_missing=() @@ -351,11 +350,11 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then fn_check_loop # Warn the user that dependency checking is unavailable for their distro. -elif [ "${commandname}" == "INSTALL" ]||[ -n "${checkflag}" ]&&[ "${checkflag}" != "0" ]; then +elif [ "${commandname}" == "INSTALL" ] || [ -n "${checkflag}" ] && [ "${checkflag}" != "0" ]; then fn_print_warning_nl "LinuxGSM dependency checking currently unavailable for ${distroname}." # Prevent future dependency checking if unavailable for the distro. echo "${version}" > "${tmpdir}/dependency-no-check.tmp" -elif [ -f "${tmpdir}/dependency-no-check.tmp" ]; then +elif [ -f "${tmpdir}/dependency-no-check.tmp" ]; then # Allow LinuxGSM to try a dependency check if LinuxGSM has been recently updated. nocheckversion=$(cat "${tmpdir}/dependency-no-check.tmp") if [ "${version}" != "${nocheckversion}" ]; then diff --git a/lgsm/functions/check_ip.sh b/lgsm/functions/check_ip.sh index 0dafbbcdc2..fc5d70f2c4 100755 --- a/lgsm/functions/check_ip.sh +++ b/lgsm/functions/check_ip.sh @@ -10,17 +10,17 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_game.sh -ip_commands_array=( "/bin/ip" "/usr/sbin/ip" "ip") +ip_commands_array=("/bin/ip" "/usr/sbin/ip" "ip") for ip_command in "${ip_commands_array[@]}"; do - if [ "$(command -v ${ip_command} 2>/dev/null)" ]; then + if [ "$(command -v ${ip_command} 2> /dev/null)" ]; then ipcommand="${ip_command}" break fi done -ethtool_commands_array=( "/bin/ethtool" "/usr/sbin/ethtool" "ethtool") +ethtool_commands_array=("/bin/ethtool" "/usr/sbin/ethtool" "ethtool") for ethtool_command in "${ethtool_commands_array[@]}"; do - if [ "$(command -v ${ethtool_command} 2>/dev/null)" ]; then + if [ "$(command -v ${ethtool_command} 2> /dev/null)" ]; then ethtoolcommand="${ethtool_command}" break fi @@ -32,27 +32,27 @@ getipwc=$(${ipcommand} -o -4 addr | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\ # Check if server has multiple IP addresses # If the IP variable has been set by user. -if [ -n "${ip}" ]&&[ "${ip}" != "0.0.0.0" ]; then - queryips=( "${ip}" ) - webadminip=( "${ip}" ) - telnetip=( "${ip}" ) +if [ -n "${ip}" ] && [ "${ip}" != "0.0.0.0" ]; then + queryips=("${ip}") + webadminip=("${ip}") + telnetip=("${ip}") # If game config does have an IP set. -elif [ -n "${configip}" ]&&[ "${configip}" != "0.0.0.0" ];then - queryips=( "${configip}" ) +elif [ -n "${configip}" ] && [ "${configip}" != "0.0.0.0" ]; then + queryips=("${configip}") ip="${configip}" - webadminip=( "${configip}" ) - telnetip=( "${configip}" ) + webadminip=("${configip}") + telnetip=("${configip}") # If there is only 1 server IP address. # Some IP details can automaticly use the one IP elif [ "${getipwc}" == "1" ]; then - queryips=( $(echo "${getip}") ) + queryips=($(echo "${getip}")) ip="0.0.0.0" - webadminip=( "${getip}" ) - telnetip=( "${getip}" ) + webadminip=("${getip}") + telnetip=("${getip}") # If no ip is set by the user and server has more than one IP. else - queryips=( $(echo "${getip}") ) + queryips=($(echo "${getip}")) ip="0.0.0.0" - webadminip=( "${ip}" ) - telnetip=( "${ip}" ) + webadminip=("${ip}") + telnetip=("${ip}") fi diff --git a/lgsm/functions/check_last_update.sh b/lgsm/functions/check_last_update.sh index 07e9d3883e..ee86c0ba14 100755 --- a/lgsm/functions/check_last_update.sh +++ b/lgsm/functions/check_last_update.sh @@ -16,8 +16,8 @@ if [ -f "${lockdir}/lastupdate.lock" ]; then fi check_status.sh -if [ -f "${lockdir}/lastupdate.lock" ]&&[ "${status}" != "0" ]; then - if [ ! -f "${lockdir}/${selfname}-laststart.lock" ]||[ "${laststart}" -lt "${lastupdate}" ]; then +if [ -f "${lockdir}/lastupdate.lock" ] && [ "${status}" != "0" ]; then + if [ ! -f "${lockdir}/${selfname}-laststart.lock" ] || [ "${laststart}" -lt "${lastupdate}" ]; then fn_print_info "${selfname} has not been restarted since last update" fn_script_log_info "${selfname} has not been restarted since last update" command_restart.sh diff --git a/lgsm/functions/check_logs.sh b/lgsm/functions/check_logs.sh index b8dad203cf..fa3df92d10 100755 --- a/lgsm/functions/check_logs.sh +++ b/lgsm/functions/check_logs.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_check_logs(){ +fn_check_logs() { fn_print_dots "Checking for log files" fn_print_info_nl "Checking for log files: Creating log files" checklogs=1 @@ -15,12 +15,12 @@ fn_check_logs(){ } # Create directories for the script and console logs. -if [ ! -d "${lgsmlogdir}" ]||[ ! -d "${consolelogdir}" ]; then +if [ ! -d "${lgsmlogdir}" ] || [ ! -d "${consolelogdir}" ]; then fn_check_logs fi # Create gamelogdir. # If variable exists gamelogdir exists and log/server does not. -if [ "${gamelogdir}" ]&&[ -d "${gamelogdir}" ]&&[ ! -d "${logdir}/server" ]; then +if [ "${gamelogdir}" ] && [ -d "${gamelogdir}" ] && [ ! -d "${logdir}/server" ]; then fn_check_logs fi diff --git a/lgsm/functions/check_permissions.sh b/lgsm/functions/check_permissions.sh index 4c8fda389b..92a76600bc 100755 --- a/lgsm/functions/check_permissions.sh +++ b/lgsm/functions/check_permissions.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_check_ownership(){ +fn_check_ownership() { if [ -f "${rootdir}/${selfname}" ]; then if [ "$(find "${rootdir}/${selfname}" -not -user "$(whoami)" | wc -l)" -ne "0" ]; then selfownissue=1 @@ -23,7 +23,7 @@ fn_check_ownership(){ filesownissue=1 fi fi - if [ "${selfownissue}" == "1" ]||[ "${funcownissue}" == "1" ]||[ "${filesownissue}" == "1" ]; then + if [ "${selfownissue}" == "1" ] || [ "${funcownissue}" == "1" ] || [ "${filesownissue}" == "1" ]; then fn_print_fail_nl "Ownership issues found" fn_script_log_fatal "Ownership issues found" fn_print_information_nl "The current user ($(whoami)) does not have ownership of the following files:" @@ -36,7 +36,7 @@ fn_check_ownership(){ if [ "${funcownissue}" == "1" ]; then find "${functionsdir}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n" fi - if [ "${filesownissue}" == "1" ]; then + if [ "${filesownissue}" == "1" ]; then find "${serverfiles}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n" fi @@ -52,7 +52,7 @@ fn_check_ownership(){ fi } -fn_check_permissions(){ +fn_check_permissions() { if [ -d "${functionsdir}" ]; then if [ "$(find "${functionsdir}" -type f -not -executable | wc -l)" -ne "0" ]; then fn_print_fail_nl "Permissions issues found" @@ -78,7 +78,7 @@ fn_check_permissions(){ # Grab the first and second digit for user and group permission. userrootdirperm="${rootdirperm:0:1}" grouprootdirperm="${rootdirperm:1:1}" - if [ "${userrootdirperm}" != "7" ]&&[ "${grouprootdirperm}" != "7" ]; then + if [ "${userrootdirperm}" != "7" ] && [ "${grouprootdirperm}" != "7" ]; then fn_print_fail_nl "Permissions issues found" fn_script_log_fatal "Permissions issues found" fn_print_information_nl "The following directory does not have the correct permissions:" @@ -102,9 +102,9 @@ fn_check_permissions(){ userexecperm="${execperm:0:1}" groupexecperm="${execperm:1:1}" # Check for invalid user permission. - if [ "${userexecperm}" == "0" ]||[ "${userexecperm}" == "2" ]||[ "${userexecperm}" == "4" ]||[ "${userexecperm}" == "6" ]; then + if [ "${userexecperm}" == "0" ] || [ "${userexecperm}" == "2" ] || [ "${userexecperm}" == "4" ] || [ "${userexecperm}" == "6" ]; then # If user permission is invalid, then check for invalid group permissions. - if [ "${groupexecperm}" == "0" ]||[ "${groupexecperm}" == "2" ]||[ "${groupexecperm}" == "4" ]||[ "${groupexecperm}" == "6" ]; then + if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ] || [ "${groupexecperm}" == "6" ]; then # If permission issues are found. fn_print_warn_nl "Permissions issue found" fn_script_log_warn "Permissions issue found" @@ -122,18 +122,18 @@ fn_check_permissions(){ # Grab the first and second digit for user and group permission. userexecperm="${execperm:0:1}" groupexecperm="${execperm:1:1}" - if [ "${userexecperm}" == "0" ]||[ "${userexecperm}" == "2" ]||[ "${userexecperm}" == "4" ]||[ "${userexecperm}" == "6" ]; then - if [ "${groupexecperm}" == "0" ]||[ "${groupexecperm}" == "2" ]||[ "${groupexecperm}" == "4" ]||[ "${groupexecperm}" == "6" ]; then - # If errors are still found. - fn_print_fail_nl "The following file could not be set executable:" - ls -l "${executabledir}/${execname}" - fn_script_log_warn "The following file could not be set executable:" - fn_script_log_info "${executabledir}/${execname}" - if [ "${monitorflag}" == "1" ]; then - alert="permissions" - alert.sh - fi - core_exit.sh + if [ "${userexecperm}" == "0" ] || [ "${userexecperm}" == "2" ] || [ "${userexecperm}" == "4" ] || [ "${userexecperm}" == "6" ]; then + if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ] || [ "${groupexecperm}" == "6" ]; then + # If errors are still found. + fn_print_fail_nl "The following file could not be set executable:" + ls -l "${executabledir}/${execname}" + fn_script_log_warn "The following file could not be set executable:" + fn_script_log_info "${executabledir}/${execname}" + if [ "${monitorflag}" == "1" ]; then + alert="permissions" + alert.sh + fi + core_exit.sh fi fi fi @@ -144,26 +144,26 @@ fn_check_permissions(){ ## The following fn_sys_perm_* functions checks for permission errors in /sys directory. # Checks for permission errors in /sys directory. -fn_sys_perm_errors_detect(){ +fn_sys_perm_errors_detect() { # Reset test variables. sysdirpermerror="0" classdirpermerror="0" netdirpermerror="0" # Check permissions. # /sys, /sys/class and /sys/class/net should be readable & executable. - if [ ! -r "/sys" ]||[ ! -x "/sys" ]; then + if [ ! -r "/sys" ] || [ ! -x "/sys" ]; then sysdirpermerror="1" fi - if [ ! -r "/sys/class" ]||[ ! -x "/sys/class" ]; then + if [ ! -r "/sys/class" ] || [ ! -x "/sys/class" ]; then classdirpermerror="1" fi - if [ ! -r "/sys/class/net" ]||[ ! -x "/sys/class/net" ]; then + if [ ! -r "/sys/class/net" ] || [ ! -x "/sys/class/net" ]; then netdirpermerror="1" fi } # Display a message on how to fix the issue manually. -fn_sys_perm_fix_manually_msg(){ +fn_sys_perm_fix_manually_msg() { echo -e "" fn_print_information_nl "This error causes servers to fail starting properly" fn_script_log_info "This error causes servers to fail starting properly." @@ -180,7 +180,7 @@ fn_sys_perm_fix_manually_msg(){ } # Attempt to fix /sys related permission errors if sudo is available, exits otherwise. -fn_sys_perm_errors_fix(){ +fn_sys_perm_errors_fix() { if sudo -n true > /dev/null 2>&1; then fn_print_dots "Automatically fixing /sys permissions" fn_script_log_info "Automatically fixing /sys permissions." @@ -195,7 +195,7 @@ fn_sys_perm_errors_fix(){ fi # Run check again to see if it's fixed. fn_sys_perm_errors_detect - if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then + if [ "${sysdirpermerror}" == "1" ] || [ "${classdirpermerror}" == "1" ] || [ "${netdirpermerror}" == "1" ]; then fn_print_error "Could not fix /sys permissions" fn_script_log_error "Could not fix /sys permissions." fn_sleep_time @@ -206,16 +206,16 @@ fn_sys_perm_errors_fix(){ fn_script_log_pass "Permissions in /sys fixed" fi else - # Show the user how to fix. - fn_sys_perm_fix_manually_msg + # Show the user how to fix. + fn_sys_perm_fix_manually_msg fi } # Processes to the /sys related permission errors check & fix/info. -fn_sys_perm_error_process(){ +fn_sys_perm_error_process() { fn_sys_perm_errors_detect # If any error was found. - if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then + if [ "${sysdirpermerror}" == "1" ] || [ "${classdirpermerror}" == "1" ] || [ "${netdirpermerror}" == "1" ]; then fn_print_error_nl "Permission error(s) found in /sys" fn_script_log_error "Permission error(s) found in /sys" # Run the fix diff --git a/lgsm/functions/check_status.sh b/lgsm/functions/check_status.sh index 670669e50c..28ec38eb25 100755 --- a/lgsm/functions/check_status.sh +++ b/lgsm/functions/check_status.sh @@ -7,4 +7,4 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -status=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${sessionname}") +status=$(tmux list-sessions -F "#{session_name}" 2> /dev/null | grep -Ecx "^${sessionname}") diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh index 030cbbf03a..d41e8669f4 100755 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -12,7 +12,7 @@ core_steamcmd.sh fn_check_steamcmd_clear fn_check_steamcmd -if [ ${shortname} == "ark" ]; then +if [ "${shortname}" == "ark" ]; then fn_check_steamcmd_ark fi fn_check_steamcmd_dir diff --git a/lgsm/functions/check_system_requirements.sh b/lgsm/functions/check_system_requirements.sh index cc72288fb0..bfe597135c 100755 --- a/lgsm/functions/check_system_requirements.sh +++ b/lgsm/functions/check_system_requirements.sh @@ -26,19 +26,19 @@ elif [ "${shortname}" == "arma3" ]; then elif [ "${shortname}" == "rust" ]; then ramrequirementmb="4000" ramrequirementgb="4" -elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then +elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "wmc" ]; then ramrequirementmb="1000" ramrequirementgb="1" elif [ "${shortname}" == "pstbs" ]; then ramrequirementmb="2000" ramrequirementgb="2" -elif [ "${shortname}" == "ns2" ]||[ "${shortname}" == "ns2c" ]; then +elif [ "${shortname}" == "ns2" ] || [ "${shortname}" == "ns2c" ]; then ramrequirementmb="1000" ramrequirementgb="1" elif [ "${shortname}" == "st" ]; then ramrequirementmb="1000" ramrequirementgb="1" -elif [ "${shortname}" == "pvr" ];then +elif [ "${shortname}" == "pvr" ]; then ramrequirementmb="2000" ramrequirementgb="2" fi diff --git a/lgsm/functions/check_tmuxception.sh b/lgsm/functions/check_tmuxception.sh index e11b558612..64705a3a8b 100755 --- a/lgsm/functions/check_tmuxception.sh +++ b/lgsm/functions/check_tmuxception.sh @@ -7,8 +7,8 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_check_is_in_tmux(){ - if [ "${TMUX}" ]; then +fn_check_is_in_tmux() { + if [ "${TMUX}" ]; then fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a tmux session." fn_script_log_fatal "Tmuxception error: Attempted to start a tmux session inside of a tmux session." fn_print_information_nl "LinuxGSM creates a tmux session when starting the server." @@ -18,7 +18,7 @@ fn_check_is_in_tmux(){ fi } -fn_check_is_in_screen(){ +fn_check_is_in_screen() { if [ "${STY}" ]; then fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a screen session." fn_script_log_fatal "Tmuxception error: Attempted to start a tmux session inside of a screen session." diff --git a/lgsm/functions/check_version.sh b/lgsm/functions/check_version.sh index a0f3d44350..657e32b54c 100755 --- a/lgsm/functions/check_version.sh +++ b/lgsm/functions/check_version.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -if [ -n "${modulesversion}" ]&&[ -n "${version}" ]&&[ "${version}" != "${modulesversion}" ]; then +if [ -n "${modulesversion}" ] && [ -n "${version}" ] && [ "${version}" != "${modulesversion}" ]; then exitbypass=1 echo -e "" fn_print_error_nl "LinuxGSM version mismatch" diff --git a/lgsm/functions/command_backup.sh b/lgsm/functions/command_backup.sh index adce957c99..0dfabcd030 100644 --- a/lgsm/functions/command_backup.sh +++ b/lgsm/functions/command_backup.sh @@ -13,7 +13,7 @@ fn_firstcommand_set check.sh # Trap to remove lockfile on quit. -fn_backup_trap(){ +fn_backup_trap() { echo -e "" echo -en "backup ${backupname}.tar.gz..." fn_print_canceled_eol_nl @@ -30,7 +30,7 @@ fn_backup_trap(){ } # Check if a backup is pending or has been aborted using backup.lock. -fn_backup_check_lockfile(){ +fn_backup_check_lockfile() { if [ -f "${lockdir}/backup.lock" ]; then fn_print_info_nl "Lock file found: Backup is currently running" fn_script_log_error "Lock file found: Backup is currently running: ${lockdir}/backup.lock" @@ -39,7 +39,7 @@ fn_backup_check_lockfile(){ } # Initialisation. -fn_backup_init(){ +fn_backup_init() { # Backup file name with selfname and current date. backupname="${selfname}-$(date '+%Y-%m-%d-%H%M%S')" @@ -47,7 +47,7 @@ fn_backup_init(){ fn_print_dots "Backup starting" fn_script_log_info "Backup starting" fn_print_ok_nl "Backup starting" - if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then + if [ ! -d "${backupdir}" ] || [ "${backupcount}" == "0" ]; then fn_print_info_nl "There are no previous backups" else if [ "${lastbackupdaysago}" == "0" ]; then @@ -62,7 +62,7 @@ fn_backup_init(){ } # Check if server is started and whether to stop it. -fn_backup_stop_server(){ +fn_backup_stop_server() { check_status.sh # Server is running but will not be stopped. if [ "${stoponbackup}" == "off" ]; then @@ -82,7 +82,7 @@ fn_backup_stop_server(){ } # Create required folders. -fn_backup_dir(){ +fn_backup_dir() { # Create backupdir if it doesn't exist. if [ ! -d "${backupdir}" ]; then mkdir -p "${backupdir}" @@ -90,17 +90,17 @@ fn_backup_dir(){ } # Migrate Backups from old dir before refactor -fn_backup_migrate_olddir(){ +fn_backup_migrate_olddir() { # Check if old backup dir is there before the refactor and move the backups if [ -d "${rootdir}/backups" ]; then if [ "${rootdir}/backups" != "${backupdir}" ]; then fn_print_dots "Backup directory is being migrated" fn_script_log_info "Backup directory is being migrated" fn_script_log_info "${rootdir}/backups > ${backupdir}" - mv "${rootdir}/backups/"* "${backupdir}" 2>/dev/null + mv "${rootdir}/backups/"* "${backupdir}" 2> /dev/null exitcode=$? if [ "${exitcode}" -eq 0 ]; then - rmdir "${rootdir}/backups" 2>/dev/null + rmdir "${rootdir}/backups" 2> /dev/null exitcode=$? fi if [ "${exitcode}" -eq 0 ]; then @@ -114,7 +114,7 @@ fn_backup_migrate_olddir(){ fi } -fn_backup_create_lockfile(){ +fn_backup_create_lockfile() { # Create lockfile. date '+%s' > "${lockdir}/backup.lock" fn_script_log_info "Lockfile generated" @@ -124,7 +124,7 @@ fn_backup_create_lockfile(){ } # Compressing files. -fn_backup_compression(){ +fn_backup_compression() { # Tells how much will be compressed using rootdirduexbackup value from info_distro and prompt for continue. fn_print_info "A total of ${rootdirduexbackup} will be compressed." fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.tar.gz" @@ -133,7 +133,7 @@ fn_backup_compression(){ excludedir=$(fn_backup_relpath) # Check that excludedir is a valid path. - if [ ! -d "${excludedir}" ] ; then + if [ ! -d "${excludedir}" ]; then fn_print_fail_nl "Problem identifying the previous backup directory for exclusion." fn_script_log_fatal "Problem identifying the previous backup directory for exclusion" core_exit.sh @@ -157,17 +157,17 @@ fn_backup_compression(){ } # Clear old backups according to maxbackups and maxbackupdays variables. -fn_backup_prune(){ +fn_backup_prune() { # Clear if backup variables are set. - if [ "${maxbackups}" ]&&[ -n "${maxbackupdays}" ]; then + if [ "${maxbackups}" ] && [ -n "${maxbackupdays}" ]; then # How many backups there are. info_distro.sh # How many backups exceed maxbackups. - backupquotadiff=$((backupcount-maxbackups)) + backupquotadiff=$((backupcount - maxbackups)) # How many backups exceed maxbackupdays. - backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.gz" -mtime +"${maxbackupdays}"|wc -l) + backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.gz" -mtime +"${maxbackupdays}" | wc -l) # If anything can be cleared. - if [ "${backupquotadiff}" -gt "0" ]||[ "${backupsoudatedcount}" -gt "0" ]; then + if [ "${backupquotadiff}" -gt "0" ] || [ "${backupsoudatedcount}" -gt "0" ]; then fn_print_dots "Pruning" fn_script_log_info "Backup pruning activated" fn_print_ok_nl "Pruning" @@ -220,32 +220,32 @@ fn_backup_relpath() { # Compare the leading entries of each array. These common elements will be clipped off. # for the relative path output. - for ((base=0; base<${#rdirtoks[@]}; base++)); do + for ((base = 0; base < ${#rdirtoks[@]}; base++)); do [[ "${rdirtoks[$base]}" != "${bdirtoks[$base]}" ]] && break done # Next, climb out of the remaining rootdir location with updir references. - for ((x=base;x<${#rdirtoks[@]};x++)); do + for ((x = base; x < ${#rdirtoks[@]}; x++)); do echo -n "../" done # Climb down the remaining components of the backupdir location. - for ((x=base;x<$(( ${#bdirtoks[@]} - 1 ));x++)); do + for ((x = base; x < $((${#bdirtoks[@]} - 1)); x++)); do echo -n "${bdirtoks[$x]}/" done # In the event there were no directories left in the backupdir above to # traverse down, just add a newline. Otherwise at this point, there is # one remaining directory component in the backupdir to navigate. - if (( "$base" < "${#bdirtoks[@]}" )) ; then - echo -e "${bdirtoks[ $(( ${#bdirtoks[@]} - 1)) ]}" + if (("$base" < "${#bdirtoks[@]}")); then + echo -e "${bdirtoks[$((${#bdirtoks[@]} - 1))]}" else echo fi } # Start the server if it was stopped for the backup. -fn_backup_start_server(){ +fn_backup_start_server() { if [ -n "${startserver}" ]; then exitbypass=1 command_start.sh diff --git a/lgsm/functions/command_check_update.sh b/lgsm/functions/command_check_update.sh index 9648dd49e2..59b29d6e9a 100755 --- a/lgsm/functions/command_check_update.sh +++ b/lgsm/functions/command_check_update.sh @@ -14,12 +14,16 @@ fn_print_dots "" check.sh core_logs.sh -core_steamcmd.sh +if [ "${appid}" ]; then + core_steamcmd.sh -check_steamcmd.sh + check_steamcmd.sh -fn_update_steamcmd_localbuild -fn_update_steamcmd_remotebuild -fn_update_steamcmd_compare + fn_update_steamcmd_localbuild + fn_update_steamcmd_remotebuild + fn_update_steamcmd_compare +elif [ "${shortname}" == "ts3" ]; then + update_ts3.sh +fi core_exit.sh diff --git a/lgsm/functions/command_debug.sh b/lgsm/functions/command_debug.sh index b6ab14fe85..190a8c5279 100755 --- a/lgsm/functions/command_debug.sh +++ b/lgsm/functions/command_debug.sh @@ -11,7 +11,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set # Trap to remove lockfile on quit. -fn_lockfile_trap(){ +fn_lockfile_trap() { # Remove lockfile. rm -f "${lockdir:?}/${selfname}.lock" # resets terminal. Servers can sometimes mess up the terminal on exit. @@ -32,7 +32,7 @@ info_game.sh fn_print_header { echo -e "${lightblue}Distro:\t\t${default}${distroname}" - echo -e "${lightblue}Arch:\t\t${default}${arch}" + echo -e "${lightblue}Architecture:\t\t${default}${arch}" echo -e "${lightblue}Kernel:\t\t${default}${kernel}" echo -e "${lightblue}Hostname:\t\t${default}${HOSTNAME}" echo -e "${lightblue}tmux:\t\t${default}${tmuxv}" @@ -70,7 +70,7 @@ fi fn_reload_startparameters echo -e "${lightblue}Start parameters:${default}" -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then +if [ "${engine}" == "source" ] || [ "${engine}" == "goldsrc" ]; then echo -e "${executable} ${startparameters} -debug" elif [ "${engine}" == "quake" ]; then echo -e "${executable} ${startparameters} -condebug" @@ -111,7 +111,7 @@ else fi # Note: do not add double quotes to ${executable} ${startparameters}. -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then +if [ "${engine}" == "source" ] || [ "${engine}" == "goldsrc" ]; then eval "${executable} ${startparameters} -debug" elif [ "${engine}" == "quake" ]; then eval "${executable} ${startparameters} -condebug" diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index 2daeeb2f72..08d9f031b4 100755 --- a/lgsm/functions/command_details.sh +++ b/lgsm/functions/command_details.sh @@ -15,7 +15,7 @@ check.sh info_distro.sh info_game.sh info_messages.sh -if [ "${querymode}" == "2" ]||[ "${querymode}" == "3" ]; then +if [ "${querymode}" == "2" ] || [ "${querymode}" == "3" ]; then for queryip in "${queryips[@]}"; do query_gamedig.sh if [ "${querystatus}" == "0" ]; then @@ -30,7 +30,7 @@ fn_info_message_gameserver fn_info_message_script fn_info_message_backup # Some game servers do not have parms. -if [ "${shortname}" != "jc2" ]&&[ "${shortname}" != "dst" ]&&[ "${shortname}" != "pz" ]&&[ "${engine}" != "renderware" ]; then +if [ "${shortname}" != "jc2" ] && [ "${shortname}" != "dst" ] && [ "${shortname}" != "pz" ] && [ "${engine}" != "renderware" ]; then fn_info_message_commandlineparms fi fn_info_message_ports_edit diff --git a/lgsm/functions/command_dev_detect_deps.sh b/lgsm/functions/command_dev_detect_deps.sh index 976bf94dcf..d16b744189 100755 --- a/lgsm/functions/command_dev_detect_deps.sh +++ b/lgsm/functions/command_dev_detect_deps.sh @@ -15,26 +15,26 @@ echo -e "Dependencies Checker" echo -e "=================================" echo -e "Checking directory: " echo -e "${serverfiles}" -if [ "$(command -v eu-readelf 2>/dev/null)" ]; then +if [ "$(command -v eu-readelf 2> /dev/null)" ]; then readelf=eu-readelf -elif [ "$(command -v readelf 2>/dev/null)" ]; then +elif [ "$(command -v readelf 2> /dev/null)" ]; then readelf=readelf else echo -e "readelf/eu-readelf not installed" fi files=$(find "${serverfiles}" | wc -l) -find "${serverfiles}" -type f -print0 | -while IFS= read -r -d $'\0' line; do - if [ "${readelf}" == "eu-readelf" ]; then - ${readelf} -d "${line}" 2>/dev/null | grep NEEDED| awk '{ print $4 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf" - else - ${readelf} -d "${line}" 2>/dev/null | grep NEEDED | awk '{ print $5 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf" - fi - echo -n "${i} / ${files}" $'\r' - ((i++)) -done +find "${serverfiles}" -type f -print0 \ + | while IFS= read -r -d $'\0' line; do + if [ "${readelf}" == "eu-readelf" ]; then + ${readelf} -d "${line}" 2> /dev/null | grep NEEDED | awk '{ print $4 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf" + else + ${readelf} -d "${line}" 2> /dev/null | grep NEEDED | awk '{ print $5 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf" + fi + echo -n "${i} / ${files}" $'\r' + ((i++)) + done -sort "${tmpdir}/.depdetect_readelf" |uniq >"${tmpdir}/.depdetect_readelf_uniq" +sort "${tmpdir}/.depdetect_readelf" | uniq > "${tmpdir}/.depdetect_readelf_uniq" touch "${tmpdir}/.depdetect_centos_list" touch "${tmpdir}/.depdetect_ubuntu_list" @@ -42,7 +42,7 @@ touch "${tmpdir}/.depdetect_debian_list" while read -r lib; do echo -e "${lib}" - libs_array=( libm.so.6 libc.so.6 libtcmalloc_minimal.so.4 libpthread.so.0 libdl.so.2 libnsl.so.1 libgcc_s.so.1 librt.so.1 ld-linux.so.2 libdbus-glib-1.so.2 libgio-2.0.so.0 libglib-2.0.so.0 libGL.so.1 libgobject-2.0.so.0 libnm-glib.so.4 libnm-util.so.2 ) + libs_array=(libm.so.6 libc.so.6 libtcmalloc_minimal.so.4 libpthread.so.0 libdl.so.2 libnsl.so.1 libgcc_s.so.1 librt.so.1 ld-linux.so.2 libdbus-glib-1.so.2 libgio-2.0.so.0 libglib-2.0.so.0 libGL.so.1 libgobject-2.0.so.0 libnm-glib.so.4 libnm-util.so.2) for lib_file in "${libs_array[@]}"; do if [ "${lib}" == "${lib_file}" ]; then echo -e "glibc.i686" >> "${tmpdir}/.depdetect_centos_list" @@ -52,7 +52,7 @@ while read -r lib; do fi done - libs_array=( libawt.so libjava.so libjli.so libjvm.so libnet.so libnio.so libverify.so ) + libs_array=(libawt.so libjava.so libjli.so libjvm.so libnet.so libnio.so libverify.so) for lib_file in "${libs_array[@]}"; do if [ "${lib}" == "${lib_file}" ]; then echo -e "java-1.8.0-openjdk" >> "${tmpdir}/.depdetect_centos_list" @@ -62,7 +62,7 @@ while read -r lib; do fi done - libs_array=( libtier0.so libtier0_srv.so libvstdlib_srv.so Core.so libvstdlib.so libtier0_s.so Editor.so Engine.so liblua.so libsteam_api.so ld-linux-x86-64.so.2 libPhysX3_x86.so libPhysX3Common_x86.so libPhysX3Cooking_x86.so) + libs_array=(libtier0.so libtier0_srv.so libvstdlib_srv.so Core.so libvstdlib.so libtier0_s.so Editor.so Engine.so liblua.so libsteam_api.so ld-linux-x86-64.so.2 libPhysX3_x86.so libPhysX3Common_x86.so libPhysX3Cooking_x86.so) for lib_file in "${libs_array[@]}"; do # Known shared libs what dont requires dependencies. if [ "${lib}" == "${lib_file}" ]; then @@ -85,12 +85,12 @@ while read -r lib; do echo -e "libcurl4-gnutls-dev:i386" >> "${tmpdir}/.depdetect_ubuntu_list" echo -e "libcurl4-gnutls-dev:i386" >> "${tmpdir}/.depdetect_debian_list" libdetected=1 - elif [ "${lib}" == "libspeex.so.1" ]||[ "${lib}" == "libspeexdsp.so.1" ]; then + elif [ "${lib}" == "libspeex.so.1" ] || [ "${lib}" == "libspeexdsp.so.1" ]; then echo -e "speex.i686" >> "${tmpdir}/.depdetect_centos_list" echo -e "speex:i386" >> "${tmpdir}/.depdetect_ubuntu_list" echo -e "speex:i386" >> "${tmpdir}/.depdetect_debian_list" libdetected=1 - elif [ "${lib}" == "./libSDL-1.2.so.0" ]||[ "${lib}" == "libSDL-1.2.so.0" ]; then + elif [ "${lib}" == "./libSDL-1.2.so.0" ] || [ "${lib}" == "libSDL-1.2.so.0" ]; then echo -e "SDL.i686" >> "${tmpdir}/.depdetect_centos_list" echo -e "libsdl1.2debian" >> "${tmpdir}/.depdetect_ubuntu_list" echo -e "libsdl1.2debian" >> "${tmpdir}/.depdetect_debian_list" diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/functions/command_dev_detect_glibc.sh index 304d255fd5..73280e55d3 100755 --- a/lgsm/functions/command_dev_detect_glibc.sh +++ b/lgsm/functions/command_dev_detect_glibc.sh @@ -34,8 +34,7 @@ elif [ -f "${serverfiles}" ]; then fi echo -e "" - -glibc_check_dir_array=( steamcmddir serverfiles ) +glibc_check_dir_array=(steamcmddir serverfiles) for glibc_check_var in "${glibc_check_dir_array[@]}"; do if [ "${glibc_check_var}" == "serverfiles" ]; then glibc_check_dir="${serverfiles}" @@ -47,23 +46,23 @@ for glibc_check_var in "${glibc_check_dir_array[@]}"; do if [ -d "${glibc_check_dir}" ]; then glibc_check_files=$(find "${glibc_check_dir}" | wc -l) - find "${glibc_check_dir}" -type f -print0 | - while IFS= read -r -d $'\0' line; do - glibcversion=$(objdump -T "${line}" 2>/dev/null | grep -oP "GLIBC[^ ]+" | grep -v GLIBCXX | sort | uniq | sort -r --version-sort | head -n 1) - if [ "${glibcversion}" ]; then - echo -e "${glibcversion}: ${line}" >>"${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp" - fi - objdump -T "${line}" 2>/dev/null | grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc_${glibc_check_var}.tmp" - echo -n "${i} / ${glibc_check_files}" $'\r' - ((i++)) - done - echo -e "" - echo -e "" - echo -e "${glibc_check_name} glibc Requirements" - echo -e "=================================" + find "${glibc_check_dir}" -type f -print0 \ + | while IFS= read -r -d $'\0' line; do + glibcversion=$(objdump -T "${line}" 2> /dev/null | grep -oP "GLIBC[^ ]+" | grep -v GLIBCXX | sort | uniq | sort -r --version-sort | head -n 1) + if [ "${glibcversion}" ]; then + echo -e "${glibcversion}: ${line}" >> "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp" + fi + objdump -T "${line}" 2> /dev/null | grep -oP "GLIBC[^ ]+" >> "${tmpdir}/detect_glibc_${glibc_check_var}.tmp" + echo -n "${i} / ${glibc_check_files}" $'\r' + ((i++)) + done + echo -e "" + echo -e "" + echo -e "${glibc_check_name} glibc Requirements" + echo -e "=================================" if [ -f "${tmpdir}/detect_glibc_files_${glibc_check_var}.tmp" ]; then echo -e "Required glibc" - cat "${tmpdir}/detect_glibc_${glibc_check_var}.tmp" | sort | uniq | sort -r --version-sort | head -1 |tee -a "${tmpdir}/detect_glibc_highest.tmp" + cat "${tmpdir}/detect_glibc_${glibc_check_var}.tmp" | sort | uniq | sort -r --version-sort | head -1 | tee -a "${tmpdir}/detect_glibc_highest.tmp" echo -e "" echo -e "Files requiring GLIBC" echo -e "Highest verion required: filename" diff --git a/lgsm/functions/command_dev_detect_ldd.sh b/lgsm/functions/command_dev_detect_ldd.sh index 7d6e942a15..43630d4e93 100755 --- a/lgsm/functions/command_dev_detect_ldd.sh +++ b/lgsm/functions/command_dev_detect_ldd.sh @@ -31,21 +31,19 @@ touch "${tmpdir}/detect_ldd.tmp" touch "${tmpdir}/detect_ldd_not_found.tmp" files=$(find "${serverfiles}" | wc -l) -find "${serverfiles}" -type f -print0 | -while IFS= read -r -d $'\0' line; do - if ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" - then - echo -e "${line}" >> "${tmpdir}/detect_ldd.tmp" - ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" >> "${tmpdir}/detect_ldd.tmp" - if ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" | grep "not found" - then - echo -e "${line}" >> "${tmpdir}/detect_ldd_not_found.tmp" - ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" | grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp" +find "${serverfiles}" -type f -print0 \ + | while IFS= read -r -d $'\0' line; do + if ldd "${line}" 2> /dev/null | grep -v "not a dynamic executable"; then + echo -e "${line}" >> "${tmpdir}/detect_ldd.tmp" + ldd "${line}" 2> /dev/null | grep -v "not a dynamic executable" >> "${tmpdir}/detect_ldd.tmp" + if ldd "${line}" 2> /dev/null | grep -v "not a dynamic executable" | grep "not found"; then + echo -e "${line}" >> "${tmpdir}/detect_ldd_not_found.tmp" + ldd "${line}" 2> /dev/null | grep -v "not a dynamic executable" | grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp" + fi fi - fi - echo -n "$i / $files" $'\r' - ((i++)) -done + echo -n "$i / $files" $'\r' + ((i++)) + done echo -e "" echo -e "" echo -e "All" diff --git a/lgsm/functions/command_dev_query_raw.sh b/lgsm/functions/command_dev_query_raw.sh index c9123ebcb2..91db165849 100755 --- a/lgsm/functions/command_dev_query_raw.sh +++ b/lgsm/functions/command_dev_query_raw.sh @@ -26,175 +26,174 @@ echo -e "" echo -e "${lightgreen}Game Server Ports${default}" echo -e "==================================================================" { -echo -e "${lightblue}Port Name \tPort Number \tStatus \tTCP \tUDP${default}" -if [ -v port ]; then - echo -e "Game: \t${port} \t$(ss -tupl|grep ${port}|wc -l) \t$(ss -tupl|grep ${port}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port}|grep udp|awk '{ print $2 }')" -else - echo -e "Game:" -fi -if [ "${shortname}" == "rw" ]; then - if [ -v port2 ]; then - echo -e "Game+1: \t${port2} \t$(ss -tupl|grep ${port}|wc -l) \t$(ss -tupl|grep ${port2}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port2}|grep udp|awk '{ print $2 }')" + echo -e "${lightblue}Port Name \tPort Number \tStatus \tTCP \tUDP${default}" + if [ -v port ]; then + echo -e "Game: \t${port} \t$(ss -tupl | grep ${port} | wc -l) \t$(ss -tupl | grep ${port} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port} | grep udp | awk '{ print $2 }')" else - echo -e "Game+1:" + echo -e "Game:" fi + if [ "${shortname}" == "rw" ]; then + if [ -v port2 ]; then + echo -e "Game+1: \t${port2} \t$(ss -tupl | grep ${port} | wc -l) \t$(ss -tupl | grep ${port2} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port2} | grep udp | awk '{ print $2 }')" + else + echo -e "Game+1:" + fi - if [ -v port3 ]; then - echo -e "Game+2: \t${port3} \t$(ss -tupl|grep ${port}|wc -l) \t$(ss -tupl|grep ${port3}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port3}|grep udp|awk '{ print $2 }')" - else - echo -e "Game+2:" + if [ -v port3 ]; then + echo -e "Game+2: \t${port3} \t$(ss -tupl | grep ${port} | wc -l) \t$(ss -tupl | grep ${port3} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port3} | grep udp | awk '{ print $2 }')" + else + echo -e "Game+2:" + fi + + if [ -v port4 ]; then + echo -e "Game+3: \t${port4} \t$(ss -tupl | grep ${port} | wc -l) \t$(ss -tupl | grep ${port4} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port4} | grep udp | awk '{ print $2 }')" + else + echo -e "Game+3:" + fi fi - if [ -v port4 ]; then - echo -e "Game+3: \t${port4} \t$(ss -tupl|grep ${port}|wc -l) \t$(ss -tupl|grep ${port4}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port4}|grep udp|awk '{ print $2 }')" + if [ -v port401 ]; then + echo -e "Game+400: \t${port401} \t$(ss -tupl | grep ${port401} | wc -l) \t$(ss -tupl | grep ${port401} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${port401} | grep udp | awk '{ print $2 }')" else - echo -e "Game+3:" + echo -e "Game+400:" fi -fi - -if [ -v port401 ]; then - echo -e "Game+400: \t${port401} \t$(ss -tupl|grep ${port401}|wc -l) \t$(ss -tupl|grep ${port401}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${port401}|grep udp|awk '{ print $2 }')" -else - echo -e "Game+400:" -fi - -if [ -v portipv6 ]; then - echo -e "Game ipv6: \t${portipv6} \t$(ss -tupl|grep ${portipv6}|wc -l) \t$(ss -tupl|grep ${portipv6}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${portipv6}|grep udp|awk '{ print $2 }')" -else - echo -e "Game ipv6:" -fi -if [ -v queryport ]; then - echo -e "Query: \t${queryport} \t$(ss -tupl|grep ${queryport}|wc -l) \t$(ss -tupl|grep ${queryport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${queryport}|grep udp|awk '{ print $2 }')" -else - echo -e "Query:" -fi + if [ -v portipv6 ]; then + echo -e "Game ipv6: \t${portipv6} \t$(ss -tupl | grep ${portipv6} | wc -l) \t$(ss -tupl | grep ${portipv6} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${portipv6} | grep udp | awk '{ print $2 }')" + else + echo -e "Game ipv6:" + fi -if [ -v httpport ]; then - echo -e "HTTP: \t${httpport} \t$(ss -tupl|grep ${httpport}|wc -l) \t$(ss -tupl|grep ${httpport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${httpport}|grep udp|awk '{ print $2 }')" -else - echo -e "HTTP:" -fi + if [ -v queryport ]; then + echo -e "Query: \t${queryport} \t$(ss -tupl | grep ${queryport} | wc -l) \t$(ss -tupl | grep ${queryport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${queryport} | grep udp | awk '{ print $2 }')" + else + echo -e "Query:" + fi -if [ -v httpqueryport ]; then - echo -e "HTTP Query: \t${httpqueryport} \t$(ss -tupl|grep ${httpqueryport}|wc -l) \t$(ss -tupl|grep ${httpqueryport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${httpqueryport}|grep udp|awk '{ print $2 }')" -else - echo -e "HTTP Query:" -fi + if [ -v httpport ]; then + echo -e "HTTP: \t${httpport} \t$(ss -tupl | grep ${httpport} | wc -l) \t$(ss -tupl | grep ${httpport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${httpport} | grep udp | awk '{ print $2 }')" + else + echo -e "HTTP:" + fi + if [ -v httpqueryport ]; then + echo -e "HTTP Query: \t${httpqueryport} \t$(ss -tupl | grep ${httpqueryport} | wc -l) \t$(ss -tupl | grep ${httpqueryport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${httpqueryport} | grep udp | awk '{ print $2 }')" + else + echo -e "HTTP Query:" + fi -if [ -v webadminport ]; then - echo -e "Web Admin: \t${webadminport} \t$(ss -tupl|grep ${webadminport}|wc -l) \t$(ss -tupl|grep ${webadminport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${webadminport}|grep udp|awk '{ print $2 }')" -else - echo -e "Web Admin:" -fi + if [ -v webadminport ]; then + echo -e "Web Admin: \t${webadminport} \t$(ss -tupl | grep ${webadminport} | wc -l) \t$(ss -tupl | grep ${webadminport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${webadminport} | grep udp | awk '{ print $2 }')" + else + echo -e "Web Admin:" + fi -if [ -v clientport ]; then - echo -e "Client: \t${clientport} \t$(ss -tupl|grep ${clientport}|wc -l) \t$(ss -tupl|grep ${clientport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${clientport}|grep udp|awk '{ print $2 }')" -else - echo -e "Client:" -fi + if [ -v clientport ]; then + echo -e "Client: \t${clientport} \t$(ss -tupl | grep ${clientport} | wc -l) \t$(ss -tupl | grep ${clientport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${clientport} | grep udp | awk '{ print $2 }')" + else + echo -e "Client:" + fi -if [ -v rconport ]; then - echo -e "RCON: \t${rconport} \t$(ss -tupl|grep ${rconport}|wc -l) \t$(ss -tupl|grep ${rconport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${rconport}|grep udp|awk '{ print $2 }')" -else - echo -e "RCON:" -fi + if [ -v rconport ]; then + echo -e "RCON: \t${rconport} \t$(ss -tupl | grep ${rconport} | wc -l) \t$(ss -tupl | grep ${rconport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${rconport} | grep udp | awk '{ print $2 }')" + else + echo -e "RCON:" + fi -if [ -v rawport ]; then - echo -e "RAW UDP Socket: \t${rawport} \t$(ss -tupl|grep ${rawport}|wc -l) \t$(ss -tupl|grep ${rawport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${rawport}|grep udp|awk '{ print $2 }')" -else - echo -e "RAW UDP Socket:" -fi + if [ -v rawport ]; then + echo -e "RAW UDP Socket: \t${rawport} \t$(ss -tupl | grep ${rawport} | wc -l) \t$(ss -tupl | grep ${rawport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${rawport} | grep udp | awk '{ print $2 }')" + else + echo -e "RAW UDP Socket:" + fi -if [ -v masterport ]; then - echo -e "Game: Master: \t${masterport} \t$(ss -tupl|grep ${masterport}|wc -l) \t$(ss -tupl|grep ${masterport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${masterport}|grep udp|awk '{ print $2 }')" -else - echo -e "Game: Master:" -fi + if [ -v masterport ]; then + echo -e "Game: Master: \t${masterport} \t$(ss -tupl | grep ${masterport} | wc -l) \t$(ss -tupl | grep ${masterport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${masterport} | grep udp | awk '{ print $2 }')" + else + echo -e "Game: Master:" + fi -if [ -v steamport ]; then - echo -e "Steam: \t${steamport} \t$(ss -tupl|grep ${steamport}|wc -l) \t$(ss -tupl|grep ${steamport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${steamport}|grep udp|awk '{ print $2 }')" -else - echo -e "Steam:" -fi + if [ -v steamport ]; then + echo -e "Steam: \t${steamport} \t$(ss -tupl | grep ${steamport} | wc -l) \t$(ss -tupl | grep ${steamport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${steamport} | grep udp | awk '{ print $2 }')" + else + echo -e "Steam:" + fi -if [ -v steamauthport ]; then - echo -e "Steam: Auth: \t${steamauthport} \t$(ss -tupl|grep ${steamauthport}|wc -l) \t$(ss -tupl|grep ${steamauthport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${steamauthport}|grep udp|awk '{ print $2 }')" -else - echo -e "Steam: Auth:" -fi + if [ -v steamauthport ]; then + echo -e "Steam: Auth: \t${steamauthport} \t$(ss -tupl | grep ${steamauthport} | wc -l) \t$(ss -tupl | grep ${steamauthport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${steamauthport} | grep udp | awk '{ print $2 }')" + else + echo -e "Steam: Auth:" + fi -if [ -v steammasterport ]; then - echo -e "Steam: Master: \t${steammasterport} \t$(ss -tupl|grep ${steammasterport}|wc -l) \t$(ss -tupl|grep ${steammasterport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${steammasterport}|grep udp|awk '{ print $2 }')" -else - echo -e "Steam: Master:" -fi + if [ -v steammasterport ]; then + echo -e "Steam: Master: \t${steammasterport} \t$(ss -tupl | grep ${steammasterport} | wc -l) \t$(ss -tupl | grep ${steammasterport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${steammasterport} | grep udp | awk '{ print $2 }')" + else + echo -e "Steam: Master:" + fi -if [ -v steamqueryport ]; then - echo -e "Steam: Query: \t${steamqueryport} \t$(ss -tupl|grep ${steamqueryport}|wc -l) \t$(ss -tupl|grep ${steamqueryport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${steamqueryport}|grep udp|awk '{ print $2 }')" -else - echo -e "Steam: Query:" -fi -if [ -v beaconport ]; then - echo -e "Beacon: \t${beaconport} \t$(ss -tupl|grep ${beaconport}|wc -l) \t$(ss -tupl|grep ${beaconport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${beaconport}|grep udp|awk '{ print $2 }')" -else - echo -e "Beacon:" -fi + if [ -v steamqueryport ]; then + echo -e "Steam: Query: \t${steamqueryport} \t$(ss -tupl | grep ${steamqueryport} | wc -l) \t$(ss -tupl | grep ${steamqueryport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${steamqueryport} | grep udp | awk '{ print $2 }')" + else + echo -e "Steam: Query:" + fi + if [ -v beaconport ]; then + echo -e "Beacon: \t${beaconport} \t$(ss -tupl | grep ${beaconport} | wc -l) \t$(ss -tupl | grep ${beaconport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${beaconport} | grep udp | awk '{ print $2 }')" + else + echo -e "Beacon:" + fi -if [ -v appport ]; then - echo -e "App: \t${appport} \t$(ss -tupl|grep ${appport}|wc -l) \t$(ss -tupl|grep ${appport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${appport}|grep udp|awk '{ print $2 }')" -else - echo -e "App:" -fi + if [ -v appport ]; then + echo -e "App: \t${appport} \t$(ss -tupl | grep ${appport} | wc -l) \t$(ss -tupl | grep ${appport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${appport} | grep udp | awk '{ print $2 }')" + else + echo -e "App:" + fi -if [ -v telnetport ]; then - echo -e "Telnet: \t${telnetport} \t$(ss -tupl|grep ${telnetport}|wc -l) \t$(ss -tupl|grep ${telnetport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${telnetport}|grep udp|awk '{ print $2 }')" -else - echo -e "Telnet:" -fi + if [ -v telnetport ]; then + echo -e "Telnet: \t${telnetport} \t$(ss -tupl | grep ${telnetport} | wc -l) \t$(ss -tupl | grep ${telnetport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${telnetport} | grep udp | awk '{ print $2 }')" + else + echo -e "Telnet:" + fi -if [ -v sourcetvport ]; then - echo -e "SourceTV: \t${sourcetvport} \t$(ss -tupl|grep ${sourcetvport}|wc -l) \t$(ss -tupl|grep ${sourcetvport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${sourcetvport}|grep udp|awk '{ print $2 }')" -else - echo -e "SourceTV:" -fi + if [ -v sourcetvport ]; then + echo -e "SourceTV: \t${sourcetvport} \t$(ss -tupl | grep ${sourcetvport} | wc -l) \t$(ss -tupl | grep ${sourcetvport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${sourcetvport} | grep udp | awk '{ print $2 }')" + else + echo -e "SourceTV:" + fi -if [ -v fileport ]; then - echo -e "File: \t${fileport} \t$(ss -tupl|grep ${fileport}|wc -l) \t$(ss -tupl|grep ${fileport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${fileport}|grep udp|awk '{ print $2 }')" -else - echo -e "File:" -fi + if [ -v fileport ]; then + echo -e "File: \t${fileport} \t$(ss -tupl | grep ${fileport} | wc -l) \t$(ss -tupl | grep ${fileport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${fileport} | grep udp | awk '{ print $2 }')" + else + echo -e "File:" + fi -if [ -v udplinkport ]; then - echo -e "UDP Link: \t${udplinkport} \t$(ss -tupl|grep ${udplinkport}|wc -l) \t$(ss -tupl|grep ${udplinkport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${udplinkport}|grep udp|awk '{ print $2 }')" -else - echo -e "UDP Link:" -fi + if [ -v udplinkport ]; then + echo -e "UDP Link: \t${udplinkport} \t$(ss -tupl | grep ${udplinkport} | wc -l) \t$(ss -tupl | grep ${udplinkport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${udplinkport} | grep udp | awk '{ print $2 }')" + else + echo -e "UDP Link:" + fi -if [ -v voiceport ]; then - echo -e "Voice: \t${voiceport} \t$(ss -tupl|grep ${voiceport}|wc -l) \t$(ss -tupl|grep ${voiceport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${voiceport}|grep udp|awk '{ print $2 }')" -else - echo -e "Voice:" -fi + if [ -v voiceport ]; then + echo -e "Voice: \t${voiceport} \t$(ss -tupl | grep ${voiceport} | wc -l) \t$(ss -tupl | grep ${voiceport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${voiceport} | grep udp | awk '{ print $2 }')" + else + echo -e "Voice:" + fi -if [ -v voiceunusedport ]; then - echo -e "Voice (Unused): \t${voiceunusedport} \t$(ss -tupl|grep ${voiceunusedport}|wc -l) \t$(ss -tupl|grep ${voiceunusedport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${voiceunusedport}|grep udp|awk '{ print $2 }')" -else - echo -e "Voice (Unused):" -fi + if [ -v voiceunusedport ]; then + echo -e "Voice (Unused): \t${voiceunusedport} \t$(ss -tupl | grep ${voiceunusedport} | wc -l) \t$(ss -tupl | grep ${voiceunusedport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${voiceunusedport} | grep udp | awk '{ print $2 }')" + else + echo -e "Voice (Unused):" + fi -if [ -v battleeyeport ]; then - echo -e "BattleEye: \t${battleeyeport} \t$(ss -tupl|grep ${battleeyeport}|wc -l) \t$(ss -tupl|grep ${battleeyeport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${battleeyeport}|grep udp|awk '{ print $2 }')" -else - echo -e "BattleEye:" -fi + if [ -v battleeyeport ]; then + echo -e "BattleEye: \t${battleeyeport} \t$(ss -tupl | grep ${battleeyeport} | wc -l) \t$(ss -tupl | grep ${battleeyeport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${battleeyeport} | grep udp | awk '{ print $2 }')" + else + echo -e "BattleEye:" + fi -if [ -v statsport ]; then - echo -e "Stats: \t${battleeyeport} \t$(ss -tupl|grep ${statsport}|wc -l) \t$(ss -tupl|grep ${statsport}|grep tcp|awk '{ print $2 }') \t$(ss -tupl|grep ${statsport}|grep udp|awk '{ print $2 }')" -else - echo -e "Stats:" -fi + if [ -v statsport ]; then + echo -e "Stats: \t${battleeyeport} \t$(ss -tupl | grep ${statsport} | wc -l) \t$(ss -tupl | grep ${statsport} | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${statsport} | grep udp | awk '{ print $2 }')" + else + echo -e "Stats:" + fi } | column -s $'\t' -t echo -e "" @@ -211,10 +210,10 @@ echo -e "" echo -e "${lightgreen}Gamedig Raw Output${default}" echo -e "=================================" echo -e "" -if [ ! "$(command -v gamedig 2>/dev/null)" ]; then +if [ ! "$(command -v gamedig 2> /dev/null)" ]; then fn_print_failure_nl "gamedig not installed" fi -if [ ! "$(command -v jq 2>/dev/null)" ]; then +if [ ! "$(command -v jq 2> /dev/null)" ]; then fn_print_failure_nl "jq not installed" fi for queryip in "${queryips[@]}"; do diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh index d6ab960bd5..e90ccc5e04 100755 --- a/lgsm/functions/command_fastdl.sh +++ b/lgsm/functions/command_fastdl.sh @@ -24,7 +24,7 @@ luafastdlfile="lgsm_cl_force_fastdl.lua" luafastdlfullpath="${luasvautorundir}/${luafastdlfile}" # Check if bzip2 is installed. -if [ ! "$(command -v bzip2 2>/dev/null)" ]; then +if [ ! "$(command -v bzip2 2> /dev/null)" ]; then fn_print_fail "bzip2 is not installed" fn_script_log_fatal "bzip2 is not installed" core_exit.sh @@ -64,7 +64,7 @@ if [ "${shortname}" == "gmod" ]; then fi # Clears any fastdl directory content. -fn_clear_old_fastdl(){ +fn_clear_old_fastdl() { # Clearing old FastDL. if [ -d "${fastdldir}" ]; then echo -en "clearing existing FastDL directory ${fastdldir}..." @@ -81,7 +81,7 @@ fn_clear_old_fastdl(){ fi } -fn_fastdl_dirs(){ +fn_fastdl_dirs() { # Check and create directories. if [ ! -d "${webdir}" ]; then echo -en "creating web directory ${webdir}..." @@ -112,7 +112,7 @@ fn_fastdl_dirs(){ } # Using this gist https://gist.github.com/agunnerson-ibm/efca449565a3e7356906 -fn_human_readable_file_size(){ +fn_human_readable_file_size() { local abbrevs=( $((1 << 60)):ZB $((1 << 50)):EB @@ -142,7 +142,7 @@ fn_human_readable_file_size(){ } # Provides info about the fastdl directory content and prompts for confirmation. -fn_fastdl_preview(){ +fn_fastdl_preview() { # Remove any file list. if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then rm -f "${tmpdir:?}/fastdl_files_to_compress.txt" @@ -152,13 +152,14 @@ fn_fastdl_preview(){ # Garry's Mod if [ "${shortname}" == "gmod" ]; then cd "${systemdir}" || exit - allowed_extentions_array=( "*.ain" "*.bsp" "*.mdl" "*.mp3" "*.ogg" "*.otf" "*.pcf" "*.phy" "*.png" "*.svg" "*.vtf" "*.vmt" "*.vtx" "*.vvd" "*.ttf" "*.wav" ) + allowed_extentions_array=("*.ain" "*.bsp" "*.mdl" "*.mp3" "*.ogg" "*.otf" "*.pcf" "*.phy" "*.png" "*.svg" "*.vtf" "*.vmt" "*.vtx" "*.vvd" "*.ttf" "*.wav") for allowed_extention in "${allowed_extentions_array[@]}"; do fileswc=0 tput sc while read -r ext; do ((fileswc++)) - tput rc; tput el + tput rc + tput el echo -e "gathering ${allowed_extention} : ${fileswc}..." echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt" done < <(find . -type f -iname "${allowed_extention}") @@ -170,30 +171,32 @@ fn_fastdl_preview(){ done # Source engine else - fastdl_directories_array=( "maps" "materials" "models" "particles" "sound" "resources" ) + fastdl_directories_array=("maps" "materials" "models" "particles" "sound" "resources") for directory in "${fastdl_directories_array[@]}"; do if [ -d "${systemdir}/${directory}" ]; then if [ "${directory}" == "maps" ]; then - local allowed_extentions_array=( "*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt" ) + local allowed_extentions_array=("*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt") elif [ "${directory}" == "materials" ]; then - local allowed_extentions_array=( "*.vtf" "*.vmt" "*.vbf" "*.png" "*.svg" ) + local allowed_extentions_array=("*.vtf" "*.vmt" "*.vbf" "*.png" "*.svg") elif [ "${directory}" == "models" ]; then - local allowed_extentions_array=( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" "*.vmt" "*.vtf" ) + local allowed_extentions_array=("*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" "*.vmt" "*.vtf") elif [ "${directory}" == "particles" ]; then - local allowed_extentions_array=( "*.pcf" ) + local allowed_extentions_array=("*.pcf") elif [ "${directory}" == "sound" ]; then - local allowed_extentions_array=( "*.wav" "*.mp3" "*.ogg" ) + local allowed_extentions_array=("*.wav" "*.mp3" "*.ogg") fi for allowed_extention in "${allowed_extentions_array[@]}"; do fileswc=0 tput sc while read -r ext; do ((fileswc++)) - tput rc; tput el + tput rc + tput el echo -e "gathering ${directory} ${allowed_extention} : ${fileswc}..." echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt" done < <(find "${systemdir}/${directory}" -type f -iname "${allowed_extention}") - tput rc; tput el + tput rc + tput el echo -e "gathering ${directory} ${allowed_extention} : ${fileswc}..." if [ ${fileswc} != 0 ]; then fn_print_ok_eol_nl @@ -211,14 +214,14 @@ fn_fastdl_preview(){ # Calculates total file size. while read -r dufile; do filesize=$(stat -c %s "${dufile}") - filesizetotal=$(( filesizetotal+filesize )) + filesizetotal=$((filesizetotal + filesize)) exitcode=$? if [ "${exitcode}" != 0 ]; then fn_print_fail_eol_nl fn_script_log_fatal "Calculating total file size." core_exit.sh fi - done <"${tmpdir}/fastdl_files_to_compress.txt" + done < "${tmpdir}/fastdl_files_to_compress.txt" else fn_print_fail_eol_nl "generating file list" fn_script_log_fatal "Generating file list." @@ -234,14 +237,15 @@ fn_fastdl_preview(){ } # Builds Garry's Mod fastdl directory content. -fn_fastdl_gmod(){ +fn_fastdl_gmod() { cd "${systemdir}" || exit for allowed_extention in "${allowed_extentions_array[@]}"; do fileswc=0 tput sc while read -r fastdlfile; do ((fileswc++)) - tput rc; tput el + tput rc + tput el echo -e "copying ${allowed_extention} : ${fileswc}..." cp --parents "${fastdlfile}" "${fastdldir}" exitcode=$? @@ -305,30 +309,31 @@ fn_fastdl_gmod(){ while read -r dufile; do filesize=$(du -b "${dufile}" | awk '{ print $1 }') filesizetotal=$((filesizetotal + filesize)) - done <"${tmpdir}/fastdl_files_to_compress.txt" + done < "${tmpdir}/fastdl_files_to_compress.txt" fi } -fn_fastdl_source(){ +fn_fastdl_source() { for directory in "${fastdl_directories_array[@]}"; do if [ -d "${systemdir}/${directory}" ]; then if [ "${directory}" == "maps" ]; then - local allowed_extentions_array=( "*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt" ) + local allowed_extentions_array=("*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt") elif [ "${directory}" == "materials" ]; then - local allowed_extentions_array=( "*.vtf" "*.vmt" "*.vbf" "*.png" "*.svg" ) + local allowed_extentions_array=("*.vtf" "*.vmt" "*.vbf" "*.png" "*.svg") elif [ "${directory}" == "models" ]; then - local allowed_extentions_array=( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" ) + local allowed_extentions_array=("*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png") elif [ "${directory}" == "particles" ]; then - local allowed_extentions_array=( "*.pcf" ) + local allowed_extentions_array=("*.pcf") elif [ "${directory}" == "sound" ]; then - local allowed_extentions_array=( "*.wav" "*.mp3" "*.ogg" ) + local allowed_extentions_array=("*.wav" "*.mp3" "*.ogg") fi for allowed_extention in "${allowed_extentions_array[@]}"; do fileswc=0 tput sc while read -r fastdlfile; do ((fileswc++)) - tput rc; tput el + tput rc + tput el echo -e "copying ${directory} ${allowed_extention} : ${fileswc}..." fn_sleep_time # get relative path of file in the dir @@ -357,7 +362,7 @@ fn_fastdl_source(){ } # Builds the fastdl directory content. -fn_fastdl_build(){ +fn_fastdl_build() { # Copy all needed files for FastDL. echo -e "copying files to ${fastdldir}" fn_script_log_info "Copying files to ${fastdldir}" @@ -370,7 +375,7 @@ fn_fastdl_build(){ } # Generate lua file that will force download any file into the FastDL directory. -fn_fastdl_gmod_dl_enforcer(){ +fn_fastdl_gmod_dl_enforcer() { # Clear old lua file. if [ -f "${luafastdlfullpath}" ]; then echo -en "removing existing download enforcer: ${luafastdlfile}..." @@ -406,7 +411,7 @@ fn_fastdl_gmod_dl_enforcer(){ } # Compresses FastDL files using bzip2. -fn_fastdl_bzip2(){ +fn_fastdl_bzip2() { while read -r filetocompress; do echo -en "\r\033[Kcompressing ${filetocompress}..." bzip2 -f "${filetocompress}" @@ -418,7 +423,7 @@ fn_fastdl_bzip2(){ else fn_script_log_pass "Compressing ${filetocompress}" fi - done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \)) + done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \)) fn_print_ok_eol_nl } diff --git a/lgsm/functions/command_install_resources_mta.sh b/lgsm/functions/command_install_resources_mta.sh index 3a94444a36..15f5be22fc 100755 --- a/lgsm/functions/command_install_resources_mta.sh +++ b/lgsm/functions/command_install_resources_mta.sh @@ -10,7 +10,7 @@ commandaction="Default Resources" functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set -fn_install_resources(){ +fn_install_resources() { echo -e "" echo -e "Installing Default Resources" echo -e "=================================" diff --git a/lgsm/functions/command_mods_install.sh b/lgsm/functions/command_mods_install.sh index a5eaaf83c1..0edbe5bc04 100755 --- a/lgsm/functions/command_mods_install.sh +++ b/lgsm/functions/command_mods_install.sh @@ -21,7 +21,7 @@ if [ "${installedmodscount}" -gt "0" ]; then echo -e "Installed addons/mods" echo -e "=================================" # Go through all available commands, get details and display them to the user. - for ((llindex=0; llindex < ${#installedmodslist[@]}; llindex++)); do + for ((llindex = 0; llindex < ${#installedmodslist[@]}; llindex++)); do # Current mod is the "llindex" value of the array we're going through. currentmod="${installedmodslist[llindex]}" fn_mod_get_info @@ -40,9 +40,9 @@ compatiblemodslistindex=0 while [ "${compatiblemodslistindex}" -lt "${#compatiblemodslist[@]}" ]; do # Set values for convenience. displayedmodname="${compatiblemodslist[compatiblemodslistindex]}" - displayedmodcommand="${compatiblemodslist[compatiblemodslistindex+1]}" - displayedmodsite="${compatiblemodslist[compatiblemodslistindex+2]}" - displayedmoddescription="${compatiblemodslist[compatiblemodslistindex+3]}" + displayedmodcommand="${compatiblemodslist[compatiblemodslistindex + 1]}" + displayedmodsite="${compatiblemodslist[compatiblemodslistindex + 2]}" + displayedmoddescription="${compatiblemodslist[compatiblemodslistindex + 3]}" # Output mods to the user. echo -e "${displayedmodname} - ${displayedmoddescription} - ${displayedmodsite}" echo -e " * ${cyan}${displayedmodcommand}${default}" @@ -65,8 +65,8 @@ while [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; do echo -en "Enter an ${cyan}addon/mod${default} to ${green}install${default} (or exit to abort): " read -r usermodselect # Exit if user says exit or abort. - if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then - core_exit.sh + if [ "${usermodselect}" == "exit" ] || [ "${usermodselect}" == "abort" ]; then + core_exit.sh # Supplementary output upon invalid user input. elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then fn_print_error2_nl "${usermodselect} is not a valid addon/mod." @@ -100,11 +100,11 @@ if [ "${modcommand}" == "amxmodx" ]; then fn_mod_exist "metamod" fi -if [ "${modcommand}" == "amxmodxcs" ] || - [ "${modcommand}" == "amxmodxdod" ] || - [ "${modcommand}" == "amxmodxtfc" ] || - [ "${modcommand}" == "amxmodxns" ] || - [ "${modcommand}" == "amxmodxts" ]; then +if [ "${modcommand}" == "amxmodxcs" ] \ + || [ "${modcommand}" == "amxmodxdod" ] \ + || [ "${modcommand}" == "amxmodxtfc" ] \ + || [ "${modcommand}" == "amxmodxns" ] \ + || [ "${modcommand}" == "amxmodxts" ]; then fn_mod_exist "amxmodx" fi diff --git a/lgsm/functions/command_mods_remove.sh b/lgsm/functions/command_mods_remove.sh index 8647a21edc..7127dcb3ca 100755 --- a/lgsm/functions/command_mods_remove.sh +++ b/lgsm/functions/command_mods_remove.sh @@ -21,7 +21,7 @@ echo -e "=================================" # Displays list of installed mods. # Generates list to display to user. fn_mods_installed_list -for ((mlindex=0; mlindex < ${#installedmodslist[@]}; mlindex++)); do +for ((mlindex = 0; mlindex < ${#installedmodslist[@]}; mlindex++)); do # Current mod is the "mlindex" value of the array we are going through. currentmod="${installedmodslist[mlindex]}" # Get mod info. @@ -36,7 +36,7 @@ while [[ ! " ${installedmodslist[@]} " =~ " ${usermodselect} " ]]; do echo -en "Enter an ${cyan}addon/mod${default} to ${red}remove${default} (or exit to abort): " read -r usermodselect # Exit if user says exit or abort. - if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then + if [ "${usermodselect}" == "exit" ] || [ "${usermodselect}" == "abort" ]; then core_exit.sh # Supplementary output upon invalid user input. elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then @@ -68,9 +68,9 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do currentfileremove=$(sed "${modfileline}q;d" "${modsdir}/${modcommand}-files.txt") # If file or directory exists, then remove it. - if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then + if [ -f "${modinstalldir}/${currentfileremove}" ] || [ -d "${modinstalldir}/${currentfileremove}" ]; then rm -rf "${modinstalldir:?}/${currentfileremove:?}" - ((exitcode=$?)) + ((exitcode = $?)) if [ "${exitcode}" != 0 ]; then fn_script_log_fatal "Removing ${modinstalldir}/${currentfileremove}" break @@ -78,7 +78,8 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do fn_script_log_pass "Removing ${modinstalldir}/${currentfileremove}" fi fi - tput rc; tput el + tput rc + tput el echo -e "removing ${modprettyname} ${modfileline} / ${modsfilelistsize} : ${currentfileremove}..." ((modfileline++)) done @@ -127,7 +128,7 @@ fi # Oxide fix # Oxide replaces server files, so a validate is required after uninstall. -if [ "${engine}" == "unity3d" ]&&[[ "${modprettyname}" == *"Oxide"* ]]; then +if [ "${engine}" == "unity3d" ] && [[ "${modprettyname}" == *"Oxide"* ]]; then fn_print_information_nl "Validating to restore original ${gamename} files replaced by Oxide" fn_script_log "Validating to restore original ${gamename} files replaced by Oxide" exitbypass="1" diff --git a/lgsm/functions/command_mods_update.sh b/lgsm/functions/command_mods_update.sh index 50bbf9d678..c2f7b42b58 100755 --- a/lgsm/functions/command_mods_update.sh +++ b/lgsm/functions/command_mods_update.sh @@ -15,25 +15,25 @@ mods_core.sh # Prevents specific files being overwritten upon update (set by ${modkeepfiles}). # For that matter, remove cfg files after extraction before copying them to destination. -fn_remove_cfg_files(){ - if [ "${modkeepfiles}" != "OVERWRITE" ]&&[ "${modkeepfiles}" != "NOUPDATE" ]; then +fn_remove_cfg_files() { + if [ "${modkeepfiles}" != "OVERWRITE" ] && [ "${modkeepfiles}" != "NOUPDATE" ]; then echo -e "the following files/directories will be preserved:" fn_sleep_time # Count how many files there are to remove. filestopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' '{ print NF }') # Test all subvalues of "modkeepfiles" using the ";" separator. - for ((preservefilesindex=1; preservefilesindex < filestopreserve; preservefilesindex++)); do + for ((preservefilesindex = 1; preservefilesindex < filestopreserve; preservefilesindex++)); do # Put the current file we are looking for into a variable. - filetopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' -v x=${preservefilesindex} '{ print $x }' ) + filetopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' -v x=${preservefilesindex} '{ print $x }') echo -e " * serverfiles/${filetopreserve}" # If it matches an existing file that have been extracted delete the file. - if [ -f "${extractdir}/${filetopreserve}" ]||[ -d "${extractdir}/${filetopreserve}" ]; then + if [ -f "${extractdir}/${filetopreserve}" ] || [ -d "${extractdir}/${filetopreserve}" ]; then rm -r "${extractdir:?}/${filetopreserve}" # Write the file path in a tmp file, to rebuild a full file list as it is rebuilt upon update. if [ ! -f "${modsdir}/.removedfiles.tmp" ]; then touch "${modsdir}/.removedfiles.tmp" fi - echo -e "${filetopreserve}" >> "${modsdir}/.removedfiles.tmp" + echo -e "${filetopreserve}" >> "${modsdir}/.removedfiles.tmp" fi done fi @@ -45,7 +45,7 @@ fn_print_info_nl "Update addons/mods: ${installedmodscount} addons/mods will be fn_script_log_info "${installedmodscount} mods or addons will be updated" fn_mods_installed_list # Go through all available commands, get details and display them to the user. -for ((ulindex=0; ulindex < ${#installedmodslist[@]}; ulindex++)); do +for ((ulindex = 0; ulindex < ${#installedmodslist[@]}; ulindex++)); do # Current mod is the "ulindex" value of the array we're going through. currentmod="${installedmodslist[ulindex]}" fn_mod_get_info diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh index 3f4e397e25..48d3d496a0 100755 --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/functions/command_monitor.sh @@ -11,7 +11,7 @@ commandaction="Monitoring" functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set -fn_monitor_check_lockfile(){ +fn_monitor_check_lockfile() { # Monitor does not run it lockfile is not found. if [ ! -f "${lockdir}/${selfname}.lock" ]; then fn_print_dots "Checking lockfile: " @@ -25,14 +25,14 @@ fn_monitor_check_lockfile(){ fi # Fix if lockfile is not unix time or contains letters - if [ -f "${lockdir}/${selfname}.lock" ]&&[[ "$(head -n 1 "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then + if [ -f "${lockdir}/${selfname}.lock" ] && [[ "$(head -n 1 "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then date '+%s' > "${lockdir}/${selfname}.lock" echo "${version}" >> "${lockdir}/${selfname}.lock" echo "${port}" >> "${lockdir}/${selfname}.lock" fi } -fn_monitor_check_update(){ +fn_monitor_check_update() { # Monitor will check if update is already running. if [ "$(pgrep "${selfname} update" | wc -l)" != "0" ]; then fn_print_dots "Checking active updates: " @@ -45,7 +45,7 @@ fn_monitor_check_update(){ fi } -fn_monitor_check_session(){ +fn_monitor_check_session() { fn_print_dots "Checking session: " fn_print_checking_eol fn_script_log_info "Checking session: CHECKING" @@ -66,13 +66,13 @@ fn_monitor_check_session(){ fi } -fn_monitor_check_queryport(){ +fn_monitor_check_queryport() { # Monitor will check queryport is set before continuing. - if [ -z "${queryport}" ]||[ "${queryport}" == "0" ]; then + if [ -z "${queryport}" ] || [ "${queryport}" == "0" ]; then fn_print_dots "Checking port: " fn_print_checking_eol fn_script_log_info "Checking port: CHECKING" - if [ -n "${rconenabled}" ]&&[ "${rconenabled}" != "true" ]&&[ ${shortname} == "av" ]; then + if [ -n "${rconenabled}" ] && [ "${rconenabled}" != "true" ] && [ ${shortname} == "av" ]; then fn_print_warn "Checking port: Unable to query, rcon is not enabled" fn_script_log_warn "Checking port: Unable to query, rcon is not enabled" else @@ -83,7 +83,7 @@ fn_monitor_check_queryport(){ fi } -fn_query_gsquery(){ +fn_query_gsquery() { if [ ! -f "${functionsdir}/query_gsquery.py" ]; then fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nohash" fi @@ -91,93 +91,93 @@ fn_query_gsquery(){ querystatus="$?" } -fn_query_tcp(){ +fn_query_tcp() { bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}'' > /dev/null 2>&1 querystatus="$?" } -fn_monitor_query(){ -# Will loop and query up to 5 times every 15 seconds. -# Query will wait up to 60 seconds to confirm server is down as server can become non-responsive during map changes. -totalseconds=0 -for queryattempt in {1..5}; do - for queryip in "${queryips[@]}"; do - fn_print_dots "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " - fn_print_querying_eol - fn_script_log_info "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : QUERYING" - # querydelay - if [ "$(head -n 1 "${lockdir}/${selfname}.lock")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then - fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " - fn_print_delay_eol_nl - fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : DELAY" - fn_script_log_info "Query bypassed: ${gameservername} started less than ${querydelay} minutes ago" - fn_script_log_info "Server started: $(date -d @$(head -n 1 "${lockdir}/${selfname}.lock"))" - fn_script_log_info "Current time: $(date)" - monitorpass=1 - core_exit.sh - # will use query method selected in fn_monitor_loop - # gamedig - elif [ "${querymethod}" == "gamedig" ]; then - query_gamedig.sh - # gsquery - elif [ "${querymethod}" == "gsquery" ]; then - fn_query_gsquery - #tcp query - elif [ "${querymethod}" == "tcp" ]; then - fn_query_tcp - fi +fn_monitor_query() { + # Will loop and query up to 5 times every 15 seconds. + # Query will wait up to 60 seconds to confirm server is down as server can become non-responsive during map changes. + totalseconds=0 + for queryattempt in {1..5}; do + for queryip in "${queryips[@]}"; do + fn_print_dots "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " + fn_print_querying_eol + fn_script_log_info "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : QUERYING" + # querydelay + if [ "$(head -n 1 "${lockdir}/${selfname}.lock")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then + fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " + fn_print_delay_eol_nl + fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : DELAY" + fn_script_log_info "Query bypassed: ${gameservername} started less than ${querydelay} minutes ago" + fn_script_log_info "Server started: $(date -d @$(head -n 1 "${lockdir}/${selfname}.lock"))" + fn_script_log_info "Current time: $(date)" + monitorpass=1 + core_exit.sh + # will use query method selected in fn_monitor_loop + # gamedig + elif [ "${querymethod}" == "gamedig" ]; then + query_gamedig.sh + # gsquery + elif [ "${querymethod}" == "gsquery" ]; then + fn_query_gsquery + #tcp query + elif [ "${querymethod}" == "tcp" ]; then + fn_query_tcp + fi - if [ "${querystatus}" == "0" ]; then - # Server query OK. - fn_print_ok "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " - fn_print_ok_eol_nl - fn_script_log_pass "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: OK" - monitorpass=1 if [ "${querystatus}" == "0" ]; then - # Add query data to log. - if [ "${gdname}" ]; then - fn_script_log_info "Server name: ${gdname}" - fi - if [ "${gdplayers}" ]; then - fn_script_log_info "Players: ${gdplayers}/${gdmaxplayers}" - fi - if [ "${gdbots}" ]; then - fn_script_log_info "Bots: ${gdbots}" - fi - if [ "${gdmap}" ]; then - fn_script_log_info "Map: ${gdmap}" - fi - if [ "${gdgamemode}" ]; then - fn_script_log_info "Game Mode: ${gdgamemode}" - fi - - # send LinuxGSM stats if monitor is OK. - if [ "${stats}" == "on" ]||[ "${stats}" == "y" ]; then - info_stats.sh + # Server query OK. + fn_print_ok "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " + fn_print_ok_eol_nl + fn_script_log_pass "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: OK" + monitorpass=1 + if [ "${querystatus}" == "0" ]; then + # Add query data to log. + if [ "${gdname}" ]; then + fn_script_log_info "Server name: ${gdname}" + fi + if [ "${gdplayers}" ]; then + fn_script_log_info "Players: ${gdplayers}/${gdmaxplayers}" + fi + if [ "${gdbots}" ]; then + fn_script_log_info "Bots: ${gdbots}" + fi + if [ "${gdmap}" ]; then + fn_script_log_info "Map: ${gdmap}" + fi + if [ "${gdgamemode}" ]; then + fn_script_log_info "Game Mode: ${gdgamemode}" + fi + + # send LinuxGSM stats if monitor is OK. + if [ "${stats}" == "on" ] || [ "${stats}" == "y" ]; then + info_stats.sh + fi fi - fi - core_exit.sh - else - # Server query FAIL. - fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " - fn_print_fail_eol - fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: FAIL" - # Monitor will try gamedig (if supported) for first 30s then gsquery before restarting. - # gsquery will fail if longer than 60s - if [ "${totalseconds}" -ge "59" ]; then - # Monitor will FAIL if over 60s and trigger gane server reboot. + core_exit.sh + else + # Server query FAIL. fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " - fn_print_fail_eol_nl + fn_print_fail_eol fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: FAIL" - # Send alert if enabled. - alert="restartquery" - alert.sh - command_restart.sh - fn_firstcommand_reset - core_exit.sh + # Monitor will try gamedig (if supported) for first 30s then gsquery before restarting. + # gsquery will fail if longer than 60s + if [ "${totalseconds}" -ge "59" ]; then + # Monitor will FAIL if over 60s and trigger gane server reboot. + fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: " + fn_print_fail_eol_nl + fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt}: FAIL" + # Send alert if enabled. + alert="restartquery" + alert.sh + command_restart.sh + fn_firstcommand_reset + core_exit.sh + fi fi - fi - done + done # Second counter will wait for 15s before breaking loop. for seconds in {1..15}; do fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: ${cyan}WAIT${default}" @@ -187,25 +187,25 @@ for queryattempt in {1..5}; do break fi done -done + done } -fn_monitor_loop(){ +fn_monitor_loop() { # loop though query methods selected by querymode. totalseconds=0 if [ "${querymode}" == "2" ]; then - local query_methods_array=( gamedig gsquery ) + local query_methods_array=(gamedig gsquery) elif [ "${querymode}" == "3" ]; then - local query_methods_array=( gamedig ) + local query_methods_array=(gamedig) elif [ "${querymode}" == "4" ]; then - local query_methods_array=( gsquery ) + local query_methods_array=(gsquery) elif [ "${querymode}" == "5" ]; then - local query_methods_array=( tcp ) + local query_methods_array=(tcp) fi for querymethod in "${query_methods_array[@]}"; do # Will check if gamedig is installed and bypass if not. if [ "${querymethod}" == "gamedig" ]; then - if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then + if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then if [ -z "${monitorpass}" ]; then fn_monitor_query fi diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index f8b36fb61d..dad44d9afb 100755 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -34,8 +34,7 @@ else info_game.sh info_distro.sh info_messages.sh - for queryip in "${queryips[@]}" - do + for queryip in "${queryips[@]}"; do query_gamedig.sh if [ "${querystatus}" == "0" ]; then break @@ -50,7 +49,7 @@ else fn_info_message_script fn_info_message_backup # Some game servers do not have parms. - if [ "${shortname}" != "jc2" ]&&[ "${shortname}" != "jc3" ]&&[ "${shortname}" != "dst" ]&&[ "${shortname}" != "pz" ]&&[ "${engine}" != "renderware" ]; then + if [ "${shortname}" != "jc2" ] && [ "${shortname}" != "jc3" ] && [ "${shortname}" != "dst" ] && [ "${shortname}" != "pz" ] && [ "${engine}" != "renderware" ]; then fn_info_message_commandlineparms fi fn_info_message_ports_edit diff --git a/lgsm/functions/command_send.sh b/lgsm/functions/command_send.sh index 4b653c0bea..c143276f62 100644 --- a/lgsm/functions/command_send.sh +++ b/lgsm/functions/command_send.sh @@ -22,7 +22,7 @@ if [ "${status}" != "0" ]; then commandtosend="${userinput2}" else echo "" - commandtosend=$( fn_prompt_message "send: " ) + commandtosend=$(fn_prompt_message "send: ") fi echo "" fn_print_dots "Sending command to console: \"${commandtosend}\"" diff --git a/lgsm/functions/command_skeleton.sh b/lgsm/functions/command_skeleton.sh index 7b7d67d5fa..53c4ddec52 100644 --- a/lgsm/functions/command_skeleton.sh +++ b/lgsm/functions/command_skeleton.sh @@ -11,7 +11,7 @@ fn_print_dots "Creating skeleton directory" check.sh # Find all directorys and create them in the skel directory -find "${rootdir}" -type d -not \( -path ./skel -prune \) | cpio -pdvm skel 2>/dev/null +find "${rootdir}" -type d -not \( -path ./skel -prune \) | cpio -pdvm skel 2> /dev/null exitcode=$? if [ "${exitcode}" != 0 ]; then fn_print_fail_nl "Creating skeleton directory" diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh index 58ecfcff79..d10240fa7a 100755 --- a/lgsm/functions/command_start.sh +++ b/lgsm/functions/command_start.sh @@ -10,17 +10,17 @@ commandaction="Starting" functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set -fn_start_teamspeak3(){ +fn_start_teamspeak3() { if [ ! -f "${servercfgfullpath}" ]; then fn_print_warn_nl "${servercfgfullpath} is missing" fn_script_log_warn "${servercfgfullpath} is missing" - echo " * Creating blank ${servercfg}" + echo " * Creating blank ${servercfg}" fn_script_log_info "Creating blank ${servercfg}" fn_sleep_time - echo " * ${servercfg} can remain blank by default." + echo " * ${servercfg} can remain blank by default." fn_script_log_info "${servercfgfullpath} can remain blank by default." fn_sleep_time - echo " * ${servercfg} is located in ${servercfgfullpath}." + echo " * ${servercfg} is located in ${servercfgfullpath}." fn_script_log_info "${servercfg} is located in ${servercfgfullpath}." sleep 5 touch "${servercfgfullpath}" @@ -34,12 +34,12 @@ fn_start_teamspeak3(){ # This will allow the Jedi Knight 2 version to be printed in console on start. # Used to allow update to detect JK2MV server version. -fn_start_jk2(){ +fn_start_jk2() { fn_start_tmux tmux send -t "${sessionname}" version ENTER > /dev/null 2>&1 } -fn_start_tmux(){ +fn_start_tmux() { if [ "${parmsbypass}" ]; then startparameters="" fi @@ -57,7 +57,7 @@ fn_start_tmux(){ # Log rotation. fn_script_log_info "Rotating log files" - if [ "${engine}" == "unreal2" ]&&[ -f "${gamelog}" ]; then + if [ "${engine}" == "unreal2" ] && [ -f "${gamelog}" ]; then mv "${gamelog}" "${gamelogdate}" fi if [ -f "${lgsmlog}" ]; then @@ -91,7 +91,7 @@ fn_start_tmux(){ if [ "${tmuxv}" == "master" ]; then fn_script_log "tmux version: master (user compiled)" echo -e "tmux version: master (user compiled)" >> "${consolelog}" - if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then + if [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'" fi elif [ -n "${tmuxv}" ]; then @@ -107,7 +107,7 @@ fn_start_tmux(){ https://linuxgsm.com/tmux-upgrade Currently installed: $(tmux -V)" > "${consolelog}" # Console logging enable or not set. - elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then + elif [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'" fi else @@ -140,11 +140,10 @@ fn_start_tmux(){ cat "${lgsmlogdir}/.${selfname}-tmux-error.tmp" | tee -a "${lgsmlog}" # Detected error https://linuxgsm.com/support - if grep -c "Operation not permitted" "${lgsmlogdir}/.${selfname}-tmux-error.tmp" - then - echo -e "" - echo -e "Fix" - echo -e "=================================" + if grep -c "Operation not permitted" "${lgsmlogdir}/.${selfname}-tmux-error.tmp"; then + echo -e "" + echo -e "Fix" + echo -e "=================================" if ! grep "tty:" /etc/group | grep "$(whoami)"; then echo -e "$(whoami) is not part of the tty group." fn_script_log_info "$(whoami) is not part of the tty group." @@ -172,7 +171,7 @@ fn_start_tmux(){ fn_print_ok "${servername}" fn_script_log_pass "Started ${servername}" fi - rm "${lgsmlogdir:?}/.${selfname}-tmux-error.tmp" 2>/dev/null + rm "${lgsmlogdir:?}/.${selfname}-tmux-error.tmp" 2> /dev/null echo -en "\n" } @@ -195,7 +194,7 @@ info_game.sh core_logs.sh # Will check for updates is updateonstart is yes. -if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then +if [ "${updateonstart}" == "yes" ] || [ "${updateonstart}" == "1" ] || [ "${updateonstart}" == "on" ]; then exitbypass=1 unset updateonstart command_update.sh diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index ef54b525c6..d18ef7c23a 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -11,11 +11,11 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set # Attempts graceful shutdown by sending 'CTRL+c'. -fn_stop_graceful_ctrlc(){ +fn_stop_graceful_ctrlc() { fn_print_dots "Graceful: CTRL+c" fn_script_log_info "Graceful: CTRL+c" # Sends quit. - tmux send-keys -t "${sessionname}" C-c > /dev/null 2>&1 + tmux send-keys -t "${sessionname}" C-c > /dev/null 2>&1 # Waits up to 30 seconds giving the server time to shutdown gracefuly. for seconds in {1..30}; do check_status.sh @@ -39,13 +39,13 @@ fn_stop_graceful_ctrlc(){ # Attempts graceful shutdown by sending a specified command. # Usage: fn_stop_graceful_cmd "console_command" "timeout_in_seconds" # e.g.: fn_stop_graceful_cmd "quit" "30" -fn_stop_graceful_cmd(){ +fn_stop_graceful_cmd() { fn_print_dots "Graceful: sending \"${1}\"" fn_script_log_info "Graceful: sending \"${1}\"" # Sends specific stop command. tmux send -t "${sessionname}" ENTER "${1}" ENTER > /dev/null 2>&1 # Waits up to ${seconds} seconds giving the server time to shutdown gracefully. - for ((seconds=1; seconds<=${2}; seconds++)); do + for ((seconds = 1; seconds <= ${2}; seconds++)); do check_status.sh if [ "${status}" == "0" ]; then fn_print_ok "Graceful: sending \"${1}\": ${seconds}: " @@ -67,7 +67,7 @@ fn_stop_graceful_cmd(){ # Attempts graceful shutdown of goldsrc using rcon 'quit' command. # There is only a 3 second delay before a forced a tmux shutdown # as GoldSrc servers 'quit' command does a restart rather than shutdown. -fn_stop_graceful_goldsrc(){ +fn_stop_graceful_goldsrc() { fn_print_dots "Graceful: sending \"quit\"" fn_script_log_info "Graceful: sending \"quit\"" # sends quit @@ -83,9 +83,9 @@ fn_stop_graceful_goldsrc(){ } # telnet command for sdtd graceful shutdown. -fn_stop_graceful_sdtd_telnet(){ - if [ -z "${telnetpass}" ]||[ "${telnetpass}" == "NOT SET" ]; then - sdtd_telnet_shutdown=$( expect -c ' +fn_stop_graceful_sdtd_telnet() { + if [ -z "${telnetpass}" ] || [ "${telnetpass}" == "NOT SET" ]; then + sdtd_telnet_shutdown=$(expect -c ' proc abort {} { puts "Timeout or EOF\n" exit 1 @@ -99,7 +99,7 @@ fn_stop_graceful_sdtd_telnet(){ puts "Completed.\n" ') else - sdtd_telnet_shutdown=$( expect -c ' + sdtd_telnet_shutdown=$(expect -c ' proc abort {} { puts "Timeout or EOF\n" exit 1 @@ -120,12 +120,12 @@ fn_stop_graceful_sdtd_telnet(){ } # Attempts graceful shutdown of 7 Days To Die using telnet. -fn_stop_graceful_sdtd(){ +fn_stop_graceful_sdtd() { fn_print_dots "Graceful: telnet" fn_script_log_info "Graceful: telnet" if [ "${telnetenabled}" == "false" ]; then fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}" - elif [ "$(command -v expect 2>/dev/null)" ]; then + elif [ "$(command -v expect 2> /dev/null)" ]; then # Tries to shutdown with both localhost and server IP. for telnetip in 127.0.0.1 ${ip}; do fn_print_dots "Graceful: telnet: ${telnetip}:${telnetport}" @@ -180,7 +180,7 @@ fn_stop_graceful_sdtd(){ } # Attempts graceful shutdown by sending /save /stop. -fn_stop_graceful_avorion(){ +fn_stop_graceful_avorion() { fn_print_dots "Graceful: /save /stop" fn_script_log_info "Graceful: /save /stop" # Sends /save. @@ -208,7 +208,7 @@ fn_stop_graceful_avorion(){ fi } -fn_stop_graceful_select(){ +fn_stop_graceful_select() { if [ "${stopmode}" == "1" ]; then fn_stop_tmux elif [ "${stopmode}" == "2" ]; then @@ -231,10 +231,12 @@ fn_stop_graceful_select(){ fn_stop_graceful_avorion elif [ "${stopmode}" == "11" ]; then fn_stop_graceful_cmd "end" 30 + elif [ "${stopmode}" == "12" ]; then + fn_stop_graceful_cmd "shutdown" 30 fi } -fn_stop_tmux(){ +fn_stop_tmux() { fn_print_dots "${servername}" fn_script_log_info "tmux kill-session: ${sessionname}: ${servername}" # Kill tmux session. @@ -251,7 +253,7 @@ fn_stop_tmux(){ } # Checks if the server is already stopped. -fn_stop_pre_check(){ +fn_stop_pre_check() { if [ "${status}" == "0" ]; then fn_print_info_nl "${servername} is already stopped" fn_script_log_error "${servername} is already stopped" diff --git a/lgsm/functions/command_ts3_server_pass.sh b/lgsm/functions/command_ts3_server_pass.sh index 1e227f3de9..be0816d15f 100755 --- a/lgsm/functions/command_ts3_server_pass.sh +++ b/lgsm/functions/command_ts3_server_pass.sh @@ -10,7 +10,7 @@ commandaction="Changing password" functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set -fn_serveradmin_password_prompt(){ +fn_serveradmin_password_prompt() { fn_print_header fn_print_information_nl "You are about to change the ${gamename} ServerAdmin password." fn_print_warning_nl "${gamename} will restart during this process." @@ -25,7 +25,7 @@ fn_serveradmin_password_prompt(){ fn_script_log_info "Changing password" } -fn_serveradmin_password_set(){ +fn_serveradmin_password_set() { # Start server in "new password mode". ts3serverpass="1" exitbypass="1" diff --git a/lgsm/functions/command_update.sh b/lgsm/functions/command_update.sh index 828c8c38de..07b65e5fac 100755 --- a/lgsm/functions/command_update.sh +++ b/lgsm/functions/command_update.sh @@ -21,7 +21,7 @@ elif [ "${shortname}" == "mc" ]; then update_minecraft.sh elif [ "${shortname}" == "mcb" ]; then update_minecraft_bedrock.sh -elif [ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then +elif [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then update_papermc.sh elif [ "${shortname}" == "mumble" ]; then update_mumble.sh diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/functions/command_update_linuxgsm.sh index e7b70f3274..39a441f59b 100755 --- a/lgsm/functions/command_update_linuxgsm.sh +++ b/lgsm/functions/command_update_linuxgsm.sh @@ -19,9 +19,9 @@ fn_script_log_info "Updating LinuxGSM" fn_print_dots "Selecting repo" fn_script_log_info "Selecting repo" # Select remotereponame -curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1>/dev/null +curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null if [ $? != "0" ]; then - curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1>/dev/null + curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null if [ $? != "0" ]; then fn_print_fail_nl "Selecting repo: Unable to to access GitHub or Bitbucket repositories" fn_script_log_fatal "Selecting repo: Unable to to access GitHub or Bitbucket repositories" @@ -38,9 +38,9 @@ fi # Check linuxsm.sh echo -en "checking ${remotereponame} linuxgsm.sh...\c" if [ "${remotereponame}" == "GitHub" ]; then - curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1>/dev/null + curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null else - curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1>/dev/null + curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null fi if [ $? != "0" ]; then fn_print_fail_eol_nl @@ -118,9 +118,9 @@ fi echo -en "checking ${remotereponame} config _default.cfg...\c" fn_script_log_info "Checking ${remotereponame} config _default.cfg" if [ "${remotereponame}" == "GitHub" ]; then - curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null + curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null else - curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null + curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null fi if [ $? != "0" ]; then fn_print_fail_eol_nl @@ -152,9 +152,9 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then echo -en "checking ${remotereponame} config ${distroid}-${distroversioncsv}.csv...\c" fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" if [ "${remotereponame}" == "GitHub" ]; then - curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1>/dev/null + curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null else - curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1>/dev/null + curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null fi if [ $? != "0" ]; then fn_print_fail_eol_nl @@ -189,9 +189,9 @@ if [ -n "${functionsdir}" ]; then echo -en "checking ${remotereponame} module ${functionfile}...\c" github_file_url_dir="lgsm/functions" if [ "${remotereponame}" == "GitHub" ]; then - curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}" 1>/dev/null + curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}" 1> /dev/null else - curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}" 1>/dev/null + curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}" 1> /dev/null fi if [ $? != 0 ]; then fn_print_error_eol_nl diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh index 4c51bacb30..15257a3e28 100755 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/functions/command_validate.sh @@ -10,7 +10,7 @@ commandaction="Validating" functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set -fn_validate(){ +fn_validate() { fn_print_warn "Validate might overwrite some customised files" fn_script_log_warn "${commandaction} server: Validate might overwrite some customised files" totalseconds=3 diff --git a/lgsm/functions/command_wipe.sh b/lgsm/functions/command_wipe.sh index d2d05defcb..29577984e5 100755 --- a/lgsm/functions/command_wipe.sh +++ b/lgsm/functions/command_wipe.sh @@ -11,7 +11,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set # Provides an exit code upon error. -fn_wipe_exit_code(){ +fn_wipe_exit_code() { exitcode=$? if [ "${exitcode}" != 0 ]; then fn_print_fail_eol_nl @@ -22,17 +22,17 @@ fn_wipe_exit_code(){ } # Removes files to wipe server. -fn_wipe_files(){ +fn_wipe_files() { fn_print_start_nl "${wipetype}" fn_script_log_info "${wipetype}" # Remove Map files - if [ -n "${serverwipe}" ]||[ -n "${mapwipe}" ]; then + if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]; then echo -en "removing .map file(s)..." fn_script_log_info "removing *.map file(s)" fn_sleep_time - find "${serveridentitydir:?}" -type f -name "*.map" -printf "%f\n" >> "${lgsmlog}" + find "${serveridentitydir:?}" -type f -name "*.map" -printf "%f\n" >> "${lgsmlog}" find "${serveridentitydir:?}" -type f -name "*.map" -delete | tee -a "${lgsmlog}" fn_wipe_exit_code else @@ -42,12 +42,12 @@ fn_wipe_files(){ fi fi # Remove Save files. - if [ -n "${serverwipe}" ]||[ -n "${mapwipe}" ]; then + if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then if [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]; then echo -en "removing .sav file(s)..." fn_script_log_info "removing .sav file(s)" fn_sleep_time - find "${serveridentitydir:?}" -type f -name "*.sav*" -printf "%f\n" >> "${lgsmlog}" + find "${serveridentitydir:?}" -type f -name "*.sav*" -printf "%f\n" >> "${lgsmlog}" find "${serveridentitydir:?}" -type f -name "*.sav*" -delete fn_wipe_exit_code else @@ -74,7 +74,7 @@ fn_wipe_files(){ fi } -fn_map_wipe_warning(){ +fn_map_wipe_warning() { fn_print_warn "Map wipe will reset the map data and keep blueprint data" fn_script_log_warn "Map wipe will reset the map data and keep blueprint data" totalseconds=3 @@ -89,7 +89,7 @@ fn_map_wipe_warning(){ fn_print_warn_nl "Map wipe will reset the map data and keep blueprint data" } -fn_full_wipe_warning(){ +fn_full_wipe_warning() { fn_print_warn "Server wipe will reset the map data and remove blueprint data" fn_script_log_warn "Server wipe will reset the map data and remove blueprint data" totalseconds=3 @@ -105,8 +105,8 @@ fn_full_wipe_warning(){ } # Will change the seed if the seed is not defined by the user. -fn_wipe_random_seed(){ - if [ -f "${datadir}/${selfname}-seed.txt" ]&&[ -n "${randomseed}" ]; then +fn_wipe_random_seed() { + if [ -f "${datadir}/${selfname}-seed.txt" ] && [ -n "${randomseed}" ]; then shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt" seed=$(cat "${datadir}/${selfname}-seed.txt") randomseed=1 @@ -118,10 +118,10 @@ fn_wipe_random_seed(){ } # A summary of what wipe is going to do. -fn_wipe_details(){ +fn_wipe_details() { fn_print_information_nl "Wipe does not remove Rust+ data." echo -en "* Wipe map data: " - if [ -n "${serverwipe}" ]||[ -n "${mapwipe}" ]; then + if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then fn_print_yes_eol_nl else fn_print_no_eol_nl @@ -147,7 +147,7 @@ check.sh fix_rust.sh # Check if there is something to wipe. -if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]&&[ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then +if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ] || [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ] && [ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then if [ -n "${serverwipe}" ]; then wipetype="Full wipe" fn_full_wipe_warning diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index 297f4101f7..cc5af18090 100755 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -19,7 +19,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_dl_steamcmd(){ +fn_dl_steamcmd() { fn_print_start_nl "${remotelocation}" fn_script_log_info "${commandaction} ${selfname}: ${remotelocation}" if [ -n "${branch}" ]; then @@ -41,7 +41,7 @@ fn_dl_steamcmd(){ fi # Validate will be added as a parameter if required. - if [ "${commandname}" == "VALIDATE" ]||[ "${commandname}" == "INSTALL" ]; then + if [ "${commandname}" == "VALIDATE" ] || [ "${commandname}" == "INSTALL" ]; then validate="validate" fi @@ -53,13 +53,13 @@ fn_dl_steamcmd(){ rm -f "${steamcmdlog:?}" fi counter=0 - while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do - counter=$((counter+1)) + while [ "${counter}" == "0" ] || [ "${exitcode}" != "0" ]; do + counter=$((counter + 1)) # Select SteamCMD parameters # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. if [ "${appid}" == "90" ]; then # If using a specific branch. - if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then + if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" elif [ -n "${branch}" ]; then ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" @@ -68,7 +68,7 @@ fn_dl_steamcmd(){ fi # Force Windows Platform type. elif [ "${steamcmdforcewindows}" == "yes" ]; then - if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then + if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" elif [ -n "${branch}" ]; then ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" @@ -77,7 +77,7 @@ fn_dl_steamcmd(){ fi # All other servers. else - if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then + if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" elif [ -n "${branch}" ]; then ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" @@ -89,7 +89,7 @@ fn_dl_steamcmd(){ # Error checking for SteamCMD. Some errors will loop to try again and some will just exit. # Check also if we have more errors than retries to be sure that we do not loop to many times and error out. exitcode=$? - if [ -n "$(grep -i "Error!" "${steamcmdlog}" | tail -1)" ]&&[ "$(grep -ic "Error!" "${steamcmdlog}")" -ge "${counter}" ] ; then + if [ -n "$(grep -i "Error!" "${steamcmdlog}" | tail -1)" ] && [ "$(grep -ic "Error!" "${steamcmdlog}")" -ge "${counter}" ]; then # Not enough space. if [ -n "$(grep "0x202" "${steamcmdlog}" | tail -1)" ]; then fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files" @@ -97,9 +97,9 @@ fn_dl_steamcmd(){ core_exit.sh # Not enough space. elif [ -n "$(grep "0x212" "${steamcmdlog}" | tail -1)" ]; then - fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files" - fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files" - core_exit.sh + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files" + core_exit.sh # Need tp purchase game. elif [ -n "$(grep "No subscription" "${steamcmdlog}" | tail -1)" ]; then fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Steam account does not have a license for the required game" @@ -110,13 +110,13 @@ fn_dl_steamcmd(){ fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Two-factor authentication failure" fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Two-factor authentication failure" core_exit.sh - # Incorrect Branch password - elif [ -n "$(grep "Password check for AppId" "${steamcmdlog}" | tail -1)" ]; then - fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect" - fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect" - core_exit.sh + # Incorrect Branch password + elif [ -n "$(grep "Password check for AppId" "${steamcmdlog}" | tail -1)" ]; then + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect" + core_exit.sh # Update did not finish. - elif [ -n "$(grep "0x402" "${steamcmdlog}" | tail -1)" ]||[ -n "$(grep "0x602" "${steamcmdlog}" | tail -1)" ]; then + elif [ -n "$(grep "0x402" "${steamcmdlog}" | tail -1)" ] || [ -n "$(grep "0x602" "${steamcmdlog}" | tail -1)" ]; then fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Update required but not completed - check network" fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Update required but not completed - check network" else @@ -141,7 +141,7 @@ fn_dl_steamcmd(){ } # Emptys contents of the LinuxGSM tmpdir. -fn_clear_tmp(){ +fn_clear_tmp() { echo -en "clearing LinuxGSM tmp directory..." if [ -d "${tmpdir}" ]; then rm -rf "${tmpdir:?}/"* @@ -156,9 +156,9 @@ fn_clear_tmp(){ fi } -fn_dl_hash(){ +fn_dl_hash() { # Runs Hash Check if available. - if [ "${hash}" != "0" ]&&[ "${hash}" != "nohash" ]&&[ "${hash}" != "nomd5" ]; then + if [ "${hash}" != "0" ] && [ "${hash}" != "nohash" ] && [ "${hash}" != "nomd5" ]; then # MD5 if [ "${#hash}" == "32" ]; then hashbin="md5sum" @@ -204,7 +204,7 @@ fn_dl_hash(){ # Extracts can be defined in code like so: # fn_dl_extract "${local_filedir}" "${local_filename}" "${extractdir}" # fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles" -fn_dl_extract(){ +fn_dl_extract() { local_filedir="${1}" local_filename="${2}" extractdir="${3}" @@ -214,7 +214,7 @@ fn_dl_extract(){ if [ ! -d "${extractdir}" ]; then mkdir "${extractdir}" fi - if [ "${mime}" == "application/gzip" ]||[ "${mime}" == "application/x-gzip" ]; then + if [ "${mime}" == "application/gzip" ] || [ "${mime}" == "application/x-gzip" ]; then extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdir}") elif [ "${mime}" == "application/x-bzip2" ]; then extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdir}") @@ -239,7 +239,7 @@ fn_dl_extract(){ } # Trap to remove file download if canceled before completed. -fn_fetch_trap(){ +fn_fetch_trap() { echo -e "" echo -en "downloading ${local_filename}..." fn_print_canceled_eol_nl @@ -253,7 +253,7 @@ fn_fetch_trap(){ } # Will check a file exists and download it. Will not exit if fails to download. -fn_check_file(){ +fn_check_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -263,11 +263,11 @@ fn_check_file(){ if [ -n "${remote_fileurl_backup}" ]; then # counter set to 0 to allow second try counter=0 - remote_fileurls_array=( remote_fileurl remote_fileurl_backup ) + remote_fileurls_array=(remote_fileurl remote_fileurl_backup) else # counter set to 1 to not allow second try counter=1 - remote_fileurls_array=( remote_fileurl ) + remote_fileurls_array=(remote_fileurl) fi for remote_fileurl_array in "${remote_fileurls_array[@]}"; do if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then @@ -277,7 +277,7 @@ fn_check_file(){ fileurl="${remote_fileurl_backup}" fileurl_name="${remote_fileurl_backup_name}" fi - counter=$((counter+1)) + counter=$((counter + 1)) echo -en "checking ${fileurl_name} ${remote_filename}...\c" curlcmd=$(curl --output /dev/null --silent --head --fail "${fileurl}" 2>&1) local exitcode=$? @@ -321,7 +321,7 @@ fn_check_file(){ fi } -fn_fetch_file(){ +fn_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -334,16 +334,16 @@ fn_fetch_file(){ hash="${10:-0}" # Download file if missing or download forced. - if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then + if [ ! -f "${local_filedir}/${local_filename}" ] || [ "${forcedl}" == "forcedl" ]; then # If backup fileurl exists include it. if [ -n "${remote_fileurl_backup}" ]; then # counter set to 0 to allow second try counter=0 - remote_fileurls_array=( remote_fileurl remote_fileurl_backup ) + remote_fileurls_array=(remote_fileurl remote_fileurl_backup) else # counter set to 1 to not allow second try counter=1 - remote_fileurls_array=( remote_fileurl ) + remote_fileurls_array=(remote_fileurl) fi for remote_fileurl_array in "${remote_fileurls_array[@]}"; do if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then @@ -353,14 +353,14 @@ fn_fetch_file(){ fileurl="${remote_fileurl_backup}" fileurl_name="${remote_fileurl_backup_name}" fi - counter=$((counter+1)) + counter=$((counter + 1)) if [ ! -d "${local_filedir}" ]; then mkdir -p "${local_filedir}" fi # Trap will remove part downloaded files if canceled. trap fn_fetch_trap INT # Larger files show a progress bar. - if [ "${local_filename##*.}" == "bz2" ]||[ "${local_filename##*.}" == "gz" ]||[ "${local_filename##*.}" == "zip" ]||[ "${local_filename##*.}" == "jar" ]||[ "${local_filename##*.}" == "xz" ]; then + if [ "${local_filename##*.}" == "bz2" ] || [ "${local_filename##*.}" == "gz" ] || [ "${local_filename##*.}" == "zip" ] || [ "${local_filename##*.}" == "jar" ] || [ "${local_filename##*.}" == "xz" ]; then echo -en "downloading ${local_filename}..." fn_sleep_time echo -en "\033[1K" @@ -374,7 +374,7 @@ fn_fetch_file(){ # Download will fail if downloads a html file. if [ -f "${local_filedir}/${local_filename}" ]; then - if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE" )" ]; then + if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE")" ]; then rm "${local_filedir:?}/${local_filename:?}" local exitcode=2 fi @@ -443,7 +443,7 @@ fn_fetch_file(){ # hash: Optional, set an hash sum and will compare it against the file. # Fetches files from the Git repo. -fn_fetch_file_github(){ +fn_fetch_file_github() { github_fileurl_dir="${1}" github_fileurl_name="${2}" # For legacy versions - code can be removed at a future date @@ -451,7 +451,7 @@ fn_fetch_file_github(){ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - elif [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + elif [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" else @@ -470,10 +470,10 @@ fn_fetch_file_github(){ fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" } -fn_check_file_github(){ +fn_check_file_github() { github_fileurl_dir="${1}" github_fileurl_name="${2}" - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" else @@ -486,11 +486,11 @@ fn_check_file_github(){ } # Fetches config files from the Git repo. -fn_fetch_config(){ +fn_fetch_config() { github_fileurl_dir="${1}" github_fileurl_name="${2}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" else @@ -510,11 +510,11 @@ fn_fetch_config(){ } # Fetches modules from the Git repo during first download. -fn_fetch_function(){ +fn_fetch_function() { github_fileurl_dir="lgsm/functions" github_fileurl_name="${functionfile}" - # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. + if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" else @@ -534,11 +534,11 @@ fn_fetch_function(){ } # Fetches modules from the Git repo during update-lgsm. -fn_update_function(){ +fn_update_function() { github_fileurl_dir="lgsm/functions" github_fileurl_name="${functionfile}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" else @@ -563,7 +563,7 @@ fn_update_function(){ # $2 Repo name. # $3 Destination for download. # $4 Search string in releases (needed if there are more files that can be downloaded from the release pages). -fn_dl_latest_release_github(){ +fn_dl_latest_release_github() { local githubreleaseuser="${1}" local githubreleaserepo="${2}" local githubreleasedownloadpath="${3}" diff --git a/lgsm/functions/core_exit.sh b/lgsm/functions/core_exit.sh index 34379a4860..93c37dfc7a 100755 --- a/lgsm/functions/core_exit.sh +++ b/lgsm/functions/core_exit.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_exit_dev_debug(){ +fn_exit_dev_debug() { if [ -f "${rootdir}/.dev-debug" ]; then echo -e "" echo -e "${functionselfname} exiting with code: ${exitcode}" @@ -25,7 +25,7 @@ fi if [ "${exitbypass}" ]; then unset exitbypass -elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then +elif [ "${exitcode}" ] && [ "${exitcode}" != "0" ]; then # List LinuxGSM version in logs fn_script_log_info "LinuxGSM version: ${version}" if [ "${exitcode}" == "1" ]; then @@ -41,7 +41,7 @@ elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then # remove trap. trap - INT exit "${exitcode}" -elif [ "${exitcode}" ]&&[ "${exitcode}" == "0" ]; then +elif [ "${exitcode}" ] && [ "${exitcode}" == "0" ]; then # List LinuxGSM version in logs fn_script_log_info "LinuxGSM version: ${version}" fn_script_log_pass "${functionselfname} exiting with code: ${exitcode}" diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index 67ed2a59b3..20d26de057 100755 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -8,784 +8,789 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v22.1.0" +modulesversion="v22.2.0" # Core -core_dl.sh(){ -functionfile="${FUNCNAME[0]}" -if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then - fn_fetch_core_dl "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" -else - fn_bootstrap_fetch_file_github "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" -fi +core_dl.sh() { + functionfile="${FUNCNAME[0]}" + if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then + fn_fetch_core_dl "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + else + fn_bootstrap_fetch_file_github "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + fi } -core_messages.sh(){ -functionfile="${FUNCNAME[0]}" -if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then - fn_fetch_core_dl "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" -else - fn_bootstrap_fetch_file_github "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" -fi +core_messages.sh() { + functionfile="${FUNCNAME[0]}" + if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then + fn_fetch_core_dl "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + else + fn_bootstrap_fetch_file_github "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + fi } -core_legacy.sh(){ -functionfile="${FUNCNAME[0]}" -if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then - fn_fetch_core_dl "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" -else - fn_bootstrap_fetch_file_github "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" -fi +core_legacy.sh() { + functionfile="${FUNCNAME[0]}" + if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then + fn_fetch_core_dl "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + else + fn_bootstrap_fetch_file_github "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + fi } -core_exit.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +core_exit.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -core_getopt.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +core_getopt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -core_trap.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +core_trap.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -core_steamcmd.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +core_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -core_github.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +core_github.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Commands -command_backup.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_backup.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_console.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_console.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_debug.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_debug.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_details.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_details.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_donate.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_donate.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_postdetails.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_postdetails.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_test_alert.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_test_alert.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_monitor.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_monitor.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_start.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_start.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_stop.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_stop.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_validate.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_validate.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_install.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_install.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_install_resources_mta.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_install_resources_mta.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_squad_license.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_squad_license.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_mods_install.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_mods_install.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_mods_update.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_mods_update.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_mods_remove.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_mods_remove.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_fastdl.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_fastdl.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_ts3_server_pass.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_ts3_server_pass.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_restart.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_restart.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_skeleton.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_skeleton.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_wipe.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_wipe.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_send.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_send.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Checks -check.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_config.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_config.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_deps.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_deps.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_executable.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_executable.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_glibc.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_glibc.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_ip.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_ip.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_last_update.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_last_update.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_logs.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_logs.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_permissions.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_permissions.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_root.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_root.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_status.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_status.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_steamcmd.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_system_dir.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_system_dir.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_system_requirements.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_system_requirements.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_tmuxception.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_tmuxception.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -check_version.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +check_version.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Compress -compress_unreal2_maps.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +compress_unreal2_maps.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -compress_ut99_maps.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +compress_ut99_maps.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Mods -mods_list.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +mods_list.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -mods_core.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +mods_core.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Dev -command_dev_clear_functions.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_dev_clear_functions.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_dev_debug.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_dev_debug.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_dev_detect_deps.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_dev_detect_deps.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_dev_detect_glibc.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_dev_detect_glibc.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_dev_detect_ldd.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_dev_detect_ldd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_dev_query_raw.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_dev_query_raw.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Fix -fix.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_ark.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_ark.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_av.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_av.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_arma3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_arma3.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_armar.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_armar.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_bt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_bo.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_bo.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_cmw.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_cmw.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_csgo.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_csgo.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_dst.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_dst.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_hw.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_hw.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_ins.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_ins.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_kf.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_kf.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_kf2.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_kf2.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_lo.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_lo.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_mcb.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_mcb.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_mta.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_mta.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_nmrih.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_nmrih.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_onset.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_onset.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_ro.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_ro.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_rust.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_rust.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_rw.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_rw.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_sfc.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_sfc.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_st.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_st.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_steamcmd.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_terraria.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_terraria.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_tf2.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_tf2.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_ut3.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_ut3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_rust.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_rust.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_samp.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_samp.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_sdtd.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_sdtd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_sof2.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_sof2.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_squad.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_squad.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_ts3.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_ts3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_ut2k4.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_ut2k4.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_ut.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_ut.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_unt.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_unt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_vh.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_vh.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_wurm.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_wurm.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fix_zmr.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fix_zmr.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Info -info_distro.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +info_distro.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -info_game.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +info_game.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -info_messages.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +info_messages.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -info_stats.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +info_stats.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Alert -alert.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_discord.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_discord.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_email.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_email.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_ifttt.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_ifttt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_mailgun.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_mailgun.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_pushbullet.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_pushbullet.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_pushover.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_pushover.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_gotify.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_gotify.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_telegram.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_telegram.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_rocketchat.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_rocketchat.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -alert_slack.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +alert_slack.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Logs -core_logs.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +core_logs.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Query -query_gamedig.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +query_gamedig.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Update -command_update_functions.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_update_functions.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_update_linuxgsm.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_update_linuxgsm.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_update.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_update.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -command_check_update.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +command_check_update.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_ts3.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_ts3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_minecraft.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_minecraft.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_minecraft_bedrock.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_minecraft_bedrock.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_papermc.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_papermc.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_mumble.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_mumble.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_mta.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_mta.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_factorio.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_factorio.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_jediknight2.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_jediknight2.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_steamcmd.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -update_vintagestory.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +update_vintagestory.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -fn_update_functions.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +fn_update_functions.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # ## Installer functions # -fn_autoinstall(){ -autoinstall=1 -command_install.sh +fn_autoinstall() { + autoinstall=1 + command_install.sh } -install_complete.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_complete.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_config.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_config.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_factorio_save.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_factorio_save.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_dst_token.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_dst_token.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_eula.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_eula.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_gsquery.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_gsquery.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_gslt.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_gslt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_header.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_header.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_logs.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_logs.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_retry.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_retry.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_server_dir.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_server_dir.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_server_files.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_server_files.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_stats.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_stats.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_steamcmd.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_ts3.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_ts3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_ts3db.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_ts3db.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_ut2k4.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_ut2k4.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_dl_ut2k4.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_dl_ut2k4.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } -install_ut2k4_key.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function +install_ut2k4_key.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function } # Calls code required for legacy servers diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index 9594fa5ae6..3c44931b9b 100755 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -10,158 +10,157 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ### Define all commands here. ## User commands | Trigger commands | Description # Standard commands. -cmd_install=( "i;install" "command_install.sh" "Install the server." ) -cmd_auto_install=( "ai;auto-install" "fn_autoinstall" "Install the server without prompts." ) -cmd_start=( "st;start" "command_start.sh" "Start the server." ) -cmd_stop=( "sp;stop" "command_stop.sh" "Stop the server." ) -cmd_restart=( "r;restart" "command_restart.sh" "Restart the server." ) -cmd_details=( "dt;details" "command_details.sh" "Display server information." ) -cmd_postdetails=( "pd;postdetails" "command_postdetails.sh" "Post details to termbin.com (removing passwords)." ) -cmd_backup=( "b;backup" "command_backup.sh" "Create backup archives of the server." ) -cmd_update_linuxgsm=( "ul;update-lgsm;uf;update-functions" "command_update_linuxgsm.sh" "Check and apply any LinuxGSM updates." ) -cmd_test_alert=( "ta;test-alert" "command_test_alert.sh" "Send a test alert." ) -cmd_monitor=( "m;monitor" "command_monitor.sh" "Check server status and restart if crashed." ) -cmd_skeleton=( "sk;skeleton" "command_skeleton.sh" "Create a skeleton directory." ) -cmd_donate=( "do;donate" "command_donate.sh" "Donation options." ) -cmd_send=( "sd;send" "command_send.sh" "Send command to game server console." ) +cmd_install=("i;install" "command_install.sh" "Install the server.") +cmd_auto_install=("ai;auto-install" "fn_autoinstall" "Install the server without prompts.") +cmd_start=("st;start" "command_start.sh" "Start the server.") +cmd_stop=("sp;stop" "command_stop.sh" "Stop the server.") +cmd_restart=("r;restart" "command_restart.sh" "Restart the server.") +cmd_details=("dt;details" "command_details.sh" "Display server information.") +cmd_postdetails=("pd;postdetails" "command_postdetails.sh" "Post details to termbin.com (removing passwords).") +cmd_backup=("b;backup" "command_backup.sh" "Create backup archives of the server.") +cmd_update_linuxgsm=("ul;update-lgsm;uf;update-functions" "command_update_linuxgsm.sh" "Check and apply any LinuxGSM updates.") +cmd_test_alert=("ta;test-alert" "command_test_alert.sh" "Send a test alert.") +cmd_monitor=("m;monitor" "command_monitor.sh" "Check server status and restart if crashed.") +cmd_skeleton=("sk;skeleton" "command_skeleton.sh" "Create a skeleton directory.") +cmd_donate=("do;donate" "command_donate.sh" "Donation options.") +cmd_send=("sd;send" "command_send.sh" "Send command to game server console.") # Console servers only. -cmd_console=( "c;console" "command_console.sh" "Access server console." ) -cmd_debug=( "d;debug" "command_debug.sh" "Start server directly in your terminal." ) +cmd_console=("c;console" "command_console.sh" "Access server console.") +cmd_debug=("d;debug" "command_debug.sh" "Start server directly in your terminal.") # Update servers only. -cmd_update=( "u;update" "command_update.sh" "Check and apply any server updates." ) -cmd_check_update=( "cu;check-update" "command_check_update.sh" "Check if a gameserver update is available" ) -cmd_force_update=( "fu;force-update;update-restart;ur" "forceupdate=1; command_update.sh" "Apply server updates bypassing check." ) +cmd_update=("u;update" "command_update.sh" "Check and apply any server updates.") +cmd_check_update=("cu;check-update" "command_check_update.sh" "Check if a gameserver update is available") +cmd_force_update=("fu;force-update;update-restart;ur" "forceupdate=1; command_update.sh" "Apply server updates bypassing check.") # SteamCMD servers only. -cmd_validate=( "v;validate" "command_validate.sh" "Validate server files with SteamCMD." ) +cmd_validate=("v;validate" "command_validate.sh" "Validate server files with SteamCMD.") # Server with mods-install. -cmd_mods_install=( "mi;mods-install" "command_mods_install.sh" "View and install available mods/addons." ) -cmd_mods_remove=( "mr;mods-remove" "command_mods_remove.sh" "View and remove an installed mod/addon." ) -cmd_mods_update=( "mu;mods-update" "command_mods_update.sh" "Update installed mods/addons." ) +cmd_mods_install=("mi;mods-install" "command_mods_install.sh" "View and install available mods/addons.") +cmd_mods_remove=("mr;mods-remove" "command_mods_remove.sh" "View and remove an installed mod/addon.") +cmd_mods_update=("mu;mods-update" "command_mods_update.sh" "Update installed mods/addons.") # Server specific. -cmd_change_password=( "pw;change-password" "command_ts3_server_pass.sh" "Change TS3 serveradmin password." ) -cmd_install_default_resources=( "ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources." ) -cmd_fullwipe=( "fw;full-wipe;wa;wipeall" "serverwipe=1; command_wipe.sh" "Reset the map and remove blueprint data." ) -cmd_mapwipe=( "mw;map-wipe;w;wipe;wi" "mapwipe=1; command_wipe.sh" "Reset the map and keep blueprint data." ) -cmd_map_compressor_u99=( "mc;map-compressor" "compress_ut99_maps.sh" "Compresses all ${gamename} server maps." ) -cmd_map_compressor_u2=( "mc;map-compressor" "compress_unreal2_maps.sh" "Compresses all ${gamename} server maps." ) -cmd_install_cdkey=( "cd;server-cd-key" "install_ut2k4_key.sh" "Add your server cd key." ) -cmd_install_dst_token=( "ct;cluster-token" "install_dst_token.sh" "Configure cluster token." ) -cmd_install_squad_license=( "li;license" "install_squad_license.sh" "Add your Squad server license." ) -cmd_fastdl=( "fd;fastdl" "command_fastdl.sh" "Build a FastDL directory." ) +cmd_change_password=("pw;change-password" "command_ts3_server_pass.sh" "Change TS3 serveradmin password.") +cmd_install_default_resources=("ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources.") +cmd_fullwipe=("fw;full-wipe;wa;wipeall" "serverwipe=1; command_wipe.sh" "Reset the map and remove blueprint data.") +cmd_mapwipe=("mw;map-wipe;w;wipe;wi" "mapwipe=1; command_wipe.sh" "Reset the map and keep blueprint data.") +cmd_map_compressor_u99=("mc;map-compressor" "compress_ut99_maps.sh" "Compresses all ${gamename} server maps.") +cmd_map_compressor_u2=("mc;map-compressor" "compress_unreal2_maps.sh" "Compresses all ${gamename} server maps.") +cmd_install_cdkey=("cd;server-cd-key" "install_ut2k4_key.sh" "Add your server cd key.") +cmd_install_dst_token=("ct;cluster-token" "install_dst_token.sh" "Configure cluster token.") +cmd_install_squad_license=("li;license" "install_squad_license.sh" "Add your Squad server license.") +cmd_fastdl=("fd;fastdl" "command_fastdl.sh" "Build a FastDL directory.") # Dev commands. -cmd_dev_debug=( "dev;developer" "command_dev_debug.sh" "Enable developer Mode." ) -cmd_dev_detect_deps=( "dd;detect-deps" "command_dev_detect_deps.sh" "Detect required dependencies." ) -cmd_dev_detect_glibc=( "dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc." ) -cmd_dev_detect_ldd=( "dl;detect-ldd" "command_dev_detect_ldd.sh" "Detect required dynamic dependencies." ) -cmd_dev_query_raw=( "qr;query-raw" "command_dev_query_raw.sh" "The raw output of gamedig and gsquery." ) -cmd_dev_clear_functions=( "cf;clear-functions" "command_dev_clear_functions.sh" "Delete the contents of the functions dir." ) - +cmd_dev_debug=("dev;developer" "command_dev_debug.sh" "Enable developer Mode.") +cmd_dev_detect_deps=("dd;detect-deps" "command_dev_detect_deps.sh" "Detect required dependencies.") +cmd_dev_detect_glibc=("dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc.") +cmd_dev_detect_ldd=("dl;detect-ldd" "command_dev_detect_ldd.sh" "Detect required dynamic dependencies.") +cmd_dev_query_raw=("qr;query-raw" "command_dev_query_raw.sh" "The raw output of gamedig and gsquery.") +cmd_dev_clear_functions=("cf;clear-functions" "command_dev_clear_functions.sh" "Delete the contents of the functions dir.") ### Set specific opt here. -currentopt=( "${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monitor[@]}" "${cmd_test_alert[@]}" "${cmd_details[@]}" "${cmd_postdetails[@]}" "${cmd_skeleton[@]}" ) +currentopt=("${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monitor[@]}" "${cmd_test_alert[@]}" "${cmd_details[@]}" "${cmd_postdetails[@]}" "${cmd_skeleton[@]}") # Update LinuxGSM. -currentopt+=( "${cmd_update_linuxgsm[@]}" ) +currentopt+=("${cmd_update_linuxgsm[@]}") # Exclude noupdate games here. -if [ "${shortname}" == "jk2" ]||[ "${engine}" != "idtech3" ];then - if [ "${shortname}" != "bf1942" ]&&[ "${shortname}" != "bfv" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]&&[ "${engine}" != "quake" ]&&[ "${shortname}" != "samp" ]&&[ "${shortname}" != "ut2k4" ]&&[ "${shortname}" != "ut99" ]; then - currentopt+=( "${cmd_update[@]}" ) +if [ "${shortname}" == "jk2" ] || [ "${engine}" != "idtech3" ]; then + if [ "${shortname}" != "bf1942" ] && [ "${shortname}" != "bfv" ] && [ "${engine}" != "idtech2" ] && [ "${engine}" != "iw2.0" ] && [ "${engine}" != "iw3.0" ] && [ "${engine}" != "quake" ] && [ "${shortname}" != "samp" ] && [ "${shortname}" != "ut2k4" ] && [ "${shortname}" != "ut99" ]; then + currentopt+=("${cmd_update[@]}") # force update for SteamCMD or Multi Theft Auto only. - if [ "${appid}" ]||[ "${shortname}" == "mta" ]; then - currentopt+=( "${cmd_force_update[@]}" ) + if [ "${appid}" ] || [ "${shortname}" == "mta" ]; then + currentopt+=("${cmd_force_update[@]}") fi fi fi # Validate and check-update command. -if [ "${appid}" ]; then - currentopt+=( "${cmd_validate[@]}" "${cmd_check_update[@]}" ) +if [ "${appid}" ]||[ "${shortname}" == "ts3" ]; then + currentopt+=("${cmd_validate[@]}" "${cmd_check_update[@]}") fi # Backup. -currentopt+=( "${cmd_backup[@]}" ) +currentopt+=("${cmd_backup[@]}") # Console & Debug. -currentopt+=( "${cmd_console[@]}" "${cmd_debug[@]}" ) +currentopt+=("${cmd_console[@]}" "${cmd_debug[@]}") # Console send. if [ "${consoleinteract}" == "yes" ]; then - currentopt+=( "${cmd_send[@]}" ) + currentopt+=("${cmd_send[@]}") fi ## Game server exclusive commands. # FastDL command. if [ "${engine}" == "source" ]; then - currentopt+=( "${cmd_fastdl[@]}" ) + currentopt+=("${cmd_fastdl[@]}") fi # TeamSpeak exclusive. if [ "${shortname}" == "ts3" ]; then - currentopt+=( "${cmd_change_password[@]}" ) + currentopt+=("${cmd_change_password[@]}") fi # Unreal exclusive. if [ "${shortname}" == "rust" ]; then - currentopt+=( "${cmd_fullwipe[@]}" "${cmd_mapwipe[@]}" ) + currentopt+=("${cmd_fullwipe[@]}" "${cmd_mapwipe[@]}") fi if [ "${engine}" == "unreal2" ]; then if [ "${shortname}" == "ut2k4" ]; then - currentopt+=( "${cmd_install_cdkey[@]}" "${cmd_map_compressor_u2[@]}" ) + currentopt+=("${cmd_install_cdkey[@]}" "${cmd_map_compressor_u2[@]}") else - currentopt+=( "${cmd_map_compressor_u2[@]}" ) + currentopt+=("${cmd_map_compressor_u2[@]}") fi fi if [ "${engine}" == "unreal" ]; then - currentopt+=( "${cmd_map_compressor_u99[@]}" ) + currentopt+=("${cmd_map_compressor_u99[@]}") fi # DST exclusive. if [ "${shortname}" == "dst" ]; then - currentopt+=( "${cmd_install_dst_token[@]}" ) + currentopt+=("${cmd_install_dst_token[@]}") fi # MTA exclusive. if [ "${shortname}" == "mta" ]; then - currentopt+=( "${cmd_install_default_resources[@]}" ) + currentopt+=("${cmd_install_default_resources[@]}") fi # Squad license exclusive. if [ "${shortname}" == "squad" ]; then - currentopt+=( "${cmd_install_squad_license[@]}" ) + currentopt+=("${cmd_install_squad_license[@]}") fi ## Mods commands. -if [ "${engine}" == "source" ]||[ "${shortname}" == "rust" ]||[ "${shortname}" == "hq" ]||[ "${shortname}" == "sdtd" ]||[ "${shortname}" == "cs" ]||[ "${shortname}" == "dod" ]||[ "${shortname}" == "tfc" ]||[ "${shortname}" == "ns" ]||[ "${shortname}" == "ts" ]||[ "${shortname}" == "hldm" ]||[ "${shortname}" == "vh" ]; then - currentopt+=( "${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}" ) +if [ "${engine}" == "source" ] || [ "${shortname}" == "rust" ] || [ "${shortname}" == "hq" ] || [ "${shortname}" == "sdtd" ] || [ "${shortname}" == "cs" ] || [ "${shortname}" == "dod" ] || [ "${shortname}" == "tfc" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "hldm" ] || [ "${shortname}" == "vh" ]; then + currentopt+=("${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}") fi ## Installer. -currentopt+=( "${cmd_install[@]}" "${cmd_auto_install[@]}" ) +currentopt+=("${cmd_install[@]}" "${cmd_auto_install[@]}") ## Developer commands. -currentopt+=( "${cmd_dev_debug[@]}" ) +currentopt+=("${cmd_dev_debug[@]}") if [ -f ".dev-debug" ]; then - currentopt+=( "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_functions[@]}" ) + currentopt+=("${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_functions[@]}") fi ## Donate. -currentopt+=( "${cmd_donate[@]}" ) +currentopt+=("${cmd_donate[@]}") ### Build list of available commands. optcommands=() index="0" -for ((index="0"; index < ${#currentopt[@]}; index+=3)); do +for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do cmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }') - for ((cmdindex=1; cmdindex <= cmdamount; cmdindex++)); do - optcommands+=( "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')" ) + for ((cmdindex = 1; cmdindex <= cmdamount; cmdindex++)); do + optcommands+=("$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')") done done # Shows LinuxGSM usage. -fn_opt_usage(){ +fn_opt_usage() { echo -e "Usage: $0 [option]" echo -e "" echo -e "LinuxGSM - ${gamename} - Version ${version}" @@ -171,12 +170,12 @@ fn_opt_usage(){ # Display available commands. index="0" { - for ((index="0"; index < ${#currentopt[@]}; index+=3)); do - # Hide developer commands. - if [ "${currentopt[index+2]}" != "DEVCOMMAND" ]; then - echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index+2]}" - fi - done + for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do + # Hide developer commands. + if [ "${currentopt[index + 2]}" != "DEVCOMMAND" ]; then + echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}" + fi + done } | column -s $'\t' -t fn_script_log_pass "Display commands" core_exit.sh @@ -188,15 +187,15 @@ if [ -z "${getopt}" ]; then fi # If command exists. for i in "${optcommands[@]}"; do - if [ "${i}" == "${getopt}" ] ; then + if [ "${i}" == "${getopt}" ]; then # Seek and run command. index="0" - for ((index="0"; index < ${#currentopt[@]}; index+=3)); do + for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do currcmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }') - for ((currcmdindex=1; currcmdindex <= currcmdamount; currcmdindex++)); do + for ((currcmdindex = 1; currcmdindex <= currcmdamount; currcmdindex++)); do if [ "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then # Run command. - eval "${currentopt[index+1]}" + eval "${currentopt[index + 1]}" # Exit should occur in modules. Should this not happen print an error fn_print_error2_nl "Command did not exit correctly: ${getopt}" fn_script_log_error "Command did not exit correctly: ${getopt}" diff --git a/lgsm/functions/core_github.sh b/lgsm/functions/core_github.sh index 5bd4bd7302..0462e65bfa 100644 --- a/lgsm/functions/core_github.sh +++ b/lgsm/functions/core_github.sh @@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" github_api="https://api.github.com" -fn_githublocalversionfile(){ +fn_githublocalversionfile() { local githubreleaseuser="${1}" local githubreleaserepo="${2}" @@ -18,12 +18,12 @@ fn_githublocalversionfile(){ # $1 githubuser/group # $2 github repo name -fn_github_get_latest_release_version(){ +fn_github_get_latest_release_version() { local githubreleaseuser="${1}" local githubreleaserepo="${2}" local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest" - githubreleaseversion=$(curl -s --connect-timeout 10 "${githublatestreleaseurl}" | jq '.tag_name' ) + githubreleaseversion=$(curl -s --connect-timeout 10 "${githublatestreleaseurl}" | jq '.tag_name') # error if no version is there if [ -z "${githubreleaseversion}" ]; then @@ -34,14 +34,14 @@ fn_github_get_latest_release_version(){ # $1 githubuser/group # $2 github repo name -fn_github_set_latest_release_version(){ +fn_github_set_latest_release_version() { local githubreleaseuser="${1}" local githubreleaserepo="${2}" fn_githublocalversionfile "${githubreleaseuser}" "${githubreleaserepo}" local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest" - githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq -r '.tag_name' ) + githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq -r '.tag_name') # error if no version is there if [ -z "${githubreleaseversion}" ]; then @@ -54,7 +54,7 @@ fn_github_set_latest_release_version(){ # $1 githubuser/group # $2 github repo name -fn_github_get_installed_version(){ +fn_github_get_installed_version() { local githubreleaseuser="${1}" local githubreleaserepo="${2}" @@ -66,7 +66,7 @@ fn_github_get_installed_version(){ # $1 githubuser/group # $2 github repo name # if a update needs to be downloaded - updateneeded is set to 1 -fn_github_compare_version(){ +fn_github_compare_version() { local githubreleaseuser="${1}" local githubreleaserepo="${2}" exitcode=0 @@ -76,7 +76,7 @@ fn_github_compare_version(){ local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest" githublocalversion=$(cat "${githublocalversionfile}") - githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq '.tag_name' ) + githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq '.tag_name') # error if no version is there if [ -z "${githubreleaseversion}" ]; then @@ -91,7 +91,7 @@ fn_github_compare_version(){ echo -en "\n" else # check if version that is installed is higher than the remote version to not override it - last_version=$(echo -e "${githublocalversion}\n${githubreleaseversion}" | sort -V | head -n1 ) + last_version=$(echo -e "${githublocalversion}\n${githubreleaseversion}" | sort -V | head -n1) if [ "${githubreleaseversion}" == "${last_version}" ]; then echo -en "\n" echo -e "Update from github.com/${githubreleaseuser}/${githubreleaserepo}/ available:" diff --git a/lgsm/functions/core_legacy.sh b/lgsm/functions/core_legacy.sh index 811acfbba0..f9aa514551 100755 --- a/lgsm/functions/core_legacy.sh +++ b/lgsm/functions/core_legacy.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # This is to help the transition to v20.3.0 and above -legacy_versions_array=( v20.2.1 v20.2.0 v20.1.5 v20.1.4 v20.1.3 v20.1.2 v20.1.1 v20.1.0 v19.12.5 v19.12.4 v19.12.3 v19.12.2 v19.12.1 v19.12.0 ) +legacy_versions_array=(v20.2.1 v20.2.0 v20.1.5 v20.1.4 v20.1.3 v20.1.2 v20.1.1 v20.1.0 v19.12.5 v19.12.4 v19.12.3 v19.12.2 v19.12.1 v19.12.0) for legacy_version in "${legacy_versions_array[@]}"; do if [ "${version}" == "${legacy_version}" ]; then legacymode=1 @@ -78,7 +78,7 @@ if [ -z "${wsstartmap}" ]; then fi fi -fn_parms(){ +fn_parms() { fn_reload_startparameters parms="${startparameters}" } diff --git a/lgsm/functions/core_logs.sh b/lgsm/functions/core_logs.sh index b999cb347e..1f0e275400 100755 --- a/lgsm/functions/core_logs.sh +++ b/lgsm/functions/core_logs.sh @@ -16,7 +16,7 @@ fi # For games not displaying a console, and having logs into their game directory. check_status.sh -if [ "${status}" != "0" ]&&[ "${commandname}" == "START" ]&&[ -n "${gamelogfile}" ]; then +if [ "${status}" != "0" ] && [ "${commandname}" == "START" ] && [ -n "${gamelogfile}" ]; then if [ "$(find "${systemdir}" -name "gamelog*.log")" ]; then fn_print_info "Moving game logs to ${gamelogdir}" fn_script_log_info "Moving game logs to ${gamelogdir}" @@ -38,7 +38,14 @@ if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ]; darkrplogdir="${systemdir}/data/darkrp_logs" legacyserverlogdir="${logdir}/server" # Setting up counting variables - scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0" + scriptcount="0" + consolecount="0" + gamecount="0" + srcdscount="0" + smcount="0" + ulxcount="0" + darkrpcount="0" + legacycount="0" fn_sleep_time fn_print_info "Removing logs older than ${logdays} days" fn_script_log_info "Removing logs older than ${logdays} days" @@ -48,7 +55,7 @@ if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ]; scriptcount=$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l) find "${lgsmlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; # SRCDS and unreal logfiles. - if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then + if [ "${engine}" == "unreal2" ] || [ "${engine}" == "source" ]; then find "${gamelogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}" gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}" | wc -l) find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; diff --git a/lgsm/functions/core_messages.sh b/lgsm/functions/core_messages.sh index 463f833c2e..5362dd3d30 100755 --- a/lgsm/functions/core_messages.sh +++ b/lgsm/functions/core_messages.sh @@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # nl: new line: message is following by a new line. # eol: end of line: message is placed at the end of the current line. -fn_ansi_loader(){ +fn_ansi_loader() { if [ "${ansi}" != "off" ]; then # echo colors default="\e[0m" @@ -34,8 +34,8 @@ fn_ansi_loader(){ creeol="\r\033[K" } -fn_sleep_time(){ - if [ "${sleeptime}" != "0" ]||[ "${travistest}" != "1" ]; then +fn_sleep_time() { + if [ "${sleeptime}" != "0" ] || [ "${travistest}" != "1" ]; then if [ -z "${sleeptime}" ]; then sleeptime=0.5 fi @@ -46,7 +46,7 @@ fn_sleep_time(){ # Log display ######################## ## Feb 28 14:56:58 ut99-server: Monitor: -fn_script_log(){ +fn_script_log() { if [ -d "${lgsmlogdir}" ]; then if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ${1}" >> "${lgsmlog}" @@ -57,7 +57,7 @@ fn_script_log(){ } ## Feb 28 14:56:58 ut99-server: Monitor: PASS: -fn_script_log_pass(){ +fn_script_log_pass() { if [ -d "${lgsmlogdir}" ]; then if [ -n "${commandname}" ]; then @@ -70,7 +70,7 @@ fn_script_log_pass(){ } ## Feb 28 14:56:58 ut99-server: Monitor: FATAL: -fn_script_log_fatal(){ +fn_script_log_fatal() { if [ -d "${lgsmlogdir}" ]; then if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: FATAL: ${1}" >> "${lgsmlog}" @@ -82,7 +82,7 @@ fn_script_log_fatal(){ } ## Feb 28 14:56:58 ut99-server: Monitor: ERROR: -fn_script_log_error(){ +fn_script_log_error() { if [ -d "${lgsmlogdir}" ]; then if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ERROR: ${1}" >> "${lgsmlog}" @@ -94,7 +94,7 @@ fn_script_log_error(){ } ## Feb 28 14:56:58 ut99-server: Monitor: WARN: -fn_script_log_warn(){ +fn_script_log_warn() { if [ -d "${lgsmlogdir}" ]; then if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: WARN: ${1}" >> "${lgsmlog}" @@ -106,7 +106,7 @@ fn_script_log_warn(){ } ## Feb 28 14:56:58 ut99-server: Monitor: INFO: -fn_script_log_info(){ +fn_script_log_info() { if [ -d "${lgsmlogdir}" ]; then if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: INFO: ${1}" >> "${lgsmlog}" @@ -117,7 +117,7 @@ fn_script_log_info(){ } ## Feb 28 14:56:58 ut99-server: Monitor: UPDATE: -fn_script_log_update(){ +fn_script_log_update() { if [ -d "${lgsmlogdir}" ]; then if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: UPDATE: ${1}" >> "${lgsmlog}" @@ -131,7 +131,7 @@ fn_script_log_update(){ ################################## # [ .... ] -fn_print_dots(){ +fn_print_dots() { if [ "${commandaction}" ]; then echo -en "${creeol}[ .... ] ${commandaction} ${selfname}: $*" else @@ -140,7 +140,7 @@ fn_print_dots(){ fn_sleep_time } -fn_print_dots_nl(){ +fn_print_dots_nl() { if [ "${commandaction}" ]; then echo -e "${creeol}[ .... ] ${commandaction} ${selfname}: $*" else @@ -151,7 +151,7 @@ fn_print_dots_nl(){ } # [ OK ] -fn_print_ok(){ +fn_print_ok() { if [ "${commandaction}" ]; then echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*" else @@ -160,7 +160,7 @@ fn_print_ok(){ fn_sleep_time } -fn_print_ok_nl(){ +fn_print_ok_nl() { if [ "${commandaction}" ]; then echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*" else @@ -171,7 +171,7 @@ fn_print_ok_nl(){ } # [ FAIL ] -fn_print_fail(){ +fn_print_fail() { if [ "${commandaction}" ]; then echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*" else @@ -180,7 +180,7 @@ fn_print_fail(){ fn_sleep_time } -fn_print_fail_nl(){ +fn_print_fail_nl() { if [ "${commandaction}" ]; then echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*" else @@ -191,7 +191,7 @@ fn_print_fail_nl(){ } # [ ERROR ] -fn_print_error(){ +fn_print_error() { if [ "${commandaction}" ]; then echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*" else @@ -200,7 +200,7 @@ fn_print_error(){ fn_sleep_time } -fn_print_error_nl(){ +fn_print_error_nl() { if [ "${commandaction}" ]; then echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*" else @@ -211,7 +211,7 @@ fn_print_error_nl(){ } # [ WARN ] -fn_print_warn(){ +fn_print_warn() { if [ "${commandaction}" ]; then echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*" else @@ -220,7 +220,7 @@ fn_print_warn(){ fn_sleep_time } -fn_print_warn_nl(){ +fn_print_warn_nl() { if [ "${commandaction}" ]; then echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*" else @@ -231,7 +231,7 @@ fn_print_warn_nl(){ } # [ INFO ] -fn_print_info(){ +fn_print_info() { if [ "${commandaction}" ]; then echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*" else @@ -240,7 +240,7 @@ fn_print_info(){ fn_sleep_time } -fn_print_info_nl(){ +fn_print_info_nl() { if [ "${commandaction}" ]; then echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*" else @@ -251,7 +251,7 @@ fn_print_info_nl(){ } # [ START ] -fn_print_start(){ +fn_print_start() { if [ "${commandaction}" ]; then echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*" else @@ -260,7 +260,7 @@ fn_print_start(){ fn_sleep_time } -fn_print_start_nl(){ +fn_print_start_nl() { if [ "${commandaction}" ]; then echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*" else @@ -275,69 +275,69 @@ fn_print_start_nl(){ # No More Room in Hell Debug # ================================= -fn_print_header(){ +fn_print_header() { echo -e "" echo -e "${lightyellow}${gamename} ${commandaction}${default}" echo -e "=================================${default}" } # Complete! -fn_print_complete(){ +fn_print_complete() { echo -en "${green}Complete!${default} $*" fn_sleep_time } -fn_print_complete_nl(){ +fn_print_complete_nl() { echo -e "${green}Complete!${default} $*" fn_sleep_time } # Failure! -fn_print_failure(){ +fn_print_failure() { echo -en "${red}Failure!${default} $*" fn_sleep_time } -fn_print_failure_nl(){ +fn_print_failure_nl() { echo -e "${red}Failure!${default} $*" fn_sleep_time } # Error! -fn_print_error2(){ +fn_print_error2() { echo -en "${red}Error!${default} $*" fn_sleep_time } -fn_print_error2_nl(){ +fn_print_error2_nl() { echo -e "${red}Error!${default} $*" fn_sleep_time } # Warning! -fn_print_warning(){ +fn_print_warning() { echo -en "${lightyellow}Warning!${default} $*" fn_sleep_time } -fn_print_warning_nl(){ +fn_print_warning_nl() { echo -e "${lightyellow}Warning!${default} $*" fn_sleep_time } # Information! -fn_print_information(){ +fn_print_information() { echo -en "${cyan}Information!${default} $*" fn_sleep_time } -fn_print_information_nl(){ +fn_print_information_nl() { echo -e "${cyan}Information!${default} $*" fn_sleep_time } # Y/N Prompt -fn_prompt_yn(){ +fn_prompt_yn() { local prompt="$1" local initial="$2" @@ -350,23 +350,23 @@ fn_prompt_yn(){ fi while true; do - read -e -i "${initial}" -p "${prompt}" -r yn + read -e -i "${initial}" -p "${prompt}" -r yn case "${yn}" in - [Yy]|[Yy][Ee][Ss]) return 0 ;; - [Nn]|[Nn][Oo]) return 1 ;; - *) echo -e "Please answer yes or no." ;; + [Yy] | [Yy][Ee][Ss]) return 0 ;; + [Nn] | [Nn][Oo]) return 1 ;; + *) echo -e "Please answer yes or no." ;; esac done } # Prompt for message -fn_prompt_message(){ +fn_prompt_message() { while true; do unset prompt local prompt="$1" - read -e -p "${prompt}" -r answer + read -e -p "${prompt}" -r answer if fn_prompt_yn "Continue" Y; then - break; + break fi done echo "${answer}" @@ -376,160 +376,160 @@ fn_prompt_message(){ ################################## # YES -fn_print_yes_eol(){ +fn_print_yes_eol() { echo -en "${cyan}YES${default}" fn_sleep_time } -fn_print_yes_eol_nl(){ +fn_print_yes_eol_nl() { echo -e "${cyan}YES${default}" fn_sleep_time } # NO -fn_print_no_eol(){ +fn_print_no_eol() { echo -en "${red}NO${default}" fn_sleep_time } -fn_print_no_eol_nl(){ +fn_print_no_eol_nl() { echo -e "${red}NO${default}" fn_sleep_time } # OK -fn_print_ok_eol(){ +fn_print_ok_eol() { echo -en "${green}OK${default}" fn_sleep_time } -fn_print_ok_eol_nl(){ +fn_print_ok_eol_nl() { echo -e "${green}OK${default}" fn_sleep_time } # FAIL -fn_print_fail_eol(){ +fn_print_fail_eol() { echo -en "${red}FAIL${default}" fn_sleep_time } -fn_print_fail_eol_nl(){ +fn_print_fail_eol_nl() { echo -e "${red}FAIL${default}" fn_sleep_time } # ERROR -fn_print_error_eol(){ +fn_print_error_eol() { echo -en "${red}ERROR${default}" fn_sleep_time } -fn_print_error_eol_nl(){ +fn_print_error_eol_nl() { echo -e "${red}ERROR${default}" fn_sleep_time } # WAIT -fn_print_wait_eol(){ +fn_print_wait_eol() { echo -en "${cyan}WAIT${default}" fn_sleep_time } -fn_print_wait_eol_nl(){ +fn_print_wait_eol_nl() { echo -e "${cyan}WAIT${default}" fn_sleep_time } # WARN -fn_print_warn_eol(){ +fn_print_warn_eol() { echo -en "${lightyellow}WARN${default}" fn_sleep_time } -fn_print_warn_eol_nl(){ +fn_print_warn_eol_nl() { echo -e "${lightyellow}WARN${default}" fn_sleep_time } # INFO -fn_print_info_eol(){ +fn_print_info_eol() { echo -en "${cyan}INFO${default}" fn_sleep_time } -fn_print_info_eol_nl(){ +fn_print_info_eol_nl() { echo -e "${cyan}INFO${default}" fn_sleep_time } # QUERYING -fn_print_querying_eol(){ +fn_print_querying_eol() { echo -en "${cyan}QUERYING${default}" fn_sleep_time } -fn_print_querying_eol_nl(){ +fn_print_querying_eol_nl() { echo -e "${cyan}QUERYING${default}" fn_sleep_time } # CHECKING -fn_print_checking_eol(){ +fn_print_checking_eol() { echo -en "${cyan}CHECKING${default}" fn_sleep_time } -fn_print_checking_eol_nl(){ +fn_print_checking_eol_nl() { echo -e "${cyan}CHECKING${default}" fn_sleep_time } # DELAY -fn_print_delay_eol(){ +fn_print_delay_eol() { echo -en "${green}DELAY${default}" fn_sleep_time } -fn_print_delay_eol_nl(){ +fn_print_delay_eol_nl() { echo -e "${green}DELAY${default}" fn_sleep_time } # CANCELED -fn_print_canceled_eol(){ +fn_print_canceled_eol() { echo -en "${lightyellow}CANCELED${default}" fn_sleep_time } -fn_print_canceled_eol_nl(){ +fn_print_canceled_eol_nl() { echo -e "${lightyellow}CANCELED${default}" fn_sleep_time } # REMOVED -fn_print_removed_eol(){ +fn_print_removed_eol() { echo -en "${red}REMOVED${default}" fn_sleep_time } -fn_print_removed_eol_nl(){ +fn_print_removed_eol_nl() { echo -e "${red}REMOVED${default}" fn_sleep_time } # UPDATE -fn_print_update_eol(){ +fn_print_update_eol() { echo -en "${cyan}UPDATE${default}" fn_sleep_time } -fn_print_update_eol_nl(){ +fn_print_update_eol_nl() { echo -e "${cyan}UPDATE${default}" fn_sleep_time } -fn_print_ascii_logo(){ +fn_print_ascii_logo() { echo -e "" echo -e " mdMMMMbm" echo -e " mMMMMMMMMMMm" @@ -565,7 +565,7 @@ fn_print_ascii_logo(){ echo -e "" } -fn_print_restart_warning(){ +fn_print_restart_warning() { fn_print_warn "${selfname} will be restarted" fn_script_log_warn "${selfname} will be restarted" totalseconds=3 @@ -584,7 +584,7 @@ fn_print_restart_warning(){ # Useful when a command has to call upon another command causing the other command to overrite commandname variables # Used to remember the command that ran first. -fn_firstcommand_set(){ +fn_firstcommand_set() { if [ -z "${firstcommandname}" ]; then firstcommandname="${commandname}" firstcommandaction="${commandaction}" @@ -592,7 +592,7 @@ fn_firstcommand_set(){ } # Used to reset commandname variables to the command the script ran first. -fn_firstcommand_reset(){ +fn_firstcommand_reset() { commandname="${firstcommandname}" commandaction="${firstcommandaction}" } diff --git a/lgsm/functions/core_steamcmd.sh b/lgsm/functions/core_steamcmd.sh index 5fbd5db9f1..92c14136a2 100755 --- a/lgsm/functions/core_steamcmd.sh +++ b/lgsm/functions/core_steamcmd.sh @@ -7,8 +7,8 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_install_steamcmd(){ - if [ "${shortname}" == "ark" ]&&[ "${installsteamcmd}" == "1" ]; then +fn_install_steamcmd() { + if [ "${shortname}" == "ark" ] && [ "${installsteamcmd}" == "1" ]; then steamcmddir="${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" fi if [ ! -d "${steamcmddir}" ]; then @@ -19,7 +19,7 @@ fn_install_steamcmd(){ chmod +x "${steamcmddir}/steamcmd.sh" } -fn_check_steamcmd_user(){ +fn_check_steamcmd_user() { # Checks if steamuser is setup. if [ "${steamuser}" == "username" ]; then fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}" @@ -39,10 +39,10 @@ fn_check_steamcmd_user(){ fi } -fn_check_steamcmd(){ +fn_check_steamcmd() { # Checks if SteamCMD exists when starting or updating a server. # Only install if steamcmd package is missing or steamcmd dir is missing. - if [ ! -f "${steamcmddir}/steamcmd.sh" ]&&[ -z "$(command -v steamcmd 2>/dev/null)" ]; then + if [ ! -f "${steamcmddir}/steamcmd.sh" ] && [ -z "$(command -v steamcmd 2> /dev/null)" ]; then if [ "${commandname}" == "INSTALL" ]; then fn_install_steamcmd else @@ -56,7 +56,7 @@ fn_check_steamcmd(){ fi } -fn_check_steamcmd_dir(){ +fn_check_steamcmd_dir() { # Worksround that pre-installs the correct steam directories to ensure all packages use the correct Standard. # https://github.com/ValveSoftware/steam-for-linux/issues/6976#issuecomment-610446347 @@ -86,25 +86,25 @@ fn_check_steamcmd_dir(){ fi } -fn_check_steamcmd_dir_legacy(){ +fn_check_steamcmd_dir_legacy() { # Remove old Steam installation directories ~/Steam and ${rootdir}/steamcmd - if [ -d "${rootdir}/steamcmd" ]&&[ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then + if [ -d "${rootdir}/steamcmd" ] && [ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then rm -rf "${rootdir:?}/steamcmd" fi - if [ -d "${HOME}/Steam" ]&&[ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then + if [ -d "${HOME}/Steam" ] && [ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then rm -rf "${HOME}/Steam" fi } -fn_check_steamcmd_steamapp(){ +fn_check_steamcmd_steamapp() { # Check that steamapp directory fixes issue #3481 if [ ! -d "${serverfiles}/steamapps" ]; then mkdir -p "${serverfiles}/steamapps" fi } -fn_check_steamcmd_ark(){ +fn_check_steamcmd_ark() { # Checks if SteamCMD exists in # Engine/Binaries/ThirdParty/SteamCMD/Linux # to allow ark mods to work @@ -123,9 +123,9 @@ fn_check_steamcmd_ark(){ fi } -fn_check_steamcmd_clear(){ +fn_check_steamcmd_clear() { # Will remove steamcmd dir if steamcmd package is installed. - if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${rootdir}/steamcmd" ]; then + if [ "$(command -v steamcmd 2> /dev/null)" ] && [ -d "${rootdir}/steamcmd" ]; then rm -rf "${steamcmddir:?}" exitcode=$? if [ "${exitcode}" != 0 ]; then @@ -136,15 +136,15 @@ fn_check_steamcmd_clear(){ fi } -fn_check_steamcmd_exec(){ - if [ "$(command -v steamcmd 2>/dev/null)" ]; then +fn_check_steamcmd_exec() { + if [ "$(command -v steamcmd 2> /dev/null)" ]; then steamcmdcommand="steamcmd" else steamcmdcommand="./steamcmd.sh" fi } -fn_update_steamcmd_localbuild(){ +fn_update_steamcmd_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" fn_appmanifest_check @@ -157,7 +157,7 @@ fn_update_steamcmd_localbuild(){ fi # Checks if localbuild variable has been set. - if [ -z "${localbuild}" ]||[ "${localbuild}" == "null" ]; then + if [ -z "${localbuild}" ] || [ "${localbuild}" == "null" ]; then fn_print_fail "Checking local build: ${remotelocation}" fn_script_log_fatal "Checking local build" core_exit.sh @@ -167,7 +167,7 @@ fn_update_steamcmd_localbuild(){ fi } -fn_update_steamcmd_remotebuild(){ +fn_update_steamcmd_remotebuild() { # Gets remote build info. if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit @@ -184,7 +184,7 @@ fn_update_steamcmd_remotebuild(){ if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -194,7 +194,7 @@ fn_update_steamcmd_remotebuild(){ fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -202,7 +202,7 @@ fn_update_steamcmd_remotebuild(){ fi } -fn_update_steamcmd_compare(){ +fn_update_steamcmd_compare() { fn_print_dots "Checking for update: ${remotelocation}" if [ "${localbuild}" != "${remotebuild}" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" @@ -280,12 +280,12 @@ fn_update_steamcmd_compare(){ fi } -fn_appmanifest_info(){ +fn_appmanifest_info() { appmanifestfile=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf") appmanifestfilewc=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf" | wc -l) } -fn_appmanifest_check(){ +fn_appmanifest_check() { fn_appmanifest_info # Multiple or no matching appmanifest files may sometimes be present. # This error is corrected if required. diff --git a/lgsm/functions/core_trap.sh b/lgsm/functions/core_trap.sh index a3eaf5675c..ae2b794706 100755 --- a/lgsm/functions/core_trap.sh +++ b/lgsm/functions/core_trap.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_exit_trap(){ +fn_exit_trap() { if [ -z "${exitcode}" ]; then exitcode=$? fi diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh index f9f61162fc..0ed9fdf705 100755 --- a/lgsm/functions/fix.sh +++ b/lgsm/functions/fix.sh @@ -9,19 +9,19 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Messages that are displayed for some fixes. -fn_fix_msg_start(){ +fn_fix_msg_start() { fn_print_dots "Applying ${fixname} fix: ${gamename}" fn_print_info "Applying ${fixname} fix: ${gamename}" fn_script_log_info "Applying ${fixname} fix: ${gamename}" } -fn_fix_msg_start_nl(){ +fn_fix_msg_start_nl() { fn_print_dots "Applying ${fixname} fix: ${gamename}" fn_print_info "Applying ${fixname} fix: ${gamename}" fn_script_log_info "Applying ${fixname} fix: ${gamename}" } -fn_fix_msg_end(){ +fn_fix_msg_end() { if [ $? != 0 ]; then fn_print_error_nl "Applying ${fixname} fix: ${gamename}" fn_script_log_error "Applying ${fixname} fix: ${gamename}" @@ -32,17 +32,19 @@ fn_fix_msg_end(){ } # Fixes that are run on start. -if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then +if [ "${commandname}" != "INSTALL" ] && [ -z "${fixbypass}" ]; then if [ "${appid}" ]; then fix_steamcmd.sh fi - if [ "${shortname}" == "arma3" ]; then + if [ "${shortname}" == "arma3" ]; then fix_arma3.sh elif [ "${shortname}" == "armar" ]; then fix_armar.sh elif [ "${shortname}" == "ark" ]; then fix_ark.sh + elif [ "${shortname}" == "bt" ]; then + fix_bt.sh elif [ "${shortname}" == "bo" ]; then fix_bo.sh elif [ "${shortname}" == "csgo" ]; then @@ -96,32 +98,32 @@ fi # Fixes that are run on install only. if [ "${commandname}" == "INSTALL" ]; then - if [ "${shortname}" == "av" ]||[ "${shortname}" == "cmw" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "lo" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "samp" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then - echo -e "" - echo -e "${lightyellow}Applying Post-Install Fixes${default}" - echo -e "=================================" - fn_sleep_time - postinstall=1 - if [ "${shortname}" == "av" ]; then - fix_av.sh - elif [ "${shortname}" == "kf" ]; then - fix_kf.sh - elif [ "${shortname}" == "kf2" ]; then - fix_kf2.sh - elif [ "${shortname}" == "lo" ]; then - fix_lo.sh - elif [ "${shortname}" == "ro" ]; then - fix_ro.sh - elif [ "${shortname}" == "samp" ]; then - fix_samp.sh - elif [ "${shortname}" == "ut2k4" ]; then - fix_ut2k4.sh - elif [ "${shortname}" == "ut" ]; then - fix_ut.sh - elif [ "${shortname}" == "ut3" ]; then - fix_ut3.sh - else - fn_print_information_nl "No fixes required." - fi + if [ "${shortname}" == "av" ] || [ "${shortname}" == "cmw" ] || [ "${shortname}" == "kf" ] || [ "${shortname}" == "kf2" ] || [ "${shortname}" == "lo" ] || [ "${shortname}" == "onset" ] || [ "${shortname}" == "ro" ] || [ "${shortname}" == "samp" ] || [ "${shortname}" == "ut2k4" ] || [ "${shortname}" == "ut" ] || [ "${shortname}" == "ut3" ]; then + echo -e "" + echo -e "${lightyellow}Applying Post-Install Fixes${default}" + echo -e "=================================" + fn_sleep_time + postinstall=1 + if [ "${shortname}" == "av" ]; then + fix_av.sh + elif [ "${shortname}" == "kf" ]; then + fix_kf.sh + elif [ "${shortname}" == "kf2" ]; then + fix_kf2.sh + elif [ "${shortname}" == "lo" ]; then + fix_lo.sh + elif [ "${shortname}" == "ro" ]; then + fix_ro.sh + elif [ "${shortname}" == "samp" ]; then + fix_samp.sh + elif [ "${shortname}" == "ut2k4" ]; then + fix_ut2k4.sh + elif [ "${shortname}" == "ut" ]; then + fix_ut.sh + elif [ "${shortname}" == "ut3" ]; then + fix_ut3.sh + else + fn_print_information_nl "No fixes required." fi + fi fi diff --git a/lgsm/functions/fix_ark.sh b/lgsm/functions/fix_ark.sh index da0097cabd..f8e0447e3e 100755 --- a/lgsm/functions/fix_ark.sh +++ b/lgsm/functions/fix_ark.sh @@ -19,7 +19,11 @@ elif [ "${steamappsfilewc}" -eq "1" ]; then # This allows LinxuGSM to select either ~/.steam or ~/Steam. depending on what is being used steamappsfile=$(find "${HOME}" -name appworkshop_346110.acf) steamappsdir=$(dirname "${steamappsfile}") - steamappspath=$(cd "${steamappsdir}" || return; cd ../;pwd) + steamappspath=$( + cd "${steamappsdir}" || return + cd ../ + pwd + ) # removes the symlink if exists. # fixes issue with older versions of LinuxGSM linking to /home/arkserver/steamcmd @@ -41,7 +45,7 @@ elif [ "${steamappsfilewc}" -eq "1" ]; then fi # if the steamapps symlink is incorrect unlink it. - if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]&&[ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]&&[ "$(readlink "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps")" != "${steamappspath}" ]; then + if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ] && [ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ] && [ "$(readlink "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps")" != "${steamappspath}" ]; then fixname="incorrect steamapps symlink" fn_fix_msg_start unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" diff --git a/lgsm/functions/fix_arma3.sh b/lgsm/functions/fix_arma3.sh index bdd85af715..bbf14c9d20 100755 --- a/lgsm/functions/fix_arma3.sh +++ b/lgsm/functions/fix_arma3.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: 20150 Segmentation fault (core dumped) error. -if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3" ]||[ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3 - Other Profiles" ]; then +if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3" ] || [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3 - Other Profiles" ]; then fixname="20150 Segmentation fault (core dumped)" fn_fix_msg_start mkdir -p "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3 - Other Profiles" diff --git a/lgsm/functions/fix_bt.sh b/lgsm/functions/fix_bt.sh new file mode 100755 index 0000000000..094c2617c4 --- /dev/null +++ b/lgsm/functions/fix_bt.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# LinuxGSM fix_bt.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Resolves an issue with Barotrauma. + +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +# Fixes: Missing user data directory error. +if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Daedalic Entertainment GmbH/Barotrauma" ]; then + fixname="Missing user data directory error." + fn_fix_msg_start + mkdir -p "${XDG_DATA_HOME:="${HOME}/.local/share"}/Daedalic Entertainment GmbH/Barotrauma" + fn_fix_msg_end +fi diff --git a/lgsm/functions/fix_csgo.sh b/lgsm/functions/fix_csgo.sh index be59c42ecb..a393f2fd9c 100755 --- a/lgsm/functions/fix_csgo.sh +++ b/lgsm/functions/fix_csgo.sh @@ -31,3 +31,12 @@ if [ -f "${servercfgdir}/valve.rc" ] && grep -E '^\s*exec\s*(default|joystick)\. sed -i 's/^\s*exec\s*joystick.cfg/\/\/exec joystick.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1 fn_fix_msg_end fi + +# Fixes: Detected engine 11 but could not load: /home/csgo/serverfiles/bin/libgcc_s.so.1: version `GCC_7.0.0' not found (required by /lib/i386-linux-gnu/libstdc++.so.6) +libgccc_so="${serverfiles}/bin/libgcc_s.so.1" +if [ -f "${libgccc_so}" ]; then + fixname="libgcc_s.so.1 move away" + fn_fix_msg_start + mv -v "${libgccc_so}" "${libgccc_so}.bck" + fn_fix_msg_end +fi diff --git a/lgsm/functions/fix_dst.sh b/lgsm/functions/fix_dst.sh index 49fce22e32..e30507dc9e 100755 --- a/lgsm/functions/fix_dst.sh +++ b/lgsm/functions/fix_dst.sh @@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer). # Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS. -if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" ]; then +if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" ]; then fixname="libcurl-gnutls.so.4" fn_fix_msg_start ln -s "/usr/lib/libcurl.so.4" "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" diff --git a/lgsm/functions/fix_lo.sh b/lgsm/functions/fix_lo.sh index 466d6abd07..b868a55b4c 100644 --- a/lgsm/functions/fix_lo.sh +++ b/lgsm/functions/fix_lo.sh @@ -8,10 +8,10 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" local APPID_FILE=${executabledir}/steam_appid.txt if [ ! -f "${APPID_FILE}" ]; then - fn_print_information "adding ${APPID_FILE} to ${gamename} server." - fn_sleep_time - echo "903950" > "${APPID_FILE}" + fn_print_information "adding ${APPID_FILE} to ${gamename} server." + fn_sleep_time + echo "903950" > "${APPID_FILE}" else - fn_print_information "${APPID_FILE} already exists. No action to be taken." - fn_sleep_time + fn_print_information "${APPID_FILE} already exists. No action to be taken." + fn_sleep_time fi diff --git a/lgsm/functions/fix_onset.sh b/lgsm/functions/fix_onset.sh index c444c1ae99..e4183999df 100755 --- a/lgsm/functions/fix_onset.sh +++ b/lgsm/functions/fix_onset.sh @@ -11,7 +11,7 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" # Fixes: Failed loading "mariadb": libmariadbclient.so.18: cannot open shared object file: No such file or directory # Issue only occures on CentOS as libmariadbclient.so.18 is called libmariadb.so.3 on CentOS. -if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/libmariadbclient.so.18" ]&&[ -f "/usr/lib64/libmariadb.so.3" ]; then +if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/libmariadbclient.so.18" ] && [ -f "/usr/lib64/libmariadb.so.3" ]; then fixname="libmariadbclient.so.18" fn_fix_msg_start ln -s "/usr/lib64/libmariadb.so.3" "${serverfiles}/libmariadbclient.so.18" diff --git a/lgsm/functions/fix_samp.sh b/lgsm/functions/fix_samp.sh index 7a62bd4d19..a88bf154f6 100644 --- a/lgsm/functions/fix_samp.sh +++ b/lgsm/functions/fix_samp.sh @@ -9,14 +9,14 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ -f "${servercfgfullpath}" ]; then # check if default password is set "changeme" - currentpass=$(grep -E "^rcon_password" "${servercfgfullpath}" | sed 's/^rcon_password //' ) + currentpass=$(grep -E "^rcon_password" "${servercfgfullpath}" | sed 's/^rcon_password //') defaultpass="changeme" # check if default password is set if [ "${currentpass}" == "${defaultpass}" ]; then fixname="change default rcon password" fn_fix_msg_start fn_script_log_info "changing rcon/admin password." - random=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs) + random=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs) rconpass="admin${random}" sed -i "s/rcon_password changeme/rcon_password ${rconpass}/g" "${servercfgfullpath}" fn_fix_msg_end diff --git a/lgsm/functions/fix_squad.sh b/lgsm/functions/fix_squad.sh index b1ba1fde2d..7d5929b5df 100644 --- a/lgsm/functions/fix_squad.sh +++ b/lgsm/functions/fix_squad.sh @@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # As the server base dir changed for the game, we need to migrate the default config from the old to the new location oldservercfg="${serverfiles}/Squad/ServerConfig/${servercfg}" -if [ -f "${oldservercfg}" ]&&[ -f "${servercfgfullpath}" ]; then +if [ -f "${oldservercfg}" ] && [ -f "${servercfgfullpath}" ]; then # diff old and new config - if it is different move the old config over the new one if [ "$(diff -c "${oldservercfg}" "${servercfgfullpath}" | wc -l)" -gt 0 ]; then fixname="Migrate server config to new Game folder" diff --git a/lgsm/functions/fix_steamcmd.sh b/lgsm/functions/fix_steamcmd.sh index abac31cfb4..0162a6495c 100755 --- a/lgsm/functions/fix_steamcmd.sh +++ b/lgsm/functions/fix_steamcmd.sh @@ -10,7 +10,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # function to simplify the steamclient.so fix # example # fn_fix_steamclient_so 32|64 (bit) "${serverfiles}/linux32/" -fn_fix_steamclient_so(){ +fn_fix_steamclient_so() { # $1 type of fix 32 or 64 as possible values # $2 as destination where the lib will be copied to if [ "$1" == "32" ]; then @@ -132,7 +132,7 @@ elif [ "${shortname}" == "pvr" ]; then fn_fix_steamclient_so "64" "${executabledir}" elif [ "${shortname}" == "ss3" ]; then fn_fix_steamclient_so "32" "${serverfiles}/Bin" -elif [ "${shortname}" == "tu" ];then +elif [ "${shortname}" == "tu" ]; then fn_fix_steamclient_so "64" "${executabledir}" elif [ "${shortname}" == "unt" ]; then fn_fix_steamclient_so "64" "${serverfiles}" diff --git a/lgsm/functions/fix_tf2.sh b/lgsm/functions/fix_tf2.sh index 27b35a0d27..77e41a9698 100755 --- a/lgsm/functions/fix_tf2.sh +++ b/lgsm/functions/fix_tf2.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: Team Fortress 2 Segmentation fault for Red-Hat Distros #2062. -if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/bin/libcurl-gnutls.so.4" ]; then +if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/bin/libcurl-gnutls.so.4" ]; then fixname="libcurl-gnutls.so.4" fn_fix_msg_start ln -s "/usr/lib/libcurl.so.4" "${serverfiles}/bin/libcurl-gnutls.so.4" diff --git a/lgsm/functions/fix_ts3.sh b/lgsm/functions/fix_ts3.sh index 021f037640..7c7387cb60 100755 --- a/lgsm/functions/fix_ts3.sh +++ b/lgsm/functions/fix_ts3.sh @@ -17,9 +17,9 @@ fi # Fixes: failed to register local accounting service: No such file or directory. accountingfile="/dev/shm/7gbhujb54g8z9hu43jre8" -if [ -f "${accountingfile}" ]&&[ "${status}" == "0" ]; then +if [ -f "${accountingfile}" ] && [ "${status}" == "0" ]; then # Check permissions for the file if the current user owns it, if not exit. - if [ "$( stat -c %U ${accountingfile})" == "$(whoami)" ]; then + if [ "$(stat -c %U ${accountingfile})" == "$(whoami)" ]; then fixname="Delete file ${accountingfile}" fn_fix_msg_start rm -f "${accountingfile}" diff --git a/lgsm/functions/fix_vh.sh b/lgsm/functions/fix_vh.sh index 7d60916a44..ab02188737 100755 --- a/lgsm/functions/fix_vh.sh +++ b/lgsm/functions/fix_vh.sh @@ -12,10 +12,8 @@ export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH modsdir="${lgsmdir}/mods" modsinstalledlistfullpath="${modsdir}/installed-mods.txt" if [ -f "${modsinstalledlistfullpath}" ]; then - if grep -qE "^valheimplus" "${modsinstalledlistfullpath}" - then - if ! grep -qE "^executable=\"./start_server_bepinex.sh\"" "${configdirserver}/${selfname}.cfg" - then + if grep -qE "^valheimplus" "${modsinstalledlistfullpath}"; then + if ! grep -qE "^executable=\"./start_server_bepinex.sh\"" "${configdirserver}/${selfname}.cfg"; then echo 'executable="./start_server_bepinex.sh"' >> "${configdirserver}/${selfname}.cfg" executable="./start_server_bepinex.sh" fi diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index f747b0d1b5..f29e621d50 100755 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -30,9 +30,9 @@ kernel="$(uname -r)" # Distro Codename - xenial # Gathers distro info from various sources filling in missing gaps. -distro_info_array=( os-release lsb_release hostnamectl debian_version redhat-release ) +distro_info_array=(os-release lsb_release hostnamectl debian_version redhat-release) for distro_info in "${distro_info_array[@]}"; do - if [ -f "/etc/os-release" ]&&[ "${distro_info}" == "os-release" ]; then + if [ -f "/etc/os-release" ] && [ "${distro_info}" == "os-release" ]; then distroname="$(grep "PRETTY_NAME" /etc/os-release | awk -F\= '{gsub(/"/,"",$2);print $2}')" distroversion="$(grep "VERSION_ID" /etc/os-release | awk -F\= '{gsub(/"/,"",$2);print $2}')" # Special var for rhel like distros to removed point in number e.g 8.4 to just 8. @@ -40,8 +40,8 @@ for distro_info in "${distro_info_array[@]}"; do distroid="$(grep "ID=" /etc/os-release | grep -v _ID | awk -F\= '{gsub(/"/,"",$2);print $2}')" distroidlike="$(grep "ID_LIKE=" /etc/os-release | grep -v _ID | awk -F\= '{gsub(/"/,"",$2);print $2}')" distrocodename="$(grep "VERSION_CODENAME" /etc/os-release | awk -F\= '{gsub(/"/,"",$2);print $2}')" - elif [ "$(command -v lsb_release 2>/dev/null)" ]&&[ "${distro_info}" == "lsb_release" ]; then - if [ -z "${distroname}" ];then + elif [ "$(command -v lsb_release 2> /dev/null)" ] && [ "${distro_info}" == "lsb_release" ]; then + if [ -z "${distroname}" ]; then distroname="$(lsb_release -sd)" elif [ -z "${distroversion}" ]; then distroversion="$(lsb_release -sr)" @@ -50,11 +50,11 @@ for distro_info in "${distro_info_array[@]}"; do elif [ -z "${distrocodename}" ]; then distrocodename="$(lsb_release -sc)" fi - elif [ "$(command -v hostnamectl 2>/dev/null)" ]&&[ "${distro_info}" == "hostnamectl" ]; then - if [ -z "${distroname}" ];then + elif [ "$(command -v hostnamectl 2> /dev/null)" ] && [ "${distro_info}" == "hostnamectl" ]; then + if [ -z "${distroname}" ]; then distroname="$(hostnamectl | grep "Operating System" | sed 's/Operating System: //g')" fi - elif [ -f "/etc/debian_version" ]&&[ "${distro_info}" == "debian_version" ]; then + elif [ -f "/etc/debian_version" ] && [ "${distro_info}" == "debian_version" ]; then if [ -z "${distroname}" ]; then distroname="Debian $(cat /etc/debian_version)" elif [ -z "${distroversion}" ]; then @@ -62,7 +62,7 @@ for distro_info in "${distro_info_array[@]}"; do elif [ -z "${distroid}" ]; then distroid="debian" fi - elif [ -f "/etc/redhat-release" ]&&[ "${distro_info}" == "redhat-release" ]; then + elif [ -f "/etc/redhat-release" ] && [ "${distro_info}" == "redhat-release" ]; then if [ -z "${distroname}" ]; then distroname="$(cat /etc/redhat-release)" elif [ -z "${distroversion}" ]; then @@ -74,16 +74,16 @@ for distro_info in "${distro_info_array[@]}"; do done # some RHEL based distros use 8.4 instead of just 8. -if [[ "${distroidlike}" == *"rhel"* ]]||[ "${distroid}" == "rhel" ]; then +if [[ "${distroidlike}" == *"rhel"* ]] || [ "${distroid}" == "rhel" ]; then distroversioncsv="${distroversionrh}" else distroversioncsv="${distroversion}" fi # Check if distro supported by distro vendor. -if [ "$(command -v distro-info 2>/dev/null)" ]; then +if [ "$(command -v distro-info 2> /dev/null)" ]; then distrosunsupported="$(distro-info --unsupported)" - distrosunsupported_array=( "${distrosunsupported}" ) + distrosunsupported_array=("${distrosunsupported}") for distrounsupported in "${distrosunsupported_array[@]}"; do if [ "${distrounsupported}" == "${distrocodename}" ]; then distrosupport=unsupported @@ -102,7 +102,7 @@ glibcversion="$(ldd --version | sed -n '1s/.* //p')" ## tmux version # e.g: tmux 1.6 -if [ ! "$(command -V tmux 2>/dev/null)" ]; then +if [ ! "$(command -V tmux 2> /dev/null)" ]; then tmuxv="${red}NOT INSTALLED!${default}" tmuxvdigit="0" else @@ -114,25 +114,25 @@ else fi fi -if [ "$(command -V java 2>/dev/null)" ]; then +if [ "$(command -V java 2> /dev/null)" ]; then javaversion="$(java -version 2>&1 | grep "version")" fi -if [ "$(command -v mono 2>/dev/null)" ]; then +if [ "$(command -v mono 2> /dev/null)" ]; then monoversion="$(mono --version 2>&1 | grep -Po '(?<=version )\d')" fi ## Uptime -uptime="$(/dev/null)" ]; then +if [ "$(command -v numfmt 2> /dev/null)" ]; then # Issue #2005 - Kernel 3.14+ contains MemAvailable which should be used. All others will be calculated. # get the raw KB values of these fields. @@ -162,31 +162,34 @@ if [ "$(command -v numfmt 2>/dev/null)" ]; then if grep -q ^MemAvailable /proc/meminfo; then physmemactualfreekb="$(grep ^MemAvailable /proc/meminfo | awk '{print $2}')" else - physmemactualfreekb="$((physmemfreekb+physmembufferskb+physmemcachedkb))" + physmemactualfreekb="$((physmemfreekb + physmembufferskb + physmemcachedkb))" fi # Available RAM and swap. - physmemtotalmb="$((physmemtotalkb/1024))" + physmemtotalmb="$((physmemtotalkb / 1024))" physmemtotal="$(numfmt --to=iec --from=iec --suffix=B "${physmemtotalkb}K")" physmemfree="$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")" - physmemused="$(numfmt --to=iec --from=iec --suffix=B "$((physmemtotalkb-physmemfreekb-physmembufferskb-physmemcachedkb-physmemreclaimablekb))K")" + physmemused="$(numfmt --to=iec --from=iec --suffix=B "$((physmemtotalkb - physmemfreekb - physmembufferskb - physmemcachedkb - physmemreclaimablekb))K")" physmemavailable="$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")" - physmemcached="$(numfmt --to=iec --from=iec --suffix=B "$((physmemcachedkb+physmemreclaimablekb))K")" + physmemcached="$(numfmt --to=iec --from=iec --suffix=B "$((physmemcachedkb + physmemreclaimablekb))K")" swaptotal="$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapTotal /proc/meminfo | awk '{print $2}')K")" swapfree="$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapFree /proc/meminfo | awk '{print $2}')K")" - swapused="$(numfmt --to=iec --from=iec --suffix=B "$(($(grep ^SwapTotal /proc/meminfo | awk '{print $2}')-$(grep ^SwapFree /proc/meminfo | awk '{print $2}')))K")" + swapused="$(numfmt --to=iec --from=iec --suffix=B "$(($(grep ^SwapTotal /proc/meminfo | awk '{print $2}') - $(grep ^SwapFree /proc/meminfo | awk '{print $2}')))K")" # RAM usage of the game server pid # MB if [ "${gameserverpid}" ]; then - memused="$(ps --forest -o rss -g "${gameserverpid}" | awk '{s+=$1} END {print s}'| awk '{$1/=1024;printf "%.0f",$1}{print $2}')" - # % + memused="$(ps --forest -o rss -g "${gameserverpid}" | awk '{s+=$1} END {print s}' | awk '{$1/=1024;printf "%.0f",$1}{print $2}')" + # % pmemused="$(ps --forest -o %mem -g "${gameserverpid}" | awk '{s+=$1} END {print s}')" fi else # Older distros will need to use free. # Older versions of free do not support -h option. - if [ "$(free -h > /dev/null 2>&1; echo $?)" -ne "0" ]; then + if [ "$( + free -h > /dev/null 2>&1 + echo $? + )" -ne "0" ]; then humanreadable="-m" else humanreadable="-h" @@ -257,7 +260,7 @@ if [ -d "${backupdir}" ]; then # date of most recent backup. lastbackupdate="$(date -r "${lastbackup}")" # no of days since last backup. - lastbackupdaysago="$(( ( $(date +'%s') - $(date -r "${lastbackup}" +'%s') )/60/60/24 ))" + lastbackupdaysago="$((($(date +'%s') - $(date -r "${lastbackup}" +'%s')) / 60 / 60 / 24))" # size of most recent backup. lastbackupsize="$(du -h "${lastbackup}" | awk '{print $1}')" fi @@ -265,11 +268,11 @@ fi # Network Interface name netint=$(${ipcommand} -o addr | grep "${ip}" | awk '{print $2}') -netlink=$(${ethtoolcommand} "${netint}" 2>/dev/null| grep Speed | awk '{print $2}') +netlink=$(${ethtoolcommand} "${netint}" 2> /dev/null | grep Speed | awk '{print $2}') # Sets the SteamCMD glibc requirement if the game server requirement is less or not required. if [ "${appid}" ]; then - if [ "${glibc}" = "null" ]||[ -z "${glibc}" ]||[ "$(printf '%s\n'${glibc}'\n' "2.14" | sort -V | head -n 1)" != "2.14" ]; then + if [ "${glibc}" = "null" ] || [ -z "${glibc}" ] || [ "$(printf '%s\n'${glibc}'\n' "2.14" | sort -V | head -n 1)" != "2.14" ]; then glibc="2.14" fi fi diff --git a/lgsm/functions/info_game.sh b/lgsm/functions/info_game.sh index 88c27b4c9a..dcec74b31d 100644 --- a/lgsm/functions/info_game.sh +++ b/lgsm/functions/info_game.sh @@ -14,7 +14,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # grep -v "foo" filter out lines that contain foo # cut -f1 -d "/" remove everything after / -fn_info_game_ac(){ +fn_info_game_ac() { # Config if [ ! -f "${servercfgfullpath}" ]; then httpport="${zero}" @@ -26,7 +26,7 @@ fn_info_game_ac(){ httpport=$(grep "HTTP_PORT" "${servercfgfullpath}" | tr -cd '[:digit:]') port=$(grep "TCP_PORT" "${servercfgfullpath}" | tr -cd '[:digit:]') queryport="${httpport}" - servername=$(grep "NAME" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/NAME//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| head -n 1) + servername=$(grep "NAME" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/NAME//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | head -n 1) adminpassword=$(grep "ADMIN_PASSWORD" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/ADMIN_PASSWORD//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') # Not set @@ -39,7 +39,7 @@ fn_info_game_ac(){ fi } -fn_info_game_ark(){ +fn_info_game_ark() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -60,11 +60,11 @@ fn_info_game_ark(){ port=${port:-"0"} queryport=${queryport:-"0"} rconport=${rconport:-"0"} - rawport=$((port+1)) + rawport=$((port + 1)) maxplayers=${maxplayers:-"0"} } -fn_info_game_arma3(){ +fn_info_game_arma3() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -87,13 +87,13 @@ fn_info_game_arma3(){ # Parameters port=${port:-"2302"} voiceport=${port:-"2302"} - queryport=$((port+1)) - steammasterport=$((port+2)) - voiceunusedport=$((port+3)) - battleeyeport=$((port+4)) + queryport=$((port + 1)) + steammasterport=$((port + 2)) + voiceunusedport=$((port + 3)) + battleeyeport=$((port + 4)) } -fn_info_game_armar(){ +fn_info_game_armar() { if [ -f "${servercfgfullpath}" ]; then adminpassword=$(jq -r '.adminPassword' "${servercfgfullpath}") configip=$(jq -r '.gameHostBindAddress' "${servercfgfullpath}") @@ -104,7 +104,6 @@ fn_info_game_armar(){ serverpassword=$(jq -r '.game.password' "${servercfgfullpath}") battleeyeport=1376 - # Not set adminpassword=${adminpassword:-"NOT SET"} configip=${configip:-"0.0.0.0"} @@ -138,9 +137,9 @@ fn_info_game_av() { servername=$(grep "name=" "${servercfgfullpath}" | sed 's/name=//') serverpassword=$(grep "password=" "${servercfgfullpath}" | sed 's/password=//') port=$(grep "port=" "${servercfgfullpath}" | sed 's/port=//') - queryport=$((port+3)) - steamqueryport=$((port+20)) - steammasterport=$((port+21)) + queryport=$((port + 3)) + steamqueryport=$((port + 20)) + steammasterport=$((port + 21)) rconport=$(grep "rconPort=" "${servercfgfullpath}" | sed 's/rconPort=//') rconpassword=$(grep "rconPassword=" "${servercfgfullpath}" | sed 's/rconPassword=//') @@ -162,7 +161,7 @@ fn_info_game_av() { fi } -fn_info_game_bf1942(){ +fn_info_game_bf1942() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -188,7 +187,7 @@ fn_info_game_bf1942(){ fi } -fn_info_game_bfv(){ +fn_info_game_bfv() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -214,7 +213,7 @@ fn_info_game_bfv(){ fi } -fn_info_game_bo(){ +fn_info_game_bo() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -226,7 +225,7 @@ fn_info_game_bo(){ servername=$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') serverpassword=$(grep "Password=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') port=$(grep "ServerPort=" "${servercfgfullpath}" | tr -cd '[:digit:]') - queryport=$((port+1)) + queryport=$((port + 1)) maxplayers=$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]') # Not set @@ -238,7 +237,7 @@ fn_info_game_bo(){ fi } -fn_info_game_bt(){ +fn_info_game_bt() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -247,7 +246,7 @@ fn_info_game_bt(){ queryport="${zero}" maxplayers="${unavailable}" else - servername=$(grep -Po 'name="\K.*(?=")' "${servercfgfullpath}") # Assuming GNU grep is used + servername=$(grep -Po 'name="\K.*(?=")' "${servercfgfullpath}") # Assuming GNU grep is used serverpassword=$(grep -Po 'password="\K.*(?=")' "${servercfgfullpath}") # Assuming GNU grep is used port=$(grep " port=" "${servercfgfullpath}" | tr -cd '[:digit:]') queryport=$(grep "queryport=" "${servercfgfullpath}" | tr -cd '[:digit:]') @@ -262,7 +261,7 @@ fn_info_game_bt(){ fi } -fn_info_game_bt1944(){ +fn_info_game_bt1944() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -282,10 +281,10 @@ fn_info_game_bt1944(){ # Parameters port=${port:-"0"} queryport=${queryport:-"0"} - rconport=$((port+2)) + rconport=$((port + 2)) } -fn_info_game_cd(){ +fn_info_game_cd() { if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" port="${zero}" @@ -305,7 +304,7 @@ fn_info_game_cd(){ fi } -fn_info_game_cmw(){ +fn_info_game_cmw() { # Config if [ ! -f "${servercfgfullpath}" ]; then adminpassword="${unavailable}" @@ -332,7 +331,7 @@ fn_info_game_cmw(){ queryport=${queryport:-"0"} } -fn_info_game_cod(){ +fn_info_game_cod() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -352,7 +351,7 @@ fn_info_game_cod(){ port=${port:-"0"} } -fn_info_game_coduo(){ +fn_info_game_coduo() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -373,9 +372,7 @@ fn_info_game_coduo(){ queryport=${port:-"28960"} } - - -fn_info_game_cod2(){ +fn_info_game_cod2() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -396,7 +393,7 @@ fn_info_game_cod2(){ queryport=${port:-"28960"} } -fn_info_game_cod4(){ +fn_info_game_cod4() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -419,7 +416,7 @@ fn_info_game_cod4(){ queryport=${port:-"28960"} } -fn_info_game_codwaw(){ +fn_info_game_codwaw() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -440,7 +437,7 @@ fn_info_game_codwaw(){ queryport=${port:-"28960"} } -fn_info_game_col(){ +fn_info_game_col() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -472,7 +469,7 @@ fn_info_game_col(){ fi } -fn_info_game_dodr(){ +fn_info_game_dodr() { # Config if [ ! -f "${servercfgfullpath}" ]; then maxplayers="${zero}" @@ -489,7 +486,7 @@ fn_info_game_dodr(){ queryport=${queryport:-"27015"} } -fn_info_game_dayz(){ +fn_info_game_dayz() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -513,11 +510,11 @@ fn_info_game_dayz(){ # Parameters port=${port:-"2302"} - steammasterport=$((port+2)) - battleeyeport=$((port+4)) + steammasterport=$((port + 2)) + battleeyeport=$((port + 4)) } -fn_info_game_dst(){ +fn_info_game_dst() { # Config if [ ! -f "${clustercfgfullpath}" ]; then servername="${unavailable}" @@ -568,7 +565,7 @@ fn_info_game_dst(){ cave=${cave:-"NOT SET"} } -fn_info_game_eco(){ +fn_info_game_eco() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -597,7 +594,7 @@ fn_info_game_eco(){ fi } -fn_info_game_etl(){ +fn_info_game_etl() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -626,7 +623,7 @@ fn_info_game_etl(){ fi } -fn_info_game_fctr(){ +fn_info_game_fctr() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="Factorio Server" @@ -656,9 +653,15 @@ fn_info_game_fctr(){ port=${port:-"0"} rconport=${rconport:-"0"} rconpassword=${rconpassword:-"NOT SET"} + + # get server version if installed + local factoriobin="${executabledir}${executable:1}" + if [ -f "${factoriobin}" ]; then + serverversion=$(${factoriobin} --version | grep "Version:" | awk '{print $2}') + fi } -fn_info_game_jc2(){ +fn_info_game_jc2() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -687,7 +690,7 @@ fn_info_game_jc2(){ fi } -fn_info_game_hw(){ +fn_info_game_hw() { # Parameters servername=${servername:-"NOT SET"} port=${port:-"0"} @@ -697,7 +700,7 @@ fn_info_game_hw(){ creativemode=${creativemode:-"NOT SET"} } -fn_info_game_inss(){ +fn_info_game_inss() { # Parameters port=${port:-"0"} queryport=${queryport:-"0"} @@ -709,7 +712,7 @@ fn_info_game_inss(){ maxplayers=${maxplayers:-"0"} } -fn_info_game_jc3(){ +fn_info_game_jc3() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -747,7 +750,7 @@ fn_info_game_jc3(){ fi } -fn_info_game_jk2(){ +fn_info_game_jk2() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -776,7 +779,7 @@ fn_info_game_jk2(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_kf(){ +fn_info_game_kf() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -797,7 +800,7 @@ fn_info_game_kf(){ serverpassword=$(sed -nr 's/^GamePassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') adminpassword=$(sed -nr 's/^AdminPassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') port=$(sed -nr 's/^Port=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]') - queryport=$((port+1)) + queryport=$((port + 1)) queryportgs=$(sed -nr 's/^OldQueryPortNumber=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]') steamport="20560" steammasterport="28852" @@ -827,7 +830,7 @@ fn_info_game_kf(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_kf2(){ +fn_info_game_kf2() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -865,7 +868,7 @@ fn_info_game_kf2(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_lo(){ +fn_info_game_lo() { # Parameters servername=${servername:-"NOT SET"} port=${port:-"0"} @@ -873,7 +876,7 @@ fn_info_game_lo(){ maxplayers=${slots:-"0"} } -fn_info_game_mc(){ +fn_info_game_mc() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -914,7 +917,7 @@ fn_info_game_mc(){ fi } -fn_info_game_mcb(){ +fn_info_game_mcb() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -944,7 +947,7 @@ fn_info_game_mcb(){ fi } -fn_info_game_mh(){ +fn_info_game_mh() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -970,7 +973,7 @@ fn_info_game_mh(){ beaconport=${beaconport:-"0"} } -fn_info_game_mohaa(){ +fn_info_game_mohaa() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -996,7 +999,7 @@ fn_info_game_mohaa(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_mom(){ +fn_info_game_mom() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1021,7 +1024,7 @@ fn_info_game_mom(){ beaconport=${queryport:-"15000"} } -fn_info_game_mta(){ +fn_info_game_mta() { # Config if [ ! -f "${servercfgfullpath}" ]; then port=${zero} @@ -1033,7 +1036,7 @@ fn_info_game_mta(){ maxplayers="${zero}" else port=$(grep -m 1 "serverport" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]') - queryport=$((port+123)) + queryport=$((port + 123)) httpport=$(grep -m 1 "httpport" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]') servername=$(grep -m 1 "servername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<") serverpassword=$(grep -m 1 "password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<") @@ -1057,7 +1060,7 @@ fn_info_game_mta(){ } -fn_info_game_mumble(){ +fn_info_game_mumble() { # Config if [ ! -f "${servercfgfullpath}" ]; then port="64738" @@ -1076,7 +1079,7 @@ fn_info_game_mumble(){ fi } -fn_info_game_onset(){ +fn_info_game_onset() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1085,11 +1088,11 @@ fn_info_game_onset(){ httpport="${zero}" queryport="${zero}" else - servername=$(grep -v "servername_short" "${servercfgfullpath}" | grep "servername" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/servername//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' ) + servername=$(grep -v "servername_short" "${servercfgfullpath}" | grep "servername" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/servername//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') maxplayers=$(grep "maxplayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') port=$(grep "port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') - httpport=$((port-2)) - queryport=$((port-1)) + httpport=$((port - 2)) + queryport=$((port - 1)) # Not set servername=${servername:-"NOT SET"} @@ -1100,7 +1103,7 @@ fn_info_game_onset(){ fi } -fn_info_game_pc(){ +fn_info_game_pc() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1127,7 +1130,7 @@ fn_info_game_pc(){ fi } -fn_info_game_pc2(){ +fn_info_game_pc2() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1154,7 +1157,7 @@ fn_info_game_pc2(){ fi } -fn_info_game_pstbs(){ +fn_info_game_pstbs() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1180,7 +1183,7 @@ fn_info_game_pstbs(){ # Not set rconport=${rconport:-"0"} - if [ -z "${rconpassword}" ]||[ ${#rconpassword} == 1 ]; then + if [ -z "${rconpassword}" ] || [ ${#rconpassword} == 1 ]; then rconpassword="NOT SET" fi fi @@ -1196,7 +1199,7 @@ fn_info_game_pstbs(){ reservedslots=${reservedslots:-"0"} } -fn_info_game_pvr(){ +fn_info_game_pvr() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1212,11 +1215,11 @@ fn_info_game_pvr(){ # Parameters port=${port:-"0"} - port401=$((port+400)) + port401=$((port + 400)) queryport=${port:-"0"} } -fn_info_game_pz(){ +fn_info_game_pz() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1228,7 +1231,7 @@ fn_info_game_pz(){ gameworld="${unavailable}" else servername=$(grep "PublicName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/PublicName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') - serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Password" | sed -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Password" | sed -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') rconpassword=$(grep "RCONPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/RCONPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') maxplayers=$(grep "MaxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') port=$(grep "DefaultPort" "${servercfgfullpath}" | tr -cd '[:digit:]') @@ -1250,7 +1253,7 @@ fn_info_game_pz(){ } -fn_info_game_q2(){ +fn_info_game_q2() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -1273,7 +1276,7 @@ fn_info_game_q2(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_q3(){ +fn_info_game_q3() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -1299,7 +1302,7 @@ fn_info_game_q3(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_ql(){ +fn_info_game_ql() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -1334,7 +1337,7 @@ fn_info_game_ql(){ fi } -fn_info_game_qw(){ +fn_info_game_qw() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -1358,7 +1361,7 @@ fn_info_game_qw(){ queryport=${port} } -fn_info_game_ro(){ +fn_info_game_ro() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1378,7 +1381,7 @@ fn_info_game_ro(){ serverpassword=$(sed -nr 's/^GamePassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') adminpassword=$(sed -nr 's/^AdminPassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') port=$(sed -nr 's/^Port=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]') - queryport=$((port+1)) + queryport=$((port + 1)) steamport="20610" steammasterport="28902" lanport=$(grep "LANServerPort=" "${servercfgfullpath}" | tr -cd '[:digit:]') @@ -1406,7 +1409,7 @@ fn_info_game_ro(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_rtcw(){ +fn_info_game_rtcw() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -1432,7 +1435,7 @@ fn_info_game_rtcw(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_rust(){ +fn_info_game_rust() { # Parameters servername=${servername:-"NOT SET"} port=${port:-"0"} @@ -1452,7 +1455,7 @@ fn_info_game_rust(){ salt=${salt:-"0"} } -fn_info_game_rw(){ +fn_info_game_rw() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1474,12 +1477,12 @@ fn_info_game_rw(){ rconport=$(grep "rcon_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') maxplayers=$(grep "settings_max_players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') port=$(grep "server_port" "${servercfgfullpath}" | grep -v "database_mysql_server_port" | grep -v "#" | tr -cd '[:digit:]') - port2=$((port+1)) - port3=$((port+2)) - port4=$((port+3)) + port2=$((port + 1)) + port3=$((port + 2)) + port4=$((port + 3)) queryport="${port}" - httpqueryport=$((port-1)) - gamemode=$(grep "settings_default_gamemode=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/settings_default_gamemode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + httpqueryport=$((port - 1)) + gamemode=$(grep "settings_default_gamemode=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/settings_default_gamemode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') gameworld=$(grep "server_world_name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_world_name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') configip=$(grep "server_ip" "${servercfgfullpath}" | grep -v "database_mysql_server_ip" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/server_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') @@ -1501,7 +1504,7 @@ fn_info_game_rw(){ fi } -fn_info_game_samp(){ +fn_info_game_samp() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="unnamed server" @@ -1527,7 +1530,7 @@ fn_info_game_samp(){ fi } -fn_info_game_sb(){ +fn_info_game_sb() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1560,7 +1563,7 @@ fn_info_game_sb(){ fi } -fn_info_game_sbots(){ +fn_info_game_sbots() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1583,7 +1586,7 @@ fn_info_game_sbots(){ maxplayers=${maxplayers:-"0"} } -fn_info_game_scpsl(){ +fn_info_game_scpsl() { # Config if [ -f "${servercfgfullpath}" ]; then servername=$(sed -nr 's/^server_name: (.*)$/\1/p' "${servercfgfullpath}") @@ -1604,7 +1607,7 @@ fn_info_game_scpsl(){ queryport=${port} } -fn_info_game_sdtd(){ +fn_info_game_sdtd() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1626,7 +1629,7 @@ fn_info_game_sdtd(){ servername=$(grep "ServerName" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"") serverpassword=$(grep "ServerPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"") port=$(grep "ServerPort" "${servercfgfullpath}" | grep -Eo 'value="[0-9]+"' | tr -cd '[:digit:]') - port3=$((port+2)) + port3=$((port + 2)) queryport=${port:-"0"} webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"") webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}" | tr -cd '[:digit:]') @@ -1660,7 +1663,7 @@ fn_info_game_sdtd(){ fi } -fn_info_game_sf(){ +fn_info_game_sf() { # Parameters servername=${selfname:-"NOT SET"} port=${port:-"0"} @@ -1668,7 +1671,7 @@ fn_info_game_sf(){ beaconport=${beaconport:-"0"} } -fn_info_game_sof2(){ +fn_info_game_sof2() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -1694,7 +1697,7 @@ fn_info_game_sof2(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_sol(){ +fn_info_game_sol() { # Config if [ ! -f "${servercfgfullpath}" ]; then adminpassword="${unavailable}" @@ -1708,7 +1711,7 @@ fn_info_game_sol(){ maxplayers=$(grep "Max_Players=" "${servercfgfullpath}" | tr -cd '[:digit:]') port=$(grep "Port=" "${servercfgfullpath}" | tr -cd '[:digit:]') queryport="${port}" - filesport=$((port+10)) + filesport=$((port + 10)) servername=$(grep "Server_Name=" "${servercfgfullpath}" | awk -F '=' '{print $2}') serverpassword=$(grep "Game_Password=" "${servercfgfullpath}" | awk -F '=' '{print $2}') @@ -1722,7 +1725,7 @@ fn_info_game_sol(){ fi } -fn_info_game_source(){ +fn_info_game_source() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1748,16 +1751,16 @@ fn_info_game_source(){ clientport=${clientport:-"0"} # Steamport can be between 26901-26910 and is normaly automatically set. # Some servers might support -steamport parameter to set - if [ "${steamport}" == "0" ]||[ -v "${steamport}" ]; then + if [ "${steamport}" == "0" ] || [ -v "${steamport}" ]; then steamport="$(echo "${ssinfo}" | grep "${srcdslinuxpid}" | awk '{print $5}' | grep ":269" | cut -d ":" -f2)" fi } -fn_info_game_spark(){ +fn_info_game_spark() { defaultmap=${defaultmap:-"NOT SET"} maxplayers=${maxplayers:-"0"} port=${port:-"0"} - queryport=$((port+1)) + queryport=$((port + 1)) servername=${servername:-"NOT SET"} serverpassword=${serverpassword:-"NOT SET"} webadminuser=${webadminuser:-"NOT SET"} @@ -1767,7 +1770,7 @@ fn_info_game_spark(){ #mods=${mods:-"NOT SET"} } -fn_info_game_squad(){ +fn_info_game_squad() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1788,7 +1791,7 @@ fn_info_game_squad(){ rconpassword=$(grep "Password=" "${servercfgdir}/Rcon.cfg" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') rconport=${rconport:-"0"} - if [ -z "${rconpassword}" ]||[ ${#rconpassword} == 1 ]; then + if [ -z "${rconpassword}" ] || [ ${#rconpassword} == 1 ]; then rconpassword="NOT SET" fi @@ -1799,7 +1802,7 @@ fn_info_game_squad(){ queryport=${queryport:-"0"} } -fn_info_game_st(){ +fn_info_game_st() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1829,7 +1832,7 @@ fn_info_game_st(){ worldname=${worldname:-"NOT SET"} } -fn_info_game_terraria(){ +fn_info_game_terraria() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1853,7 +1856,7 @@ fn_info_game_terraria(){ fi } -fn_info_game_stn(){ +fn_info_game_stn() { # Config if [ -f "${servercfgfullpath}" ]; then servername=$(sed -nr 's/^ServerName="(.*)"/\1/p' "${servercfgfullpath}") @@ -1873,7 +1876,7 @@ fn_info_game_stn(){ fi } -fn_info_game_ti(){ +fn_info_game_ti() { if [ -f "${servercfgfullpath}" ]; then servername=$(sed -nr 's/^ServerName="(.*)"/\1/p' "${servercfgfullpath}") maxplayers=$(sed -nr 's/^MaxPlayerCount=([0-9]+)/\1/' "${servercfgfullpath}") @@ -1883,7 +1886,7 @@ fn_info_game_ti(){ fi } -fn_info_game_ts3(){ +fn_info_game_ts3() { # Config if [ ! -f "${servercfgfullpath}" ]; then dbplugin="${unavailable}" @@ -1918,7 +1921,7 @@ fn_info_game_ts3(){ fi } -fn_info_game_tu(){ +fn_info_game_tu() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1934,11 +1937,11 @@ fn_info_game_tu(){ # Parameters port=${port:-"0"} - steamport=$((port+1)) + steamport=$((port + 1)) queryport=${queryport:-"0"} } -fn_info_game_tw(){ +fn_info_game_tw() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="unnamed server" @@ -1965,7 +1968,7 @@ fn_info_game_tw(){ fi } -fn_info_game_ut99(){ +fn_info_game_ut99() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1979,17 +1982,17 @@ fn_info_game_ut99(){ webadminuser="${unavailable}" webadminpass="${unavailable}" else - servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//') - serverpassword=$(grep "GamePassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/GamePassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//') - adminpassword=$(grep "AdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//') + servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//') + serverpassword=$(grep "GamePassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/GamePassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//') + adminpassword=$(grep "AdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//') port=$(grep "Port" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Port" | grep -v "#" | tr -cd '[:digit:]') - queryport=$((port+1)) + queryport=$((port + 1)) queryportgs=$(grep "OldQueryPortNumber" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') beaconport=$(grep "ServerBeaconPort" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') - webadminenabled=$(grep "bEnabled" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bEnabled//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//') + webadminenabled=$(grep "bEnabled" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bEnabled//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//') httpport=$(grep "ListenPort" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') - webadminuser=$(grep "AdminUsername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminUsername//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//') - webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 4 | grep "AdminPassword" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| sed 's/\r$//') + webadminuser=$(grep "AdminUsername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminUsername//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//') + webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 4 | grep "AdminPassword" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | sed 's/\r$//') # Not set servername=${servername:-"NOT SET"} @@ -2009,7 +2012,7 @@ fn_info_game_ut99(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_unreal2(){ +fn_info_game_unreal2() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -2027,7 +2030,7 @@ fn_info_game_unreal2(){ serverpassword=$(sed -nr 's/^GamePassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') adminpassword=$(sed -nr 's/^AdminPassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') port=$(sed -nr 's/^Port=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]') - queryport=$((port+1)) + queryport=$((port + 1)) queryportgs=$(sed -nr 's/^OldQueryPortNumber=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]') webadminenabled=$(sed -nr 's/^bEnabled=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') webadminport=$(sed -nr 's/^ListenPort=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]') @@ -2051,15 +2054,15 @@ fn_info_game_unreal2(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_unt(){ +fn_info_game_unt() { # Parameters servername=${selfname:-"NOT SET"} port=${port:-"0"} queryport=${port} - steamport=$((port+1)) + steamport=$((port + 1)) } -fn_info_game_ut(){ +fn_info_game_ut() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -2072,10 +2075,10 @@ fn_info_game_ut(){ # Parameters port=${port:-"0"} - queryport=$((port+1)) + queryport=$((port + 1)) } -fn_info_game_unreal2k4(){ +fn_info_game_unreal2k4() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -2094,7 +2097,7 @@ fn_info_game_unreal2k4(){ serverpassword=$(sed -nr 's/^GamePassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') adminpassword=$(sed -nr 's/^AdminPassword=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') port=$(sed -nr 's/^Port=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]') - queryport=$((port+1)) + queryport=$((port + 1)) queryportgs=$(sed -nr 's/^OldQueryPortNumber=(.*)$/\1/p' "${servercfgfullpath}" | tr -cd '[:digit:]') lanport=$(grep "LANServerPort=" "${servercfgfullpath}" | tr -cd '[:digit:]') webadminenabled=$(sed -nr 's/^bEnabled=(.*)$/\1/p' "${servercfgfullpath}" | tr -d '=\";,:' | sed 's/\r$//') @@ -2117,7 +2120,7 @@ fn_info_game_unreal2k4(){ fi } -fn_info_game_ut3(){ +fn_info_game_ut3() { # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -2155,12 +2158,12 @@ fn_info_game_ut3(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_game_vh(){ +fn_info_game_vh() { # Parameters port=${port:-"0"} # Query port only enabled if public server if [ "${public}" != "0" ]; then - queryport=$((port+1)) + queryport=$((port + 1)) else querymode="1" fi @@ -2169,28 +2172,41 @@ fn_info_game_vh(){ servername=${servername:-"NOT SET"} } -fn_info_game_vints(){ +fn_info_game_vints() { if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" maxplayers="${unavailable}" serverpassword="${unavailable}" - port="${unavailable}" - queryport="${unavailable}" - configip="${unavailable}" + port="${port:-"0"}" else servername=$(jq -r '.ServerName' "${servercfgfullpath}") maxplayers=$(jq -r '.MaxClients' "${servercfgfullpath}") serverpassword=$(jq -r 'select(.Password != null) | .Password' "${servercfgfullpath}") port=$(jq -r '.Port' "${servercfgfullpath}") - queryport=${port:-"0"} configip=$(jq -r 'select(.Ip != null) | .Ip' "${servercfgfullpath}") + fi + queryport=${port:-"0"} + serverpassword=${serverpassword:-"NOT SET"} + configip=${configip:-"0.0.0.0"} +} - serverpassword=${serverpassword:-"NOT SET"} - configip=${configip:-"0.0.0.0"} +fn_info_game_vpmc() { + if [ ! -f "${servercfgfullpath}" ]; then + servername="${unavailable}" + configip="0.0.0.0" + port="25577" + else + servername=$(sed -nr 's/^motd\s*=\s*"(.*)"/\1/p' "${servercfgfullpath}") + bindaddress=$(sed -nr 's/^bind\s*=\s*"([0-9.:]+)"/\1/p' "${servercfgfullpath}") + configip=$(echo "${bindaddress}" | cut -d ':' -f 1) + port=$(echo "${bindaddress}" | cut -d ':' -f 2) + + servername=${servername:-"NOT SET"} fi + queryport=${port:-"25577"} } -fn_info_game_wet(){ +fn_info_game_wet() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -2219,7 +2235,7 @@ fn_info_game_wet(){ fi } -fn_info_game_wf(){ +fn_info_game_wf() { # Config if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -2242,8 +2258,7 @@ fn_info_game_wf(){ webadminport=${webadminport:-"0"} } - -fn_info_game_wmc(){ +fn_info_game_wmc() { if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" maxplayers="${zero}" @@ -2259,19 +2274,19 @@ fn_info_game_wmc(){ maxplayers=$(sed -nr 's/^player_limit: ([-]*[0-9])/\1/p' "${servercfgfullpath}") configip=$(sed -nr 's/^[ ]+host: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+):[0-9]+/\1/p' "${servercfgfullpath}") - if [ "${maxplayers}" == "-1" ]||[ "${maxplayers}" == "0" ]; then + if [ "${maxplayers}" == "-1" ] || [ "${maxplayers}" == "0" ]; then maxplayers="UNLIMITED" fi # Not set servername=${servername:-"NOT SET"} - queryport=${rconpassword:-"NOT SET"} + queryport=${queryport:-"25577"} maxplayers=${maxplayers:-"0"} configip=${configip:-"0.0.0.0"} fi } -fn_info_game_wurm(){ +fn_info_game_wurm() { # Config if [ ! -f "${servercfgfullpath}" ]; then port="${zero}" @@ -2367,7 +2382,7 @@ elif [ "${shortname}" == "kf2" ]; then fn_info_game_kf2 elif [ "${shortname}" == "lo" ]; then fn_info_game_lo -elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then +elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then fn_info_game_mc elif [ "${shortname}" == "mcb" ]; then fn_info_game_mcb @@ -2389,7 +2404,7 @@ elif [ "${shortname}" == "pc2" ]; then fn_info_game_pc2 elif [ "${shortname}" == "pstbs" ]; then fn_info_game_pstbs -elif [ "${shortname}" == "pvr" ];then +elif [ "${shortname}" == "pvr" ]; then fn_info_game_pvr elif [ "${shortname}" == "pz" ]; then fn_info_game_pz @@ -2415,7 +2430,7 @@ elif [ "${shortname}" == "sb" ]; then fn_info_game_sb elif [ "${shortname}" == "sbots" ]; then fn_info_game_sbots -elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then +elif [ "${shortname}" == "scpsl" ] || [ "${shortname}" == "scpslsm" ]; then fn_info_game_scpsl elif [ "${shortname}" == "sdtd" ]; then fn_info_game_sdtd @@ -2457,6 +2472,8 @@ elif [ "${shortname}" == "vh" ]; then fn_info_game_vh elif [ "${shortname}" == "vints" ]; then fn_info_game_vints +elif [ "${shortname}" == "vpmc" ]; then + fn_info_game_vpmc elif [ "${shortname}" == "wet" ]; then fn_info_game_wet elif [ "${shortname}" == "wf" ]; then @@ -2465,7 +2482,7 @@ elif [ "${shortname}" == "wmc" ]; then fn_info_game_wmc elif [ "${shortname}" == "wurm" ]; then fn_info_game_wurm -elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then +elif [ "${engine}" == "source" ] || [ "${engine}" == "goldsrc" ]; then fn_info_game_source elif [ "${engine}" == "unreal2" ]; then fn_info_game_unreal2 @@ -2473,7 +2490,7 @@ fi # External IP address if [ -z "${extip}" ]; then - extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2>/dev/null)" + extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2> /dev/null)" exitcode=$? # Should ifconfig.co return an error will use last known IP. if [ ${exitcode} -eq 0 ]; then @@ -2507,16 +2524,16 @@ fi # Steam Master Server - checks if detected by master server. # Checked after config init, as the queryport is needed if [ -z "${displaymasterserver}" ]; then - if [ "$(command -v jq 2>/dev/null)" ]; then - if [ "${ip}" ]&&[ "${port}" ]; then - if [ "${steammaster}" == "true" ]||[ "${commandname}" == "DEV-QUERY-RAW" ]; then + if [ "$(command -v jq 2> /dev/null)" ]; then + if [ "${ip}" ] && [ "${port}" ]; then + if [ "${steammaster}" == "true" ] || [ "${commandname}" == "DEV-QUERY-RAW" ]; then # Will query server IP addresses first. for queryip in "${queryips[@]}"; do - masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${queryip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2>/dev/null)" + masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${queryip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2> /dev/null)" done # Should that not work it will try the external IP. if [ "${masterserver}" == "0" ]; then - masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${extip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2>/dev/null)" + masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${extip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2> /dev/null)" fi if [ "${masterserver}" == "0" ]; then displaymasterserver="false" diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index f0def5b0ef..a216327c93 100755 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Separator is different for details. -fn_messages_separator(){ +fn_messages_separator() { if [ "${commandname}" == "DETAILS" ]; then printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = else @@ -17,7 +17,7 @@ fn_messages_separator(){ } # Removes the passwords form all but details. -fn_info_message_password_strip(){ +fn_info_message_password_strip() { if [ "${commandname}" != "DETAILS" ]; then if [ "${serverpassword}" ]; then serverpassword="********" @@ -55,7 +55,7 @@ fn_info_message_password_strip(){ # Alert Summary # used with alertlog -fn_info_message_head(){ +fn_info_message_head() { echo -e "" echo -e "${lightyellow}Alert Summary${default}" fn_messages_separator @@ -75,7 +75,7 @@ fn_info_message_head(){ echo -e "${ip}:${port}" } -fn_info_message_distro(){ +fn_info_message_distro() { # # Distro Details # ================================= @@ -106,7 +106,7 @@ fn_info_message_distro(){ } | column -s $'\t' -t } -fn_info_message_server_resource(){ +fn_info_message_server_resource() { # # Server Resource # ================================= @@ -172,7 +172,7 @@ fn_info_message_server_resource(){ } | column -s $'\t' -t } -fn_info_message_gameserver_resource(){ +fn_info_message_gameserver_resource() { # # Game Server Resource Usage # ================================= @@ -188,7 +188,7 @@ fn_info_message_gameserver_resource(){ echo -e "${lightyellow}Game Server Resource Usage${default}" fn_messages_separator { - if [ "${status}" != "0" ]&&[ -v status ]; then + if [ "${status}" != "0" ] && [ -v status ]; then if [ -n "${cpuused}" ]; then echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}" else @@ -204,7 +204,7 @@ fn_info_message_gameserver_resource(){ echo -e "${lightblue}Mem Used:\t${default}0%\t0MB${default}" fi } | column -s $'\t' -t - echo -e "" + echo -e "" { echo -e "${lightyellow}Storage${default}" echo -e "${lightblue}Total:\t${default}${rootdirdu}" @@ -215,7 +215,7 @@ fn_info_message_gameserver_resource(){ } | column -s $'\t' -t } -fn_info_message_gameserver(){ +fn_info_message_gameserver() { # # Counter-Strike: Global Offensive Server Details # ================================= @@ -326,15 +326,15 @@ fn_info_message_gameserver(){ echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}" fi else - if [ -n "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then + if [ -n "${gdplayers}" ] && [ -n "${gdmaxplayers}" ]; then echo -e "${lightblue}Players:\t${default}${gdplayers}/${gdmaxplayers}" - elif [ -n "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then + elif [ -n "${gdplayers}" ] && [ -n "${maxplayers}" ]; then echo -e "${lightblue}Players:\t${default}${gdplayers}/${maxplayers}" - elif [ -z "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then + elif [ -z "${gdplayers}" ] && [ -n "${gdmaxplayers}" ]; then echo -e "${lightblue}Players:\t${default}0/${gdmaxplayers}" - elif [ -n "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then + elif [ -n "${gdplayers}" ] && [ -z "${gdmaxplayers}" ]; then echo -e "${lightblue}Players:\t${default}${gdplayers}/∞" - elif [ -z "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]&&[ -n "${maxplayers}" ]; then + elif [ -z "${gdplayers}" ] && [ -z "${gdmaxplayers}" ] && [ -n "${maxplayers}" ]; then echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}" fi fi @@ -500,7 +500,7 @@ fn_info_message_gameserver(){ echo -e "" } -fn_info_message_script(){ +fn_info_message_script() { # csgoserver Script Details # ================================= # Script name: csgoserver @@ -596,7 +596,7 @@ fn_info_message_script(){ } | column -s $'\t' -t } -fn_info_message_backup(){ +fn_info_message_backup() { # # Backups # ================================= @@ -609,7 +609,7 @@ fn_info_message_backup(){ echo -e "" echo -e "${lightgreen}Backups${default}" fn_messages_separator - if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then + if [ ! -d "${backupdir}" ] || [ "${backupcount}" == "0" ]; then echo -e "No Backups created" else { @@ -628,7 +628,7 @@ fn_info_message_backup(){ fi } -fn_info_message_commandlineparms(){ +fn_info_message_commandlineparms() { # # Command-line Parameters # ================================= @@ -645,7 +645,7 @@ fn_info_message_commandlineparms(){ echo -e "${preexecutable} ${executable} ${startparameters}" } -fn_info_message_ports_edit(){ +fn_info_message_ports_edit() { # # Ports # ================================= @@ -658,20 +658,20 @@ fn_info_message_ports_edit(){ startparameterslocation="${red}UNKNOWN${default}" # engines/games that require editing in the config file. - local ports_edit_array=( "ac" "arma3" "armar" "bo" "bt" "cd" "dst" "eco" "idtech2" "idtech3" "idtech3_ql" "jc2" "jc3" "lwjgl2" "mcb" "mumble" "pc" "pc2" "pz" "qw" "refractor" "renderware" "rw" "sb" "sdtd" "st" "stn" "ts3" "tw" "terraria" "unreal" "unreal2" "unreal3" "vints" "wurm") + local ports_edit_array=("ac" "arma3" "armar" "bo" "bt" "cd" "dst" "eco" "idtech2" "idtech3" "idtech3_ql" "jc2" "jc3" "lwjgl2" "mcb" "mumble" "pc" "pc2" "pz" "qw" "refractor" "renderware" "rw" "sb" "sdtd" "st" "stn" "ts3" "tw" "terraria" "unreal" "unreal2" "unreal3" "vints" "wurm") for port_edit in "${ports_edit_array[@]}"; do if [ "${shortname}" == "ut3" ]; then startparameterslocation="${servercfgdir}/UTWeb.ini" elif [ "${shortname}" == "kf2" ]; then startparameterslocation="${servercfgdir}/LinuxServer-KFEngine.ini\n${servercfgdir}/KFWeb.ini" - elif [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then + elif [ "${engine}" == "${port_edit}" ] || [ "${gamename}" == "${port_edit}" ] || [ "${shortname}" == "${port_edit}" ]; then startparameterslocation="${servercfgfullpath}" fi done # engines/games that require editing the start parameters. - local ports_edit_array=( "av" "col" "fctr" "goldsrc" "hw" "iw3.0" "ioquake3" "qfusion" "rust" "scpsl" "scpslsm" "sol" "spark" "source" "unreal4" "arma3" "dayz" "unt" "vh" ) + local ports_edit_array=("av" "col" "fctr" "goldsrc" "hw" "iw3.0" "ioquake3" "qfusion" "rust" "scpsl" "scpslsm" "sol" "spark" "source" "unreal4" "arma3" "dayz" "unt" "vh") for port_edit in "${ports_edit_array[@]}"; do - if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then + if [ "${engine}" == "${port_edit}" ] || [ "${gamename}" == "${port_edit}" ] || [ "${shortname}" == "${port_edit}" ]; then startparameterslocation="${configdirserver}" fi done @@ -679,7 +679,7 @@ fn_info_message_ports_edit(){ echo -e "" } -fn_info_message_ports(){ +fn_info_message_ports() { echo -e "${lightblue}Useful port diagnostic command:${default}" if [ "${shortname}" == "armar" ]; then echo -e "ss -tuplwn | grep enfMain" @@ -687,7 +687,7 @@ fn_info_message_ports(){ echo -e "ss -tuplwn | grep AvorionServer" elif [ "${shortname}" == "bf1942" ]; then echo -e "ss -tuplwn | grep bf1942_lnxded" - elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "rw" ]||[ "${shortname}" == "wmc" ]; then + elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "rw" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then echo -e "ss -tuplwn | grep java" elif [ "${shortname}" == "terraria" ]; then echo -e "ss -tuplwn | grep Main" @@ -702,7 +702,7 @@ fn_info_message_ports(){ echo -e "" } -fn_info_message_statusbottom(){ +fn_info_message_statusbottom() { echo -e "" if [ "${status}" == "0" ]; then echo -e "${lightblue}Status:\t${red}STOPPED${default}" @@ -712,7 +712,7 @@ fn_info_message_statusbottom(){ echo -e "" } -fn_info_logs(){ +fn_info_logs() { echo -e "" echo -e "${selfname} Logs" echo -e "=================================" @@ -750,7 +750,7 @@ fn_info_logs(){ else echo -e "${gamelogdir}" # dos2unix sed 's/\r//' - tail "${gamelogdir}"/* 2>/dev/null | grep -v "==>" | sed '/^$/d' | sed 's/\r//' | tail -25 + tail "${gamelogdir}"/* 2> /dev/null | grep -v "==>" | sed '/^$/d' | sed 's/\r//' | tail -25 fi echo -e "" fi @@ -766,7 +766,7 @@ fn_info_logs(){ # Query 27015 udp 1 # RCON 27020 tcp 1 -fn_port(){ +fn_port() { if [ "${1}" == "header" ]; then echo -e "${lightblue}DESCRIPTION\tPORT\tPROTOCOL\tLISTEN${default}" else @@ -777,7 +777,7 @@ fn_port(){ fi } -fn_info_message_ac(){ +fn_info_message_ac() { { fn_port "header" fn_port "Game" port udp @@ -787,7 +787,7 @@ fn_info_message_ac(){ } | column -s $'\t' -t } -fn_info_message_ark(){ +fn_info_message_ark() { { fn_port "header" fn_port "Game" port udp @@ -797,7 +797,7 @@ fn_info_message_ark(){ } | column -s $'\t' -t } -fn_info_message_arma3(){ +fn_info_message_arma3() { { fn_port "header" fn_port "Game" port udp @@ -809,7 +809,7 @@ fn_info_message_arma3(){ } | column -s $'\t' -t } -fn_info_message_armar(){ +fn_info_message_armar() { { fn_port "header" fn_port "Game" port udp @@ -818,7 +818,7 @@ fn_info_message_armar(){ } | column -s $'\t' -t } -fn_info_message_av(){ +fn_info_message_av() { { fn_port "header" fn_port "Game" port udp @@ -829,7 +829,7 @@ fn_info_message_av(){ } | column -s $'\t' -t } -fn_info_message_bf1942(){ +fn_info_message_bf1942() { { fn_port "header" fn_port "Game" port udp @@ -837,7 +837,7 @@ fn_info_message_bf1942(){ } | column -s $'\t' -t } -fn_info_message_bfv(){ +fn_info_message_bfv() { { fn_port "header" fn_port "Game" port udp @@ -845,7 +845,7 @@ fn_info_message_bfv(){ } | column -s $'\t' -t } -fn_info_message_bo(){ +fn_info_message_bo() { { fn_port "header" fn_port "Game" port udp @@ -853,7 +853,7 @@ fn_info_message_bo(){ } | column -s $'\t' -t } -fn_info_message_bt(){ +fn_info_message_bt() { { fn_port "header" fn_port "Game" port udp @@ -861,7 +861,7 @@ fn_info_message_bt(){ } | column -s $'\t' -t } -fn_info_message_bt1944(){ +fn_info_message_bt1944() { { fn_port "header" fn_port "Game" port udp @@ -870,7 +870,7 @@ fn_info_message_bt1944(){ } | column -s $'\t' -t } -fn_info_messages_cd(){ +fn_info_messages_cd() { { fn_port "header" fn_port "Game" port udp @@ -879,7 +879,7 @@ fn_info_messages_cd(){ } | column -s $'\t' -t } -fn_info_message_cmw(){ +fn_info_message_cmw() { fn_info_message_password_strip { fn_port "header" @@ -889,7 +889,7 @@ fn_info_message_cmw(){ } | column -s $'\t' -t } -fn_info_message_cod(){ +fn_info_message_cod() { { fn_port "header" fn_port "Game" port udp @@ -897,7 +897,7 @@ fn_info_message_cod(){ } | column -s $'\t' -t } -fn_info_message_coduo(){ +fn_info_message_coduo() { { fn_port "header" fn_port "Game" port udp @@ -905,7 +905,7 @@ fn_info_message_coduo(){ } | column -s $'\t' -t } -fn_info_message_cod2(){ +fn_info_message_cod2() { { fn_port "header" fn_port "Game" port udp @@ -913,7 +913,7 @@ fn_info_message_cod2(){ } | column -s $'\t' -t } -fn_info_message_cod4(){ +fn_info_message_cod4() { { fn_port "header" fn_port "Game" port udp @@ -921,7 +921,7 @@ fn_info_message_cod4(){ } | column -s $'\t' -t } -fn_info_message_codwaw(){ +fn_info_message_codwaw() { { fn_port "header" fn_port "Game" port udp @@ -929,7 +929,7 @@ fn_info_message_codwaw(){ } | column -s $'\t' -t } -fn_info_message_col(){ +fn_info_message_col() { { fn_port "header" fn_port "Game" port udp @@ -938,7 +938,7 @@ fn_info_message_col(){ } | column -s $'\t' -t } -fn_info_message_csgo(){ +fn_info_message_csgo() { { fn_port "header" fn_port "Game" port udp @@ -949,7 +949,7 @@ fn_info_message_csgo(){ } | column -s $'\t' -t } -fn_info_message_dayz(){ +fn_info_message_dayz() { { fn_port "header" fn_port "Game" port udp @@ -959,7 +959,7 @@ fn_info_message_dayz(){ } | column -s $'\t' -t } -fn_info_message_dodr(){ +fn_info_message_dodr() { { fn_port "header" fn_port "Game" port udp @@ -967,7 +967,7 @@ fn_info_message_dodr(){ } | column -s $'\t' -t } -fn_info_message_dst(){ +fn_info_message_dst() { { fn_port "header" fn_port "Game: Server" port udp @@ -977,7 +977,7 @@ fn_info_message_dst(){ } | column -s $'\t' -t } -fn_info_message_eco(){ +fn_info_message_eco() { { fn_port "header" fn_port "Game" port udp @@ -985,7 +985,7 @@ fn_info_message_eco(){ } | column -s $'\t' -t } -fn_info_message_etl(){ +fn_info_message_etl() { { fn_port "header" fn_port "Game" port udp @@ -993,7 +993,7 @@ fn_info_message_etl(){ } | column -s $'\t' -t } -fn_info_message_fctr(){ +fn_info_message_fctr() { { fn_port "header" fn_port "Game" port udp @@ -1001,7 +1001,7 @@ fn_info_message_fctr(){ } | column -s $'\t' -t } -fn_info_message_goldsrc(){ +fn_info_message_goldsrc() { { fn_port "header" fn_port "Game" port udp @@ -1009,7 +1009,7 @@ fn_info_message_goldsrc(){ } | column -s $'\t' -t } -fn_info_message_hw(){ +fn_info_message_hw() { { fn_port "header" fn_port "Game" port udp @@ -1017,7 +1017,7 @@ fn_info_message_hw(){ } | column -s $'\t' -t } -fn_info_message_ins(){ +fn_info_message_ins() { { fn_port "header" fn_port "Game" port udp @@ -1028,7 +1028,7 @@ fn_info_message_ins(){ } | column -s $'\t' -t } -fn_info_message_inss(){ +fn_info_message_inss() { { fn_port "header" fn_port "Game" port udp @@ -1037,7 +1037,7 @@ fn_info_message_inss(){ } | column -s $'\t' -t } -fn_info_message_jc2(){ +fn_info_message_jc2() { { fn_port "header" fn_port "Game" port udp @@ -1045,7 +1045,7 @@ fn_info_message_jc2(){ } | column -s $'\t' -t } -fn_info_message_jc3(){ +fn_info_message_jc3() { { fn_port "header" fn_port "Game" port udp @@ -1055,23 +1055,23 @@ fn_info_message_jc3(){ } | column -s $'\t' -t } -fn_info_message_jk2(){ +fn_info_message_jk2() { { fn_port "header" fn_port "Game" port udp } | column -s $'\t' -t } -fn_info_message_kf(){ +fn_info_message_kf() { { - fn_port "header" - fn_port "Game" port udp - fn_port "Query" queryport udp - fn_port "Query (GameSpy)" queryportgs udp - fn_port "Web Admin" webadminport tcp - fn_port "LAN" lanport udp - fn_port "Steam" steamport udp - fn_port "Steam Master" steammasterport udp + fn_port "header" + fn_port "Game" port udp + fn_port "Query" queryport udp + fn_port "Query (GameSpy)" queryportgs udp + fn_port "Web Admin" webadminport tcp + fn_port "LAN" lanport udp + fn_port "Steam" steamport udp + fn_port "Steam Master" steammasterport udp } | column -s $'\t' -t echo -e "" echo -e "${lightgreen}${servername} Web Admin${default}" @@ -1084,7 +1084,7 @@ fn_info_message_kf(){ } | column -s $'\t' -t } -fn_info_message_kf2(){ +fn_info_message_kf2() { fn_info_message_password_strip { fn_port "header" @@ -1103,7 +1103,7 @@ fn_info_message_kf2(){ } | column -s $'\t' -t } -fn_info_message_lo(){ +fn_info_message_lo() { { fn_port "header" fn_port "Game" port udp @@ -1111,7 +1111,7 @@ fn_info_message_lo(){ } | column -s $'\t' -t } -fn_info_message_mc(){ +fn_info_message_mc() { { fn_port "header" fn_port "Game" port tcp @@ -1120,7 +1120,7 @@ fn_info_message_mc(){ } | column -s $'\t' -t } -fn_info_message_mcb(){ +fn_info_message_mcb() { { fn_port "header" fn_port "Game" port udp @@ -1128,7 +1128,7 @@ fn_info_message_mcb(){ } | column -s $'\t' -t } -fn_info_message_mh(){ +fn_info_message_mh() { { fn_port "header" fn_port "Game" port udp @@ -1137,14 +1137,14 @@ fn_info_message_mh(){ } | column -s $'\t' -t } -fn_info_message_mohaa(){ +fn_info_message_mohaa() { { fn_port "header" fn_port "Game" port udp } | column -s $'\t' -t } -fn_info_message_mom(){ +fn_info_message_mom() { { fn_port "header" fn_port "Game" port udp @@ -1152,7 +1152,7 @@ fn_info_message_mom(){ } | column -s $'\t' -t } -fn_info_message_mta(){ +fn_info_message_mta() { { fn_port "header" fn_port "Game" port udp @@ -1163,7 +1163,7 @@ fn_info_message_mta(){ } | column -s $'\t' -t } -fn_info_message_mumble(){ +fn_info_message_mumble() { { fn_port "header" fn_port "Voice" port udp @@ -1171,7 +1171,7 @@ fn_info_message_mumble(){ } | column -s $'\t' -t } -fn_info_message_onset(){ +fn_info_message_onset() { { fn_port "header" fn_port "Game" port udp @@ -1180,7 +1180,7 @@ fn_info_message_onset(){ } | column -s $'\t' -t } -fn_info_message_pc(){ +fn_info_message_pc() { { fn_port "header" fn_port "Game" port udp @@ -1189,7 +1189,7 @@ fn_info_message_pc(){ } | column -s $'\t' -t } -fn_info_message_pc2(){ +fn_info_message_pc2() { { fn_port "header" fn_port "Game" port udp @@ -1198,7 +1198,7 @@ fn_info_message_pc2(){ } | column -s $'\t' -t } -fn_info_message_pstbs(){ +fn_info_message_pstbs() { { fn_port "header" fn_port "Game" port udp @@ -1207,7 +1207,7 @@ fn_info_message_pstbs(){ } | column -s $'\t' -t } -fn_info_message_pvr(){ +fn_info_message_pvr() { { fn_port "header" fn_port "Game" port udp @@ -1217,7 +1217,7 @@ fn_info_message_pvr(){ } | column -s $'\t' -t } -fn_info_message_pz(){ +fn_info_message_pz() { { fn_port "header" fn_port "Game" port udp @@ -1225,28 +1225,28 @@ fn_info_message_pz(){ } | column -s $'\t' -t } -fn_info_message_qw(){ +fn_info_message_qw() { { fn_port "header" fn_port "Game" port udp } | column -s $'\t' -t } -fn_info_message_q2(){ +fn_info_message_q2() { { fn_port "header" fn_port "Game" port udp } | column -s $'\t' -t } -fn_info_message_q3(){ +fn_info_message_q3() { { fn_port "header" fn_port "Game" port udp } | column -s $'\t' -t } -fn_info_message_ql(){ +fn_info_message_ql() { { fn_port "header" fn_port "Game" port udp @@ -1256,7 +1256,7 @@ fn_info_message_ql(){ } | column -s $'\t' -t } -fn_info_message_ro(){ +fn_info_message_ro() { { fn_port "header" fn_port "Game" port udp @@ -1277,14 +1277,14 @@ fn_info_message_ro(){ } | column -s $'\t' -t } -fn_info_message_rtcw(){ +fn_info_message_rtcw() { { fn_port "header" fn_port "Game" port udp } | column -s $'\t' -t } -fn_info_message_rust(){ +fn_info_message_rust() { { fn_port "header" fn_port "Game" port udp @@ -1294,7 +1294,7 @@ fn_info_message_rust(){ } | column -s $'\t' -t } -fn_info_message_rw(){ +fn_info_message_rw() { { fn_port "header" fn_port "Game" port udp @@ -1310,7 +1310,7 @@ fn_info_message_rw(){ } | column -s $'\t' -t } -fn_info_message_samp(){ +fn_info_message_samp() { { fn_port "header" fn_port "Game" port udp @@ -1318,7 +1318,7 @@ fn_info_message_samp(){ } | column -s $'\t' -t } -fn_info_message_sb(){ +fn_info_message_sb() { { fn_port "header" fn_port "Game" port udp @@ -1327,7 +1327,7 @@ fn_info_message_sb(){ } | column -s $'\t' -t } -fn_info_message_sbots(){ +fn_info_message_sbots() { { fn_port "header" fn_port "Game" port udp @@ -1335,14 +1335,14 @@ fn_info_message_sbots(){ } | column -s $'\t' -t } -fn_info_message_scpsl(){ +fn_info_message_scpsl() { { fn_port "header" fn_port "Game" port tcp } | column -s $'\t' -t } -fn_info_message_sdtd(){ +fn_info_message_sdtd() { fn_info_message_password_strip { fn_port "header" @@ -1371,7 +1371,7 @@ fn_info_message_sdtd(){ } | column -s $'\t' -t } -fn_info_message_sf(){ +fn_info_message_sf() { { fn_port "header" fn_port "Game" port udp @@ -1380,7 +1380,7 @@ fn_info_message_sf(){ } | column -s $'\t' -t } -fn_info_message_sof2(){ +fn_info_message_sof2() { { fn_port "header" fn_port "Game" port udp @@ -1388,7 +1388,7 @@ fn_info_message_sof2(){ } | column -s $'\t' -t } -fn_info_message_sol(){ +fn_info_message_sol() { { fn_port "header" fn_port "Game" port udp @@ -1396,7 +1396,7 @@ fn_info_message_sol(){ fn_port "Files" filesport tcp } | column -s $'\t' -t } -fn_info_message_source(){ +fn_info_message_source() { { fn_port "header" fn_port "Game" port udp @@ -1404,14 +1404,14 @@ fn_info_message_source(){ fn_port "RCON" rconport tcp fn_port "SourceTV" sourcetvport udp # Will not show if unaviable - if [ "${steamport}" == "0" ]||[ -v "${steamport}" ]; then + if [ "${steamport}" == "0" ] || [ -v "${steamport}" ]; then fn_port "Steam" steamport udp fi fn_port "Client" clientport udp } | column -s $'\t' -t } -fn_info_message_spark(){ +fn_info_message_spark() { fn_info_message_password_strip { fn_port "header" @@ -1429,7 +1429,7 @@ fn_info_message_spark(){ } | column -s $'\t' -t } -fn_info_message_squad(){ +fn_info_message_squad() { { fn_port "header" fn_port "Game" port udp @@ -1438,7 +1438,7 @@ fn_info_message_squad(){ } | column -s $'\t' -t } -fn_info_message_st(){ +fn_info_message_st() { { fn_port "header" fn_port "Game" port udp @@ -1453,7 +1453,7 @@ fn_info_message_st(){ } | column -s $'\t' -t } -fn_info_message_ti(){ +fn_info_message_ti() { { fn_port "header" fn_port "Game" port udp @@ -1461,7 +1461,7 @@ fn_info_message_ti(){ } | column -s $'\t' -t } -fn_info_message_ts3(){ +fn_info_message_ts3() { { fn_port "header" fn_port "Voice" port udp @@ -1474,7 +1474,7 @@ fn_info_message_ts3(){ } | column -s $'\t' -t } -fn_info_message_tw(){ +fn_info_message_tw() { { fn_port "header" fn_port "Game" port udp @@ -1482,7 +1482,7 @@ fn_info_message_tw(){ } | column -s $'\t' -t } -fn_info_message_terraria(){ +fn_info_message_terraria() { { fn_port "header" fn_port "Game" port tcp @@ -1490,7 +1490,7 @@ fn_info_message_terraria(){ } | column -s $'\t' -t } -fn_info_message_tu(){ +fn_info_message_tu() { { fn_port "header" fn_port "Game" port udp @@ -1499,7 +1499,7 @@ fn_info_message_tu(){ } | column -s $'\t' -t } -fn_info_message_unreal(){ +fn_info_message_unreal() { fn_info_message_password_strip { fn_port "header" @@ -1519,14 +1519,14 @@ fn_info_message_unreal(){ } | column -s $'\t' -t } -fn_info_message_ut2k4(){ +fn_info_message_ut2k4() { { - fn_port "header" - fn_port "Game" port udp - fn_port "Query" queryport udp - fn_port "Query (GameSpy)" queryportgs udp - fn_port "Web Admin" webadminport tcp - fn_port "LAN" lanport udp + fn_port "header" + fn_port "Game" port udp + fn_port "Query" queryport udp + fn_port "Query (GameSpy)" queryportgs udp + fn_port "Web Admin" webadminport tcp + fn_port "LAN" lanport udp } | column -s $'\t' -t echo -e "" echo -e "${lightgreen}${servername} Web Admin${default}" @@ -1539,7 +1539,7 @@ fn_info_message_ut2k4(){ } | column -s $'\t' -t } -fn_info_message_unreal(){ +fn_info_message_unreal() { fn_info_message_password_strip { fn_port "header" @@ -1559,7 +1559,7 @@ fn_info_message_unreal(){ } | column -s $'\t' -t } -fn_info_message_unt(){ +fn_info_message_unt() { { fn_port "header" fn_port "Game" port udp @@ -1568,7 +1568,7 @@ fn_info_message_unt(){ } | column -s $'\t' -t } -fn_info_message_ut(){ +fn_info_message_ut() { { fn_port "header" fn_port "Game" port udp @@ -1576,7 +1576,7 @@ fn_info_message_ut(){ } | column -s $'\t' -t } -fn_info_message_ut3(){ +fn_info_message_ut3() { fn_info_message_password_strip { fn_port "header" @@ -1595,7 +1595,7 @@ fn_info_message_ut3(){ } | column -s $'\t' -t } -fn_info_message_vh(){ +fn_info_message_vh() { { fn_port "header" fn_port "Game" port udp @@ -1603,14 +1603,21 @@ fn_info_message_vh(){ } | column -s $'\t' -t } -fn_info_message_vints(){ +fn_info_message_vints() { + { + fn_port "header" + fn_port "Game" port tcp + } | column -s $'\t' -t +} + +fn_info_message_vpmc() { { fn_port "header" fn_port "Game" port tcp } | column -s $'\t' -t } -fn_info_message_wet(){ +fn_info_message_wet() { { fn_port "header" fn_port "Game" port udp @@ -1618,7 +1625,7 @@ fn_info_message_wet(){ } | column -s $'\t' -t } -fn_info_message_wf(){ +fn_info_message_wf() { { fn_port "header" fn_port "Game" port udp @@ -1626,7 +1633,7 @@ fn_info_message_wf(){ } | column -s $'\t' -t } -fn_info_message_wurm(){ +fn_info_message_wurm() { { fn_port "header" fn_port "Game" port tcp @@ -1634,7 +1641,7 @@ fn_info_message_wurm(){ } | column -s $'\t' -t } -fn_info_message_stn(){ +fn_info_message_stn() { { fn_port "header" fn_port "Game" port udp @@ -1642,7 +1649,7 @@ fn_info_message_stn(){ } | column -s $'\t' -t } -fn_info_message_select_engine(){ +fn_info_message_select_engine() { # Display details depending on game or engine. if [ "${shortname}" == "ac" ]; then fn_info_message_ac @@ -1712,7 +1719,7 @@ fn_info_message_select_engine(){ fn_info_message_kf2 elif [ "${shortname}" == "lo" ]; then fn_info_message_lo - elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then + elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "wmc" ]; then fn_info_message_mc elif [ "${shortname}" == "mcb" ]; then fn_info_message_mcb @@ -1756,7 +1763,7 @@ fn_info_message_select_engine(){ fn_info_message_sb elif [ "${shortname}" == "sbots" ]; then fn_info_message_sbots - elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then + elif [ "${shortname}" == "scpsl" ] || [ "${shortname}" == "scpslsm" ]; then fn_info_message_scpsl elif [ "${shortname}" == "sdtd" ]; then fn_info_message_sdtd @@ -1798,6 +1805,8 @@ fn_info_message_select_engine(){ fn_info_message_ut2k4 elif [ "${shortname}" == "ut3" ]; then fn_info_message_ut3 + elif [ "${shortname}" == "vpmc" ]; then + fn_info_message_vpmc elif [ "${shortname}" == "wet" ]; then fn_info_message_wet elif [ "${shortname}" == "wf" ]; then diff --git a/lgsm/functions/info_stats.sh b/lgsm/functions/info_stats.sh index 03bebe4208..93c01cf32a 100755 --- a/lgsm/functions/info_stats.sh +++ b/lgsm/functions/info_stats.sh @@ -20,7 +20,7 @@ fi # to allow human readable uuid's. # e.g angry_proskuriakova_38a9ef76-4ae3-46a6-a895-7af474831eba -if [ ! -f "${datadir}/uuid-${selfname}.txt" ]||[ ! -f "${datadir}/uuid-install.txt" ]; then +if [ ! -f "${datadir}/uuid-${selfname}.txt" ] || [ ! -f "${datadir}/uuid-install.txt" ]; then # download dictionary words if [ ! -f "${datadir}/name-left.csv" ]; then fn_fetch_file_github "lgsm/data" "name-left.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nohash" @@ -30,7 +30,7 @@ if [ ! -f "${datadir}/uuid-${selfname}.txt" ]||[ ! -f "${datadir}/uuid-install.t fi # generate instance uuid - if [ -n "$(command -v uuidgen 2>/dev/null)" ]; then + if [ -n "$(command -v uuidgen 2> /dev/null)" ]; then uuid="$(uuidgen)" else uuid="$(cat /proc/sys/kernel/random/uuid)" @@ -40,7 +40,7 @@ if [ ! -f "${datadir}/uuid-${selfname}.txt" ]||[ ! -f "${datadir}/uuid-install.t nameright="$(shuf -n 1 "${datadir}/name-right.csv")" echo "instance_${nameleft}_${nameright}_${uuid}" > "${datadir}/uuid-${selfname}.txt" # generate install uuid if missing - if [ ! -f "${datadir}/uuid-install.txt" ];then + if [ ! -f "${datadir}/uuid-install.txt" ]; then echo "${nameleft}_${nameright}_${uuid}" > "${datadir}/uuid-install.txt" fi fi diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index a7c18b65de..8feb8655e6 100755 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Checks if server cfg dir exists, creates it if it doesn't. -fn_check_cfgdir(){ +fn_check_cfgdir() { if [ ! -d "${servercfgdir}" ]; then echo -e "creating ${servercfgdir} config directory." fn_script_log_info "creating ${servercfgdir} config directory." @@ -17,7 +17,7 @@ fn_check_cfgdir(){ } # Downloads default configs from Game-Server-Configs repo to lgsm/config-default. -fn_fetch_default_config(){ +fn_fetch_default_config() { echo -e "" echo -e "${lightyellow}Downloading ${gamename} Configs${default}" echo -e "=================================" @@ -31,7 +31,7 @@ fn_fetch_default_config(){ } # Copys default configs from Game-Server-Configs repo to server config location. -fn_default_config_remote(){ +fn_default_config_remote() { for config in "${array_configs[@]}"; do # every config is copied echo -e "copying ${config} config file." @@ -39,10 +39,10 @@ fn_default_config_remote(){ if [ "${config}" == "${servercfgdefault}" ]; then mkdir -p "${servercfgdir}" cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}" - elif [ "${shortname}" == "arma3" ]&&[ "${config}" == "${networkcfgdefault}" ]; then + elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then mkdir -p "${servercfgdir}" cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}" - elif [ "${shortname}" == "dst" ]&&[ "${config}" == "${clustercfgdefault}" ]; then + elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}" else mkdir -p "${servercfgdir}" @@ -53,7 +53,7 @@ fn_default_config_remote(){ } # Copys local default config to server config location. -fn_default_config_local(){ +fn_default_config_local() { echo -e "copying ${servercfgdefault} config file." cp -nv "${servercfgdir}/${servercfgdefault}" "${servercfgfullpath}" fn_sleep_time @@ -62,7 +62,7 @@ fn_default_config_local(){ # Changes some variables within the default configs. # SERVERNAME to LinuxGSM # PASSWORD to random password -fn_set_config_vars(){ +fn_set_config_vars() { if [ -f "${servercfgfullpath}" ]; then random=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs) servername="LinuxGSM" @@ -71,9 +71,9 @@ fn_set_config_vars(){ fn_script_log_info "changing hostname." fn_sleep_time # prevents var from being overwritten with the servername. - if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2>/dev/null; then + if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then sed -i "s/SERVERNAME=SERVERNAME/SERVERNAME=${servername}/g" "${servercfgfullpath}" - elif grep -q "SERVERNAME=\"SERVERNAME\"" "${lgsmdir}/config-default/config-game/${config}" 2>/dev/null; then + elif grep -q "SERVERNAME=\"SERVERNAME\"" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then sed -i "s/SERVERNAME=\"SERVERNAME\"/SERVERNAME=\"${servername}\"/g" "${servercfgfullpath}" else sed -i "s/SERVERNAME/${servername}/g" "${servercfgfullpath}" @@ -94,7 +94,7 @@ fn_set_config_vars(){ } # Changes some variables within the default Don't Starve Together configs. -fn_set_dst_config_vars(){ +fn_set_dst_config_vars() { ## cluster.ini if grep -Fq "SERVERNAME" "${clustercfgfullpath}"; then echo -e "changing server name." @@ -144,7 +144,7 @@ fn_set_dst_config_vars(){ } # Lists local config file locations -fn_list_config_locations(){ +fn_list_config_locations() { echo -e "" echo -e "${lightyellow}Config File Locations${default}" echo -e "=================================" @@ -167,21 +167,21 @@ if [ "${shortname}" == "sdtd" ]; then fn_list_config_locations elif [ "${shortname}" == "ac" ]; then gamedirname="AssettoCorsa" - array_configs+=( server_cfg.ini ) + array_configs+=(server_cfg.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ahl" ]; then gamedirname="ActionHalfLife" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ahl2" ]; then gamedirname="ActionSource" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -189,7 +189,7 @@ elif [ "${shortname}" == "ahl2" ]; then elif [ "${shortname}" == "ark" ]; then gamedirname="ARKSurvivalEvolved" fn_check_cfgdir - array_configs+=( GameUserSettings.ini ) + array_configs+=(GameUserSettings.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -197,7 +197,7 @@ elif [ "${shortname}" == "ark" ]; then elif [ "${shortname}" == "arma3" ]; then gamedirname="Arma3" fn_check_cfgdir - array_configs+=( server.cfg network.cfg ) + array_configs+=(server.cfg network.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -205,21 +205,21 @@ elif [ "${shortname}" == "arma3" ]; then elif [ "${shortname}" == "armar" ]; then gamedirname="ArmaReforger" fn_check_cfgdir - array_configs+=( server.json ) + array_configs+=(server.json) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "bo" ]; then gamedirname="BallisticOverkill" - array_configs+=( config.txt ) + array_configs+=(config.txt) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations -elif [ "${shortname}" == "bo" ]; then +elif [ "${shortname}" == "bd" ]; then gamedirname="BaseDefense" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -227,7 +227,7 @@ elif [ "${shortname}" == "bo" ]; then elif [ "${shortname}" == "bt" ]; then gamedirname="Barotrauma" fn_check_cfgdir - array_configs+=( serversettings.xml ) + array_configs+=(serversettings.xml) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -235,133 +235,133 @@ elif [ "${shortname}" == "bt" ]; then elif [ "${shortname}" == "bt1944" ]; then gamedirname="Battalion1944" fn_check_cfgdir - array_configs+=( DefaultGame.ini ) + array_configs+=(DefaultGame.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "bf1942" ]; then gamedirname="Battlefield1942" - array_configs+=( serversettings.con ) + array_configs+=(serversettings.con) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "bfv" ]; then gamedirname="BattlefieldVietnam" - array_configs+=( serversettings.con ) + array_configs+=(serversettings.con) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "bs" ]; then gamedirname="BladeSymphony" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "bb" ]; then gamedirname="BrainBread" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "bb2" ]; then gamedirname="BrainBread2" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "bmdm" ]; then gamedirname="BlackMesa" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "cd" ]; then gamedirname="CraftingDead" - array_configs+=( properties.json ) + array_configs+=(properties.json) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "cod" ]; then gamedirname="CallOfDuty" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "coduo" ]; then gamedirname="CallOfDutyUnitedOffensive" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "cod2" ]; then gamedirname="CallOfDuty2" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "cod4" ]; then gamedirname="CallOfDuty4" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "codwaw" ]; then gamedirname="CallOfDutyWorldAtWar" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "cc" ]; then gamedirname="CodenameCURE" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "col" ]; then gamedirname="ColonySurvival" - array_configs+=( colserver.json ) + array_configs+=(colserver.json) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "cs" ]; then gamedirname="CounterStrike" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "cscz" ]; then gamedirname="CounterStrikeConditionZero" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "csgo" ]; then gamedirname="CounterStrikeGlobalOffensive" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "css" ]; then gamedirname="CounterStrikeSource" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -369,41 +369,41 @@ elif [ "${shortname}" == "css" ]; then elif [ "${shortname}" == "dayz" ]; then gamedirname="DayZ" fn_check_cfgdir - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "dod" ]; then gamedirname="DayOfDefeat" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "dodr" ]; then gamedirname="DayOfDragons" - array_configs+=( Game.ini ) + array_configs+=(Game.ini) fn_fetch_default_config fn_default_config_remote fn_list_config_locations elif [ "${shortname}" == "dods" ]; then gamedirname="DayOfDefeatSource" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "doi" ]; then gamedirname="DayOfInfamy" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "dmc" ]; then gamedirname="DeathmatchClassic" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -411,154 +411,154 @@ elif [ "${shortname}" == "dmc" ]; then elif [ "${shortname}" == "dst" ]; then gamedirname="DontStarveTogether" fn_check_cfgdir - array_configs+=( cluster.ini server.ini ) + array_configs+=(cluster.ini server.ini) fn_fetch_default_config fn_default_config_remote fn_set_dst_config_vars fn_list_config_locations elif [ "${shortname}" == "dab" ]; then gamedirname="DoubleActionBoogaloo" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "dys" ]; then gamedirname="Dystopia" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "eco" ]; then gamedirname="Eco" - array_configs+=( Network.eco ) + array_configs+=(Network.eco) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "etl" ]; then gamedirname="ETLegacy" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "fctr" ]; then gamedirname="Factorio" - array_configs+=( server-settings.json ) + array_configs+=(server-settings.json) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "fof" ]; then gamedirname="FistfulofFrags" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "gmod" ]; then gamedirname="GarrysMod" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "hldm" ]; then gamedirname="HalfLifeDeathmatch" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "hldms" ]; then gamedirname="HalfLifeDeathmatchSource" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "opfor" ]; then gamedirname="OpposingForce" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "hl2dm" ]; then gamedirname="HalfLife2Deathmatch" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ins" ]; then gamedirname="Insurgency" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ios" ]; then gamedirname="IOSoccer" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "jc2" ]; then gamedirname="JustCause2" - array_configs+=( config.lua ) + array_configs+=(config.lua) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "jc3" ]; then gamedirname="JustCause3" - array_configs+=( config.json ) + array_configs+=(config.json) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "kf" ]; then gamedirname="KillingFloor" - array_configs+=( Default.ini ) + array_configs+=(Default.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "l4d" ]; then gamedirname="Left4Dead" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "l4d2" ]; then gamedirname="Left4Dead2" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations -elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then +elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then gamedirname="Minecraft" - array_configs+=( server.properties ) + array_configs+=(server.properties) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "mcb" ]; then gamedirname="MinecraftBedrock" - array_configs+=( server.properties ) + array_configs+=(server.properties) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "mohaa" ]; then gamedirname="MedalOfHonorAlliedAssault" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -566,28 +566,28 @@ elif [ "${shortname}" == "mohaa" ]; then elif [ "${shortname}" == "mh" ]; then gamedirname="Mordhau" fn_check_cfgdir - array_configs+=( Game.ini ) + array_configs+=(Game.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ns" ]; then gamedirname="NaturalSelection" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "nmrih" ]; then gamedirname="NoMoreRoominHell" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "nd" ]; then gamedirname="NuclearDawn" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -595,33 +595,33 @@ elif [ "${shortname}" == "nd" ]; then elif [ "${shortname}" == "mta" ]; then gamedirname="MultiTheftAuto" fn_check_cfgdir - array_configs+=( acl.xml mtaserver.conf vehiclecolors.conf ) + array_configs+=(acl.xml mtaserver.conf vehiclecolors.conf) fn_fetch_default_config fn_default_config_remote fn_list_config_locations -elif [ "${shotname}" == "mom" ];then +elif [ "${shotname}" == "mom" ]; then gamedirname="MemoriesofMars" - array_configs+=( DedicatedServerConfig.cfg) + array_configs+=(DedicatedServerConfig.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "mumble" ]; then gamedirname="Mumble" - array_configs+=( murmur.ini ) + array_configs+=(murmur.ini) fn_fetch_default_config fn_default_config_remote fn_list_config_locations elif [ "${shortname}" == "pvr" ]; then gamedirname="PavlovVR" fn_check_cfgdir - array_configs+=( Game.ini ) + array_configs+=(Game.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars elif [ "${shortname}" == "pvkii" ]; then gamedirname="PiratesVikingandKnightsII" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -629,14 +629,14 @@ elif [ "${shortname}" == "pvkii" ]; then elif [ "${shortname}" == "pz" ]; then gamedirname="ProjectZomboid" fn_check_cfgdir - array_configs+=( server.ini ) + array_configs+=(server.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "pc" ]; then gamedirname="ProjectCars" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -647,48 +647,48 @@ elif [ "${shortname}" == "pc2" ]; then fn_list_config_locations elif [ "${shortname}" == "q2" ]; then gamedirname="Quake2" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "q3" ]; then gamedirname="Quake3Arena" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ql" ]; then gamedirname="QuakeLive" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "jk2" ]; then gamedirname="JediKnightIIJediOutcast" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars elif [ "${shortname}" == "qw" ]; then gamedirname="QuakeWorld" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ricochet" ]; then gamedirname="Ricochet" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "rtcw" ]; then gamedirname="ReturnToCastleWolfenstein" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -696,124 +696,124 @@ elif [ "${shortname}" == "rtcw" ]; then elif [ "${shortname}" == "rust" ]; then gamedirname="Rust" fn_check_cfgdir - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_list_config_locations -elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then +elif [ "${shortname}" == "scpsl" ] || [ "${shortname}" == "scpslsm" ]; then gamedirname="SCPSecretLaboratory" - array_configs+=( config_gameplay.txt config_localadmin.txt ) + array_configs+=(config_gameplay.txt config_localadmin.txt) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "sf" ]; then gamedirname="Satisfactory" - array_configs+=( GameUserSettings.ini ) + array_configs+=(GameUserSettings.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "sol" ]; then gamedirname="Soldat" - array_configs+=( soldat.ini ) + array_configs+=(soldat.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "sof2" ]; then gamedirname="SoldierOfFortune2Gold" - array_configs+=( server.cfg mapcycle.txt) + array_configs+=(server.cfg mapcycle.txt) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "sfc" ]; then gamedirname="SourceFortsClassic" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "squad" ]; then gamedirname="Squad" - array_configs+=( Admins.cfg Bans.cfg License.cfg Server.cfg Rcon.cfg ) + array_configs+=(Admins.cfg Bans.cfg License.cfg Server.cfg Rcon.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "sb" ]; then gamedirname="Starbound" - array_configs+=( starbound_server.config ) + array_configs+=(starbound_server.config) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "st" ]; then gamedirname="Stationeers" - array_configs+=( default.ini ) + array_configs+=(default.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "stn" ]; then gamedirname="SurvivetheNights" - array_configs+=( ServerConfig.txt ServerUsers.txt TpPresets.json UserPermissions.json ) + array_configs+=(ServerConfig.txt ServerUsers.txt TpPresets.json UserPermissions.json) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "sven" ]; then gamedirname="SvenCoop" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "tf2" ]; then gamedirname="TeamFortress2" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "tfc" ]; then gamedirname="TeamFortressClassic" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ti" ]; then gamedirname="TheIsle" - array_configs+=( Game.ini ) + array_configs+=(Game.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ts" ]; then gamedirname="TheSpecialists" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ts3" ]; then gamedirname="TeamSpeak3" - array_configs+=( ts3server.ini ) + array_configs+=(ts3server.ini) fn_fetch_default_config fn_default_config_remote fn_list_config_locations elif [ "${shortname}" == "tw" ]; then gamedirname="Teeworlds" - array_configs+=( server.cfg ctf.cfg dm.cfg duel.cfg tdm.cfg ) + array_configs+=(server.cfg ctf.cfg dm.cfg duel.cfg tdm.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "terraria" ]; then gamedirname="Terraria" - array_configs+=( serverconfig.txt ) + array_configs+=(serverconfig.txt) fn_fetch_default_config fn_default_config_remote fn_set_config_vars @@ -821,90 +821,90 @@ elif [ "${shortname}" == "terraria" ]; then elif [ "${shortname}" == "tu" ]; then gamedirname="TowerUnite" fn_check_cfgdir - array_configs+=( TowerServer.ini ) + array_configs+=(TowerServer.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ut" ]; then gamedirname="UnrealTournament" - array_configs+=( Game.ini Engine.ini ) + array_configs+=(Game.ini Engine.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ut2k4" ]; then gamedirname="UnrealTournament2004" - array_configs+=( UT2004.ini ) + array_configs+=(UT2004.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "ut99" ]; then gamedirname="UnrealTournament99" - array_configs+=( Default.ini ) + array_configs+=(Default.ini) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "unt" ]; then gamedirname="Unturned" - array_configs+=( Config.json ) + array_configs+=(Config.json) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "vints" ]; then gamedirname="VintageStory" - array_configs+=( serverconfig.json ) + array_configs+=(serverconfig.json) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "vs" ]; then gamedirname="VampireSlayer" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "wet" ]; then gamedirname="WolfensteinEnemyTerritory" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "wf" ]; then gamedirname="Warfork" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "wmc" ]; then gamedirname="Waterfall" - array_configs+=( config.yml ) + array_configs+=(config.yml) fn_fetch_default_config fn_default_config_remote fn_set_config_vars elif [ "${shortname}" == "wurm" ]; then gamedirname="WurmUnlimited" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "zmr" ]; then gamedirname="ZombieMasterReborn" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "zps" ]; then gamedirname="ZombiePanicSource" - array_configs+=( server.cfg ) + array_configs+=(server.cfg) fn_fetch_default_config fn_default_config_remote fn_set_config_vars diff --git a/lgsm/functions/install_eula.sh b/lgsm/functions/install_eula.sh index d7c0b0b7ae..5b8b4db5d3 100755 --- a/lgsm/functions/install_eula.sh +++ b/lgsm/functions/install_eula.sh @@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "${shortname}" == "ts3" ]; then eulaurl="https://www.teamspeak.com/en/privacy-and-terms" -elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then +elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then eulaurl="https://account.mojang.com/documents/minecraft_eula" elif [ "${shortname}" == "ut" ]; then eulaurl="https://www.epicgames.com/unrealtournament/unreal-tournament-pre-alpha-test-development-build-eula" @@ -41,7 +41,7 @@ fi if [ "${shortname}" == "ts3" ]; then touch "${executabledir}/.ts3server_license_accepted" -elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then +elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then touch "${serverfiles}/eula.txt" echo -e "eula=true" > "${serverfiles}/eula.txt" elif [ "${shortname}" == "ut" ]; then diff --git a/lgsm/functions/install_gslt.sh b/lgsm/functions/install_gslt.sh index a8f8065c26..1ae1ef3b01 100755 --- a/lgsm/functions/install_gslt.sh +++ b/lgsm/functions/install_gslt.sh @@ -11,7 +11,7 @@ echo -e "" echo -e "${lightyellow}Game Server Login Token${default}" echo -e "=================================" fn_sleep_time -if [ "${shortname}" == "csgo" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "bs" ]; then +if [ "${shortname}" == "csgo" ] || [ "${shortname}" == "css" ] || [ "${shortname}" == "nmrih" ] || [ "${shortname}" == "bs" ]; then echo -e "GSLT is required to run a public ${gamename} server" fn_script_log_info "GSLT is required to run a public ${gamename} server" else diff --git a/lgsm/functions/install_logs.sh b/lgsm/functions/install_logs.sh index 57a41500cd..80a55fb944 100755 --- a/lgsm/functions/install_logs.sh +++ b/lgsm/functions/install_logs.sh @@ -59,7 +59,7 @@ if [ "${consolelogdir}" ]; then fi # Create Game logs. -if [ "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then +if [ "${gamelogdir}" ] && [ ! -d "${gamelogdir}" ]; then echo -en "installing game log dir: ${gamelogdir}..." if ! mkdir -p "${gamelogdir}"; then fn_print_fail_eol_nl diff --git a/lgsm/functions/install_retry.sh b/lgsm/functions/install_retry.sh index 080f864a2f..a36b4fb38d 100755 --- a/lgsm/functions/install_retry.sh +++ b/lgsm/functions/install_retry.sh @@ -8,7 +8,8 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if fn_prompt_yn "Retry install?" Y; then - command_install.sh; core_exit.sh + command_install.sh + core_exit.sh else exitcode=0 core_exit.sh diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index 91fb1743a5..c9faf643a7 100755 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -7,61 +7,196 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_install_server_files(){ +fn_install_server_files() { if [ "${shortname}" == "ahl" ]; then - remote_fileurl="http://linuxgsm.download/ActionHalfLife/action_halflife-1.0.tar.xz"; local_filedir="${tmpdir}"; local_filename="action_halflife-1.0.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="61d7b79fd714888b6d65944fdaafa94a" + remote_fileurl="http://linuxgsm.download/ActionHalfLife/action_halflife-1.0.tar.xz" + local_filedir="${tmpdir}" + local_filename="action_halflife-1.0.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="61d7b79fd714888b6d65944fdaafa94a" elif [ "${shortname}" == "bf1942" ]; then - remote_fileurl="http://linuxgsm.download/BattleField1942/bf1942_lnxded-1.61-hacked-to-1.612.full.tar.xz"; local_filedir="${tmpdir}"; local_filename="bf1942_lnxded-1.61-hacked-to-1.612.full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="4223bf4ed85f5162c24b2cba51249b9e" - elif [ "${shortname}" == "bfv" ];then - remote_fileurl="http://linuxgsm.download/BattlefieldVietnam/bfv_linded-v1.21-20041207_patch.tar.xz"; local_filedir="${tmpdir}"; local_filename="bfv_linded-v1.21-20041207_patch.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="e3b4962cdd9d41e23c6fed65101bccde" + remote_fileurl="http://linuxgsm.download/BattleField1942/bf1942_lnxded-1.61-hacked-to-1.612.full.tar.xz" + local_filedir="${tmpdir}" + local_filename="bf1942_lnxded-1.61-hacked-to-1.612.full.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="4223bf4ed85f5162c24b2cba51249b9e" + elif [ "${shortname}" == "bfv" ]; then + remote_fileurl="http://linuxgsm.download/BattlefieldVietnam/bfv_linded-v1.21-20041207_patch.tar.xz" + local_filedir="${tmpdir}" + local_filename="bfv_linded-v1.21-20041207_patch.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="e3b4962cdd9d41e23c6fed65101bccde" elif [ "${shortname}" == "bb" ]; then - remote_fileurl="http://linuxgsm.download/BrainBread/brainbread-v1.2-linuxserver.tar.xz"; local_filedir="${tmpdir}"; local_filename="brainbread-v1.2-linuxserver.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="55f227183b736397806d5b6db6143f15" + remote_fileurl="http://linuxgsm.download/BrainBread/brainbread-v1.2-linuxserver.tar.xz" + local_filedir="${tmpdir}" + local_filename="brainbread-v1.2-linuxserver.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="55f227183b736397806d5b6db6143f15" elif [ "${shortname}" == "cod" ]; then - remote_fileurl="http://linuxgsm.download/CallOfDuty/cod-lnxded-1.5b-full.tar.xz"; local_filedir="${tmpdir}"; local_filename="cod-lnxded-1.5-large.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="ee0ad1ccbfa1fd27fde01a4a431a5c2f" + remote_fileurl="http://linuxgsm.download/CallOfDuty/cod-lnxded-1.5b-full.tar.xz" + local_filedir="${tmpdir}" + local_filename="cod-lnxded-1.5-large.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="ee0ad1ccbfa1fd27fde01a4a431a5c2f" elif [ "${shortname}" == "coduo" ]; then - remote_fileurl="http://linuxgsm.download/CallOfDutyUnitedOffensive/coduo-lnxded-1.51b-full.tar.xz"; local_filedir="${tmpdir}"; local_filename="coduo-lnxded-1.51b-full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="35cabccd67adcda44aaebc59405915b9" + remote_fileurl="http://linuxgsm.download/CallOfDutyUnitedOffensive/coduo-lnxded-1.51b-full.tar.xz" + local_filedir="${tmpdir}" + local_filename="coduo-lnxded-1.51b-full.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="35cabccd67adcda44aaebc59405915b9" elif [ "${shortname}" == "cod2" ]; then - remote_fileurl="http://linuxgsm.download/CallOfDuty2/cod2-lnxded-1.3-full.tar.xz"; local_filedir="${tmpdir}"; local_filename="cod2-lnxded-1.3-full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="b8c4c611f01627dd43348e78478a3d41" + remote_fileurl="http://linuxgsm.download/CallOfDuty2/cod2-lnxded-1.3-full.tar.xz" + local_filedir="${tmpdir}" + local_filename="cod2-lnxded-1.3-full.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="b8c4c611f01627dd43348e78478a3d41" elif [ "${shortname}" == "cod4" ]; then - remote_fileurl="http://linuxgsm.download/CallOfDuty4/cod4x18_1790_lnxded.tar.xz"; local_filedir="${tmpdir}"; local_filename="cod4x18_1790_lnxded.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="30609db2afde09d22498fbab3a427d11" + remote_fileurl="http://linuxgsm.download/CallOfDuty4/cod4x18_lnxded.tar.xz" + local_filedir="${tmpdir}" + local_filename="cod4x18_lnxded.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="d255b59b9756d7dbead67718208512ee" elif [ "${shortname}" == "codwaw" ]; then - remote_fileurl="http://linuxgsm.download/CallOfDutyWorldAtWar/codwaw-lnxded-1.7-full.tar.xz"; local_filedir="${tmpdir}"; local_filename="codwaw-lnxded-1.7-full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2c6be1bb66ea631b9b2e7ae6216c6680" + remote_fileurl="http://linuxgsm.download/CallOfDutyWorldAtWar/codwaw-lnxded-1.7-full.tar.xz" + local_filedir="${tmpdir}" + local_filename="codwaw-lnxded-1.7-full.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="2c6be1bb66ea631b9b2e7ae6216c6680" elif [ "${shortname}" == "etl" ]; then - remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/etlegacy-v2.78.1-i386-et-260b.tar.xz"; local_filedir="${tmpdir}"; local_filename="etlegacy-v2.78.1-i386-et-260b.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="7c08b52cb09b30eadb98ea05ef780fc7" + remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/etlegacy-v2.78.1-i386-et-260b.tar.xz" + local_filedir="${tmpdir}" + local_filename="etlegacy-v2.78.1-i386-et-260b.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="7c08b52cb09b30eadb98ea05ef780fc7" elif [ "${shortname}" == "mohaa" ]; then - remote_fileurl="http://linuxgsm.download/MedalofHonorAlliedAssault/moh_revival_v1.12_RC3.5.1.tar.xz"; local_filedir="${tmpdir}"; local_filename="moh_revival_v1.12_RC3.5.1.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="7c664538999252eeaf2b6d9949416480" + remote_fileurl="http://linuxgsm.download/MedalofHonorAlliedAssault/moh_revival_v1.12_RC3.5.1.tar.xz" + local_filedir="${tmpdir}" + local_filename="moh_revival_v1.12_RC3.5.1.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="7c664538999252eeaf2b6d9949416480" elif [ "${shortname}" == "ns" ]; then - remote_fileurl="http://linuxgsm.download/NaturalSelection/ns_dedicated_server_v32.tar.xz"; local_filedir="${tmpdir}"; local_filename="ns_dedicated_server_v32.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="23ec3cadd93d8bb1c475bad5b9cce370" + remote_fileurl="http://linuxgsm.download/NaturalSelection/ns_dedicated_server_v32.tar.xz" + local_filedir="${tmpdir}" + local_filename="ns_dedicated_server_v32.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="23ec3cadd93d8bb1c475bad5b9cce370" elif [ "${shortname}" == "q2" ]; then - remote_fileurl="http://linuxgsm.download/Quake2/quake2-3.20-glibc-i386-full-linux2.0.tar.xz"; local_filedir="${tmpdir}"; local_filename="quake2-3.20-glibc-i386-full-linux2.0.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2908164a32d4808bb720f2161f6b0c82" + remote_fileurl="http://linuxgsm.download/Quake2/quake2-3.20-glibc-i386-full-linux2.0.tar.xz" + local_filedir="${tmpdir}" + local_filename="quake2-3.20-glibc-i386-full-linux2.0.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="2908164a32d4808bb720f2161f6b0c82" elif [ "${shortname}" == "q3" ]; then - remote_fileurl="http://linuxgsm.download/Quake3/quake3-1.32c-x86-full-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="quake3-1.32c-x86-full-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="b0e26d8919fe9313fb9d8ded2360f3db" + remote_fileurl="http://linuxgsm.download/Quake3/quake3-1.32c-x86-full-linux.tar.xz" + local_filedir="${tmpdir}" + local_filename="quake3-1.32c-x86-full-linux.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="b0e26d8919fe9313fb9d8ded2360f3db" elif [ "${shortname}" == "qw" ]; then - remote_fileurl="http://linuxgsm.download/QuakeWorld/nquake.server.linux.190506.full.tar.xz"; local_filedir="${tmpdir}"; local_filename="nquake.server.linux.190506.full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="82055b7d973206c13a606db8ba288d03" + remote_fileurl="http://linuxgsm.download/QuakeWorld/nquake.server.linux.190506.full.tar.xz" + local_filedir="${tmpdir}" + local_filename="nquake.server.linux.190506.full.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="82055b7d973206c13a606db8ba288d03" elif [ "${shortname}" == "rtcw" ]; then - remote_fileurl="http://linuxgsm.download/ReturnToCastleWolfenstein/iortcw-1.51c-x86_64-server-linux-20190507.tar.xz"; local_filedir="${tmpdir}"; local_filename="iortcw-1.51c-x86_64-server-linux-20190507.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="df6ff664d37dd0d22787848bdb3cac5f" + remote_fileurl="http://linuxgsm.download/ReturnToCastleWolfenstein/iortcw-1.51c-x86_64-server-linux-20190507.tar.xz" + local_filedir="${tmpdir}" + local_filename="iortcw-1.51c-x86_64-server-linux-20190507.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="df6ff664d37dd0d22787848bdb3cac5f" elif [ "${shortname}" == "sfc" ]; then - remote_fileurl="http://linuxgsm.download/SourceFortsClassic/SFClassic-1.0-RC7-fix.tar.xz"; local_filedir="${tmpdir}"; local_filename="SFClassic-1.0-RC7-fix.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="70077137185700e28fe6bbb6021d12bc" + remote_fileurl="http://linuxgsm.download/SourceFortsClassic/SFClassic-1.0-RC7-fix.tar.xz" + local_filedir="${tmpdir}" + local_filename="SFClassic-1.0-RC7-fix.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="70077137185700e28fe6bbb6021d12bc" elif [ "${shortname}" == "sof2" ]; then - remote_fileurl="http://linuxgsm.download/SoldierOfFortune2/sof2gold-1.03.tar.xz"; local_filedir="${tmpdir}"; local_filename="sof2gold-1.03.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="201e23bab04207d00ce813d001c483d9" + remote_fileurl="http://linuxgsm.download/SoldierOfFortune2/sof2gold-1.03.tar.xz" + local_filedir="${tmpdir}" + local_filename="sof2gold-1.03.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="201e23bab04207d00ce813d001c483d9" elif [ "${shortname}" == "ts" ]; then - remote_fileurl="http://linuxgsm.download/TheSpecialists/ts-3-linux-final.tar.xz"; local_filedir="${tmpdir}"; local_filename="ts-3-linux-final.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="3c66ecff6e3644f7ac88015732a0fb93" + remote_fileurl="http://linuxgsm.download/TheSpecialists/ts-3-linux-final.tar.xz" + local_filedir="${tmpdir}" + local_filename="ts-3-linux-final.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="3c66ecff6e3644f7ac88015732a0fb93" elif [ "${shortname}" == "ut2k4" ]; then - remote_fileurl="http://linuxgsm.download/UnrealTournament2004/ut2004-server-3369-3-ultimate-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="ut2004-server-3369-3-ultimate-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="9fceaab68554749f4b45be66613b9a15" + remote_fileurl="http://linuxgsm.download/UnrealTournament2004/ut2004-server-3369-3-ultimate-linux.tar.xz" + local_filedir="${tmpdir}" + local_filename="ut2004-server-3369-3-ultimate-linux.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="9fceaab68554749f4b45be66613b9a15" elif [ "${shortname}" == "ut99" ]; then - remote_fileurl="http://linuxgsm.download/UnrealTournament99/ut99-server-469b-ultimate-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="ut99-server-469b-ultimate-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="dba3f1122a5e60ee45ece7422fcf78f5" + remote_fileurl="http://linuxgsm.download/UnrealTournament99/ut99-server-469b-ultimate-linux.tar.xz" + local_filedir="${tmpdir}" + local_filename="ut99-server-469b-ultimate-linux.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="dba3f1122a5e60ee45ece7422fcf78f5" elif [ "${shortname}" == "ut" ]; then - remote_fileurl="http://linuxgsm.download/UnrealTournament/UnrealTournament-Server-XAN-3525360-Linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="UnrealTournament-Server-XAN-3525360-Linux.tar.xz"; chmodx="noexecute" run="norun"; force="noforce"; md5="41dd92015713a78211eaccf503b72393" + remote_fileurl="http://linuxgsm.download/UnrealTournament/UnrealTournament-Server-XAN-3525360-Linux.tar.xz" + local_filedir="${tmpdir}" + local_filename="UnrealTournament-Server-XAN-3525360-Linux.tar.xz" + chmodx="noexecute" run="norun" + force="noforce" + md5="41dd92015713a78211eaccf503b72393" elif [ "${shortname}" == "ut3" ]; then - remote_fileurl="http://linuxgsm.download/UnrealTournament3/UT3-linux-server-2.1.tar.xz"; local_filedir="${tmpdir}"; local_filename="UT3-linux-server-2.1.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="8876cca61e3f83ea08db25208bde6ac6" + remote_fileurl="http://linuxgsm.download/UnrealTournament3/UT3-linux-server-2.1.tar.xz" + local_filedir="${tmpdir}" + local_filename="UT3-linux-server-2.1.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="8876cca61e3f83ea08db25208bde6ac6" elif [ "${shortname}" == "vs" ]; then - remote_fileurl="http://linuxgsm.download/VampireSlayer/vs_l-6.0_full.tar.xz"; local_filedir="${tmpdir}"; local_filename="vs_l-6.0_full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="b322f79e0abd31847493c52acf802667" + remote_fileurl="http://linuxgsm.download/VampireSlayer/vs_l-6.0_full.tar.xz" + local_filedir="${tmpdir}" + local_filename="vs_l-6.0_full.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="b322f79e0abd31847493c52acf802667" elif [ "${shortname}" == "wet" ]; then - remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/enemy-territory.260b.tar.xz"; local_filedir="${tmpdir}"; local_filename="enemy-territory.260b.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="581a333cc7eacda2f56d5a00fe11eafa" + remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/enemy-territory.260b.tar.xz" + local_filedir="${tmpdir}" + local_filename="enemy-territory.260b.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="581a333cc7eacda2f56d5a00fe11eafa" elif [ "${shortname}" == "samp" ]; then - remote_fileurl="https://files.sa-mp.com/samp037svr_R2-1.tar.gz"; local_filedir="${tmpdir}"; local_filename="samp037svr_R2-1.tar.gz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="93705e165550c97484678236749198a4" + remote_fileurl="https://files.sa-mp.com/samp037svr_R2-1.tar.gz" + local_filedir="${tmpdir}" + local_filename="samp037svr_R2-1.tar.gz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="93705e165550c97484678236749198a4" elif [ "${shortname}" == "zmr" ]; then - remote_fileurl="http://linuxgsm.download/ZombieMasterReborn/zombie_master_reborn_b5_2.tar.xz"; local_filedir="${tmpdir}"; local_filename="zombie_master_reborn_b5_2.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="4b9b9832e863d03981a40c26065792a6" + remote_fileurl="http://linuxgsm.download/ZombieMasterReborn/zombie_master_reborn_b6_1.tar.xz" + local_filedir="${tmpdir}" + local_filename="zombie_master_reborn_b6_1.tar.xz" + chmodx="nochmodx" run="norun" + force="noforce" + md5="0188ae86dbc9376f11ae3032dba2d665" fi fn_fetch_file "${remote_fileurl}" "" "" "" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}" @@ -87,7 +222,7 @@ elif [ "${shortname}" == "mcb" ]; then elif [ "${shortname}" == "pmc" ]; then install_eula.sh update_papermc.sh -elif [ "${shortname}" == "wmc" ]; then +elif [ "${shortname}" == "wmc" ]||[ "${shortname}" == "vpmc" ]; then update_papermc.sh elif [ "${shortname}" == "mumble" ]; then update_mumble.sh @@ -100,7 +235,7 @@ elif [ "${shortname}" == "jk2" ]; then update_jediknight2.sh elif [ "${shortname}" == "vints" ]; then update_vintagestory.sh -elif [ -z "${appid}" ]||[ "${shortname}" == "ahl" ]||[ "${shortname}" == "bd" ]||[ "${shortname}" == "bb" ]||[ "${shortname}" == "ns" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "ts" ]||[ "${shortname}" == "vs" ]||[ "${shortname}" == "zmr" ]; then +elif [ -z "${appid}" ] || [ "${shortname}" == "ahl" ] || [ "${shortname}" == "bb" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "sfc" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "vs" ] || [ "${shortname}" == "zmr" ]; then if [ "${shortname}" == "ut" ]; then install_eula.sh fi diff --git a/lgsm/functions/install_ts3db.sh b/lgsm/functions/install_ts3db.sh index 07ab7a111a..e394296de9 100755 --- a/lgsm/functions/install_ts3db.sh +++ b/lgsm/functions/install_ts3db.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_install_ts3db_mariadb(){ +fn_install_ts3db_mariadb() { if [ ! -f "${serverfiles}/libts3db_mariadb.so" ]; then echo -e "copying libmariadb.so.2...\c" cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}" @@ -34,13 +34,13 @@ fn_install_ts3db_mariadb(){ read -rp "Enter MariaDB socket path: " mariadbsocket { - echo -e "[config]" - echo -e "host='${mariahostname}'" - echo -e "port='${mariaport}'" - echo -e "username='${mariausername}'" - echo -e "password='${mariapassword}'" - echo -e "database='${mariadbname}'" - echo -e "socket='${mariadbsocket}'" + echo -e "[config]" + echo -e "host='${mariahostname}'" + echo -e "port='${mariaport}'" + echo -e "username='${mariausername}'" + echo -e "password='${mariapassword}'" + echo -e "database='${mariadbname}'" + echo -e "socket='${mariadbsocket}'" } >> "${servercfgdir}/ts3db_mariadb.ini" sed -i "s/dbplugin=ts3db_sqlite3/dbplugin=ts3db_mariadb/g" "${servercfgfullpath}" sed -i "s/dbpluginparameter=/dbpluginparameter=ts3db_mariadb.ini/g" "${servercfgfullpath}" @@ -58,7 +58,7 @@ if [ -z "${autoinstall}" ]; then fn_install_ts3db_mariadb fi else -fn_print_information_nl "./${selfname} auto-install is uses sqlite. For MariaDB use ./${selfname} install" + fn_print_information_nl "./${selfname} auto-install is uses sqlite. For MariaDB use ./${selfname} install" fi install_eula.sh diff --git a/lgsm/functions/mods_core.sh b/lgsm/functions/mods_core.sh index 47ac70cb2a..7e2d097a79 100755 --- a/lgsm/functions/mods_core.sh +++ b/lgsm/functions/mods_core.sh @@ -17,7 +17,7 @@ modsinstalledlistfullpath="${modsdir}/${modsinstalledlist}" ## Installation. # Download management. -fn_mod_install_files(){ +fn_mod_install_files() { fn_fetch_file "${modurl}" "" "" "" "${modstmpdir}" "${modfilename}" # Check if variable is valid checking if file has been downloaded and exists. if [ ! -f "${modstmpdir}/${modfilename}" ]; then @@ -32,7 +32,7 @@ fn_mod_install_files(){ } # Convert mod files to lowercase if needed. -fn_mod_lowercase(){ +fn_mod_lowercase() { # Checking lowercase settings from mods array definition if [ "${modlowercase}" == "LowercaseOn" ]; then echo -en "converting ${modprettyname} files to lowercase..." @@ -63,13 +63,13 @@ fn_mod_lowercase(){ core_exit.sh fi fi - done < <(find "${extractdir}" -depth -name '*[[:upper:]]*') - fn_print_ok_eol_nl - fi + done < <(find "${extractdir}" -depth -name '*[[:upper:]]*') + fn_print_ok_eol_nl + fi } # Create ${modcommand}-files.txt containing the full extracted file/directory list. -fn_mod_create_filelist(){ +fn_mod_create_filelist() { echo -en "building ${modcommand}-files.txt..." fn_sleep_time # ${modsdir}/${modcommand}-files.txt. @@ -90,7 +90,7 @@ fn_mod_create_filelist(){ } # Copy the mod into serverfiles. -fn_mod_copy_destination(){ +fn_mod_copy_destination() { echo -en "copying ${modprettyname} to ${modinstalldir}..." fn_sleep_time cp -Rf "${extractdir}/." "${modinstalldir}/" @@ -105,7 +105,7 @@ fn_mod_copy_destination(){ } # Add the mod to the installed-mods.txt. -fn_mod_add_list(){ +fn_mod_add_list() { if [ -z "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then echo -e "${modcommand}" >> "${modsinstalledlistfullpath}" fn_script_log_info "${modcommand} added to ${modsinstalledlist}" @@ -113,7 +113,7 @@ fn_mod_add_list(){ } # Prevent sensitive directories from being erased upon uninstall by removing them from: ${modcommand}-files.txt. -fn_mod_tidy_files_list(){ +fn_mod_tidy_files_list() { # Check file list validity. fn_check_mod_files_list # Output to the user @@ -126,7 +126,7 @@ fn_mod_tidy_files_list(){ # generate elements to remove from list. removefromlistamount=$(echo -e "${removefromlist}" | awk -F ';' '{ print NF }') # Test all subvalue of "removefromlist" using the ";" separator. - for ((filesindex=1; filesindex < removefromlistamount; filesindex++)); do + for ((filesindex = 1; filesindex < removefromlistamount; filesindex++)); do # Put current file into test variable. removefilevar=$(echo -e "${removefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }') # Delete line(s) matching exactly. @@ -193,15 +193,15 @@ fn_mod_tidy_files_list(){ ## Information Gathering. # Get details of a mod any (relevant and unique, such as full mod name or install command) value. -fn_mod_get_info(){ +fn_mod_get_info() { # Variable to know when job is done. modinfocommand="0" # Find entry in global array. - for ((index=0; index <= ${#mods_global_array[@]}; index++)); do + for ((index = 0; index <= ${#mods_global_array[@]}; index++)); do # When entry is found. if [ "${mods_global_array[index]}" == "${currentmod}" ]; then # Go back to the previous "MOD" separator. - for ((index=index; index <= ${#mods_global_array[@]}; index--)); do + for ((index = index; index <= ${#mods_global_array[@]}; index--)); do # When "MOD" is found. if [ "${mods_global_array[index]}" == "MOD" ]; then # Get info. @@ -226,31 +226,31 @@ fn_mod_get_info(){ } # Define all variables for a mod at once when index is set to a separator. -fn_mods_define(){ -if [ -z "$index" ]; then - fn_script_log_fatal "index variable not set. Please report an issue." - fn_print_error "index variable not set. Please report an issue." - echo -e "* https://github.com/GameServerManagers/LinuxGSM/issues" - core_exit.sh -fi - modcommand="${mods_global_array[index+1]}" - modprettyname="${mods_global_array[index+2]}" - modurl="${mods_global_array[index+3]}" - modfilename="${mods_global_array[index+4]}" - modsubdirs="${mods_global_array[index+5]}" - modlowercase="${mods_global_array[index+6]}" - modinstalldir="${mods_global_array[index+7]}" - modkeepfiles="${mods_global_array[index+8]}" - modengines="${mods_global_array[index+9]}" - modgames="${mods_global_array[index+10]}" - modexcludegames="${mods_global_array[index+11]}" - modsite="${mods_global_array[index+12]}" - moddescription="${mods_global_array[index+13]}" +fn_mods_define() { + if [ -z "$index" ]; then + fn_script_log_fatal "index variable not set. Please report an issue." + fn_print_error "index variable not set. Please report an issue." + echo -e "* https://github.com/GameServerManagers/LinuxGSM/issues" + core_exit.sh + fi + modcommand="${mods_global_array[index + 1]}" + modprettyname="${mods_global_array[index + 2]}" + modurl="${mods_global_array[index + 3]}" + modfilename="${mods_global_array[index + 4]}" + modsubdirs="${mods_global_array[index + 5]}" + modlowercase="${mods_global_array[index + 6]}" + modinstalldir="${mods_global_array[index + 7]}" + modkeepfiles="${mods_global_array[index + 8]}" + modengines="${mods_global_array[index + 9]}" + modgames="${mods_global_array[index + 10]}" + modexcludegames="${mods_global_array[index + 11]}" + modsite="${mods_global_array[index + 12]}" + moddescription="${mods_global_array[index + 13]}" } # Builds list of installed mods. # using installed-mods.txt grabing mod info from mods_list.sh. -fn_mods_installed_list(){ +fn_mods_installed_list() { fn_mods_count_installed # Set/reset variables. installedmodsline="1" @@ -265,7 +265,7 @@ fn_mods_installed_list(){ # Get mod info to make sure mod exists. fn_mod_get_info # Add the mod to available commands. - installedmodslist+=( "${modcommand}" ) + installedmodslist+=("${modcommand}") # Increment line check. ((installedmodsline++)) done @@ -275,13 +275,13 @@ fn_mods_installed_list(){ } # Loops through mods_global_array to define available mods & provide available commands for mods installation. -fn_mods_available(){ +fn_mods_available() { # First, reset variables. compatiblemodslist=() availablemodscommands=() # Find compatible games. # Find separators through the global array. - for ((index="0"; index <= ${#mods_global_array[@]}; index++)); do + for ((index = "0"; index <= ${#mods_global_array[@]}; index++)); do # If current value is a separator; then. if [ "${mods_global_array[index]}" == "${modseparator}" ]; then # Set mod variables. @@ -291,9 +291,9 @@ fn_mods_available(){ # If game is compatible. if [ "${modcompatibility}" == "1" ]; then # Put it into an array to prepare user output. - compatiblemodslist+=( "${modprettyname}" "${modcommand}" "${modsite}" "${moddescription}" ) + compatiblemodslist+=("${modprettyname}" "${modcommand}" "${modsite}" "${moddescription}") # Keep available commands in an array to make life easier. - availablemodscommands+=( "${modcommand}" ) + availablemodscommands+=("${modcommand}") fi fi done @@ -302,7 +302,7 @@ fn_mods_available(){ ## Mod compatibility check. # Find out if a game is compatible with a mod from a modgames (list of games supported by a mod) variable. -fn_compatible_mod_games(){ +fn_compatible_mod_games() { # Reset test value. modcompatiblegame="0" # If value is set to GAMES (ignore). @@ -310,9 +310,9 @@ fn_compatible_mod_games(){ # How many games we need to test. gamesamount=$(echo -e "${modgames}" | awk -F ';' '{ print NF }') # Test all subvalue of "modgames" using the ";" separator. - for ((gamevarindex=1; gamevarindex < gamesamount; gamevarindex++)); do + for ((gamevarindex = 1; gamevarindex < gamesamount; gamevarindex++)); do # Put current game name into modtest variable. - gamemodtest=$( echo -e "${modgames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' ) + gamemodtest=$(echo -e "${modgames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }') # If game name matches. if [ "${gamemodtest}" == "${gamename}" ]; then # Mod is compatible. @@ -323,7 +323,7 @@ fn_compatible_mod_games(){ } # Find out if an engine is compatible with a mod from a modengines (list of engines supported by a mod) variable. -fn_compatible_mod_engines(){ +fn_compatible_mod_engines() { # Reset test value. modcompatibleengine="0" # If value is set to ENGINES (ignore). @@ -331,9 +331,9 @@ fn_compatible_mod_engines(){ # How many engines we need to test. enginesamount=$(echo -e "${modengines}" | awk -F ';' '{ print NF }') # Test all subvalue of "modengines" using the ";" separator. - for ((gamevarindex=1; gamevarindex < ${enginesamount}; gamevarindex++)); do + for ((gamevarindex = 1; gamevarindex < ${enginesamount}; gamevarindex++)); do # Put current engine name into modtest variable. - enginemodtest=$( echo -e "${modengines}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' ) + enginemodtest=$(echo -e "${modengines}" | awk -F ';' -v x=${gamevarindex} '{ print $x }') # If engine name matches. if [ "${enginemodtest}" == "${engine}" ]; then # Mod is compatible. @@ -344,7 +344,7 @@ fn_compatible_mod_engines(){ } # Find out if a game is not compatible with a mod from a modnotgames (list of games not supported by a mod) variable. -fn_not_compatible_mod_games(){ +fn_not_compatible_mod_games() { # Reset test value. modeincompatiblegame="0" # If value is set to NOTGAMES (ignore). @@ -352,9 +352,9 @@ fn_not_compatible_mod_games(){ # How many engines we need to test. excludegamesamount=$(echo -e "${modexcludegames}" | awk -F ';' '{ print NF }') # Test all subvalue of "modexcludegames" using the ";" separator. - for ((gamevarindex=1; gamevarindex < excludegamesamount; gamevarindex++)); do + for ((gamevarindex = 1; gamevarindex < excludegamesamount; gamevarindex++)); do # Put current engine name into modtest variable. - excludegamemodtest=$( echo -e "${modexcludegames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' ) + excludegamemodtest=$(echo -e "${modexcludegames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }') # If engine name matches. if [ "${excludegamemodtest}" == "${gamename}" ]; then # Mod is compatible. @@ -365,14 +365,14 @@ fn_not_compatible_mod_games(){ } # Sums up if a mod is compatible or not with modcompatibility=0/1. -fn_mod_compatible_test(){ +fn_mod_compatible_test() { # Test game and engine compatibility. fn_compatible_mod_games fn_compatible_mod_engines fn_not_compatible_mod_games if [ "${modeincompatiblegame}" == "1" ]; then modcompatibility="0" - elif [ "${modcompatibleengine}" == "1" ]||[ "${modcompatiblegame}" == "1" ]; then + elif [ "${modcompatibleengine}" == "1" ] || [ "${modcompatiblegame}" == "1" ]; then modcompatibility="1" else modcompatibility="0" @@ -382,7 +382,7 @@ fn_mod_compatible_test(){ ## Directory management. # Create mods files and directories if it doesn't exist. -fn_create_mods_dir(){ +fn_create_mods_dir() { # Create lgsm data modsdir. if [ ! -d "${modsdir}" ]; then echo -en "creating LinuxGSM mods data directory ${modsdir}..." @@ -420,7 +420,7 @@ fn_create_mods_dir(){ } # Create tmp download mod directory. -fn_mods_create_tmp_dir(){ +fn_mods_create_tmp_dir() { if [ ! -d "${modstmpdir}" ]; then mkdir -p "${modstmpdir}" exitcode=$? @@ -437,7 +437,7 @@ fn_mods_create_tmp_dir(){ } # Remove the tmp mod download directory when finished. -fn_mods_clear_tmp_dir(){ +fn_mods_clear_tmp_dir() { if [ -d "${modstmpdir}" ]; then echo -en "clearing mod download directory ${modstmpdir}..." rm -fr "${modstmpdir:?}" @@ -459,7 +459,7 @@ fn_mods_clear_tmp_dir(){ } # Counts how many mods were installed. -fn_mods_count_installed(){ +fn_mods_count_installed() { if [ -f "${modsinstalledlistfullpath}" ]; then installedmodscount=$(wc -l < "${modsinstalledlistfullpath}") else @@ -468,7 +468,7 @@ fn_mods_count_installed(){ } # Exits if no mods were installed. -fn_mods_check_installed(){ +fn_mods_check_installed() { # Count installed mods. fn_mods_count_installed # If no mods are found. @@ -482,10 +482,10 @@ fn_mods_check_installed(){ } # Checks that mod files list exists and isn't empty. -fn_check_mod_files_list(){ +fn_check_mod_files_list() { # File list must exist and be valid before any operation on it. if [ -f "${modsdir}/${modcommand}-files.txt" ]; then - # How many lines is the file list. + # How many lines is the file list. modsfilelistsize=$(wc -l < "${modsdir}/${modcommand}-files.txt") # If file list is empty. if [ "${modsfilelistsize}" -eq 0 ]; then @@ -501,7 +501,7 @@ fn_check_mod_files_list(){ fi } -fn_mod_exist(){ +fn_mod_exist() { modreq=$1 # requires one parameter, the mod if [ -f "${modsdir}/${modreq}-files.txt" ]; then @@ -516,7 +516,7 @@ fn_mod_exist(){ fi } -fn_mod_required_fail_exist(){ +fn_mod_required_fail_exist() { modreq=$1 # requires one parameter, the mod fn_script_log_fatal "${modreq}-files.txt is empty: unable to find ${modreq} installed" @@ -525,7 +525,7 @@ fn_mod_required_fail_exist(){ core_exit.sh } -fn_mod_liblist_gam_filenames(){ +fn_mod_liblist_gam_filenames() { # clear variables just in case moddll="" modso="" @@ -537,37 +537,37 @@ fn_mod_liblist_gam_filenames(){ moddll="mp.dll" modso="cs.so" moddylib="cs.dylib" - ;; + ;; "Day of Defeat") moddll="dod.dll" modso="dod.so" moddylib="dod.dylib" - ;; + ;; "Team Fortress Classic") moddll="tfc.dll" modso="tfc.so" moddylib="tfc.dylib" - ;; + ;; "Natural Selection") moddll="ns.dll" modso="ns_i386.so" moddylib="" - ;; + ;; "The Specialists") moddll="mp.dll" modso="ts_i386.so" moddylib="" - ;; + ;; "Half-Life: Deathmatch") moddll="hl.dll" modso="hl.so" moddylib="hl.dylib" - ;; + ;; esac } # modifers for liblist.gam to add/remote metamod binaries -fn_mod_install_liblist_gam_file(){ +fn_mod_install_liblist_gam_file() { fn_mod_liblist_gam_filenames @@ -625,7 +625,7 @@ fn_mod_install_liblist_gam_file(){ fi } -fn_mod_remove_liblist_gam_file(){ +fn_mod_remove_liblist_gam_file() { fn_mod_liblist_gam_filenames @@ -683,7 +683,7 @@ fn_mod_remove_liblist_gam_file(){ fi } -fn_mod_install_amxmodx_file(){ +fn_mod_install_amxmodx_file() { # does plugins.ini exist? if [ -f "${modinstalldir}/addons/metamod/plugins.ini" ]; then # since it does exist, is the entry already in plugins.ini @@ -718,9 +718,9 @@ fn_mod_install_amxmodx_file(){ fi } -fn_mod_remove_amxmodx_file(){ +fn_mod_remove_amxmodx_file() { if [ -f "${modinstalldir}/addons/metamod/plugins.ini" ]; then - # since it does exist, is the entry already in plugins.ini + # since it does exist, is the entry already in plugins.ini logentry="line (linux addons/amxmodx/dlls/amxmodx_mm_i386.so) removed from ${modinstalldir}/addons/metamod/plugins.ini" echo -en "removing amxmodx_mm_i386.so in plugins.ini..." grep -q "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" "${modinstalldir}/addons/metamod/plugins.ini" diff --git a/lgsm/functions/mods_list.sh b/lgsm/functions/mods_list.sh index ed9be2121b..151a98cbed 100755 --- a/lgsm/functions/mods_list.sh +++ b/lgsm/functions/mods_list.sh @@ -61,7 +61,7 @@ metamodsourcelatestfile=$(wget "${metamodsourcescrapeurl}" -q -O -) metamodsourcedownloadurl="https://www.metamodsource.net/latest.php?os=linux&version=${metamodsourceversion}" metamodsourceurl="${metamodsourcedownloadurl}" # Sourcemod -sourcemodversion="1.10" +sourcemodversion="1.11" sourcemodscrapeurl="https://sm.alliedmods.net/smdrop/${sourcemodversion}/sourcemod-latest-linux" sourcemodlatestfile=$(wget "${sourcemodscrapeurl}" -q -O -) sourcemoddownloadurl="https://www.sourcemod.net/latest.php?os=linux&version=${sourcemodversion}" @@ -92,7 +92,7 @@ movementapilatestlink="https://github.com/danzayau/MovementAPI/releases/download # Oxide oxiderustlatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/OxideMod/Oxide.Rust/releases/latest | jq -r '.assets[]|select(.browser_download_url | contains("linux")) | .browser_download_url') oxidehurtworldlatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/OxideMod/Oxide.Hurtworld/releases/latest | jq -r '.assets[].browser_download_url') -oxidesdtdlatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/OxideMod/Oxide.SevenDaysToDie/releases/latest | jq -r '.assets[]|select(.browser_download_url | contains("linux")) | .browser_download_url' ) +oxidesdtdlatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/OxideMod/Oxide.SevenDaysToDie/releases/latest | jq -r '.assets[]|select(.browser_download_url | contains("linux")) | .browser_download_url') # Valheim Plus valeimpluslatestlink=$(curl --connect-timeout 10 -sL https://api.github.com/repos/valheimPlus/ValheimPlus/releases/latest | jq -r '.assets[]|select(.browser_download_url | contains("UnixServer.tar.gz")) | .browser_download_url') @@ -122,77 +122,77 @@ modseparator="MOD" # [13] | "Short Description" a description showed to the user upon installation/removal # Half-life 1 Engine Mods -mod_info_metamod=( MOD "metamod" "Metamod" "${metamodurl}" "${metamodlatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/metamod/plugins.ini;" "ENGINES" "Counter-Strike 1.6;Day of Defeat;Team Fortress Classic;Natural Selection;The Specialists;Half-Life: Deathmatch;" "NOTGAMES" "https://github.com/alliedmodders/metamod-hl1" "Plugins Framework" ) -mod_info_base_amxx=( MOD "amxmodx" "AMX Mod X: Base" "${amxxbaseurl}" "${amxxbaselatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Counter-Strike 1.6;Day of Defeat;Team Fortress Classic;Natural Selection;The Specialists;Half-Life: Deathmatch;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod)" ) +mod_info_metamod=(MOD "metamod" "Metamod" "${metamodurl}" "${metamodlatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/metamod/plugins.ini;" "ENGINES" "Counter-Strike 1.6;Day of Defeat;Team Fortress Classic;Natural Selection;The Specialists;Half-Life: Deathmatch;" "NOTGAMES" "https://github.com/alliedmodders/metamod-hl1" "Plugins Framework") +mod_info_base_amxx=(MOD "amxmodx" "AMX Mod X: Base" "${amxxbaseurl}" "${amxxbaselatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Counter-Strike 1.6;Day of Defeat;Team Fortress Classic;Natural Selection;The Specialists;Half-Life: Deathmatch;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod)") # CS 1.6 (HL1) Engine Mods -mod_info_cs_amxx=( MOD "amxmodxcs" "AMX Mod X: Counter-Strike" "${amxxcsurl}" "${amxxcslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Counter-Strike 1.6;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" ) +mod_info_cs_amxx=(MOD "amxmodxcs" "AMX Mod X: Counter-Strike" "${amxxcsurl}" "${amxxcslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Counter-Strike 1.6;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)") # DOD (HL1) Engine Mods -mod_info_dod_amxx=( MOD "amxmodxdod" "AMX Mod X: Day of Defeat" "${amxxdodurl}" "${amxxdodlatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Day of Defeat;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" ) +mod_info_dod_amxx=(MOD "amxmodxdod" "AMX Mod X: Day of Defeat" "${amxxdodurl}" "${amxxdodlatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Day of Defeat;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)") # TFC (HL1) Engine Mods -mod_info_tfc_amxx=( MOD "amxmodxtfc" "AMX Mod X: Team Fortress Classic" "${amxxtfcurl}" "${amxxtfclatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Team Fortress Classic;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" ) +mod_info_tfc_amxx=(MOD "amxmodxtfc" "AMX Mod X: Team Fortress Classic" "${amxxtfcurl}" "${amxxtfclatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Team Fortress Classic;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)") # NS (Natural Selection) (HL1) Engine Mods -mod_info_ns_amxx=( MOD "amxmodxns" "AMX Mod X: Natural Selection" "${amxxnsurl}" "${amxxnslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Natural Selection;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" ) +mod_info_ns_amxx=(MOD "amxmodxns" "AMX Mod X: Natural Selection" "${amxxnsurl}" "${amxxnslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "Natural Selection;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)") # TS (The Specialists) (HL1) Engine Mods -mod_info_ts_amxx=( MOD "amxmodxts" "AMX Mod X: The Specialists" "${amxxtsurl}" "${amxxtslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "The Specialists;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)" ) +mod_info_ts_amxx=(MOD "amxmodxts" "AMX Mod X: The Specialists" "${amxxtsurl}" "${amxxtslatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/amxmodx/configs;" "ENGINES" "The Specialists;" "NOTGAMES" "https://www.amxmodx.org" "Admin Features (requires Metamod & AMX Mod X: Base)") # Source mods -mod_info_metamodsource=( MOD "metamodsource" "Metamod: Source" "${metamodsourceurl}" "${metamodsourcelatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/metamod/metaplugins.ini;" "source;" "GAMES" "NOTGAMES" "https://www.sourcemm.net" "Plugins Framework" ) -mod_info_sourcemod=( MOD "sourcemod" "SourceMod" "${sourcemodurl}" "${sourcemodlatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "source;" "GAMES" "NOTGAMES" "http://www.sourcemod.net" "Admin Features (requires Metamod: Source)" ) -mod_info_steamworks=( MOD "steamworks" "SteamWorks" "${steamworksurl}" "${steamworkslatestfile}" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/KyleSanderson/SteamWorks" "Exposing SteamWorks functions to SourcePawn" ) -mod_info_stripper=( MOD "stripper" "Stripper Source" "http://www.bailopan.net/stripper/snapshots/1.2/stripper-1.2.2-git129-linux.tar.gz" "stripper-1.2.2-git129-linux.tar.gz" "0" "LowercaseOff" "${systemdir}" "addons/stripper/maps;" "ENGINES" "Counter-Strike: Global Offensive;Counter-Strike: Source;Day of Defeat: Source;Half Life: Deathmatch;Half Life 2: Deathmatch;Insurgency;Left 4 Dead;Left 4 Dead 2;Nuclear Dawn;Team Fortress 2;" "NOTGAMES" "http://www.bailopan.net/stripper/" "Add or remove objects from map (requires MetaMod)") +mod_info_metamodsource=(MOD "metamodsource" "Metamod: Source" "${metamodsourceurl}" "${metamodsourcelatestfile}" "0" "LowercaseOff" "${systemdir}" "addons/metamod/metaplugins.ini;" "source;" "GAMES" "NOTGAMES" "https://www.sourcemm.net" "Plugins Framework") +mod_info_sourcemod=(MOD "sourcemod" "SourceMod" "${sourcemodurl}" "${sourcemodlatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "source;" "GAMES" "NOTGAMES" "http://www.sourcemod.net" "Admin Features (requires Metamod: Source)") +mod_info_steamworks=(MOD "steamworks" "SteamWorks" "${steamworksurl}" "${steamworkslatestfile}" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/KyleSanderson/SteamWorks" "Exposing SteamWorks functions to SourcePawn") +mod_info_stripper=(MOD "stripper" "Stripper Source" "http://www.bailopan.net/stripper/snapshots/1.2/stripper-1.2.2-git129-linux.tar.gz" "stripper-1.2.2-git129-linux.tar.gz" "0" "LowercaseOff" "${systemdir}" "addons/stripper/maps;" "ENGINES" "Counter-Strike: Global Offensive;Counter-Strike: Source;Day of Defeat: Source;Half Life: Deathmatch;Half Life 2: Deathmatch;Insurgency;Left 4 Dead;Left 4 Dead 2;Nuclear Dawn;Team Fortress 2;" "NOTGAMES" "http://www.bailopan.net/stripper/" "Add or remove objects from map (requires MetaMod)") # CS:GO Mods -mod_info_gokz=( MOD "gokz" "GOKZ" "${gokzlatestlink}" "${gokzlatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/KZGlobalTeam/gokz" "GOKZ ${gokzlatestversion} - Implements the KZ game mode (requires SourceMod and MetaMod)" ) -mod_info_ttt=( MOD "ttt" "Trouble in Terrorist Town" "https://csgottt.com/downloads/ttt-latest-dev-${sourcemodversion}.zip" "ttt-latest.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/Bara/TroubleinTerroristTown" "Implements the TTT game mode (requires SourceMod and MetaMod)" ) -mod_info_get5=( MOD "get5" "Get 5" "${get5url}" "${get5latestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/get5" "Plugin for competitive matches/scrims (requires SourceMod and MetaMod)" ) -mod_info_prac=( MOD "prac" "csgo practice mode" "${csgopracticelatestlink}" "${csgopracticelatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/csgo-practice-mode" "Practice Mode is a sourcemod plugin for helping players/teams run practices." ) -mod_info_pug=( MOD "pug" "PUG" "${csgopuglatestlink}" "${csgopuglatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/csgo-pug-setup" "plugin for setting up private pug/10man games" ) -mod_info_dhook=( MOD "dhook" "dhook" "https://forums.alliedmods.net/attachment.php?attachmentid=190123&d=1625050030" "dhooks-2.2.0d17.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://forums.alliedmods.net/showpost.php?p=2588686&postcount=589" "DHooks 2.2.0 - Required for GOKZ" ) -mod_info_movement=( MOD "movementapi" "movementapi" "${movementapilatestlink}" "${movementapilatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/danzayau/MovementAPI" "Movement API ${movementapilatestversion} - Required for GOKZ" ) -mod_info_cleaner=( MOD "cleaner" "cleaner" "https://github.com/e54385991/console-cleaner/archive/refs/heads/master.zip" "console-cleaner.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/e54385991/console-cleaner" "Console Cleaner - Optional for GOKZ" ) +mod_info_gokz=(MOD "gokz" "GOKZ" "${gokzlatestlink}" "${gokzlatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/KZGlobalTeam/gokz" "GOKZ ${gokzlatestversion} - Implements the KZ game mode (requires SourceMod and MetaMod)") +mod_info_ttt=(MOD "ttt" "Trouble in Terrorist Town" "https://csgottt.com/downloads/ttt-latest-dev-${sourcemodversion}.zip" "ttt-latest.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/Bara/TroubleinTerroristTown" "Implements the TTT game mode (requires SourceMod and MetaMod)") +mod_info_get5=(MOD "get5" "Get 5" "${get5url}" "${get5latestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/get5" "Plugin for competitive matches/scrims (requires SourceMod and MetaMod)") +mod_info_prac=(MOD "prac" "csgo practice mode" "${csgopracticelatestlink}" "${csgopracticelatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/csgo-practice-mode" "Practice Mode is a sourcemod plugin for helping players/teams run practices.") +mod_info_pug=(MOD "pug" "PUG" "${csgopuglatestlink}" "${csgopuglatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/splewis/csgo-pug-setup" "plugin for setting up private pug/10man games") +mod_info_dhook=(MOD "dhook" "dhook" "https://forums.alliedmods.net/attachment.php?attachmentid=190123&d=1625050030" "dhooks-2.2.0d17.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://forums.alliedmods.net/showpost.php?p=2588686&postcount=589" "DHooks 2.2.0 - Required for GOKZ") +mod_info_movement=(MOD "movementapi" "movementapi" "${movementapilatestlink}" "${movementapilatestfile}" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/danzayau/MovementAPI" "Movement API ${movementapilatestversion} - Required for GOKZ") +mod_info_cleaner=(MOD "cleaner" "cleaner" "https://github.com/e54385991/console-cleaner/archive/refs/heads/master.zip" "console-cleaner.zip" "0" "LowercaseOff" "${systemdir}" "cfg;addons/sourcemod/configs;" "ENGINES" "Counter-Strike: Global Offensive;" "NOTGAMES" "https://github.com/e54385991/console-cleaner" "Console Cleaner - Optional for GOKZ") # Garry's Mod Addons -mod_info_ulib=( MOD "ulib" "ULib" "https://codeload.github.com/TeamUlysses/ulib/zip/master" "ulib-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Complete Framework" ) -mod_info_ulx=( MOD "ulx" "ULX" "https://codeload.github.com/TeamUlysses/ulx/zip/master" "ulx-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Admin Panel (requires ULib)" ) -mod_info_utime=( MOD "utime" "UTime" "https://github.com/TeamUlysses/utime/archive/master.zip" "utime-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Keep track of players play time" ) -mod_info_uclip=( MOD "uclip" "UClip" "https://github.com/TeamUlysses/uclip/archive/master.zip" "uclip-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "An alternative to noclip" ) -mod_info_acf=( MOD "acf" "Armoured Combat Framework" "https://github.com/nrlulz/ACF/archive/master.zip" "acf-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "acf-master/lua/acf/shared/guns;" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/nrlulz/ACF" "Realistic Wepons & Engines" ) -mod_info_acf_missiles=( MOD "acfmissiles" "ACF Missiles" "https://github.com/Bubbus/ACF-Missiles/archive/master.zip" "acf-missiles-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Bubbus/ACF-Missiles" "More missiles for ACF" ) -mod_info_advdupe2=( MOD "advdupe2" "Advanced Duplicator 2" "https://github.com/wiremod/advdupe2/archive/master.zip" "advdupe2-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://www.wiremod.com" "Save your constructions. Second version" ) -mod_info_pac3=( MOD "pac3" "PAC3" "https://github.com/CapsAdmin/pac3/archive/master.zip" "pac3-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/CapsAdmin/pac3" "Advanced player model customization" ) -mod_info_wiremod=( MOD "wiremod" "Wiremod" "https://github.com/wiremod/wire/archive/master.zip" "wire-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/wire" "Base Wiremod Addon") -mod_info_wiremodextras=( MOD "wiremod-extras" "Wiremod Extras" "https://github.com/wiremod/wire-extras/archive/master.zip" "wire-extras-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/wire-extras/" "Addition to Wiremod, Extra Content") -mod_info_advduplicator=( MOD "advdupe1" "Advanced Duplicator 1" "https://github.com/wiremod/advduplicator/archive/master.zip" "advduplicator-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/advduplicator" "Save your constructions. First version" ) -mod_info_trackassemblytool=( MOD "trackassemblytool" "Track Assembly Tool" "https://github.com/dvdvideo1234/trackassemblytool/archive/master.zip" "trackassemblytool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/TrackAssemblyTool" "Assembles segmented track. Supports wire" ) -mod_info_physpropertiesadv=( MOD "physpropertiesadv" "Phys Properties Adv" "https://github.com/dvdvideo1234/physpropertiesadv/archive/master.zip" "physpropertiesadv-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/PhysPropertiesAdv" "Advanced configurable properties" ) -mod_info_controlsystemse2=( MOD "controlsystemse2" "Control Systems E2" "https://github.com/dvdvideo1234/controlsystemse2/archive/master.zip" "controlsystemse2-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/ControlSystemsE2" "PID controllers and fast traces for E2. Minor included in wire-extas" ) -mod_info_e2pistontiming=( MOD "e2pistontiming" "E2 Piston Timing" "https://github.com/dvdvideo1234/e2pistontiming/archive/master.zip" "e2pistontiming-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/E2PistonTiming" "Routine driven piston engine timings for E2" ) -mod_info_propcannontool=( MOD "propcannontool" "Prop Cannon Tool" "https://github.com/dvdvideo1234/propcannontool/archive/master.zip" "propcannontool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/PropCannonTool" "Cannon entity that can fire props. Supports wire" ) -mod_info_gearassemblytool=( MOD "gearassemblytool" "Gear Assembly Tool" "https://github.com/dvdvideo1234/gearassemblytool/archive/master.zip" "gearassemblytool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/GearAssemblyTool" "Assembles segmented gearbox" ) -mod_info_spinnertool=( MOD "spinnertool" "Spinner Tool" "https://github.com/dvdvideo1234/spinnertool/archive/master.zip" "spinnertool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/SpinnerTool" "Torque lever controlled spinner. Supports wire" ) -mod_info_surfacefrictiontool=( MOD "surfacefrictiontool" "Surface Friction Tool" "https://github.com/dvdvideo1234/surfacefrictiontool/archive/master.zip" "surfacefrictiontool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/SurfaceFrictionTool" "Controls the surface friction of a prop" ) -mod_info_magneticdipole=( MOD "magneticdipole" "Magnetic Dipole" "https://github.com/dvdvideo1234/magneticdipole/archive/master.zip" "magneticdipole-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/MagneticDipole" "Magnet entity that runs forces on its poles. Supports wire" ) -mod_info_environmentorganizer=( MOD "environmentorganizer" "Environment Organizer" "https://github.com/dvdvideo1234/environmentorganizer/archive/master.zip" "environmentorganizer-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/EnvironmentOrganizer" "Installs routines designed for server settings adjustment" ) -mod_info_precision_alignment=( MOD "precision-alignment" "Precision Alignment" "https://github.com/Mista-Tea/precision-alignment/archive/master.zip" "precision-alignment-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/precision-alignment" "Creates precise constraints and aligments" ) -mod_info_improved_stacker=( MOD "improved-stacker" "Improved Stacker" "https://github.com/Mista-Tea/improved-stacker/archive/master.zip" "improved-stacker-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-stacker" "Stacks entities in the direction chosen" ) -mod_info_improved_weight=( MOD "improved-weight" "Improved Weight" "https://github.com/Mista-Tea/improved-weight/archive/master.zip" "improved-weight-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-weight" "Weight tool but with more features" ) -mod_info_improved_antinoclip=( MOD "improved-antinoclip" "Improved Antinoclip" "https://github.com/Mista-Tea/improved-antinoclip/archive/master.zip" "improved-antinoclip-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-antinoclip" "Controls clipping trough an object" ) -mod_info_darkrp=( MOD "darkrp" "DarkRP" "https://github.com/FPtje/DarkRP/archive/master.zip" "darkrp-master.zip" "0" "LowercaseOn" "${systemdir}/gamemodes" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Most popular gamemode" ) -mod_info_darkrpmodification=( MOD "darkrpmodification" "DarkRP Modification" "https://github.com/FPtje/darkrpmodification/archive/master.zip" "darkrpmodification-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "NOUPDATE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Customize DarkRP settings" ) -mod_info_laserstool=( MOD "laserstool" "Laser STool" "https://github.com/dvdvideo1234/laserstool/archive/main.zip" "laserstool-main.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/LaserSTool" "Scripted tool that spawns laser entities, simulates light rays and even kill players" ) +mod_info_ulib=(MOD "ulib" "ULib" "https://codeload.github.com/TeamUlysses/ulib/zip/master" "ulib-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Complete Framework") +mod_info_ulx=(MOD "ulx" "ULX" "https://codeload.github.com/TeamUlysses/ulx/zip/master" "ulx-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Admin Panel (requires ULib)") +mod_info_utime=(MOD "utime" "UTime" "https://github.com/TeamUlysses/utime/archive/master.zip" "utime-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "Keep track of players play time") +mod_info_uclip=(MOD "uclip" "UClip" "https://github.com/TeamUlysses/uclip/archive/master.zip" "uclip-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://ulyssesmod.net" "An alternative to noclip") +mod_info_acf=(MOD "acf" "Armoured Combat Framework" "https://github.com/nrlulz/ACF/archive/master.zip" "acf-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "acf-master/lua/acf/shared/guns;" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/nrlulz/ACF" "Realistic Wepons & Engines") +mod_info_acf_missiles=(MOD "acfmissiles" "ACF Missiles" "https://github.com/Bubbus/ACF-Missiles/archive/master.zip" "acf-missiles-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Bubbus/ACF-Missiles" "More missiles for ACF") +mod_info_advdupe2=(MOD "advdupe2" "Advanced Duplicator 2" "https://github.com/wiremod/advdupe2/archive/master.zip" "advdupe2-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://www.wiremod.com" "Save your constructions. Second version") +mod_info_pac3=(MOD "pac3" "PAC3" "https://github.com/CapsAdmin/pac3/archive/master.zip" "pac3-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/CapsAdmin/pac3" "Advanced player model customization") +mod_info_wiremod=(MOD "wiremod" "Wiremod" "https://github.com/wiremod/wire/archive/master.zip" "wire-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/wire" "Base Wiremod Addon") +mod_info_wiremodextras=(MOD "wiremod-extras" "Wiremod Extras" "https://github.com/wiremod/wire-extras/archive/master.zip" "wire-extras-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/wire-extras/" "Addition to Wiremod, Extra Content") +mod_info_advduplicator=(MOD "advdupe1" "Advanced Duplicator 1" "https://github.com/wiremod/advduplicator/archive/master.zip" "advduplicator-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/wiremod/advduplicator" "Save your constructions. First version") +mod_info_trackassemblytool=(MOD "trackassemblytool" "Track Assembly Tool" "https://github.com/dvdvideo1234/trackassemblytool/archive/master.zip" "trackassemblytool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/TrackAssemblyTool" "Assembles segmented track. Supports wire") +mod_info_physpropertiesadv=(MOD "physpropertiesadv" "Phys Properties Adv" "https://github.com/dvdvideo1234/physpropertiesadv/archive/master.zip" "physpropertiesadv-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/PhysPropertiesAdv" "Advanced configurable properties") +mod_info_controlsystemse2=(MOD "controlsystemse2" "Control Systems E2" "https://github.com/dvdvideo1234/controlsystemse2/archive/master.zip" "controlsystemse2-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/ControlSystemsE2" "PID controllers and fast traces for E2. Minor included in wire-extas") +mod_info_e2pistontiming=(MOD "e2pistontiming" "E2 Piston Timing" "https://github.com/dvdvideo1234/e2pistontiming/archive/master.zip" "e2pistontiming-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/E2PistonTiming" "Routine driven piston engine timings for E2") +mod_info_propcannontool=(MOD "propcannontool" "Prop Cannon Tool" "https://github.com/dvdvideo1234/propcannontool/archive/master.zip" "propcannontool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/PropCannonTool" "Cannon entity that can fire props. Supports wire") +mod_info_gearassemblytool=(MOD "gearassemblytool" "Gear Assembly Tool" "https://github.com/dvdvideo1234/gearassemblytool/archive/master.zip" "gearassemblytool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/GearAssemblyTool" "Assembles segmented gearbox") +mod_info_spinnertool=(MOD "spinnertool" "Spinner Tool" "https://github.com/dvdvideo1234/spinnertool/archive/master.zip" "spinnertool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/SpinnerTool" "Torque lever controlled spinner. Supports wire") +mod_info_surfacefrictiontool=(MOD "surfacefrictiontool" "Surface Friction Tool" "https://github.com/dvdvideo1234/surfacefrictiontool/archive/master.zip" "surfacefrictiontool-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/SurfaceFrictionTool" "Controls the surface friction of a prop") +mod_info_magneticdipole=(MOD "magneticdipole" "Magnetic Dipole" "https://github.com/dvdvideo1234/magneticdipole/archive/master.zip" "magneticdipole-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/MagneticDipole" "Magnet entity that runs forces on its poles. Supports wire") +mod_info_environmentorganizer=(MOD "environmentorganizer" "Environment Organizer" "https://github.com/dvdvideo1234/environmentorganizer/archive/master.zip" "environmentorganizer-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/EnvironmentOrganizer" "Installs routines designed for server settings adjustment") +mod_info_precision_alignment=(MOD "precision-alignment" "Precision Alignment" "https://github.com/Mista-Tea/precision-alignment/archive/master.zip" "precision-alignment-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/precision-alignment" "Creates precise constraints and aligments") +mod_info_improved_stacker=(MOD "improved-stacker" "Improved Stacker" "https://github.com/Mista-Tea/improved-stacker/archive/master.zip" "improved-stacker-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-stacker" "Stacks entities in the direction chosen") +mod_info_improved_weight=(MOD "improved-weight" "Improved Weight" "https://github.com/Mista-Tea/improved-weight/archive/master.zip" "improved-weight-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-weight" "Weight tool but with more features") +mod_info_improved_antinoclip=(MOD "improved-antinoclip" "Improved Antinoclip" "https://github.com/Mista-Tea/improved-antinoclip/archive/master.zip" "improved-antinoclip-master.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/Mista-Tea/improved-antinoclip" "Controls clipping trough an object") +mod_info_darkrp=(MOD "darkrp" "DarkRP" "https://github.com/FPtje/DarkRP/archive/master.zip" "darkrp-master.zip" "0" "LowercaseOn" "${systemdir}/gamemodes" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Most popular gamemode") +mod_info_darkrpmodification=(MOD "darkrpmodification" "DarkRP Modification" "https://github.com/FPtje/darkrpmodification/archive/master.zip" "darkrpmodification-master.zip" "0" "LowercaseOff" "${systemdir}/addons" "NOUPDATE" "ENGINES" "Garry's Mod;" "NOTGAMES" "http://darkrp.com" "Customize DarkRP settings") +mod_info_laserstool=(MOD "laserstool" "Laser STool" "https://github.com/dvdvideo1234/laserstool/archive/main.zip" "laserstool-main.zip" "0" "LowercaseOn" "${systemdir}/addons" "OVERWRITE" "ENGINES" "Garry's Mod;" "NOTGAMES" "https://github.com/dvdvideo1234/LaserSTool" "Scripted tool that spawns laser entities, simulates light rays and even kill players") # Oxidemod -mod_info_rustoxide=( MOD "rustoxide" "Oxide for Rust" "${oxiderustlatestlink}" "Oxide.Rust-linux.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Rust;" "NOTGAMES" "https://umod.org/games/rust" "Allows for the use of plugins" ) -mod_info_hwoxide=( MOD "hwoxide" "Oxide for Hurtworld" "${oxidehurtworldlatestlink}" "Oxide.Hurtworld.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Hurtworld;" "NOTGAMES" "https://umod.org/games/hurtworld" "Allows for the use of plugins" ) -mod_info_sdtdoxide=( MOD "sdtdoxide" "Oxide for 7 Days To Die" "${oxidesdtdlatestlink}" "Oxide.SevenDaysToDie.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "7 Days To Die;" "NOTGAMES" "https://umod.org/games/7-days-to-die" "Allows for the use of plugins" ) +mod_info_rustoxide=(MOD "rustoxide" "Oxide for Rust" "${oxiderustlatestlink}" "Oxide.Rust-linux.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Rust;" "NOTGAMES" "https://umod.org/games/rust" "Allows for the use of plugins") +mod_info_hwoxide=(MOD "hwoxide" "Oxide for Hurtworld" "${oxidehurtworldlatestlink}" "Oxide.Hurtworld.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Hurtworld;" "NOTGAMES" "https://umod.org/games/hurtworld" "Allows for the use of plugins") +mod_info_sdtdoxide=(MOD "sdtdoxide" "Oxide for 7 Days To Die" "${oxidesdtdlatestlink}" "Oxide.SevenDaysToDie.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "7 Days To Die;" "NOTGAMES" "https://umod.org/games/7-days-to-die" "Allows for the use of plugins") # ValheimPlus -mod_info_valheimplus=( MOD "valheimplus" "Valheim PLUS" "${valeimpluslatestlink}" "ValheimPlus.tar.gz" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Valheim;" "NOTGAMES" "https://github.com/valheimPlus/ValheimPlus" "Mod to improve Valheim gameplay") +mod_info_valheimplus=(MOD "valheimplus" "Valheim PLUS" "${valeimpluslatestlink}" "ValheimPlus.tar.gz" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Valheim;" "NOTGAMES" "https://github.com/valheimPlus/ValheimPlus" "Mod to improve Valheim gameplay") # REQUIRED: Set all mods info into the global array -mods_global_array=( "${mod_info_metamod[@]}" "${mod_info_base_amxx[@]}" "${mod_info_cs_amxx[@]}" "${mod_info_dod_amxx[@]}" "${mod_info_tfc_amxx[@]}" "${mod_info_ns_amxx[@]}" "${mod_info_ts_amxx[@]}" "${mod_info_metamodsource[@]}" "${mod_info_sourcemod[@]}" "${mod_info_steamworks[@]}" "${mod_info_gokz[@]}" "${mod_info_ttt[@]}" "${mod_info_get5[@]}" "${mod_info_prac[@]}" "${mod_info_pug[@]}" "${mod_info_dhook[@]}" "${mod_info_movement[@]}" "${mod_info_cleaner[@]}" "${mod_info_ulib[@]}" "${mod_info_ulx[@]}" "${mod_info_utime[@]}" "${mod_info_uclip[@]}" "${mod_info_acf[@]}" "${mod_info_acf_missiles[@]}" "${mod_info_acf_sweps[@]}" "${mod_info_advdupe2[@]}" "${mod_info_pac3[@]}" "${mod_info_wiremod[@]}" "${mod_info_wiremodextras[@]}" "${mod_info_darkrp[@]}" "${mod_info_darkrpmodification[@]}" "${mod_info_rustoxide[@]}" "${mod_info_hwoxide[@]}" "${mod_info_sdtdoxide[@]}" "${mod_info_advduplicator[@]}" "${mod_info_trackassemblytool[@]}" "${mod_info_physpropertiesadv[@]}" "${mod_info_controlsystemse2[@]}" "${mod_info_e2pistontiming[@]}" "${mod_info_propcannontool[@]}" "${mod_info_gearassemblytool[@]}" "${mod_info_spinnertool[@]}" "${mod_info_surfacefrictiontool[@]}" "${mod_info_magneticdipole[@]}" "${mod_info_environmentorganizer[@]}" "${mod_info_precision_alignment[@]}" "${mod_info_improved_stacker[@]}" "${mod_info_improved_weight[@]}" "${mod_info_improved_antinoclip[@]}" "${mod_info_laserstool[@]}" "${mod_info_valheimplus[@]}" ) +mods_global_array=("${mod_info_metamod[@]}" "${mod_info_base_amxx[@]}" "${mod_info_cs_amxx[@]}" "${mod_info_dod_amxx[@]}" "${mod_info_tfc_amxx[@]}" "${mod_info_ns_amxx[@]}" "${mod_info_ts_amxx[@]}" "${mod_info_metamodsource[@]}" "${mod_info_sourcemod[@]}" "${mod_info_steamworks[@]}" "${mod_info_gokz[@]}" "${mod_info_ttt[@]}" "${mod_info_get5[@]}" "${mod_info_prac[@]}" "${mod_info_pug[@]}" "${mod_info_dhook[@]}" "${mod_info_movement[@]}" "${mod_info_cleaner[@]}" "${mod_info_ulib[@]}" "${mod_info_ulx[@]}" "${mod_info_utime[@]}" "${mod_info_uclip[@]}" "${mod_info_acf[@]}" "${mod_info_acf_missiles[@]}" "${mod_info_acf_sweps[@]}" "${mod_info_advdupe2[@]}" "${mod_info_pac3[@]}" "${mod_info_wiremod[@]}" "${mod_info_wiremodextras[@]}" "${mod_info_darkrp[@]}" "${mod_info_darkrpmodification[@]}" "${mod_info_rustoxide[@]}" "${mod_info_hwoxide[@]}" "${mod_info_sdtdoxide[@]}" "${mod_info_advduplicator[@]}" "${mod_info_trackassemblytool[@]}" "${mod_info_physpropertiesadv[@]}" "${mod_info_controlsystemse2[@]}" "${mod_info_e2pistontiming[@]}" "${mod_info_propcannontool[@]}" "${mod_info_gearassemblytool[@]}" "${mod_info_spinnertool[@]}" "${mod_info_surfacefrictiontool[@]}" "${mod_info_magneticdipole[@]}" "${mod_info_environmentorganizer[@]}" "${mod_info_precision_alignment[@]}" "${mod_info_improved_stacker[@]}" "${mod_info_improved_weight[@]}" "${mod_info_improved_antinoclip[@]}" "${mod_info_laserstool[@]}" "${mod_info_valheimplus[@]}") diff --git a/lgsm/functions/query_gamedig.sh b/lgsm/functions/query_gamedig.sh index 32b70aac28..43f748bccb 100755 --- a/lgsm/functions/query_gamedig.sh +++ b/lgsm/functions/query_gamedig.sh @@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Check if gamedig and jq are installed. -if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then +if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then # will bypass query if server offline. check_status.sh @@ -49,7 +49,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; fi if [ "${gdplayers}" == "null" ]; then unset gdplayers - elif [ "${gdplayers}" == "[]" ]||[ "${gdplayers}" == "-1" ]; then + elif [ "${gdplayers}" == "[]" ] || [ "${gdplayers}" == "-1" ]; then gdplayers=0 fi @@ -75,7 +75,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; # numbots. gdbots=$(echo "${gamedigraw}" | jq -re '.bots | length') - if [ "${gdbots}" == "null" ]||[ "${gdbots}" == "0" ]; then + if [ "${gdbots}" == "null" ] || [ "${gdbots}" == "0" ]; then unset gdbots fi @@ -86,7 +86,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; gdversion=$(echo "${gamedigraw}" | jq -re '.raw.version') fi - if [ "${gdversion}" == "null" ]||[ "${gdversion}" == "0" ]; then + if [ "${gdversion}" == "null" ] || [ "${gdversion}" == "0" ]; then unset gdversion fi fi diff --git a/lgsm/functions/query_gsquery.py b/lgsm/functions/query_gsquery.py index 4d6b018287..62c92082e4 100755 --- a/lgsm/functions/query_gsquery.py +++ b/lgsm/functions/query_gsquery.py @@ -6,66 +6,66 @@ # Website: https://linuxgsm.com # Description: Allows querying of various game servers. -import optparse +import argparse import socket import sys +engine_types=('protocol-valve','protocol-quake3','protocol-quake3','protocol-gamespy1','protocol-unreal2','ut3','minecraft','minecraftbe','jc2mp','mumbleping','soldat','teeworlds') + class gsquery: - def __init__(self, options, arguments): - self.option = options + server_response_timeout = 5 + default_buffer_length = 1024 + sourcequery=('protocol-valve','avalanche3.0','barotrauma','madness','quakelive','realvirtuality','refractor','source','goldsrc','spark','starbound','unity3d','unreal4','wurm') + idtech2query=('protocol-quake3','idtech2','quake','iw2.0') + idtech3query=('protocol-quake3','iw3.0','ioquake3','qfusion') + minecraftquery=('minecraft','lwjgl2') + minecraftbequery=('minecraftbe',) + jc2mpquery=('jc2mp',) + mumblequery=('mumbleping',) + soldatquery=('soldat',) + twquery=('teeworlds',) + unrealquery=('protocol-gamespy1','unreal') + unreal2query=('protocol-unreal2','unreal2') + unreal3query=('ut3','unreal3') + + def __init__(self, arguments): self.argument = arguments # - self.server_response_timeout = 5 - self.default_buffer_length = 1024 - # - sourcequery=['protocol-valve','avalanche3.0','barotrauma','madness','quakelive','realvirtuality','refractor','source','goldsrc','spark','starbound','unity3d','unreal4','wurm'] - idtech2query=['protocol-quake3','idtech2','quake','iw2.0'] - idtech3query=['protocol-quake3','iw3.0','ioquake3','qfusion'] - minecraftquery=['minecraft','lwjgl2'] - minecraftbequery=['minecraftbe'] - jc2mpquery=['jc2mp'] - mumblequery=['mumbleping'] - soldatquery=['soldat'] - twquery=['teeworlds'] - unrealquery=['protocol-gamespy1','unreal'] - unreal2query=['protocol-unreal2','unreal2'] - unreal3query=['ut3','unreal3'] - if self.option.engine in sourcequery: + if self.argument.engine in self.sourcequery: self.query_prompt_string = b'\xFF\xFF\xFF\xFFTSource Engine Query\0' - elif self.option.engine in idtech2query: + elif self.argument.engine in self.idtech2query: self.query_prompt_string = b'\xff\xff\xff\xffstatus\x00' - elif self.option.engine in idtech3query: + elif self.argument.engine in self.idtech3query: self.query_prompt_string = b'\xff\xff\xff\xffgetstatus' - elif self.option.engine in jc2mpquery: + elif self.argument.engine in self.jc2mpquery: self.query_prompt_string = b'\xFE\xFD\x09\x10\x20\x30\x40' - elif self.option.engine in minecraftquery: + elif self.argument.engine in self.minecraftquery: self.query_prompt_string = b'\xFE\xFD\x09\x3d\x54\x1f\x93' - elif self.option.engine in minecraftbequery: + elif self.argument.engine in self.minecraftbequery: self.query_prompt_string = b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78\x00\x00\x00\x00\x00\x00\x00\x00' - elif self.option.engine in mumblequery: + elif self.argument.engine in self.mumblequery: self.query_prompt_string = b'\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08' - elif self.option.engine in soldatquery: + elif self.argument.engine in self.soldatquery: self.query_prompt_string = b'\x69\x00' - elif self.option.engine in twquery: - self.query_prompt_string = b"\x04\x00\x00\xff\xff\xff\xff\x05" + bytearray(511) - elif self.option.engine in unrealquery: + elif self.argument.engine in self.twquery: + self.query_prompt_string = b'\x04\x00\x00\xff\xff\xff\xff\x05' + bytearray(511) + elif self.argument.engine in self.unrealquery: self.query_prompt_string = b'\x5C\x69\x6E\x66\x6F\x5C' - elif self.option.engine in unreal2query: + elif self.argument.engine in self.unreal2query: self.query_prompt_string = b'\x79\x00\x00\x00\x00' - elif self.option.engine in unreal3query: + elif self.argument.engine in self.unreal3query: self.query_prompt_string = b'\xFE\xFD\x09\x00\x00\x00\x00' self.connected = False self.response = None - self.sanity_checks() @staticmethod - def fatal_error(self, error_message, error_code=1): + def fatal_error(error_message, error_code=1): sys.stderr.write('ERROR: ' + str(error_message) + '\n') sys.exit(error_code) @staticmethod - def exit_success(self, success_message=''): + def exit_success(success_message=''): sys.stdout.write('OK: ' + str(success_message) + '\n') sys.exit(0) @@ -74,10 +74,10 @@ def responding(self): connection = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) connection.settimeout(self.server_response_timeout) try: - self.connected = connection.connect((self.option.address, int(self.option.port))) + self.connected = connection.connect((self.argument.address, int(self.argument.port))) except socket.timeout: self.fatal_error('Request timed out', 1) - except: + except Exception: self.fatal_error('Unable to connect', 1) # Send. connection.send(self.query_prompt_string) @@ -95,52 +95,57 @@ def responding(self): else: self.exit_success(str(self.response)) - def sanity_checks(self): - if not self.option.address: - self.fatal_error('No IPv4 address supplied.', 4) - if not self.option.port: - self.fatal_error('No port supplied.', 4) - -if __name__ == '__main__': - parser = optparse.OptionParser( - usage='usage: python3 %prog [options]', - version='%prog 0.0.1' +def parse_args(): + parser = argparse.ArgumentParser( + description='Allows querying of various game servers.', + usage='usage: python3 %(prog)s [options]', + add_help=False ) - parser.add_option( + parser.add_argument( '-a', '--address', - action='store', - dest='address', - default=False, + type=str, + required=True, help='The IPv4 address of the server.' ) - parser.add_option( + parser.add_argument( '-p', '--port', - action='store', - dest='port', - default=False, + type=int, + required=True, help='The IPv4 port of the server.' ) - parser.add_option( + parser.add_argument( '-e', '--engine', - action='store', - dest='engine', - default=False, - help='Engine type: protocol-valve protocol-quake3 protocol-quake3 protocol-gamespy1 protocol-unreal2 ut3 minecraft minecraftbe jc2mp mumbleping soldat teeworlds' + metavar='ENGINE', + choices=engine_types, + help='Engine type: ' + ' '.join(engine_types) ) - parser.add_option( + parser.add_argument( '-v', '--verbose', action='store_true', - dest='verbose', - default=False, help='Display verbose output.' ) - parser.add_option( + parser.add_argument( '-d', '--debug', action='store_true', - dest='debug', - default=False, help='Display debugging output.' ) - options, arguments = parser.parse_args() - server = gsquery(options, arguments) + parser.add_argument( + '-V', '--version', + action='version', + version='%(prog)s 0.0.1', + help='Display version and exit.' + ) + parser.add_argument( + '-h', '--help', + action='help', + help='Display help and exit.' + ) + return parser.parse_args() + +def main(): + arguments = parse_args() + server = gsquery(arguments) server.responding() + +if __name__ == '__main__': + main() diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh index 47ccefe1b0..2c8bf0d018 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/functions/update_factorio.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_factorio_dl(){ +fn_update_factorio_dl() { fn_fetch_file "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" "" "" "" "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" "" "norun" "noforce" "nohash" fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" @@ -25,7 +25,7 @@ fn_update_factorio_dl(){ fi } -fn_update_factorio_localbuild(){ +fn_update_factorio_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses executable to find local build. @@ -41,13 +41,13 @@ fn_update_factorio_localbuild(){ fi } -fn_update_factorio_remotebuild(){ +fn_update_factorio_remotebuild() { # Gets remote build info. remotebuild=$(curl -s "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" | grep -o '[0-9]\.[0-9]\{1,\}\.[0-9]\{1,\}' | head -1) if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -57,7 +57,7 @@ fn_update_factorio_remotebuild(){ fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -65,13 +65,13 @@ fn_update_factorio_remotebuild(){ fi } -fn_update_factorio_compare(){ +fn_update_factorio_compare() { fn_print_dots "Checking for update: ${remotelocation}" # Removes dots so if statement can compare version numbers. fn_print_dots "Checking for update: ${remotelocation}" localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]') - if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" diff --git a/lgsm/functions/update_jediknight2.sh b/lgsm/functions/update_jediknight2.sh index 3a3c40f146..421bc543f6 100644 --- a/lgsm/functions/update_jediknight2.sh +++ b/lgsm/functions/update_jediknight2.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_jk2_dl(){ +fn_update_jk2_dl() { fn_fetch_file "https://github.com/mvdevs/jk2mv/releases/download/${remotebuild}/jk2mv-v${remotebuild}-dedicated.zip" "" "" "" "${tmpdir}" "jk2mv-${remotebuild}-dedicated.zip" "" "norun" "noforce" "nohash" fn_dl_extract "${tmpdir}" "jk2mv-${remotebuild}-dedicated.zip" "${tmpdir}/jk2mv-v${remotebuild}-dedicated" echo -e "copying to ${serverfiles}...\c" @@ -24,13 +24,13 @@ fn_update_jk2_dl(){ fi } -fn_update_jk2_localbuild(){ +fn_update_jk2_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses log file to gather info. # Log is generated and cleared on startup but filled on shutdown. requirerestart=1 - localbuild=$(grep "\"version\"" "${consolelogdir}"/* 2>/dev/null | sed 's/.*://' | awk '{print $1}' | head -n 1) + localbuild=$(grep "\"version\"" "${consolelogdir}"/* 2> /dev/null | sed 's/.*://' | awk '{print $1}' | head -n 1) if [ -z "${localbuild}" ]; then fn_print_error "Checking local build: ${remotelocation}" fn_print_error_nl "Checking local build: ${remotelocation}: no log files containing version info" @@ -57,7 +57,7 @@ fn_update_jk2_localbuild(){ fi if [ -z "${localbuild}" ]; then - localbuild=$(grep Version "$(ls -tr "${consolelogdir}"/* 2>/dev/null)" | tail -1 | sed 's/.*Version //') + localbuild=$(grep Version "$(ls -tr "${consolelogdir}"/* 2> /dev/null)" | tail -1 | sed 's/.*Version //') fi if [ -z "${localbuild}" ]; then @@ -71,13 +71,13 @@ fn_update_jk2_localbuild(){ fi } -fn_update_jk2_remotebuild(){ +fn_update_jk2_remotebuild() { # Gets remote build info. remotebuild=$(curl -s "https://api.github.com/repos/mvdevs/jk2mv/releases/latest" | grep dedicated.zip | tail -1 | awk -F"/" '{ print $8 }') if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -87,7 +87,7 @@ fn_update_jk2_remotebuild(){ fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -95,12 +95,12 @@ fn_update_jk2_remotebuild(){ fi } -fn_update_jk2_compare(){ +fn_update_jk2_compare() { # Removes dots so if statement can compare version numbers. fn_print_dots "Checking for update: ${remotelocation}" localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]') - if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index 63a2fd51ce..d20b98ef48 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_minecraft_dl(){ +fn_update_minecraft_dl() { # Generate link to version manifest json. remotebuildlink=$(curl -s "https://launchermeta.${remotelocation}/mc/game/version_manifest.json" | jq -r --arg branch ${branch} --arg mcversion ${remotebuild} '.versions | .[] | select(.type==$branch and .id==$mcversion) | .url') # Generate link to server.jar @@ -30,7 +30,7 @@ fn_update_minecraft_dl(){ fi } -fn_update_minecraft_localbuild(){ +fn_update_minecraft_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses executable to find local build. @@ -46,7 +46,7 @@ fn_update_minecraft_localbuild(){ fi } -fn_update_minecraft_remotebuild(){ +fn_update_minecraft_remotebuild() { # Gets remote build info. # Latest release. if [ "${branch}" == "release" ] && [ "${mcversion}" == "latest" ]; then @@ -62,7 +62,7 @@ fn_update_minecraft_remotebuild(){ if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -72,7 +72,7 @@ fn_update_minecraft_remotebuild(){ fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -80,10 +80,10 @@ fn_update_minecraft_remotebuild(){ fi } -fn_update_minecraft_compare(){ +fn_update_minecraft_compare() { # Removes dots so if statement can compare version numbers. fn_print_dots "Checking for update: ${remotelocation}" - if [ "${localbuild}" != "${remotebuild}" ]||[ "${forceupdate}" == "1" ]; then + if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" diff --git a/lgsm/functions/update_minecraft_bedrock.sh b/lgsm/functions/update_minecraft_bedrock.sh index f724679a92..163e076aab 100644 --- a/lgsm/functions/update_minecraft_bedrock.sh +++ b/lgsm/functions/update_minecraft_bedrock.sh @@ -10,7 +10,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" #random number for userAgent randnum=$((1 + RANDOM % 5000)) -fn_update_minecraft_dl(){ +fn_update_minecraft_dl() { fn_fetch_file "https://minecraft.azureedge.net/bin-linux/bedrock-server-${remotebuild}.zip" "" "" "" "${tmpdir}" "bedrock_server.${remotebuild}.zip" echo -e "Extracting to ${serverfiles}...\c" if [ "${firstcommandname}" == "INSTALL" ]; then @@ -32,13 +32,13 @@ fn_update_minecraft_dl(){ fi } -fn_update_minecraft_localbuild(){ +fn_update_minecraft_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses log file to gather info. # Log is generated and cleared on startup but filled on shutdown. requirerestart=1 - localbuild=$(grep Version "${consolelogdir}"/* 2>/dev/null | tail -1 | sed 's/.*Version //') + localbuild=$(grep Version "${consolelogdir}"/* 2> /dev/null | tail -1 | sed 's/.*Version //') if [ -z "${localbuild}" ]; then fn_print_error "Checking local build: ${remotelocation}" fn_print_error_nl "Checking local build: ${remotelocation}: no log files containing version info" @@ -65,7 +65,7 @@ fn_update_minecraft_localbuild(){ fi if [ -z "${localbuild}" ]; then - localbuild=$(grep Version "$(ls -tr "${consolelogdir}"/* 2>/dev/null)" | tail -1 | sed 's/.*Version //') + localbuild=$(grep Version "$(ls -tr "${consolelogdir}"/* 2> /dev/null)" | tail -1 | sed 's/.*Version //') fi if [ -z "${localbuild}" ]; then @@ -79,7 +79,7 @@ fn_update_minecraft_localbuild(){ fi } -fn_update_minecraft_remotebuild(){ +fn_update_minecraft_remotebuild() { # Gets remote build info. if [ "${mcversion}" == "latest" ]; then remotebuild=$(curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -Ls -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.${randnum}.212 Safari/537.36" "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*' | sed 's/.*\///' | grep -Eo "[.0-9]+[0-9]") @@ -90,7 +90,7 @@ fn_update_minecraft_remotebuild(){ if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -100,7 +100,7 @@ fn_update_minecraft_remotebuild(){ fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -108,12 +108,12 @@ fn_update_minecraft_remotebuild(){ fi } -fn_update_minecraft_compare(){ +fn_update_minecraft_compare() { # Removes dots so if statement can compare version numbers. fn_print_dots "Checking for update: ${remotelocation}" localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]') - if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh index c789a3c217..61216b8094 100644 --- a/lgsm/functions/update_mta.sh +++ b/lgsm/functions/update_mta.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_mta_dl(){ +fn_update_mta_dl() { fn_fetch_file "http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz" "" "" "" "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "" "norun" "noforce" "nohash" mkdir "${tmpdir}/multitheftauto_linux_x64" fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "${tmpdir}/multitheftauto_linux_x64" @@ -26,7 +26,7 @@ fn_update_mta_dl(){ fi } -fn_update_mta_localbuild(){ +fn_update_mta_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses log file to gather info. @@ -97,13 +97,13 @@ fn_update_mta_localbuild(){ fi } -fn_update_mta_remotebuild(){ +fn_update_mta_remotebuild() { # Gets remote build info. remotebuild=$(curl -s "https://api.github.com/repos/multitheftauto/mtasa-blue/releases/latest" | jq -r '.tag_name') if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -113,7 +113,7 @@ fn_update_mta_remotebuild(){ fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -121,12 +121,12 @@ fn_update_mta_remotebuild(){ fi } -fn_update_mta_compare(){ +fn_update_mta_compare() { # Removes dots so if statement can compare version numbers. fn_print_dots "Checking for update: ${remotelocation}" localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]') - if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" if [ "${forceupdate}" == "1" ]; then # forceupdate bypasses checks, useful for small build changes diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh index 8a54e7df2c..77e64d3c07 100644 --- a/lgsm/functions/update_mumble.sh +++ b/lgsm/functions/update_mumble.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_mumble_dl(){ +fn_update_mumble_dl() { fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${remotebuild}/murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "" "" "" "${tmpdir}" "murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "" "norun" "noforce" "nohash" fn_dl_extract "${tmpdir}" "murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" @@ -25,13 +25,13 @@ fn_update_mumble_dl(){ fi } -fn_update_mumble_localbuild(){ +fn_update_mumble_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses executable to find local build. cd "${executabledir}" || exit if [ -f "${executable}" ]; then - localbuild=$(${executable} -version 2>&1 >/dev/null | awk '{print $5}') + localbuild=$(${executable} -version 2>&1 > /dev/null | awk '{print $5}') fn_print_ok "Checking local build: ${remotelocation}" fn_script_log_pass "Checking local build" else @@ -41,13 +41,13 @@ fn_update_mumble_localbuild(){ fi } -fn_update_mumble_remotebuild(){ +fn_update_mumble_remotebuild() { # Gets remote build info. remotebuild=$(curl -s "https://api.github.com/repos/mumble-voip/mumble/releases/latest" | grep 'murmur-static_x86.*\.bz2"' | tail -1 | awk -F"/" '{ print $8 }') if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -57,7 +57,7 @@ fn_update_mumble_remotebuild(){ fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -65,12 +65,12 @@ fn_update_mumble_remotebuild(){ fi } -fn_update_mumble_compare(){ +fn_update_mumble_compare() { # Removes dots so if statement can compare version numbers. fn_print_dots "Checking for update: ${remotelocation}" localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]') - if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" diff --git a/lgsm/functions/update_papermc.sh b/lgsm/functions/update_papermc.sh index 2e669d93db..1f334549ca 100644 --- a/lgsm/functions/update_papermc.sh +++ b/lgsm/functions/update_papermc.sh @@ -9,9 +9,9 @@ local commandname="UPDATE" local commandaction="Update" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_papermc_dl(){ +fn_update_papermc_dl() { # get build info - builddata=$(curl -s "https://${remotelocation}/api/v2/projects/${paperproject}/versions/${paperversion}/builds/${remotebuild}" | jq '.downloads' ) + builddata=$(curl -s "https://${remotelocation}/api/v2/projects/${paperproject}/versions/${paperversion}/builds/${remotebuild}" | jq '.downloads') buildname=$(echo -e "${builddata}" | jq -r '.application.name') buildsha256=$(echo -e "${builddata}" | jq -r '.application.sha256') @@ -33,7 +33,7 @@ fn_update_papermc_dl(){ fi } -fn_update_papermc_localbuild(){ +fn_update_papermc_localbuild() { # Gets local build info. fn_print_dots "Checking for update: ${remotelocation}: checking local build" sleep 0.5 @@ -56,12 +56,12 @@ fn_update_papermc_localbuild(){ sleep 0.5 } -fn_update_papermc_remotebuild(){ +fn_update_papermc_remotebuild() { # Gets remote build info. remotebuild=$(curl -s "https://${remotelocation}/api/v2/projects/${paperproject}/versions/${paperversion}" | jq -r '.builds[-1]') # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -71,10 +71,10 @@ fn_update_papermc_remotebuild(){ fi } -fn_update_papermc_compare(){ +fn_update_papermc_compare() { fn_print_dots "Checking for update: ${remotelocation}" sleep 0.5 - if [ "${localbuild}" != "${remotebuild}" ]||[ "${forceupdate}" == "1" ]; then + if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available for version ${paperversion}" @@ -122,6 +122,8 @@ remotelocation="papermc.io" if [ "${shortname}" == "pmc" ]; then paperproject="paper" +elif [ "${shortname}" == "vpmc" ]; then + paperproject="velocity" elif [ "${shortname}" == "wmc" ]; then paperproject="waterfall" fi diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index 782a138d10..be5c9e06f5 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -7,14 +7,18 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_ts3_dl(){ +fn_update_ts3_dl() { + ts3latestdata=$(curl -s "https://www.${remotelocation}/versions/server.json" | jq '.linux') if [ "${ts3arch}" == "amd64" ]; then - remotebuildurl=$(curl -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86_64.mirrors."teamspeak.com"') + remotebuildurl=$(echo -e "${ts3latestdata}" | jq -r '.x86_64.mirrors."teamspeak.com"') + remotehash=$(echo -e "${ts3latestdata}" | jq -r '.x86_64.checksum') elif [ "${ts3arch}" == "x86" ]; then - remotebuildurl=$(curl -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86.mirrors."teamspeak.com"') + remotebuildurl=$(echo -e "${ts3latestdata}" | jq -r '.x86.mirrors."teamspeak.com"') + remotehash=$(echo -e "${ts3latestdata}" | jq -r '.x86.checksum') fi - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${remotebuild}.tar.bz2" "" "norun" "noforce" "nohash" - fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${remotebuild}.tar.bz2" "${tmpdir}" + remotefile=$(basename "${remotebuildurl}") + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotefile}" "" "norun" "noforce" "${remotehash}" + fn_dl_extract "${tmpdir}" "${remotefile}" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${serverfiles}" local exitcode=$? @@ -30,13 +34,13 @@ fn_update_ts3_dl(){ fi } -fn_update_ts3_localbuild(){ +fn_update_ts3_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses log file to gather info. # Gives time for log file to generate. requirerestart=1 - if [ ! -d "${serverfiles}/logs" ]||[ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; then + if [ ! -d "${serverfiles}/logs" ] || [ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; then fn_print_error "Checking local build: ${remotelocation}" fn_print_error_nl "Checking local build: ${remotelocation}: no log files containing version info" fn_print_info_nl "Checking local build: ${remotelocation}: forcing server restart" @@ -49,7 +53,7 @@ fn_update_ts3_localbuild(){ fn_firstcommand_reset totalseconds=0 # Check again, allow time to generate logs. - while [ ! -d "${serverfiles}/logs" ]||[ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; do + while [ ! -d "${serverfiles}/logs" ] || [ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; do sleep 1 fn_print_info "Checking local build: ${remotelocation}: waiting for log file: ${totalseconds}" if [ -v "${loopignore}" ]; then @@ -82,7 +86,7 @@ fn_update_ts3_localbuild(){ fn_script_log_info "Waiting for local build to generate" fi localbuild=$(cat "$(find ./* -name "ts3server*_0.log" 2> /dev/null | sort | tail -1)" | grep -Eo "TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | grep -Eo "((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | tail -1) - if [ "${localbuild}" ]||[ "${seconds}" == "120" ]; then + if [ "${localbuild}" ] || [ "${seconds}" == "120" ]; then break fi sleep 1 @@ -101,17 +105,18 @@ fn_update_ts3_localbuild(){ fi } -fn_update_ts3_remotebuild(){ +fn_update_ts3_remotebuild() { # Gets remote build info. + ts3latestdata=$(curl -s "https://www.${remotelocation}/versions/server.json" | jq '.linux') if [ "${ts3arch}" == "amd64" ]; then - remotebuild=$(curl -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86_64.version') + remotebuild=$(echo -e "${ts3latestdata}" | jq -r '.x86_64.version') elif [ "${ts3arch}" == "x86" ]; then - remotebuild=$(curl -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86.version') + remotebuild=$(echo -e "${ts3latestdata}" | jq -r '.x86.version') fi if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -121,7 +126,7 @@ fn_update_ts3_remotebuild(){ fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -129,12 +134,12 @@ fn_update_ts3_remotebuild(){ fi } -fn_update_ts3_compare(){ +fn_update_ts3_compare() { # Removes dots so if statement can compare version numbers. fn_print_dots "Checking for update: ${remotelocation}" localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]') - if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -145,35 +150,39 @@ fn_update_ts3_compare(){ fn_script_log_info "Remote build: ${remotebuild}" fn_script_log_info "${localbuild} > ${remotebuild}" - unset updateonstart - check_status.sh - # If server stopped. - if [ "${status}" == "0" ]; then - exitbypass=1 - fn_update_ts3_dl - if [ "${requirerestart}" == "1" ]; then + if [ "${commandname}" == "UPDATE" ]; then + unset updateonstart + check_status.sh + # If server stopped. + if [ "${status}" == "0" ]; then exitbypass=1 - command_start.sh - fn_firstcommand_reset + fn_update_ts3_dl + if [ "${requirerestart}" == "1" ]; then + exitbypass=1 + command_start.sh + fn_firstcommand_reset + exitbypass=1 + command_stop.sh + fn_firstcommand_reset + fi + # If server started. + else + fn_print_restart_warning exitbypass=1 command_stop.sh fn_firstcommand_reset + exitbypass=1 + fn_update_ts3_dl + exitbypass=1 + command_start.sh + fn_firstcommand_reset fi - # If server started. - else - fn_print_restart_warning - exitbypass=1 - command_stop.sh - fn_firstcommand_reset - exitbypass=1 - fn_update_ts3_dl - exitbypass=1 - command_start.sh - fn_firstcommand_reset + unset exitbypass + date +%s > "${lockdir}/lastupdate.lock" + alert="update" + elif [ "${commandname}" == "CHECK-UPDATE" ]; then + alert="check-update" fi - unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" - alert="update" alert.sh else fn_print_ok_nl "Checking for update: ${remotelocation}" @@ -192,7 +201,7 @@ fn_update_ts3_compare(){ info_distro.sh if [ "${arch}" == "x86_64" ]; then ts3arch="amd64" -elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then +elif [ "${arch}" == "i386" ] || [ "${arch}" == "i686" ]; then ts3arch="x86" else fn_print_failure "Unknown or unsupported architecture: ${arch}" diff --git a/lgsm/functions/update_vintagestory.sh b/lgsm/functions/update_vintagestory.sh index b2231c66eb..9053849222 100755 --- a/lgsm/functions/update_vintagestory.sh +++ b/lgsm/functions/update_vintagestory.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_vs_dl(){ +fn_update_vs_dl() { # get version info for download remotebuildresponse=$(curl -s "${apiurl}" | jq --arg version "${remotebuild}" '.[$version].server') remotebuildfile=$(echo -e "${remotebuildresponse}" | jq -r '.filename') @@ -20,7 +20,7 @@ fn_update_vs_dl(){ fn_clear_tmp } -fn_update_vs_localbuild(){ +fn_update_vs_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses executable to find local build. @@ -36,7 +36,7 @@ fn_update_vs_localbuild(){ fi } -fn_update_vs_remotebuild(){ +fn_update_vs_remotebuild() { if [ "${branch}" == "stable" ]; then remotebuild=$(curl -s "${apiurl}" | jq -r '[ to_entries[] ] | .[].key' | grep -Ev "\-rc|\-pre" | sort -r -V | head -1) else @@ -46,7 +46,7 @@ fn_update_vs_remotebuild(){ if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -56,7 +56,7 @@ fn_update_vs_remotebuild(){ fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -64,10 +64,10 @@ fn_update_vs_remotebuild(){ fi } -fn_update_vs_compare(){ +fn_update_vs_compare() { # Removes dots so if statement can compare version numbers. fn_print_dots "Checking for update: ${remotelocation}" - if [ "${localbuild}" != "${remotebuild}" ]||[ "${forceupdate}" == "1" ]; then + if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" diff --git a/linuxgsm.sh b/linuxgsm.sh index 43c388571f..01c71d68c6 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -15,12 +15,12 @@ # Debugging if [ -f ".dev-debug" ]; then - exec 5>dev-debug.log + exec 5> dev-debug.log BASH_XTRACEFD="5" set -x fi -version="v22.1.0" +version="v22.2.0" shortname="core" gameservername="core" commandname="CORE" @@ -52,20 +52,20 @@ userinput2="${2}" [ -n "${LGSM_GITHUBBRANCH}" ] && githubbranch="${LGSM_GITHUBBRANCH}" || githubbranch="master" # Check that curl is installed before doing anything -if [ ! "$(command -v curl 2>/dev/null)" ]; then +if [ ! "$(command -v curl 2> /dev/null)" ]; then echo -e "[ FAIL ] Curl is not installed" exit 1 fi # Core function that is required first. -core_functions.sh(){ +core_functions.sh() { functionfile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5" } # Bootstrap # Fetches the core functions required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -77,16 +77,16 @@ fn_bootstrap_fetch_file(){ forcedl="${9:-0}" md5="${10:-0}" # Download file if missing or download forced. - if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then + if [ ! -f "${local_filedir}/${local_filename}" ] || [ "${forcedl}" == "forcedl" ]; then # If backup fileurl exists include it. if [ -n "${remote_fileurl_backup}" ]; then # counter set to 0 to allow second try counter=0 - remote_fileurls_array=( remote_fileurl remote_fileurl_backup ) + remote_fileurls_array=(remote_fileurl remote_fileurl_backup) else # counter set to 1 to not allow second try counter=1 - remote_fileurls_array=( remote_fileurl ) + remote_fileurls_array=(remote_fileurl) fi for remote_fileurl_array in "${remote_fileurls_array[@]}"; do @@ -97,7 +97,7 @@ fn_bootstrap_fetch_file(){ fileurl="${remote_fileurl_backup}" fileurl_name="${remote_fileurl_backup_name}" fi - counter=$((counter+1)) + counter=$((counter + 1)) if [ ! -d "${local_filedir}" ]; then mkdir -p "${local_filedir}" fi @@ -112,7 +112,7 @@ fn_bootstrap_fetch_file(){ # Download will fail if downloads a html file. if [ -f "${local_filedir}/${local_filename}" ]; then - if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE" )" ]; then + if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE")" ]; then rm "${local_filedir:?}/${local_filename:?}" local exitcode=2 fi @@ -164,11 +164,11 @@ fn_bootstrap_fetch_file(){ fi } -fn_bootstrap_fetch_file_github(){ +fn_bootstrap_fetch_file_github() { github_file_url_dir="${1}" github_file_url_name="${2}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else @@ -192,10 +192,10 @@ fn_bootstrap_fetch_file_github(){ fn_print_center() { columns=$(tput cols) line="$*" - printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}" + printf "%*s\n" $(((${#line} + columns) / 2)) "${line}" } -fn_print_horizontal(){ +fn_print_horizontal() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "=" } @@ -212,11 +212,11 @@ fn_install_menu_bash() { menu_options=() while read -r line || [[ -n "${line}" ]]; do var=$(echo -e "${line}" | awk -F "," '{print $2 " - " $3}') - menu_options+=( "${var}" ) + menu_options+=("${var}") done < "${options}" - menu_options+=( "Cancel" ) + menu_options+=("Cancel") select option in "${menu_options[@]}"; do - if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then + if [ "${option}" ] && [ "${option}" != "Cancel" ]; then eval "$resultvar=\"${option/%\ */}\"" fi break @@ -238,7 +238,7 @@ fn_install_menu_whiptail() { while read -r line; do key=$(echo -e "${line}" | awk -F "," '{print $3}') val=$(echo -e "${line}" | awk -F "," '{print $2}') - menu_options+=( "${val//\"}" "${key//\"}" ) + menu_options+=("${val//\"/}" "${key//\"/}") done < "${options}" OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3) if [ $? == 0 ]; then @@ -263,24 +263,26 @@ fn_install_menu() { fi done case "$(basename "${menucmd}")" in - whiptail|dialog) - fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;; + whiptail | dialog) + fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30 + ;; *) - fn_install_menu_bash selection "${title}" "${caption}" "${options}";; + fn_install_menu_bash selection "${title}" "${caption}" "${options}" + ;; esac eval "$resultvar=\"${selection}\"" } # Gets server info from serverlist.csv and puts in to array. -fn_server_info(){ +fn_server_info() { IFS="," server_info_array=($(grep -aw "${userinput}" "${serverlist}")) - shortname="${server_info_array[0]}" # csgo + shortname="${server_info_array[0]}" # csgo gameservername="${server_info_array[1]}" # csgoserver - gamename="${server_info_array[2]}" # Counter Strike: Global Offensive + gamename="${server_info_array[2]}" # Counter Strike: Global Offensive } -fn_install_getopt(){ +fn_install_getopt() { userinput="empty" echo -e "Usage: $0 [option]" echo -e "" @@ -294,13 +296,13 @@ fn_install_getopt(){ exit } -fn_install_file(){ +fn_install_file() { local_filename="${gameservername}" if [ -e "${local_filename}" ]; then i=2 - while [ -e "${local_filename}-${i}" ] ; do - (( i++ )) - done + while [ -e "${local_filename}-${i}" ]; do + ((i++)) + done local_filename="${local_filename}-${i}" fi cp -R "${selfname}" "${local_filename}" @@ -320,12 +322,12 @@ fn_install_file(){ # Prevent LinuxGSM from running as root. Except if doing a dependency install. if [ "$(whoami)" == "root" ]; then - if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then + if [ "${userinput}" == "install" ] || [ "${userinput}" == "auto-install" ] || [ "${userinput}" == "i" ] || [ "${userinput}" == "ai" ]; then if [ "${shortname}" == "core" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then + elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else @@ -343,12 +345,12 @@ if [ "${shortname}" == "core" ]; then exit 1 fi - if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then + if [ "${userinput}" == "list" ] || [ "${userinput}" == "l" ]; then { tail -n +1 "${serverlist}" | awk -F "," '{print $2 "\t" $3}' } | column -s $'\t' -t | more exit - elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then + elif [ "${userinput}" == "install" ] || [ "${userinput}" == "i" ]; then tail -n +1 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}" fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}" userinput="${result}" @@ -364,7 +366,7 @@ if [ "${shortname}" == "core" ]; then fi elif [ "${userinput}" ]; then fn_server_info - if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then + if [ "${userinput}" == "${gameservername}" ] || [ "${userinput}" == "${gamename}" ] || [ "${userinput}" == "${shortname}" ]; then fn_install_file else echo -e "[ FAIL ] unknown game server" @@ -453,7 +455,7 @@ else # Reloads start parameter to ensure all vars in startparameters are set. # Will reload the last defined startparameter. - fn_reload_startparameters(){ + fn_reload_startparameters() { # reload Wurm config. if [ "${shortname}" == "wurm" ]; then # shellcheck source=/dev/null @@ -472,7 +474,7 @@ else eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/_default.cfg")" fi -# reload preexecutable. + # reload preexecutable. if grep -qE "^[[:blank:]]*preexecutable=" "${configdirserver}/secrets-${selfname}.cfg"; then eval preexecutable="$(sed -nr 's/^ *preexecutable=(.*)$/\1/p' "${configdirserver}/secrets-${selfname}.cfg")" elif grep -qE "^[[:blank:]]*preexecutable=" "${configdirserver}/${selfname}.cfg"; then diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000..d0deca3ecd --- /dev/null +++ b/package-lock.json @@ -0,0 +1,466 @@ +{ + "name": "linuxgsm", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "linuxgsm", + "license": "MIT", + "devDependencies": { + "prettier": "^2.7.1", + "prettier-plugin-sh": "^0.12.8" + } + }, + "node_modules/@pkgr/utils": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.3.0.tgz", + "integrity": "sha512-7dIJ9CRVzBnqyEl7diUHPUFJf/oty2SeoVzcMocc5PeOUDK9KGzvgIBjGRRzzlRDaOjh3ADwH0WeibQvi3ls2Q==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "is-glob": "^4.0.3", + "open": "^8.4.0", + "picocolors": "^1.0.0", + "tiny-glob": "^0.2.9", + "tslib": "^2.4.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/globalyzer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", + "dev": true + }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true + }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/mvdan-sh": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/mvdan-sh/-/mvdan-sh-0.10.1.tgz", + "integrity": "sha512-kMbrH0EObaKmK3nVRKUIIya1dpASHIEusM13S4V1ViHFuxuNxCo+arxoa6j/dbV22YBGjl7UKJm9QQKJ2Crzhg==", + "dev": true + }, + "node_modules/open": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz", + "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==", + "dev": true, + "dependencies": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-sh": { + "version": "0.12.8", + "resolved": "https://registry.npmjs.org/prettier-plugin-sh/-/prettier-plugin-sh-0.12.8.tgz", + "integrity": "sha512-VOq8h2Gn5UzrCIKm4p/nAScXJbN09HdyFDknAcxt6Qu/tv/juu9bahxSrcnM9XWYA+Spz1F1ANJ4LhfwB7+Q1Q==", + "dev": true, + "dependencies": { + "mvdan-sh": "^0.10.1", + "sh-syntax": "^0.3.6", + "synckit": "^0.8.1" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + }, + "peerDependencies": { + "prettier": "^2.0.0" + } + }, + "node_modules/sh-syntax": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/sh-syntax/-/sh-syntax-0.3.7.tgz", + "integrity": "sha512-xIB/uRniZ9urxAuXp1Ouh/BKSI1VK8RSqfwGj7cV57HvGrFo3vHdJfv8Tdp/cVcxJgXQTkmHr5mG5rqJW8r4wQ==", + "dev": true, + "dependencies": { + "tslib": "^2.4.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/synckit": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.3.tgz", + "integrity": "sha512-1goXnDYNJlKwCM37f5MTzRwo+8SqutgVtg2d37D6YnHHT4E3IhQMRfKiGdfTZU7LBlI6T8inCQUxnMBFHrbqWw==", + "dev": true, + "dependencies": { + "@pkgr/utils": "^2.3.0", + "tslib": "^2.4.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/tiny-glob": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", + "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", + "dev": true, + "dependencies": { + "globalyzer": "0.1.0", + "globrex": "^0.1.2" + } + }, + "node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + } + }, + "dependencies": { + "@pkgr/utils": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.3.0.tgz", + "integrity": "sha512-7dIJ9CRVzBnqyEl7diUHPUFJf/oty2SeoVzcMocc5PeOUDK9KGzvgIBjGRRzzlRDaOjh3ADwH0WeibQvi3ls2Q==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "is-glob": "^4.0.3", + "open": "^8.4.0", + "picocolors": "^1.0.0", + "tiny-glob": "^0.2.9", + "tslib": "^2.4.0" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true + }, + "globalyzer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", + "dev": true + }, + "globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true + }, + "is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "requires": { + "is-docker": "^2.0.0" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "mvdan-sh": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/mvdan-sh/-/mvdan-sh-0.10.1.tgz", + "integrity": "sha512-kMbrH0EObaKmK3nVRKUIIya1dpASHIEusM13S4V1ViHFuxuNxCo+arxoa6j/dbV22YBGjl7UKJm9QQKJ2Crzhg==", + "dev": true + }, + "open": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz", + "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==", + "dev": true, + "requires": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true + }, + "prettier-plugin-sh": { + "version": "0.12.8", + "resolved": "https://registry.npmjs.org/prettier-plugin-sh/-/prettier-plugin-sh-0.12.8.tgz", + "integrity": "sha512-VOq8h2Gn5UzrCIKm4p/nAScXJbN09HdyFDknAcxt6Qu/tv/juu9bahxSrcnM9XWYA+Spz1F1ANJ4LhfwB7+Q1Q==", + "dev": true, + "requires": { + "mvdan-sh": "^0.10.1", + "sh-syntax": "^0.3.6", + "synckit": "^0.8.1" + } + }, + "sh-syntax": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/sh-syntax/-/sh-syntax-0.3.7.tgz", + "integrity": "sha512-xIB/uRniZ9urxAuXp1Ouh/BKSI1VK8RSqfwGj7cV57HvGrFo3vHdJfv8Tdp/cVcxJgXQTkmHr5mG5rqJW8r4wQ==", + "dev": true, + "requires": { + "tslib": "^2.4.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "synckit": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.3.tgz", + "integrity": "sha512-1goXnDYNJlKwCM37f5MTzRwo+8SqutgVtg2d37D6YnHHT4E3IhQMRfKiGdfTZU7LBlI6T8inCQUxnMBFHrbqWw==", + "dev": true, + "requires": { + "@pkgr/utils": "^2.3.0", + "tslib": "^2.4.0" + } + }, + "tiny-glob": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", + "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", + "dev": true, + "requires": { + "globalyzer": "0.1.0", + "globrex": "^0.1.2" + } + }, + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000000..c62ce31759 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "linuxgsm", + "description": "


\"LinuxGSM\"

", + "directories": { + "test": "tests" + }, + "devDependencies": { + "prettier": "^2.7.1", + "prettier-plugin-sh": "^0.12.8" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/GameServerManagers/LinuxGSM.git" + }, + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/GameServerManagers/LinuxGSM/issues" + }, + "homepage": "https://github.com/GameServerManagers/LinuxGSM#readme" +} diff --git a/tests/tests_defaultcfg/tests_defaultcfg.sh b/tests/tests_defaultcfg/tests_defaultcfg.sh index 4039d90e7a..5f97f9a333 100644 --- a/tests/tests_defaultcfg/tests_defaultcfg.sh +++ b/tests/tests_defaultcfg/tests_defaultcfg.sh @@ -6,20 +6,20 @@ echo -e "Description:" echo -e "test checks that vars present in ALL _default.cfg files are correct." echo -e "" echo -e "In master config < | > In game config" -find "lgsm/config-default/config-lgsm/" ! -name '*template.cfg' -name "*.cfg" -type f -print0 | -while IFS= read -r -d $'\0' line; do - grep "=" "${line}" | cut -f1 -d"=" > defaultcfgtemp.txt - diffoutput=$(diff tests/tests_defaultcfg/defaultcfg_0.txt defaultcfgtemp.txt) - if [ "${diffoutput}" ]; then - echo "File with errors:" - echo "${line}" - echo -e "=================================" - echo -e "In master config < | > In game config" - echo "${diffoutput}" - echo "" - fi - rm -f defaultcfgtemp.txt -done +find "lgsm/config-default/config-lgsm/" ! -name '*template.cfg' -name "*.cfg" -type f -print0 \ + | while IFS= read -r -d $'\0' line; do + grep "=" "${line}" | cut -f1 -d"=" > defaultcfgtemp.txt + diffoutput=$(diff tests/tests_defaultcfg/defaultcfg_0.txt defaultcfgtemp.txt) + if [ "${diffoutput}" ]; then + echo "File with errors:" + echo "${line}" + echo -e "=================================" + echo -e "In master config < | > In game config" + echo "${diffoutput}" + echo "" + fi + rm -f defaultcfgtemp.txt + done echo -e "" echo -e "1.0 - Master Comparison" @@ -28,20 +28,20 @@ echo -e "Description:" echo -e "test checks that vars present in ALL _default.cfg files are correct." echo -e "" echo -e "In master config < | > In game config" -find lgsm/config-default/config-lgsm/ ! -name '*template.cfg' -name "*.cfg" -type f -print0 | -while IFS= read -r -d $'\0' line; do - grep "=" "${line}" | cut -f1 -d"=" > defaultcfgtemp.txt - diffoutput=$(diff tests/tests_defaultcfg/defaultcfg_0.txt defaultcfgtemp.txt | grep '^<') - if [ "${diffoutput}" ]; then - echo "File with errors:" - echo "${line}" - echo -e "=================================" - echo -e "In master config < | > In game config" - echo "${diffoutput}" - echo "" - fi - rm -f defaultcfgtemp.txt -done +find lgsm/config-default/config-lgsm/ ! -name '*template.cfg' -name "*.cfg" -type f -print0 \ + | while IFS= read -r -d $'\0' line; do + grep "=" "${line}" | cut -f1 -d"=" > defaultcfgtemp.txt + diffoutput=$(diff tests/tests_defaultcfg/defaultcfg_0.txt defaultcfgtemp.txt | grep '^<') + if [ "${diffoutput}" ]; then + echo "File with errors:" + echo "${line}" + echo -e "=================================" + echo -e "In master config < | > In game config" + echo "${diffoutput}" + echo "" + fi + rm -f defaultcfgtemp.txt + done echo -e "" echo -e "2.0 - Check Comment" @@ -50,16 +50,16 @@ echo -e "Description:" echo -e "test checks that comments in ALL _default.cfg files are correct." echo -e "" echo -e "In master config < | > In game config" -find lgsm/config-default/config-lgsm/ ! -name '*template.cfg' -name "*.cfg" -type f -print0 | -while IFS= read -r -d $'\0' line; do - grep "#" "${line}" > defaultcfgtemp.txt - diffoutput=$(diff tests/tests_defaultcfg/defaultcfg_1.txt defaultcfgtemp.txt | grep '^<') - if [ "${diffoutput}" ]; then - echo "File with errors:" - echo "${line}" - echo -e "=================================" - echo "${diffoutput}" - echo "" - fi - rm -f defaultcfgtemp.txt -done +find lgsm/config-default/config-lgsm/ ! -name '*template.cfg' -name "*.cfg" -type f -print0 \ + | while IFS= read -r -d $'\0' line; do + grep "#" "${line}" > defaultcfgtemp.txt + diffoutput=$(diff tests/tests_defaultcfg/defaultcfg_1.txt defaultcfgtemp.txt | grep '^<') + if [ "${diffoutput}" ]; then + echo "File with errors:" + echo "${line}" + echo -e "=================================" + echo "${diffoutput}" + echo "" + fi + rm -f defaultcfgtemp.txt + done diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index 6a074861c7..0a7c0893fa 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -15,12 +15,12 @@ # Debugging if [ -f ".dev-debug" ]; then - exec 5>dev-debug.log + exec 5> dev-debug.log BASH_XTRACEFD="5" set -x fi -version="v22.1.0" +version="v22.2.0" shortname="fctr" gameservername="fctrserver" commandname="CORE" @@ -58,14 +58,14 @@ githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" # Core function that is required first. -core_functions.sh(){ +core_functions.sh() { functionfile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" } # Bootstrap # Fetches the core functions required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -77,16 +77,16 @@ fn_bootstrap_fetch_file(){ forcedl="${9:-0}" md5="${10:-0}" # Download file if missing or download forced. - if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then + if [ ! -f "${local_filedir}/${local_filename}" ] || [ "${forcedl}" == "forcedl" ]; then # If backup fileurl exists include it. if [ -n "${remote_fileurl_backup}" ]; then # counter set to 0 to allow second try counter=0 - remote_fileurls_array=( remote_fileurl remote_fileurl_backup ) + remote_fileurls_array=(remote_fileurl remote_fileurl_backup) else # counter set to 1 to not allow second try counter=1 - remote_fileurls_array=( remote_fileurl ) + remote_fileurls_array=(remote_fileurl) fi for remote_fileurl_array in "${remote_fileurls_array[@]}"; do @@ -97,7 +97,7 @@ fn_bootstrap_fetch_file(){ fileurl="${remote_fileurl_backup}" fileurl_name="${remote_fileurl_backup_name}" fi - counter=$((counter+1)) + counter=$((counter + 1)) if [ ! -d "${local_filedir}" ]; then mkdir -p "${local_filedir}" fi @@ -111,7 +111,7 @@ fn_bootstrap_fetch_file(){ local exitcode=$? # Download will fail if downloads a html file. if [ -f "${local_filedir}/${local_filename}" ]; then - if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE" )" ]; then + if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE")" ]; then rm "${local_filedir:?}/${local_filename:?}" local exitcode=2 fi @@ -164,11 +164,11 @@ fn_bootstrap_fetch_file(){ fi } -fn_bootstrap_fetch_file_github(){ +fn_bootstrap_fetch_file_github() { github_file_url_dir="${1}" github_file_url_name="${2}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else @@ -192,10 +192,10 @@ fn_bootstrap_fetch_file_github(){ fn_print_center() { columns=$(tput cols) line="$*" - printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}" + printf "%*s\n" $(((${#line} + columns) / 2)) "${line}" } -fn_print_horizontal(){ +fn_print_horizontal() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "=" } @@ -212,11 +212,11 @@ fn_install_menu_bash() { menu_options=() while read -r line || [[ -n "${line}" ]]; do var=$(echo -e "${line}" | awk -F "," '{print $2 " - " $3}') - menu_options+=( "${var}" ) + menu_options+=("${var}") done < "${options}" - menu_options+=( "Cancel" ) + menu_options+=("Cancel") select option in "${menu_options[@]}"; do - if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then + if [ "${option}" ] && [ "${option}" != "Cancel" ]; then eval "$resultvar=\"${option/%\ */}\"" fi break @@ -238,7 +238,7 @@ fn_install_menu_whiptail() { while read -r line; do key=$(echo -e "${line}" | awk -F "," '{print $3}') val=$(echo -e "${line}" | awk -F "," '{print $2}') - menu_options+=( "${val//\"}" "${key//\"}" ) + menu_options+=("${val//\"/}" "${key//\"/}") done < "${options}" OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3) if [ $? == 0 ]; then @@ -263,24 +263,26 @@ fn_install_menu() { fi done case "$(basename "${menucmd}")" in - whiptail|dialog) - fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;; + whiptail | dialog) + fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30 + ;; *) - fn_install_menu_bash selection "${title}" "${caption}" "${options}";; + fn_install_menu_bash selection "${title}" "${caption}" "${options}" + ;; esac eval "$resultvar=\"${selection}\"" } # Gets server info from serverlist.csv and puts in to array. -fn_server_info(){ +fn_server_info() { IFS="," server_info_array=($(grep -aw "${userinput}" "${serverlist}")) - shortname="${server_info_array[0]}" # csgo + shortname="${server_info_array[0]}" # csgo gameservername="${server_info_array[1]}" # csgoserver - gamename="${server_info_array[2]}" # Counter Strike: Global Offensive + gamename="${server_info_array[2]}" # Counter Strike: Global Offensive } -fn_install_getopt(){ +fn_install_getopt() { userinput="empty" echo -e "Usage: $0 [option]" echo -e "" @@ -294,13 +296,13 @@ fn_install_getopt(){ exit } -fn_install_file(){ +fn_install_file() { local_filename="${gameservername}" if [ -e "${local_filename}" ]; then i=2 - while [ -e "${local_filename}-${i}" ] ; do - (( i++ )) - done + while [ -e "${local_filename}-${i}" ]; do + ((i++)) + done local_filename="${local_filename}-${i}" fi cp -R "${selfname}" "${local_filename}" @@ -320,12 +322,12 @@ fn_install_file(){ # Prevent LinuxGSM from running as root. Except if doing a dependency install. if [ "$(whoami)" == "root" ]; then - if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then + if [ "${userinput}" == "install" ] || [ "${userinput}" == "auto-install" ] || [ "${userinput}" == "i" ] || [ "${userinput}" == "ai" ]; then if [ "${shortname}" == "core" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then + elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else @@ -343,12 +345,12 @@ if [ "${shortname}" == "core" ]; then exit 1 fi - if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then + if [ "${userinput}" == "list" ] || [ "${userinput}" == "l" ]; then { tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}' } | column -s $'\t' -t | more exit - elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then + elif [ "${userinput}" == "install" ] || [ "${userinput}" == "i" ]; then tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}" fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}" userinput="${result}" @@ -364,7 +366,7 @@ if [ "${shortname}" == "core" ]; then fi elif [ "${userinput}" ]; then fn_server_info - if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then + if [ "${userinput}" == "${gameservername}" ] || [ "${userinput}" == "${gamename}" ] || [ "${userinput}" == "${shortname}" ]; then fn_install_file else echo -e "[ FAIL ] unknown game server" @@ -463,7 +465,7 @@ else fi fi -fn_currentstatus_tmux(){ +fn_currentstatus_tmux() { check_status.sh if [ "${status}" != "0" ]; then currentstatus="STARTED" @@ -472,14 +474,14 @@ fn_currentstatus_tmux(){ fi } -fn_setstatus(){ +fn_setstatus() { fn_currentstatus_tmux echo"" echo -e "Required status: ${requiredstatus}" counter=0 echo -e "Current status: ${currentstatus}" - while [ "${requiredstatus}" != "${currentstatus}" ]; do - counter=$((counter+1)) + while [ "${requiredstatus}" != "${currentstatus}" ]; do + counter=$((counter + 1)) fn_currentstatus_tmux echo -en "New status: ${currentstatus}\\r" @@ -505,7 +507,7 @@ fn_setstatus(){ # End of every test will expect the result to either pass or fail # If the script does not do as intended the whole test will fail # if expecting a pass -fn_test_result_pass(){ +fn_test_result_pass() { if [ $? != 0 ]; then echo -e "=================================" echo -e "Expected result: PASS" @@ -523,7 +525,7 @@ fn_test_result_pass(){ } # if expecting a fail -fn_test_result_fail(){ +fn_test_result_fail() { if [ $? == 0 ]; then echo -e "=================================" echo -e "Expected result: FAIL" @@ -541,7 +543,7 @@ fn_test_result_fail(){ } # test result n/a -fn_test_result_na(){ +fn_test_result_na() { echo -e "=================================" echo -e "Expected result: N/A" echo -e "Actual result: N/A" @@ -627,7 +629,7 @@ echo -e "0.1 - Create log dir's" echo -e "=================================" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x install_logs.sh @@ -643,7 +645,7 @@ echo -e "Description:" echo -e "Enable dev-debug" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_debug.sh @@ -666,13 +668,13 @@ echo -e "Command: ./${gameservername} start" echo -e "" # Allows for testing not on Travis CI if [ -z "${TRAVIS}" ]; then -( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" - BASH_XTRACEFD="5" - set -x - command_start.sh -) -fn_test_result_fail + ( + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_start.sh + ) + fn_test_result_fail else echo -e "Test bypassed" fi @@ -689,7 +691,7 @@ echo -e "displaying options messages." echo -e "Command: ./${gameservername}" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x core_getopt.sh @@ -708,7 +710,7 @@ echo -e "Command: ./${gameservername} abc123" echo -e "" getopt="abc123" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x core_getopt.sh @@ -729,7 +731,7 @@ echo -e "Description:" echo -e "install ${gamename} server." echo -e "Command: ./${gameservername} auto-install" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x fn_autoinstall @@ -752,7 +754,7 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_start.sh @@ -771,7 +773,7 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_start.sh @@ -790,10 +792,11 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x - updateonstart="on";command_start.sh + updateonstart="on" + command_start.sh ) fn_test_result_pass echo -e "run order" @@ -809,7 +812,7 @@ echo -e "Command: ./${gameservername} stop" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_stop.sh @@ -828,7 +831,7 @@ echo -e "Command: ./${gameservername} stop" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_stop.sh @@ -847,7 +850,7 @@ echo -e "Command: ./${gameservername} restart" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_restart.sh @@ -866,7 +869,7 @@ echo -e "Command: ./${gameservername} restart" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_restart.sh @@ -889,7 +892,7 @@ echo -e "Command: ./${gameservername} update" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update.sh @@ -909,7 +912,7 @@ echo -e "Command: ./jc2server update-lgam" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update_linuxgsm.sh @@ -936,7 +939,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -959,7 +962,7 @@ date '+%s' > "${lockdir}/${selfname}.lock" echo "${version}" >> "${lockdir}/${selfname}.lock" echo "${port}" >> "${lockdir}/${selfname}.lock" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -978,7 +981,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -997,7 +1000,7 @@ echo -e "Command: ./${gameservername} test-alert" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_test_alert.sh @@ -1020,7 +1023,7 @@ echo -e "Command: ./${gameservername} details" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_details.sh @@ -1039,7 +1042,7 @@ echo -e "Command: ./${gameservername} postdetails" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_postdetails.sh @@ -1081,7 +1084,7 @@ echo -e "Command: ./${gameservername} detect-glibc" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_glibc.sh @@ -1100,7 +1103,7 @@ echo -e "Command: ./${gameservername} detect-ldd" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_ldd.sh @@ -1119,7 +1122,7 @@ echo -e "Command: ./${gameservername} detect-deps" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_deps.sh @@ -1138,7 +1141,7 @@ echo -e "Command: ./${gameservername} query-raw" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_query_raw.sh @@ -1162,7 +1165,7 @@ echo -e "Command: ./${gameservername} donate" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_donate.sh diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index 4bdadb59f8..58e8da188b 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -15,12 +15,12 @@ # Debugging if [ -f ".dev-debug" ]; then - exec 5>dev-debug.log + exec 5> dev-debug.log BASH_XTRACEFD="5" set -x fi -version="v22.1.0" +version="v22.2.0" shortname="jc2" gameservername="jc2server" commandname="CORE" @@ -59,14 +59,14 @@ githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" # Core function that is required first. -core_functions.sh(){ +core_functions.sh() { functionfile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" } # Bootstrap # Fetches the core functions required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -78,16 +78,16 @@ fn_bootstrap_fetch_file(){ forcedl="${9:-0}" md5="${10:-0}" # Download file if missing or download forced. - if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then + if [ ! -f "${local_filedir}/${local_filename}" ] || [ "${forcedl}" == "forcedl" ]; then # If backup fileurl exists include it. if [ -n "${remote_fileurl_backup}" ]; then # counter set to 0 to allow second try counter=0 - remote_fileurls_array=( remote_fileurl remote_fileurl_backup ) + remote_fileurls_array=(remote_fileurl remote_fileurl_backup) else # counter set to 1 to not allow second try counter=1 - remote_fileurls_array=( remote_fileurl ) + remote_fileurls_array=(remote_fileurl) fi for remote_fileurl_array in "${remote_fileurls_array[@]}"; do @@ -98,7 +98,7 @@ fn_bootstrap_fetch_file(){ fileurl="${remote_fileurl_backup}" fileurl_name="${remote_fileurl_backup_name}" fi - counter=$((counter+1)) + counter=$((counter + 1)) if [ ! -d "${local_filedir}" ]; then mkdir -p "${local_filedir}" fi @@ -112,7 +112,7 @@ fn_bootstrap_fetch_file(){ local exitcode=$? # Download will fail if downloads a html file. if [ -f "${local_filedir}/${local_filename}" ]; then - if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE" )" ]; then + if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE")" ]; then rm "${local_filedir:?}/${local_filename:?}" local exitcode=2 fi @@ -165,11 +165,11 @@ fn_bootstrap_fetch_file(){ fi } -fn_bootstrap_fetch_file_github(){ +fn_bootstrap_fetch_file_github() { github_file_url_dir="${1}" github_file_url_name="${2}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else @@ -193,10 +193,10 @@ fn_bootstrap_fetch_file_github(){ fn_print_center() { columns=$(tput cols) line="$*" - printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}" + printf "%*s\n" $(((${#line} + columns) / 2)) "${line}" } -fn_print_horizontal(){ +fn_print_horizontal() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "=" } @@ -213,11 +213,11 @@ fn_install_menu_bash() { menu_options=() while read -r line || [[ -n "${line}" ]]; do var=$(echo -e "${line}" | awk -F "," '{print $2 " - " $3}') - menu_options+=( "${var}" ) + menu_options+=("${var}") done < "${options}" - menu_options+=( "Cancel" ) + menu_options+=("Cancel") select option in "${menu_options[@]}"; do - if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then + if [ "${option}" ] && [ "${option}" != "Cancel" ]; then eval "$resultvar=\"${option/%\ */}\"" fi break @@ -239,7 +239,7 @@ fn_install_menu_whiptail() { while read -r line; do key=$(echo -e "${line}" | awk -F "," '{print $3}') val=$(echo -e "${line}" | awk -F "," '{print $2}') - menu_options+=( "${val//\"}" "${key//\"}" ) + menu_options+=("${val//\"/}" "${key//\"/}") done < "${options}" OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3) if [ $? == 0 ]; then @@ -264,24 +264,26 @@ fn_install_menu() { fi done case "$(basename "${menucmd}")" in - whiptail|dialog) - fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;; + whiptail | dialog) + fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30 + ;; *) - fn_install_menu_bash selection "${title}" "${caption}" "${options}";; + fn_install_menu_bash selection "${title}" "${caption}" "${options}" + ;; esac eval "$resultvar=\"${selection}\"" } # Gets server info from serverlist.csv and puts in to array. -fn_server_info(){ +fn_server_info() { IFS="," server_info_array=($(grep -aw "${userinput}" "${serverlist}")) - shortname="${server_info_array[0]}" # csgo + shortname="${server_info_array[0]}" # csgo gameservername="${server_info_array[1]}" # csgoserver - gamename="${server_info_array[2]}" # Counter Strike: Global Offensive + gamename="${server_info_array[2]}" # Counter Strike: Global Offensive } -fn_install_getopt(){ +fn_install_getopt() { userinput="empty" echo -e "Usage: $0 [option]" echo -e "" @@ -295,13 +297,13 @@ fn_install_getopt(){ exit } -fn_install_file(){ +fn_install_file() { local_filename="${gameservername}" if [ -e "${local_filename}" ]; then i=2 - while [ -e "${local_filename}-${i}" ] ; do - (( i++ )) - done + while [ -e "${local_filename}-${i}" ]; do + ((i++)) + done local_filename="${local_filename}-${i}" fi cp -R "${selfname}" "${local_filename}" @@ -321,12 +323,12 @@ fn_install_file(){ # Prevent LinuxGSM from running as root. Except if doing a dependency install. if [ "$(whoami)" == "root" ]; then - if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then + if [ "${userinput}" == "install" ] || [ "${userinput}" == "auto-install" ] || [ "${userinput}" == "i" ] || [ "${userinput}" == "ai" ]; then if [ "${shortname}" == "core" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then + elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else @@ -344,12 +346,12 @@ if [ "${shortname}" == "core" ]; then exit 1 fi - if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then + if [ "${userinput}" == "list" ] || [ "${userinput}" == "l" ]; then { tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}' } | column -s $'\t' -t | more exit - elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then + elif [ "${userinput}" == "install" ] || [ "${userinput}" == "i" ]; then tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}" fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}" userinput="${result}" @@ -365,7 +367,7 @@ if [ "${shortname}" == "core" ]; then fi elif [ "${userinput}" ]; then fn_server_info - if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then + if [ "${userinput}" == "${gameservername}" ] || [ "${userinput}" == "${gamename}" ] || [ "${userinput}" == "${shortname}" ]; then fn_install_file else echo -e "[ FAIL ] unknown game server" @@ -464,7 +466,7 @@ else fi fi -fn_currentstatus_tmux(){ +fn_currentstatus_tmux() { check_status.sh if [ "${status}" != "0" ]; then currentstatus="STARTED" @@ -473,14 +475,14 @@ fn_currentstatus_tmux(){ fi } -fn_setstatus(){ +fn_setstatus() { fn_currentstatus_tmux echo"" echo -e "Required status: ${requiredstatus}" counter=0 echo -e "Current status: ${currentstatus}" - while [ "${requiredstatus}" != "${currentstatus}" ]; do - counter=$((counter+1)) + while [ "${requiredstatus}" != "${currentstatus}" ]; do + counter=$((counter + 1)) fn_currentstatus_tmux echo -en "New status: ${currentstatus}\\r" @@ -506,7 +508,7 @@ fn_setstatus(){ # End of every test will expect the result to either pass or fail # If the script does not do as intended the whole test will fail # if expecting a pass -fn_test_result_pass(){ +fn_test_result_pass() { if [ $? != 0 ]; then echo -e "=================================" echo -e "Expected result: PASS" @@ -524,7 +526,7 @@ fn_test_result_pass(){ } # if expecting a fail -fn_test_result_fail(){ +fn_test_result_fail() { if [ $? == 0 ]; then echo -e "=================================" echo -e "Expected result: FAIL" @@ -542,7 +544,7 @@ fn_test_result_fail(){ } # test result n/a -fn_test_result_na(){ +fn_test_result_na() { echo -e "=================================" echo -e "Expected result: N/A" echo -e "Actual result: N/A" @@ -632,7 +634,7 @@ echo -e "0.1 - Create log dir's" echo -e "=================================" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x install_logs.sh @@ -648,7 +650,7 @@ echo -e "Description:" echo -e "Enable dev-debug" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_debug.sh @@ -671,13 +673,13 @@ echo -e "Command: ./${gameservername} start" echo -e "" # Allows for testing not on Travis CI if [ -z "${TRAVIS}" ]; then -( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" - BASH_XTRACEFD="5" - set -x - command_start.sh -) -fn_test_result_fail + ( + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_start.sh + ) + fn_test_result_fail else echo -e "Test bypassed" fi @@ -694,7 +696,7 @@ echo -e "displaying options messages." echo -e "Command: ./${gameservername}" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x core_getopt.sh @@ -713,7 +715,7 @@ echo -e "Command: ./${gameservername} abc123" echo -e "" getopt="abc123" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x core_getopt.sh @@ -734,7 +736,7 @@ echo -e "Description:" echo -e "install ${gamename} server." echo -e "Command: ./${gameservername} auto-install" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x fn_autoinstall @@ -757,7 +759,7 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_start.sh @@ -776,7 +778,7 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_start.sh @@ -795,10 +797,11 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x - updateonstart="on";command_start.sh + updateonstart="on" + command_start.sh ) fn_test_result_pass echo -e "run order" @@ -814,7 +817,7 @@ echo -e "Command: ./${gameservername} stop" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_stop.sh @@ -833,7 +836,7 @@ echo -e "Command: ./${gameservername} stop" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_stop.sh @@ -852,7 +855,7 @@ echo -e "Command: ./${gameservername} restart" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_restart.sh @@ -871,7 +874,7 @@ echo -e "Command: ./${gameservername} restart" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_restart.sh @@ -894,7 +897,7 @@ echo -e "Command: ./${gameservername} update" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update.sh @@ -915,7 +918,7 @@ fn_setstatus fn_print_info_nl "changed buildid to 0." sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update.sh @@ -936,7 +939,7 @@ fn_setstatus fn_print_info_nl "changed buildid to 0." sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update.sh @@ -957,7 +960,7 @@ fn_setstatus fn_print_info_nl "removed appmanifest_${appid}.acf." rm --verbose "${serverfiles:?}/steamapps/appmanifest_${appid}.acf" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update.sh @@ -976,10 +979,11 @@ echo -e "Command: ./jc2server force-update" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x - forceupdate=1;command_update.sh + forceupdate=1 + command_update.sh ) fn_test_result_pass echo -e "run order" @@ -995,10 +999,11 @@ echo -e "Command: ./jc2server force-update" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x - forceupdate=1;command_update.sh + forceupdate=1 + command_update.sh ) fn_test_result_pass echo -e "run order" @@ -1014,7 +1019,7 @@ echo -e "Command: ./jc2server validate" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_validate.sh @@ -1034,7 +1039,7 @@ echo -e "Command: ./jc2server validate" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_validate.sh @@ -1054,7 +1059,7 @@ echo -e "Command: ./jc2server update-lgam" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update_linuxgsm.sh @@ -1070,7 +1075,7 @@ echo -e "=================================" echo -e "Description:" echo -e "Inserting Travis IP in to config." echo -e "Allows monitor to work" -if [ "$(${ipcommand}-o -4 addr|grep eth0)" ]; then +if [ "$(${ipcommand}-o -4 addr | grep eth0)" ]; then travisip=$(${ipcommand}-o -4 addr | grep eth0 | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}' | grep -v 127.0.0) else travisip=$(${ipcommand}-o -4 addr | grep ens | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}' | sort -u | grep -v 127.0.0) @@ -1095,7 +1100,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -1118,7 +1123,7 @@ date '+%s' > "${lockdir}/${selfname}.lock" echo "${version}" >> "${lockdir}/${selfname}.lock" echo "${port}" >> "${lockdir}/${selfname}.lock" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -1137,7 +1142,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -1158,7 +1163,7 @@ fn_setstatus cp "${servercfgfullpath}" "config.lua" sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_test_alert.sh @@ -1186,7 +1191,7 @@ echo -e "Command: ./${gameservername} details" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_details.sh @@ -1205,7 +1210,7 @@ echo -e "Command: ./${gameservername} postdetails" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_postdetails.sh @@ -1247,7 +1252,7 @@ echo -e "Command: ./${gameservername} detect-glibc" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_glibc.sh @@ -1266,7 +1271,7 @@ echo -e "Command: ./${gameservername} detect-ldd" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_ldd.sh @@ -1285,7 +1290,7 @@ echo -e "Command: ./${gameservername} detect-deps" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_deps.sh @@ -1304,7 +1309,7 @@ echo -e "Command: ./${gameservername} query-raw" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_query_raw.sh @@ -1327,7 +1332,7 @@ echo -e "Command: ./${gameservername} donate" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_donate.sh diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index f9e64e07ce..3fbbc3bf3b 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -15,12 +15,12 @@ # Debugging if [ -f ".dev-debug" ]; then - exec 5>dev-debug.log + exec 5> dev-debug.log BASH_XTRACEFD="5" set -x fi -version="v22.1.0" +version="v22.2.0" shortname="mc" gameservername="mcserver" commandname="CORE" @@ -59,14 +59,14 @@ githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" # Core function that is required first. -core_functions.sh(){ +core_functions.sh() { functionfile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" } # Bootstrap # Fetches the core functions required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -78,16 +78,16 @@ fn_bootstrap_fetch_file(){ forcedl="${9:-0}" md5="${10:-0}" # Download file if missing or download forced. - if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then + if [ ! -f "${local_filedir}/${local_filename}" ] || [ "${forcedl}" == "forcedl" ]; then # If backup fileurl exists include it. if [ -n "${remote_fileurl_backup}" ]; then # counter set to 0 to allow second try counter=0 - remote_fileurls_array=( remote_fileurl remote_fileurl_backup ) + remote_fileurls_array=(remote_fileurl remote_fileurl_backup) else # counter set to 1 to not allow second try counter=1 - remote_fileurls_array=( remote_fileurl ) + remote_fileurls_array=(remote_fileurl) fi for remote_fileurl_array in "${remote_fileurls_array[@]}"; do @@ -98,7 +98,7 @@ fn_bootstrap_fetch_file(){ fileurl="${remote_fileurl_backup}" fileurl_name="${remote_fileurl_backup_name}" fi - counter=$((counter+1)) + counter=$((counter + 1)) if [ ! -d "${local_filedir}" ]; then mkdir -p "${local_filedir}" fi @@ -112,7 +112,7 @@ fn_bootstrap_fetch_file(){ local exitcode=$? # Download will fail if downloads a html file. if [ -f "${local_filedir}/${local_filename}" ]; then - if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE" )" ]; then + if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE")" ]; then rm "${local_filedir:?}/${local_filename:?}" local exitcode=2 fi @@ -165,11 +165,11 @@ fn_bootstrap_fetch_file(){ fi } -fn_bootstrap_fetch_file_github(){ +fn_bootstrap_fetch_file_github() { github_file_url_dir="${1}" github_file_url_name="${2}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else @@ -193,10 +193,10 @@ fn_bootstrap_fetch_file_github(){ fn_print_center() { columns=$(tput cols) line="$*" - printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}" + printf "%*s\n" $(((${#line} + columns) / 2)) "${line}" } -fn_print_horizontal(){ +fn_print_horizontal() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "=" } @@ -213,11 +213,11 @@ fn_install_menu_bash() { menu_options=() while read -r line || [[ -n "${line}" ]]; do var=$(echo -e "${line}" | awk -F "," '{print $2 " - " $3}') - menu_options+=( "${var}" ) + menu_options+=("${var}") done < "${options}" - menu_options+=( "Cancel" ) + menu_options+=("Cancel") select option in "${menu_options[@]}"; do - if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then + if [ "${option}" ] && [ "${option}" != "Cancel" ]; then eval "$resultvar=\"${option/%\ */}\"" fi break @@ -239,7 +239,7 @@ fn_install_menu_whiptail() { while read -r line; do key=$(echo -e "${line}" | awk -F "," '{print $3}') val=$(echo -e "${line}" | awk -F "," '{print $2}') - menu_options+=( "${val//\"}" "${key//\"}" ) + menu_options+=("${val//\"/}" "${key//\"/}") done < "${options}" OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3) if [ $? == 0 ]; then @@ -264,24 +264,26 @@ fn_install_menu() { fi done case "$(basename "${menucmd}")" in - whiptail|dialog) - fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;; + whiptail | dialog) + fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30 + ;; *) - fn_install_menu_bash selection "${title}" "${caption}" "${options}";; + fn_install_menu_bash selection "${title}" "${caption}" "${options}" + ;; esac eval "$resultvar=\"${selection}\"" } # Gets server info from serverlist.csv and puts in to array. -fn_server_info(){ +fn_server_info() { IFS="," server_info_array=($(grep -aw "${userinput}" "${serverlist}")) - shortname="${server_info_array[0]}" # csgo + shortname="${server_info_array[0]}" # csgo gameservername="${server_info_array[1]}" # csgoserver - gamename="${server_info_array[2]}" # Counter Strike: Global Offensive + gamename="${server_info_array[2]}" # Counter Strike: Global Offensive } -fn_install_getopt(){ +fn_install_getopt() { userinput="empty" echo -e "Usage: $0 [option]" echo -e "" @@ -295,13 +297,13 @@ fn_install_getopt(){ exit } -fn_install_file(){ +fn_install_file() { local_filename="${gameservername}" if [ -e "${local_filename}" ]; then i=2 - while [ -e "${local_filename}-${i}" ] ; do - (( i++ )) - done + while [ -e "${local_filename}-${i}" ]; do + ((i++)) + done local_filename="${local_filename}-${i}" fi cp -R "${selfname}" "${local_filename}" @@ -321,12 +323,12 @@ fn_install_file(){ # Prevent LinuxGSM from running as root. Except if doing a dependency install. if [ "$(whoami)" == "root" ]; then - if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then + if [ "${userinput}" == "install" ] || [ "${userinput}" == "auto-install" ] || [ "${userinput}" == "i" ] || [ "${userinput}" == "ai" ]; then if [ "${shortname}" == "core" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then + elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else @@ -344,12 +346,12 @@ if [ "${shortname}" == "core" ]; then exit 1 fi - if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then + if [ "${userinput}" == "list" ] || [ "${userinput}" == "l" ]; then { tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}' } | column -s $'\t' -t | more exit - elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then + elif [ "${userinput}" == "install" ] || [ "${userinput}" == "i" ]; then tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}" fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}" userinput="${result}" @@ -365,7 +367,7 @@ if [ "${shortname}" == "core" ]; then fi elif [ "${userinput}" ]; then fn_server_info - if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then + if [ "${userinput}" == "${gameservername}" ] || [ "${userinput}" == "${gamename}" ] || [ "${userinput}" == "${shortname}" ]; then fn_install_file else echo -e "[ FAIL ] unknown game server" @@ -464,7 +466,7 @@ else fi fi -fn_currentstatus_tmux(){ +fn_currentstatus_tmux() { check_status.sh if [ "${status}" != "0" ]; then currentstatus="STARTED" @@ -473,14 +475,14 @@ fn_currentstatus_tmux(){ fi } -fn_setstatus(){ +fn_setstatus() { fn_currentstatus_tmux echo"" echo -e "Required status: ${requiredstatus}" counter=0 echo -e "Current status: ${currentstatus}" - while [ "${requiredstatus}" != "${currentstatus}" ]; do - counter=$((counter+1)) + while [ "${requiredstatus}" != "${currentstatus}" ]; do + counter=$((counter + 1)) fn_currentstatus_tmux echo -en "New status: ${currentstatus}\\r" @@ -506,7 +508,7 @@ fn_setstatus(){ # End of every test will expect the result to either pass or fail # If the script does not do as intended the whole test will fail # if expecting a pass -fn_test_result_pass(){ +fn_test_result_pass() { if [ $? != 0 ]; then echo -e "=================================" echo -e "Expected result: PASS" @@ -524,7 +526,7 @@ fn_test_result_pass(){ } # if expecting a fail -fn_test_result_fail(){ +fn_test_result_fail() { if [ $? == 0 ]; then echo -e "=================================" echo -e "Expected result: FAIL" @@ -542,7 +544,7 @@ fn_test_result_fail(){ } # test result n/a -fn_test_result_na(){ +fn_test_result_na() { echo -e "=================================" echo -e "Expected result: N/A" echo -e "Actual result: N/A" @@ -626,7 +628,7 @@ echo -e "0.1 - Create log dir's" echo -e "=================================" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x install_logs.sh @@ -642,7 +644,7 @@ echo -e "Description:" echo -e "Enable dev-debug" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_debug.sh @@ -665,13 +667,13 @@ echo -e "Command: ./${gameservername} start" echo -e "" # Allows for testing not on Travis CI if [ -z "${TRAVIS}" ]; then -( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" - BASH_XTRACEFD="5" - set -x - command_start.sh -) -fn_test_result_fail + ( + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_start.sh + ) + fn_test_result_fail else echo -e "Test bypassed" fi @@ -688,7 +690,7 @@ echo -e "displaying options messages." echo -e "Command: ./${gameservername}" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x core_getopt.sh @@ -707,7 +709,7 @@ echo -e "Command: ./${gameservername} abc123" echo -e "" getopt="abc123" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x core_getopt.sh @@ -728,7 +730,7 @@ echo -e "Description:" echo -e "install ${gamename} server." echo -e "Command: ./${gameservername} auto-install" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x fn_autoinstall @@ -751,7 +753,7 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_start.sh @@ -770,7 +772,7 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_start.sh @@ -789,10 +791,11 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x - updateonstart="on";command_start.sh + updateonstart="on" + command_start.sh ) fn_test_result_pass echo -e "run order" @@ -817,7 +820,7 @@ echo -e "Command: ./${gameservername} stop" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_stop.sh @@ -836,7 +839,7 @@ echo -e "Command: ./${gameservername} stop" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_stop.sh @@ -855,7 +858,7 @@ echo -e "Command: ./${gameservername} restart" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_restart.sh @@ -874,7 +877,7 @@ echo -e "Command: ./${gameservername} restart" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_restart.sh @@ -897,7 +900,7 @@ echo -e "Command: ./${gameservername} update" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update.sh @@ -917,7 +920,7 @@ echo -e "Command: ./jc2server update-lgam" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update_linuxgsm.sh @@ -933,7 +936,7 @@ echo -e "=================================" echo -e "Description:" echo -e "Inserting Travis IP in to config." echo -e "Allows monitor to work" -if [ "$(${ipcommand}-o -4 addr|grep eth0)" ]; then +if [ "$(${ipcommand}-o -4 addr | grep eth0)" ]; then travisip=$(${ipcommand}-o -4 addr | grep eth0 | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}' | grep -v 127.0.0) else travisip=$(${ipcommand}-o -4 addr | grep ens | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}' | sort -u | grep -v 127.0.0) @@ -968,7 +971,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -991,7 +994,7 @@ date '+%s' > "${lockdir}/${selfname}.lock" echo "${version}" >> "${lockdir}/${selfname}.lock" echo "${port}" >> "${lockdir}/${selfname}.lock" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -1010,7 +1013,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -1029,7 +1032,7 @@ echo -e "Command: ./${gameservername} test-alert" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_test_alert.sh @@ -1052,7 +1055,7 @@ echo -e "Command: ./${gameservername} details" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_details.sh @@ -1071,7 +1074,7 @@ echo -e "Command: ./${gameservername} postdetails" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_postdetails.sh @@ -1113,7 +1116,7 @@ echo -e "Command: ./${gameservername} detect-glibc" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_glibc.sh @@ -1132,7 +1135,7 @@ echo -e "Command: ./${gameservername} detect-ldd" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_ldd.sh @@ -1151,7 +1154,7 @@ echo -e "Command: ./${gameservername} detect-deps" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_deps.sh @@ -1167,7 +1170,7 @@ echo -e "=================================" echo -e "Description:" echo -e "Inserting Travis IP in to config." echo -e "Allows monitor to work" -if [ "$(${ipcommand}-o -4 addr|grep eth0)" ]; then +if [ "$(${ipcommand}-o -4 addr | grep eth0)" ]; then travisip=$(${ipcommand}-o -4 addr | grep eth0 | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}' | grep -v 127.0.0) else travisip=$(${ipcommand}-o -4 addr | grep ens | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}' | sort -u | grep -v 127.0.0) @@ -1184,7 +1187,7 @@ echo -e "Command: ./${gameservername} query-raw" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_query_raw.sh @@ -1207,7 +1210,7 @@ echo -e "Command: ./${gameservername} donate" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_donate.sh diff --git a/tests/tests_shellcheck.sh b/tests/tests_shellcheck.sh index f4bbf48683..c277a5177f 100644 --- a/tests/tests_shellcheck.sh +++ b/tests/tests_shellcheck.sh @@ -21,10 +21,10 @@ echo -e "Using: Shellcheck" echo -e "Testing Branch: $TRAVIS_BRANCH" echo -e "=================================" echo -e "" -scissues=$(find . -type f \( -name "*.sh" -o -name "*.cfg" \) -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \; | grep -F "^--" | wc -l) +scissues=$(find . -type f \( -name "*.sh" -o -name "*.cfg" \) -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \; | grep -F "^--" | wc -l) echo -e "Found issues: ${scissues}" echo -e "=================================" -find . -type f \( -name "*.sh" -o -name "*.cfg" \) -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \; +find . -type f \( -name "*.sh" -o -name "*.cfg" \) -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \; echo -e "" echo -e "=================================" echo -e "Bash Analysis Tests - Complete!" diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index bb149ded7b..d4857765e6 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -15,12 +15,12 @@ # Debugging if [ -f ".dev-debug" ]; then - exec 5>dev-debug.log + exec 5> dev-debug.log BASH_XTRACEFD="5" set -x fi -version="v22.1.0" +version="v22.2.0" shortname="ts3" gameservername="ts3server" commandname="CORE" @@ -59,14 +59,14 @@ githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" # Core function that is required first. -core_functions.sh(){ +core_functions.sh() { functionfile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" } # Bootstrap # Fetches the core functions required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -78,16 +78,16 @@ fn_bootstrap_fetch_file(){ forcedl="${9:-0}" md5="${10:-0}" # Download file if missing or download forced. - if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then + if [ ! -f "${local_filedir}/${local_filename}" ] || [ "${forcedl}" == "forcedl" ]; then # If backup fileurl exists include it. if [ -n "${remote_fileurl_backup}" ]; then # counter set to 0 to allow second try counter=0 - remote_fileurls_array=( remote_fileurl remote_fileurl_backup ) + remote_fileurls_array=(remote_fileurl remote_fileurl_backup) else # counter set to 1 to not allow second try counter=1 - remote_fileurls_array=( remote_fileurl ) + remote_fileurls_array=(remote_fileurl) fi for remote_fileurl_array in "${remote_fileurls_array[@]}"; do @@ -98,7 +98,7 @@ fn_bootstrap_fetch_file(){ fileurl="${remote_fileurl_backup}" fileurl_name="${remote_fileurl_backup_name}" fi - counter=$((counter+1)) + counter=$((counter + 1)) if [ ! -d "${local_filedir}" ]; then mkdir -p "${local_filedir}" fi @@ -112,7 +112,7 @@ fn_bootstrap_fetch_file(){ local exitcode=$? # Download will fail if downloads a html file. if [ -f "${local_filedir}/${local_filename}" ]; then - if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE" )" ]; then + if [ -n "$(head "${local_filedir}/${local_filename}" | grep "DOCTYPE")" ]; then rm "${local_filedir:?}/${local_filename:?}" local exitcode=2 fi @@ -165,11 +165,11 @@ fn_bootstrap_fetch_file(){ fi } -fn_bootstrap_fetch_file_github(){ +fn_bootstrap_fetch_file_github() { github_file_url_dir="${1}" github_file_url_name="${2}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else @@ -193,10 +193,10 @@ fn_bootstrap_fetch_file_github(){ fn_print_center() { columns=$(tput cols) line="$*" - printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}" + printf "%*s\n" $(((${#line} + columns) / 2)) "${line}" } -fn_print_horizontal(){ +fn_print_horizontal() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "=" } @@ -213,11 +213,11 @@ fn_install_menu_bash() { menu_options=() while read -r line || [[ -n "${line}" ]]; do var=$(echo -e "${line}" | awk -F "," '{print $2 " - " $3}') - menu_options+=( "${var}" ) + menu_options+=("${var}") done < "${options}" - menu_options+=( "Cancel" ) + menu_options+=("Cancel") select option in "${menu_options[@]}"; do - if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then + if [ "${option}" ] && [ "${option}" != "Cancel" ]; then eval "$resultvar=\"${option/%\ */}\"" fi break @@ -239,7 +239,7 @@ fn_install_menu_whiptail() { while read -r line; do key=$(echo -e "${line}" | awk -F "," '{print $3}') val=$(echo -e "${line}" | awk -F "," '{print $2}') - menu_options+=( "${val//\"}" "${key//\"}" ) + menu_options+=("${val//\"/}" "${key//\"/}") done < "${options}" OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3) if [ $? == 0 ]; then @@ -264,24 +264,26 @@ fn_install_menu() { fi done case "$(basename "${menucmd}")" in - whiptail|dialog) - fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;; + whiptail | dialog) + fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30 + ;; *) - fn_install_menu_bash selection "${title}" "${caption}" "${options}";; + fn_install_menu_bash selection "${title}" "${caption}" "${options}" + ;; esac eval "$resultvar=\"${selection}\"" } # Gets server info from serverlist.csv and puts in to array. -fn_server_info(){ +fn_server_info() { IFS="," server_info_array=($(grep -aw "${userinput}" "${serverlist}")) - shortname="${server_info_array[0]}" # csgo + shortname="${server_info_array[0]}" # csgo gameservername="${server_info_array[1]}" # csgoserver - gamename="${server_info_array[2]}" # Counter Strike: Global Offensive + gamename="${server_info_array[2]}" # Counter Strike: Global Offensive } -fn_install_getopt(){ +fn_install_getopt() { userinput="empty" echo -e "Usage: $0 [option]" echo -e "" @@ -295,13 +297,13 @@ fn_install_getopt(){ exit } -fn_install_file(){ +fn_install_file() { local_filename="${gameservername}" if [ -e "${local_filename}" ]; then i=2 - while [ -e "${local_filename}-${i}" ] ; do - (( i++ )) - done + while [ -e "${local_filename}-${i}" ]; do + ((i++)) + done local_filename="${local_filename}-${i}" fi cp -R "${selfname}" "${local_filename}" @@ -321,12 +323,12 @@ fn_install_file(){ # Prevent LinuxGSM from running as root. Except if doing a dependency install. if [ "$(whoami)" == "root" ]; then - if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then + if [ "${userinput}" == "install" ] || [ "${userinput}" == "auto-install" ] || [ "${userinput}" == "i" ] || [ "${userinput}" == "ai" ]; then if [ "${shortname}" == "core" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then + elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else @@ -344,12 +346,12 @@ if [ "${shortname}" == "core" ]; then exit 1 fi - if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then + if [ "${userinput}" == "list" ] || [ "${userinput}" == "l" ]; then { tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}' } | column -s $'\t' -t | more exit - elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then + elif [ "${userinput}" == "install" ] || [ "${userinput}" == "i" ]; then tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}" fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}" userinput="${result}" @@ -365,7 +367,7 @@ if [ "${shortname}" == "core" ]; then fi elif [ "${userinput}" ]; then fn_server_info - if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then + if [ "${userinput}" == "${gameservername}" ] || [ "${userinput}" == "${gamename}" ] || [ "${userinput}" == "${shortname}" ]; then fn_install_file else echo -e "[ FAIL ] unknown game server" @@ -464,7 +466,7 @@ else fi fi -fn_currentstatus_tmux(){ +fn_currentstatus_tmux() { check_status.sh if [ "${status}" != "0" ]; then currentstatus="STARTED" @@ -473,14 +475,14 @@ fn_currentstatus_tmux(){ fi } -fn_setstatus(){ +fn_setstatus() { fn_currentstatus_tmux echo"" echo -e "Required status: ${requiredstatus}" counter=0 echo -e "Current status: ${currentstatus}" - while [ "${requiredstatus}" != "${currentstatus}" ]; do - counter=$((counter+1)) + while [ "${requiredstatus}" != "${currentstatus}" ]; do + counter=$((counter + 1)) fn_currentstatus_tmux echo -en "New status: ${currentstatus}\\r" @@ -506,7 +508,7 @@ fn_setstatus(){ # End of every test will expect the result to either pass or fail # If the script does not do as intended the whole test will fail # if expecting a pass -fn_test_result_pass(){ +fn_test_result_pass() { if [ $? != 0 ]; then echo -e "=================================" echo -e "Expected result: PASS" @@ -524,7 +526,7 @@ fn_test_result_pass(){ } # if expecting a fail -fn_test_result_fail(){ +fn_test_result_fail() { if [ $? == 0 ]; then echo -e "=================================" echo -e "Expected result: FAIL" @@ -542,7 +544,7 @@ fn_test_result_fail(){ } # test result n/a -fn_test_result_na(){ +fn_test_result_na() { echo -e "=================================" echo -e "Expected result: N/A" echo -e "Actual result: N/A" @@ -626,7 +628,7 @@ echo -e "0.1 - Create log dir's" echo -e "=================================" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x install_logs.sh @@ -642,7 +644,7 @@ echo -e "Description:" echo -e "Enable dev-debug" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_debug.sh @@ -665,13 +667,13 @@ echo -e "Command: ./${gameservername} start" echo -e "" # Allows for testing not on Travis CI if [ -z "${TRAVIS}" ]; then -( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" - BASH_XTRACEFD="5" - set -x - command_start.sh -) -fn_test_result_fail + ( + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_start.sh + ) + fn_test_result_fail else echo -e "Test bypassed" fi @@ -688,7 +690,7 @@ echo -e "displaying options messages." echo -e "Command: ./${gameservername}" echo -e "" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x core_getopt.sh @@ -707,7 +709,7 @@ echo -e "Command: ./${gameservername} abc123" echo -e "" getopt="abc123" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x core_getopt.sh @@ -728,7 +730,7 @@ echo -e "Description:" echo -e "install ${gamename} server." echo -e "Command: ./${gameservername} auto-install" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x fn_autoinstall @@ -751,7 +753,7 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_start.sh @@ -770,7 +772,7 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_start.sh @@ -789,10 +791,11 @@ echo -e "Command: ./${gameservername} start" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x - updateonstart="on";command_start.sh + updateonstart="on" + command_start.sh ) fn_test_result_pass echo -e "run order" @@ -808,7 +811,7 @@ echo -e "Command: ./${gameservername} stop" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_stop.sh @@ -827,7 +830,7 @@ echo -e "Command: ./${gameservername} stop" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_stop.sh @@ -846,7 +849,7 @@ echo -e "Command: ./${gameservername} restart" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_restart.sh @@ -865,7 +868,7 @@ echo -e "Command: ./${gameservername} restart" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_restart.sh @@ -888,7 +891,7 @@ echo -e "Command: ./${gameservername} update" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update.sh @@ -908,7 +911,7 @@ echo -e "Command: ./jc2server update-lgam" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_update_linuxgsm.sh @@ -935,7 +938,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -958,7 +961,7 @@ date '+%s' > "${lockdir}/${selfname}.lock" echo "${version}" >> "${lockdir}/${selfname}.lock" echo "${port}" >> "${lockdir}/${selfname}.lock" ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -977,7 +980,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_monitor.sh @@ -996,7 +999,7 @@ echo -e "Command: ./${gameservername} test-alert" requiredstatus="STOPPED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_test_alert.sh @@ -1019,7 +1022,7 @@ echo -e "Command: ./${gameservername} details" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_details.sh @@ -1038,7 +1041,7 @@ echo -e "Command: ./${gameservername} postdetails" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_postdetails.sh @@ -1080,7 +1083,7 @@ echo -e "Command: ./${gameservername} detect-glibc" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_glibc.sh @@ -1099,7 +1102,7 @@ echo -e "Command: ./${gameservername} detect-ldd" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_ldd.sh @@ -1118,7 +1121,7 @@ echo -e "Command: ./${gameservername} detect-deps" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_detect_deps.sh @@ -1137,7 +1140,7 @@ echo -e "Command: ./${gameservername} query-raw" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_dev_query_raw.sh @@ -1160,7 +1163,7 @@ echo -e "Command: ./${gameservername} donate" requiredstatus="STARTED" fn_setstatus ( - exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + exec 5> "${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" set -x command_donate.sh