diff --git a/.all-contributorsrc b/.all-contributorsrc deleted file mode 100644 index 9e4a36a51..000000000 --- a/.all-contributorsrc +++ /dev/null @@ -1,119 +0,0 @@ -{ - "files": [ - "README.md" - ], - "imageSize": 100, - "commit": false, - "contributors": [ - { - "login": "dgibbs64", - "name": "Daniel Gibbs", - "avatar_url": "https://avatars2.githubusercontent.com/u/4478206?v=4", - "profile": "https://danielgibbs.co.uk", - "contributions": [ - "bug", - "code", - "ideas", - "question", - "review", - "content", - "doc", - "infra" - ] - }, - { - "login": "Frisasky", - "name": "Frisasky", - "avatar_url": "https://avatars2.githubusercontent.com/u/26865851?v=4", - "profile": "https://github.com/Frisasky", - "contributions": [ - "question", - "bug", - "code" - ] - }, - { - "login": "kennyLtv", - "name": "Kenny Lindelof", - "avatar_url": "https://avatars2.githubusercontent.com/u/6133325?v=4", - "profile": "https://kennyl.design", - "contributions": [ - "question" - ] - }, - { - "login": "Scarsz", - "name": "Austin Shapiro", - "avatar_url": "https://avatars1.githubusercontent.com/u/7691988?v=4", - "profile": "https://scarsz.me", - "contributions": [ - "bug", - "code" - ] - }, - { - "login": "marvinlehmann", - "name": "Marvin Lehmann", - "avatar_url": "https://avatars2.githubusercontent.com/u/4151266?v=4", - "profile": "https://github.com/marvinlehmann", - "contributions": [ - "bug", - "code" - ] - }, - { - "login": "Bourne-ID", - "name": "Bourne-ID", - "avatar_url": "https://avatars1.githubusercontent.com/u/7073616?v=4", - "profile": "https://github.com/Bourne-ID", - "contributions": [ - "review", - "content", - "doc", - "infra", - "review" - ] - }, - { - "login": "cedarlug", - "name": "CedarLUG", - "avatar_url": "https://avatars2.githubusercontent.com/u/19336442?v=4", - "profile": "http://cedarlug.org", - "contributions": [ - "bug", - "code", - "ideas", - "question", - "review" - ] - }, - { - "login": "UltimateByte", - "name": "UltimateByte", - "avatar_url": "https://avatars3.githubusercontent.com/u/8805941?v=4", - "profile": "https://www.terageek.org | https://www.haisoft.fr", - "contributions": [ - "bug", - "code", - "doc", - "ideas", - "review" - ] - }, - { - "login": "borzaka", - "name": "Attila", - "avatar_url": "https://avatars0.githubusercontent.com/u/1230402?v=4", - "profile": "https://github.com/borzaka", - "contributions": [ - "code", - "bug" - ] - } - ], - "contributorsPerLine": 7, - "projectName": "LinuxGSM", - "projectOwner": "GameServerManagers", - "repoType": "github", - "repoHost": "https://github.com" -} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index bb77d9f85..357dfdf6e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -3,10 +3,10 @@ github: dgibbs64 # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: dgibbs # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username -ko_fi: dgibbs # Replace with a single Ko-fi username +ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username -custom: ["https://www.paypal.me/dgibbs64", paypal.me/dgibbs64] # Replace with a single custom sponsorship URL +custom: [paypal.me/dgibbs64] # Replace with a single custom sponsorship URL diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index db7ccf4f7..d3c1adfbb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Found a bug? Raise a report +about: Found a bug? Raise a report. --- Issues raised here are **ONLY** for: @@ -27,7 +27,7 @@ As a [user description], I want [desired action] so that [desired outcome]. * **Distro:** [Ubuntu 18.04] * **Game:** [Garry's Mod] * **Command:** [Monitor] -* **LinuxGSM version:** [v12.34.56] +* **LinuxGSM version:** [v20.1.3] ## Further Information diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 68bdf0ad6..dc51fe40e 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,6 +1,6 @@ --- name: Feature request -about: Suggest an idea for this project +about: Suggest an idea for LinuxGSM. --- @@ -25,10 +25,10 @@ As a [user description], I want [desired action] so that [desired outcome]. ## Basic info -* **Distro:** [Ubuntu 18.04] +* **Distro:** [Ubuntu 20.04] * **Game:** [Garry's Mod] * **Command:** [Monitor] -* **LinuxGSM version:** [v12.34.56] +* **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 8101f74f0..ada8638cc 100644 --- a/.github/ISSUE_TEMPLATE/new-server-request.md +++ b/.github/ISSUE_TEMPLATE/new-server-request.md @@ -1,6 +1,6 @@ --- name: New server request -about: Suggest a new game server to be added +about: Suggest a new game server to be added. --- diff --git a/.github/pr_labels.yml b/.github/pr_labels.yml deleted file mode 100644 index db1f63f6b..000000000 --- a/.github/pr_labels.yml +++ /dev/null @@ -1,5 +0,0 @@ -version: '1' -invalidStatus: "pending" -labelRule: - startsWith: - - "type:" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 5aa59ce42..af1c7faba 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,7 +6,7 @@ Fixes #[issue] ## Type of change -* [ ] Bug fix (change which fixes an issue). +* [ ] Bug fix (a change which fixes an issue). * [ ] New feature (change which adds functionality). * [ ] New Server (new server added). * [ ] Refactor (restructures existing code). @@ -20,9 +20,9 @@ PR will not be merged until all steps are complete. * [ ] 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 own code. +* [ ] I have performed a self-review of my code. * [ ] I have checked that this code is commented where required. -* [ ] I have provided a detailed enough description of this PR. +* [ ] I have provided a detailed with enough description of this PR. * [ ] I have checked If documentation needs updating. ## Documentation diff --git a/.github/request-info.yml b/.github/request-info.yml deleted file mode 100644 index ed407c3b5..000000000 --- a/.github/request-info.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Configuration for request-info - https://github.com/behaviorbot/request-info - -# *Required* Comment to reply with -requestInfoReplyComment: > - ![More Data required](https://i.imgur.com/yS9cecv.png) - More data is required to assist with this issue - or issue template was not used correctly. - https://linuxgsm.com/support/#guide - -# *OPTIONAL* default titles to check against for lack of descriptiveness -# MUST BE ALL LOWERCASE -#requestInfoDefaultTitles: -# - update readme.md -# - updates - -# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given -requestInfoLabelToAdd: "needs more info" diff --git a/.github/support.yml b/.github/support.yml deleted file mode 100644 index 2f45e92ec..000000000 --- a/.github/support.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Configuration for support-requests - https://github.com/dessant/support-requests - -# Label used to mark issues as support requests -supportLabel: "Outcome: wrong forum" -# Comment to post on issues marked as support requests. Add a link -# to a support page, or set to `false` to disable -supportComment: > - We use the issue tracker exclusively for bug reports and feature requests. - However, this issue appears to be a support request. Please use our - support channels to get help with the project. - https://linuxgsm.com/support -# Whether to close issues marked as support requests -close: true -# Whether to lock issues marked as support requests -lock: false diff --git a/.github/welcome.yml b/.github/welcome.yml deleted file mode 100644 index 7d0cb281b..000000000 --- a/.github/welcome.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Configuration for welcome - https://github.com/behaviorbot/welcome - -# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome - -# Comment to be posted to on first time issues -newIssueWelcomeComment: > - Thank you for opening your first issue. Be sure to follow the issue template! and guide for posting. https://linuxgsm.com/support/#guide - -# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome - -# Comment to be posted to on PRs from first time contributors in your repository -newPRWelcomeComment: > - Thank you for opening this pull request! Please check out our contributing guidelines. - -# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge - -# Comment to be posted to on pull requests merged by a first time user -firstPRMergeComment: > - Congratulations on merging your first pull request! Thank you for supporting LinuxGSM! - -# It is recommend to include as many gifs and emojis as possible diff --git a/.github/workflows/git-sync.yml b/.github/workflows/git-sync.yml new file mode 100644 index 000000000..9fc886b4e --- /dev/null +++ b/.github/workflows/git-sync.yml @@ -0,0 +1,27 @@ +name: Backup Repo +# This action will sync the github repo with a backup bitbucket repo. +# This will allow LinuxGSM to use Bitbucket as and alternative download if github fails. +on: + push: + branches: + - master + - 'develop' + +jobs: + repo-sync: + runs-on: ubuntu-latest + steps: + - name: ssh + uses: webfactory/ssh-agent@v0.2.0 + with: + ssh-private-key: ${{ secrets.BITBUCKET_SECRET }} + ssh_private_key: ${{ secrets.BITBUCKET_SECRET }} + + - name: repo-sync + uses: wei/git-sync@v2 + with: + source_repo: "https://github.com/GameServerManagers/LinuxGSM" + source_branch: "refs/heads/*" + destination_repo: "git@bitbucket.org:GameServerManagers/linuxgsm.git" + destination_branch: "refs/heads/*" + ssh_private_key: ${{ secrets.BITBUCKET_SECRET }} diff --git a/README.md b/README.md index 25996581a..2b0f05ec1 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) [![Build Status](https://travis-ci.com/GameServerManagers/LinuxGSM.svg?branch=master)](https://travis-ci.com/GameServerManagers/LinuxGSM) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/3e98be27840043a090c3ab6e35db44b0)](https://app.codacy.com/app/GameServerManagers/LinuxGSM?utm_source=github.com&utm_medium=referral&utm_content=GameServerManagers/LinuxGSM&utm_campaign=Badge_Grade_Dashboard) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/9ef77095e98a43618ddd57381f86b4be)](https://www.codacy.com/manual/GameServerManagers/LinuxGSM?utm_source=github.com&utm_medium=referral&utm_content=GameServerManagers/LinuxGSM&utm_campaign=Badge_Coverage) [![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/) [![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors) +[![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) [![Build Status](https://travis-ci.com/GameServerManagers/LinuxGSM.svg?branch=master)](https://travis-ci.com/GameServerManagers/LinuxGSM) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/3e98be27840043a090c3ab6e35db44b0)](https://app.codacy.com/app/GameServerManagers/LinuxGSM?utm_source=github.com&utm_medium=referral&utm_content=GameServerManagers/LinuxGSM&utm_campaign=Badge_Grade_Dashboard) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/9ef77095e98a43618ddd57381f86b4be)](https://www.codacy.com/manual/GameServerManagers/LinuxGSM?utm_source=github.com&utm_medium=referral&utm_content=GameServerManagers/LinuxGSM&utm_campaign=Badge_Coverage) [![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. @@ -47,16 +47,8 @@ There are a various ways to get support, check out the [support](https://linuxgs ## :heart: Donate -If you would like to [donate](https://linuxgsm.com/donate) to the project there are several ways you can, via [Patreon](https://www.patreon.com/dgibbs), [Ko-Fi](https://ko-fi.com/dgibbs) and [PayPal](https://www.paypal.me/dgibbs64). I would like to thank everyone who has previously sent a donation. Since 2012 LinuxGSM has been steadily growing with new servers, features and improvements added regularly. +If you would like to [donate](https://linuxgsm.com/donate) to the project there are several ways you can, via [GitHub Sponsors](https://github.com/sponsors/dgibbs64), [Patreon](https://www.patreon.com/dgibbs) and [PayPal](https://www.paypal.me/dgibbs64). I would like to thank everyone who has previously sent a donation. Since 2012 LinuxGSM has been steadily growing with new servers, features and improvements added regularly. ## Contributors -Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): - - - -
Daniel Gibbs
Daniel Gibbs

🐛 💻 🤔 💬 👀 🖋 📖 🚇
Frisasky
Frisasky

💬 🐛 💻
Kenny Lindelof
Kenny Lindelof

💬
Austin Shapiro
Austin Shapiro

🐛 💻
Marvin Lehmann
Marvin Lehmann

🐛 💻
Bourne-ID
Bourne-ID

👀 🖋 📖 🚇 👀
CedarLUG
CedarLUG

🐛 💻 🤔 💬 👀
UltimateByte
UltimateByte

🐛 💻 📖 🤔 👀
Attila
Attila

💻 🐛
- - - -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! +A big thank you goes to all the wonderful people who contribute ideas, code, docs and support to this project. diff --git a/lgsm/config-default/config-lgsm/acserver/_default.cfg b/lgsm/config-default/config-lgsm/acserver/_default.cfg new file mode 100644 index 000000000..7bc9de9d1 --- /dev/null +++ b/lgsm/config-default/config-lgsm/acserver/_default.cfg @@ -0,0 +1,169 @@ +################################## +######## 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 #### + +## SteamCMD Login | https://docs.linuxgsm.com/steamcmd#steamcmd-login +steamuser="username" +steampass='password' + +## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters + +## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +fn_parms(){ +parms="-c ${servercfgfullpath}" +} + +#### 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" +postdays="7" +posttarget="https://termbin.com" + +# 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="" + +# 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" +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" + +# 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) or else in "curlcustomstring". +# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need +# any custom string in curl - simple ignore this parameter. +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" + +## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd +# Server appid +appid="302550" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" + +## 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 +stopmode="2" + +## Query mode +# 1: session only +# 2: gamedig + gsquery +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="5" +querytype="" + +## Game Server Details +# Do not edit +gamename="Assetto Corsa" +engine="unity3d" +glibc="2.15" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}" +executabledir="${systemdir}" +executable="./acServer" +servercfgdir="${systemdir}/cfg" +servercfg="${selfname}.cfg" +servercfgdefault="server_cfg.ini" +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/config-default/config-lgsm/ahl2server/_default.cfg b/lgsm/config-default/config-lgsm/ahl2server/_default.cfg index 02dd1657a..c41d0c8f9 100644 --- a/lgsm/config-default/config-lgsm/ahl2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/ahl2server/_default.cfg @@ -120,8 +120,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ahlserver/_default.cfg b/lgsm/config-default/config-lgsm/ahlserver/_default.cfg index 4e3039209..69fc33e0c 100644 --- a/lgsm/config-default/config-lgsm/ahlserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/ahlserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Action half-life" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/arkserver/_default.cfg b/lgsm/config-default/config-lgsm/arkserver/_default.cfg index 2bc9894af..11f29d17b 100644 --- a/lgsm/config-default/config-lgsm/arkserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/arkserver/_default.cfg @@ -15,11 +15,12 @@ queryport="27015" rconport="27020" # Default Map: TheIsland, Ragnarok, CrystalIsles, Aberration_P, ScorchedEarth_P defaultmap="TheIsland" +altsavedirectoryname="${defaultmap}" maxplayers="70" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ -parms="\"${defaultmap}?AltSaveDirectoryName=${defaultmap}?listen?MultiHome=${ip}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port} -automanagedmods\"" +parms="${defaultmap}?AltSaveDirectoryName=${altsavedirectoryname}?listen?MultiHome=${ip}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port} -automanagedmods -crossplay -PublicIPForEpic=${ip}" } #### LinuxGSM Settings #### @@ -125,8 +126,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/arma3server/_default.cfg b/lgsm/config-default/config-lgsm/arma3server/_default.cfg index f56fdac89..628634140 100644 --- a/lgsm/config-default/config-lgsm/arma3server/_default.cfg +++ b/lgsm/config-default/config-lgsm/arma3server/_default.cfg @@ -139,8 +139,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/avserver/_default.cfg b/lgsm/config-default/config-lgsm/avserver/_default.cfg new file mode 100644 index 000000000..f4f430e16 --- /dev/null +++ b/lgsm/config-default/config-lgsm/avserver/_default.cfg @@ -0,0 +1,172 @@ +################################## +######## 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 #### +## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters +port="27000" +# https://steamidfinder.com +adminsteamid="" + +## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +fn_parms(){ +if [ ! -z "${adminsteamid}" ]; then + admincmd="--admin ${adminsteamid}" +fi +parms="--galaxy-name ${selfname} --ip ${ip} --datapath ${avdatapath} ${admincmd}" +} + +#### 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" +postdays="7" +posttarget="https://termbin.com" + +# 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="" + +# 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" +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" + +# 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) or else in "curlcustomstring". +# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need +# any custom string in curl - simple ignore this parameter. +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" +## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd +# Server appid +appid="565060" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" +# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server +steammaster="false" + +## 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 +stopmode="10" + +## Query mode +# 1: session only +# 2: gamedig + gsquery +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="5" +querytype="" + +## Game Server Details +# Do not edit +gamename="Avorion" +engine="avorion" +glibc="2.15" + +#### Directories #### +# Edit with care + +## Game Server Directories +avdatapath="${serverfiles}/galaxy" +avgalaxypath="${avdatapath}/${selfname}" +systemdir="${serverfiles}" +executabledir="${systemdir}" +executable="./server.sh" +servercfgdir="${avgalaxypath}" +servercfg="server.ini" +servercfgdefault="server.ini" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${systemdir}/ServerLogs" +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/config-default/config-lgsm/bb2server/_default.cfg b/lgsm/config-default/config-lgsm/bb2server/_default.cfg index a1a9ae350..e361cb9dc 100644 --- a/lgsm/config-default/config-lgsm/bb2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/bb2server/_default.cfg @@ -129,8 +129,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/bbserver/_default.cfg b/lgsm/config-default/config-lgsm/bbserver/_default.cfg index 75da97662..3fdb866c3 100644 --- a/lgsm/config-default/config-lgsm/bbserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/bbserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="BrainBread" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/bdserver/_default.cfg b/lgsm/config-default/config-lgsm/bdserver/_default.cfg index 77c169e6a..ec408753e 100644 --- a/lgsm/config-default/config-lgsm/bdserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/bdserver/_default.cfg @@ -123,8 +123,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -139,7 +139,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Base Defense" -engine="goldsource" +engine="goldsrc" glibc="2.14" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/bf1942server/_default.cfg b/lgsm/config-default/config-lgsm/bf1942server/_default.cfg index b6e508e01..04bcef9b3 100644 --- a/lgsm/config-default/config-lgsm/bf1942server/_default.cfg +++ b/lgsm/config-default/config-lgsm/bf1942server/_default.cfg @@ -108,8 +108,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode @@ -119,7 +119,7 @@ stopmode="2" # 4: gsquery # 5: tcp querymode="2" -querytype="protocol-valve" +querytype="protocol-gamespy1" ## Game Server Details # Do not edit diff --git a/lgsm/config-default/config-lgsm/bfvserver/_default.cfg b/lgsm/config-default/config-lgsm/bfvserver/_default.cfg new file mode 100644 index 000000000..d0b7215c5 --- /dev/null +++ b/lgsm/config-default/config-lgsm/bfvserver/_default.cfg @@ -0,0 +1,157 @@ +################################## +######## 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 #### + +## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +fn_parms(){ +parms="+statusMonitor 1" +} + +#### 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" +postdays="7" +posttarget="https://termbin.com" + +# 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="" + +# 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" +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" + +# 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) or else in "curlcustomstring". +# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need +# any custom string in curl - simple ignore this parameter. +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 +stopmode="3" + +## Query mode +# 1: session only +# 2: gamedig + gsquery +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="1" +querytype="" + +## Game Server Details +# Do not edit +gamename="Battlefield: Vietnam" +engine="refractor" +glibc="2.2.4" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}" +executabledir="${systemdir}" +executable="./start.sh" +servercfgdir="${systemdir}/mods/bfvietnam/settings" +servercfg="serversettings.con" +servercfgdefault="serversettings.con" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${serverfiles}/mods/bfvietnam/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/config-default/config-lgsm/bmdmserver/_default.cfg b/lgsm/config-default/config-lgsm/bmdmserver/_default.cfg index b92257fff..61d4c3e4c 100644 --- a/lgsm/config-default/config-lgsm/bmdmserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/bmdmserver/_default.cfg @@ -129,8 +129,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/boserver/_default.cfg b/lgsm/config-default/config-lgsm/boserver/_default.cfg index 73015c2d6..698667c10 100644 --- a/lgsm/config-default/config-lgsm/boserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/boserver/_default.cfg @@ -122,8 +122,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/bsserver/_default.cfg b/lgsm/config-default/config-lgsm/bsserver/_default.cfg index 612e4cb2b..69094f8ef 100644 --- a/lgsm/config-default/config-lgsm/bsserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/bsserver/_default.cfg @@ -133,8 +133,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/bt1944server/_default.cfg b/lgsm/config-default/config-lgsm/bt1944server/_default.cfg index 2ca021b27..d90b94523 100644 --- a/lgsm/config-default/config-lgsm/bt1944server/_default.cfg +++ b/lgsm/config-default/config-lgsm/bt1944server/_default.cfg @@ -121,8 +121,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/btserver/_default.cfg b/lgsm/config-default/config-lgsm/btserver/_default.cfg index 45d54833a..416e77c09 100644 --- a/lgsm/config-default/config-lgsm/btserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/btserver/_default.cfg @@ -116,8 +116,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="7" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ccserver/_default.cfg b/lgsm/config-default/config-lgsm/ccserver/_default.cfg index 2913a289d..e9f0a70dd 100644 --- a/lgsm/config-default/config-lgsm/ccserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/ccserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/cmwserver/_default.cfg b/lgsm/config-default/config-lgsm/cmwserver/_default.cfg new file mode 100644 index 000000000..155ef0c17 --- /dev/null +++ b/lgsm/config-default/config-lgsm/cmwserver/_default.cfg @@ -0,0 +1,175 @@ +################################## +######## 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 #### + +## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters +ip="0.0.0.0" +port="7777" +queryport="7779" +defaultmap="AOCTD-Frigid_p" + + +## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +fn_parms(){ + +parms="${defaultmap}?steamsockets -multihome=${ip} -Port=${port} -QueryPort=${queryport} -seekfreeloadingserver -configsubdir=${gamelogdir} -log=${gamelog}" + +} + +#### 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" +postdays="7" +posttarget="https://termbin.com" + +# 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="" + +# 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" +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" + +# 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) or else in "curlcustomstring". +# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need +# any custom string in curl - simple ignore this parameter. +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" + +## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd +# Server appid +appid="220070" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" +# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server +steammaster="false" + +## 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 +stopmode="2" + +## Query mode +# 1: session only +# 2: gamedig + gsquery +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="2" +querytype="protocol-valve" + +## Game Server Details +# Do not edit +gamename="Chivalry: Medieval Warfare" +engine="unreal3" +glibc="2.15" + +#### Directories #### +# Edit with care +## Game Server Directories +systemdir="${serverfiles}" +executabledir="${systemdir}/Binaries/Linux" +executable="./UDKGameServer-Linux" +servercfgdir="${systemdir}/UDKGame/Config/${selfname}" +servercfg="PCServer-UDKGame.ini" +servercfgdefault="PCServer-UDKGame.ini" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${systemdir}/Saved/Logs" +lgsmlogdir="${logdir}/script" +consolelogdir="${logdir}/console" +gamelog="${gamelogdir}/${selfname}-game.log" +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" +gamelogdate="${gamelogdir}/${selfname}-game-$(date '+%Y-%m-%d-%H:%M:%S').log" diff --git a/lgsm/config-default/config-lgsm/cod2server/_default.cfg b/lgsm/config-default/config-lgsm/cod2server/_default.cfg index 6c8a31c71..a686ea45f 100644 --- a/lgsm/config-default/config-lgsm/cod2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/cod2server/_default.cfg @@ -111,8 +111,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/cod4server/_default.cfg b/lgsm/config-default/config-lgsm/cod4server/_default.cfg index f319c7ae9..027c52509 100644 --- a/lgsm/config-default/config-lgsm/cod4server/_default.cfg +++ b/lgsm/config-default/config-lgsm/cod4server/_default.cfg @@ -111,8 +111,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/codserver/_default.cfg b/lgsm/config-default/config-lgsm/codserver/_default.cfg index 14c2ea889..74e186466 100644 --- a/lgsm/config-default/config-lgsm/codserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/codserver/_default.cfg @@ -111,8 +111,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/coduoserver/_default.cfg b/lgsm/config-default/config-lgsm/coduoserver/_default.cfg index 9eb271d27..b4e16cfff 100644 --- a/lgsm/config-default/config-lgsm/coduoserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/coduoserver/_default.cfg @@ -111,8 +111,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/codwawserver/_default.cfg b/lgsm/config-default/config-lgsm/codwawserver/_default.cfg index 14799814f..aeecf8f7b 100644 --- a/lgsm/config-default/config-lgsm/codwawserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/codwawserver/_default.cfg @@ -111,8 +111,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/csczserver/_default.cfg b/lgsm/config-default/config-lgsm/csczserver/_default.cfg index 0fd33cd68..8065dbba2 100644 --- a/lgsm/config-default/config-lgsm/csczserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/csczserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Counter-Strike: Condition Zero" -engine="goldsource" +engine="goldsrc" glibc="2.3.6" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/csgoserver/_default.cfg b/lgsm/config-default/config-lgsm/csgoserver/_default.cfg index 0cabcd249..963f873c5 100644 --- a/lgsm/config-default/config-lgsm/csgoserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/csgoserver/_default.cfg @@ -149,8 +149,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/csserver/_default.cfg b/lgsm/config-default/config-lgsm/csserver/_default.cfg index 36f0d955a..584e0ad77 100644 --- a/lgsm/config-default/config-lgsm/csserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/csserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Counter-Strike 1.6" -engine="goldsource" +engine="goldsrc" glibc="2.3.6" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/cssserver/_default.cfg b/lgsm/config-default/config-lgsm/cssserver/_default.cfg index 586b6dc18..316eb26f8 100644 --- a/lgsm/config-default/config-lgsm/cssserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/cssserver/_default.cfg @@ -129,8 +129,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/dabserver/_default.cfg b/lgsm/config-default/config-lgsm/dabserver/_default.cfg index f03645b95..612ea671f 100644 --- a/lgsm/config-default/config-lgsm/dabserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/dabserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/dmcserver/_default.cfg b/lgsm/config-default/config-lgsm/dmcserver/_default.cfg index 3af9ee7d7..43fe8e8f1 100644 --- a/lgsm/config-default/config-lgsm/dmcserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/dmcserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Deathmatch Classic" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/dodserver/_default.cfg b/lgsm/config-default/config-lgsm/dodserver/_default.cfg index 79df74acb..0d1b447c3 100644 --- a/lgsm/config-default/config-lgsm/dodserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/dodserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Day of Defeat" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/dodsserver/_default.cfg b/lgsm/config-default/config-lgsm/dodsserver/_default.cfg index 7ec70a81d..572046108 100644 --- a/lgsm/config-default/config-lgsm/dodsserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/dodsserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/doiserver/_default.cfg b/lgsm/config-default/config-lgsm/doiserver/_default.cfg index c31bea09f..d7916e2b5 100644 --- a/lgsm/config-default/config-lgsm/doiserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/doiserver/_default.cfg @@ -125,8 +125,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/dstserver/_default.cfg b/lgsm/config-default/config-lgsm/dstserver/_default.cfg index f93bca058..7491e7e55 100644 --- a/lgsm/config-default/config-lgsm/dstserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/dstserver/_default.cfg @@ -127,8 +127,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/dysserver/_default.cfg b/lgsm/config-default/config-lgsm/dysserver/_default.cfg index 51c9db8cf..28cc7fb98 100644 --- a/lgsm/config-default/config-lgsm/dysserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/dysserver/_default.cfg @@ -129,8 +129,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ecoserver/_default.cfg b/lgsm/config-default/config-lgsm/ecoserver/_default.cfg index 1286860fc..b4a4b92eb 100644 --- a/lgsm/config-default/config-lgsm/ecoserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/ecoserver/_default.cfg @@ -116,8 +116,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/emserver/_default.cfg b/lgsm/config-default/config-lgsm/emserver/_default.cfg index 4d6fc1824..8ab7aefe1 100644 --- a/lgsm/config-default/config-lgsm/emserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/emserver/_default.cfg @@ -129,8 +129,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/etlserver/_default.cfg b/lgsm/config-default/config-lgsm/etlserver/_default.cfg index ffc85e4b9..add0f74b6 100644 --- a/lgsm/config-default/config-lgsm/etlserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/etlserver/_default.cfg @@ -105,8 +105,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/fctrserver/_default.cfg b/lgsm/config-default/config-lgsm/fctrserver/_default.cfg index 711194a84..fddab05ee 100644 --- a/lgsm/config-default/config-lgsm/fctrserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/fctrserver/_default.cfg @@ -116,8 +116,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/fofserver/_default.cfg b/lgsm/config-default/config-lgsm/fofserver/_default.cfg index 0946a0eac..49105660c 100644 --- a/lgsm/config-default/config-lgsm/fofserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/fofserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/gesserver/_default.cfg b/lgsm/config-default/config-lgsm/gesserver/_default.cfg index d47983a79..a26a5df39 100644 --- a/lgsm/config-default/config-lgsm/gesserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/gesserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/gmodserver/_default.cfg b/lgsm/config-default/config-lgsm/gmodserver/_default.cfg index 66202641c..bd254e8b1 100644 --- a/lgsm/config-default/config-lgsm/gmodserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/gmodserver/_default.cfg @@ -140,8 +140,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/hl2dmserver/_default.cfg b/lgsm/config-default/config-lgsm/hl2dmserver/_default.cfg index a67d26a96..22c3da329 100644 --- a/lgsm/config-default/config-lgsm/hl2dmserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/hl2dmserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/hldmserver/_default.cfg b/lgsm/config-default/config-lgsm/hldmserver/_default.cfg index 2e15cea7e..1a17fdd91 100644 --- a/lgsm/config-default/config-lgsm/hldmserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/hldmserver/_default.cfg @@ -123,8 +123,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -139,7 +139,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Half Life: Deathmatch" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/hldmsserver/_default.cfg b/lgsm/config-default/config-lgsm/hldmsserver/_default.cfg index e6d3b0a2a..0036ec7e1 100644 --- a/lgsm/config-default/config-lgsm/hldmsserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/hldmsserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/hwserver/_default.cfg b/lgsm/config-default/config-lgsm/hwserver/_default.cfg index c934622fb..426d2d250 100644 --- a/lgsm/config-default/config-lgsm/hwserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/hwserver/_default.cfg @@ -135,8 +135,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/insserver/_default.cfg b/lgsm/config-default/config-lgsm/insserver/_default.cfg index 9fea80b0d..98817e908 100644 --- a/lgsm/config-default/config-lgsm/insserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/insserver/_default.cfg @@ -130,8 +130,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/inssserver/_default.cfg b/lgsm/config-default/config-lgsm/inssserver/_default.cfg index 04becc752..605a95fbb 100644 --- a/lgsm/config-default/config-lgsm/inssserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/inssserver/_default.cfg @@ -131,8 +131,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/iosserver/_default.cfg b/lgsm/config-default/config-lgsm/iosserver/_default.cfg index bb53acf48..acf13f368 100644 --- a/lgsm/config-default/config-lgsm/iosserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/iosserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/jc2server/_default.cfg b/lgsm/config-default/config-lgsm/jc2server/_default.cfg index 822e860c5..81cd0ff5b 100644 --- a/lgsm/config-default/config-lgsm/jc2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/jc2server/_default.cfg @@ -116,8 +116,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/jc3server/_default.cfg b/lgsm/config-default/config-lgsm/jc3server/_default.cfg index dbe9d4616..e3793f805 100644 --- a/lgsm/config-default/config-lgsm/jc3server/_default.cfg +++ b/lgsm/config-default/config-lgsm/jc3server/_default.cfg @@ -116,8 +116,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/kf2server/_default.cfg b/lgsm/config-default/config-lgsm/kf2server/_default.cfg index 6e31023be..7ad9fc930 100644 --- a/lgsm/config-default/config-lgsm/kf2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/kf2server/_default.cfg @@ -122,8 +122,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/kfserver/_default.cfg b/lgsm/config-default/config-lgsm/kfserver/_default.cfg index df07967d7..f4ef0a7f7 100644 --- a/lgsm/config-default/config-lgsm/kfserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/kfserver/_default.cfg @@ -128,8 +128,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/l4d2server/_default.cfg b/lgsm/config-default/config-lgsm/l4d2server/_default.cfg index c2dd765c2..4852b2231 100644 --- a/lgsm/config-default/config-lgsm/l4d2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/l4d2server/_default.cfg @@ -123,8 +123,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/l4dserver/_default.cfg b/lgsm/config-default/config-lgsm/l4dserver/_default.cfg index c40a1199f..158605d2f 100644 --- a/lgsm/config-default/config-lgsm/l4dserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/l4dserver/_default.cfg @@ -123,8 +123,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/mcbserver/_default.cfg b/lgsm/config-default/config-lgsm/mcbserver/_default.cfg index 1a600d821..839f5a9af 100644 --- a/lgsm/config-default/config-lgsm/mcbserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/mcbserver/_default.cfg @@ -108,8 +108,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="5" ## Query mode diff --git a/lgsm/config-default/config-lgsm/mcserver/_default.cfg b/lgsm/config-default/config-lgsm/mcserver/_default.cfg index 2bfcb3d1d..a49465f45 100644 --- a/lgsm/config-default/config-lgsm/mcserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/mcserver/_default.cfg @@ -114,8 +114,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="5" ## Query mode diff --git a/lgsm/config-default/config-lgsm/mhserver/_default.cfg b/lgsm/config-default/config-lgsm/mhserver/_default.cfg index 6a9b9a82e..255ecdd04 100644 --- a/lgsm/config-default/config-lgsm/mhserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/mhserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/mohaaserver/_default.cfg b/lgsm/config-default/config-lgsm/mohaaserver/_default.cfg index 22d05c752..1f82fe0c4 100644 --- a/lgsm/config-default/config-lgsm/mohaaserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/mohaaserver/_default.cfg @@ -110,8 +110,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/momserver/_default.cfg b/lgsm/config-default/config-lgsm/momserver/_default.cfg new file mode 100644 index 000000000..7e89d5b9f --- /dev/null +++ b/lgsm/config-default/config-lgsm/momserver/_default.cfg @@ -0,0 +1,171 @@ +################################## +######## 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 #### + +## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters +ip="0.0.0.0" +port="7777" +beaconport="15000" +maxplayers="32" + +## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +fn_parms(){ +parms="-port=${port} -beaconport=${beaconport} -MULTIHOME="${ip}" -maxplayers=${maxplayers}" +} + +#### 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" +postdays="7" +posttarget="https://termbin.com" + +# 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="" + +# 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" +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" + +# 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) or else in "curlcustomstring". +# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need +# any custom string in curl - simple ignore this parameter. +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" + +## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd +# Server appid +appid="897590" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" +# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server +steammaster="false" + +## 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 +stopmode="2" + +## Query mode +# 1: session only +# 2: gamedig + gsquery +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="1" +querytype="" + +## Game Server Details +# Do not edit +gamename="Memories of Mars" +engine="unreal4" +glibc="2.17" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}/Game" +executabledir="${systemdir}/Binaries/Linux" +executable="./MemoriesOfMarsServer" +servercfgdir="${serverfiles}" +servercfg="DedicatedServerConfig.cfg" +servercfgdefault="DedicatedServerConfig.cfg" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${serverfiles}/Game/Saved/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/config-default/config-lgsm/mtaserver/_default.cfg b/lgsm/config-default/config-lgsm/mtaserver/_default.cfg index 944f4ae57..dc6aac282 100644 --- a/lgsm/config-default/config-lgsm/mtaserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/mtaserver/_default.cfg @@ -109,8 +109,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="4" ## Query mode diff --git a/lgsm/config-default/config-lgsm/mumbleserver/_default.cfg b/lgsm/config-default/config-lgsm/mumbleserver/_default.cfg index 301318217..6afe760ae 100644 --- a/lgsm/config-default/config-lgsm/mumbleserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/mumbleserver/_default.cfg @@ -109,8 +109,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ndserver/_default.cfg b/lgsm/config-default/config-lgsm/ndserver/_default.cfg index 58092d361..084bcc20b 100644 --- a/lgsm/config-default/config-lgsm/ndserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/ndserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/nmrihserver/_default.cfg b/lgsm/config-default/config-lgsm/nmrihserver/_default.cfg index 621962349..261d74fed 100644 --- a/lgsm/config-default/config-lgsm/nmrihserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/nmrihserver/_default.cfg @@ -129,8 +129,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ns2cserver/_default.cfg b/lgsm/config-default/config-lgsm/ns2cserver/_default.cfg index 01b6bc9b2..6e857c346 100644 --- a/lgsm/config-default/config-lgsm/ns2cserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/ns2cserver/_default.cfg @@ -131,8 +131,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="6" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ns2server/_default.cfg b/lgsm/config-default/config-lgsm/ns2server/_default.cfg index acd89375f..01cb086f9 100644 --- a/lgsm/config-default/config-lgsm/ns2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/ns2server/_default.cfg @@ -135,8 +135,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="6" ## Query mode diff --git a/lgsm/config-default/config-lgsm/nsserver/_default.cfg b/lgsm/config-default/config-lgsm/nsserver/_default.cfg index 1f0ebcb49..446e8ab8a 100644 --- a/lgsm/config-default/config-lgsm/nsserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/nsserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Natural Selection" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/onsetserver/_default.cfg b/lgsm/config-default/config-lgsm/onsetserver/_default.cfg index bf4576a6d..7401de91a 100644 --- a/lgsm/config-default/config-lgsm/onsetserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/onsetserver/_default.cfg @@ -116,8 +116,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/opforserver/_default.cfg b/lgsm/config-default/config-lgsm/opforserver/_default.cfg index 87fb58d2f..a341627a9 100644 --- a/lgsm/config-default/config-lgsm/opforserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/opforserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Half-Life: Opposing Force" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/pcserver/_default.cfg b/lgsm/config-default/config-lgsm/pcserver/_default.cfg index 8cf6c09ca..fc74fbe5e 100644 --- a/lgsm/config-default/config-lgsm/pcserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/pcserver/_default.cfg @@ -116,8 +116,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/pstbsserver/_default.cfg b/lgsm/config-default/config-lgsm/pstbsserver/_default.cfg index 54cec9d8d..1a80e7a02 100644 --- a/lgsm/config-default/config-lgsm/pstbsserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/pstbsserver/_default.cfg @@ -12,14 +12,15 @@ ip="0.0.0.0" port="10027" queryport="10037" -randommap="ALWAYS" +rconport="21114" +randommap="NONE" #servername="LinuxGSM Server" maxplayers="40" -reservedslots="2" +reservedslots="0" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ -parms="MULTIHOME=${ip}?RANDOM=${randommap}?Port=${port}?QueryPort=${queryport}?MaxPlayers=${maxplayers}?NumReservedSlots=${reservedslots}" +parms="MULTIHOME=${ip} RANDOM=${randommap} Port=${port} QueryPort=${queryport} RCONPORT=${rconport} FIXEDMAXPLAYERS=${maxplayers} NumReservedSlots=${reservedslots}" } #### LinuxGSM Settings #### @@ -125,8 +126,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/pvkiiserver/_default.cfg b/lgsm/config-default/config-lgsm/pvkiiserver/_default.cfg index 84e1bd897..0118ecaa4 100644 --- a/lgsm/config-default/config-lgsm/pvkiiserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/pvkiiserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/pzserver/_default.cfg b/lgsm/config-default/config-lgsm/pzserver/_default.cfg index 68300b0bc..da9ae479d 100644 --- a/lgsm/config-default/config-lgsm/pzserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/pzserver/_default.cfg @@ -120,8 +120,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/q2server/_default.cfg b/lgsm/config-default/config-lgsm/q2server/_default.cfg index 1647eab1a..832f641c7 100644 --- a/lgsm/config-default/config-lgsm/q2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/q2server/_default.cfg @@ -110,8 +110,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/q3server/_default.cfg b/lgsm/config-default/config-lgsm/q3server/_default.cfg index cd6634afb..6d28f4caf 100644 --- a/lgsm/config-default/config-lgsm/q3server/_default.cfg +++ b/lgsm/config-default/config-lgsm/q3server/_default.cfg @@ -110,8 +110,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/qlserver/_default.cfg b/lgsm/config-default/config-lgsm/qlserver/_default.cfg index 89bcb26a3..3a5471ad6 100644 --- a/lgsm/config-default/config-lgsm/qlserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/qlserver/_default.cfg @@ -118,8 +118,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/qwserver/_default.cfg b/lgsm/config-default/config-lgsm/qwserver/_default.cfg index 0bd55debf..59cdcc0f1 100644 --- a/lgsm/config-default/config-lgsm/qwserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/qwserver/_default.cfg @@ -109,8 +109,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ricochetserver/_default.cfg b/lgsm/config-default/config-lgsm/ricochetserver/_default.cfg index 787571afd..b825fb75b 100644 --- a/lgsm/config-default/config-lgsm/ricochetserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/ricochetserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Ricochet" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/roserver/_default.cfg b/lgsm/config-default/config-lgsm/roserver/_default.cfg index ab9c1625b..3cbfd5888 100644 --- a/lgsm/config-default/config-lgsm/roserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/roserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode @@ -150,7 +150,7 @@ glibc="2.4" serverfiles="${rootdir}/serverfiles" systemdir="${serverfiles}/system" executabledir="${systemdir}" -executable="./ucc-bin"servercfgdir="${systemdir}" +executable="./ucc-bin" servercfgdir="${systemdir}" servercfg="${selfname}.ini" servercfgdefault="default.ini" diff --git a/lgsm/config-default/config-lgsm/rtcwserver/_default.cfg b/lgsm/config-default/config-lgsm/rtcwserver/_default.cfg index 792c1a7f8..93b9ce3fe 100644 --- a/lgsm/config-default/config-lgsm/rtcwserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/rtcwserver/_default.cfg @@ -110,8 +110,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/rustserver/_default.cfg b/lgsm/config-default/config-lgsm/rustserver/_default.cfg index abb9c79df..cf70cdae7 100644 --- a/lgsm/config-default/config-lgsm/rustserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/rustserver/_default.cfg @@ -148,8 +148,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/rwserver/_default.cfg b/lgsm/config-default/config-lgsm/rwserver/_default.cfg index 37e755c29..95c37ef2d 100644 --- a/lgsm/config-default/config-lgsm/rwserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/rwserver/_default.cfg @@ -119,8 +119,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/sampserver/_default.cfg b/lgsm/config-default/config-lgsm/sampserver/_default.cfg index a658daa0c..67331ee39 100644 --- a/lgsm/config-default/config-lgsm/sampserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/sampserver/_default.cfg @@ -109,8 +109,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/sbotsserver/_default.cfg b/lgsm/config-default/config-lgsm/sbotsserver/_default.cfg index 6fb2b3579..6145c9905 100644 --- a/lgsm/config-default/config-lgsm/sbotsserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/sbotsserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/sbserver/_default.cfg b/lgsm/config-default/config-lgsm/sbserver/_default.cfg index fa9560f6c..f9ae836d1 100644 --- a/lgsm/config-default/config-lgsm/sbserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/sbserver/_default.cfg @@ -122,8 +122,8 @@ steammaster="flase" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/sdtdserver/_default.cfg b/lgsm/config-default/config-lgsm/sdtdserver/_default.cfg index a67e5795d..6269e6150 100644 --- a/lgsm/config-default/config-lgsm/sdtdserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/sdtdserver/_default.cfg @@ -119,8 +119,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="8" ## Query mode diff --git a/lgsm/config-default/config-lgsm/sfcserver/_default.cfg b/lgsm/config-default/config-lgsm/sfcserver/_default.cfg index f9d6ad595..2203ba14b 100644 --- a/lgsm/config-default/config-lgsm/sfcserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/sfcserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/sof2server/_default.cfg b/lgsm/config-default/config-lgsm/sof2server/_default.cfg index bd8110274..090330f49 100644 --- a/lgsm/config-default/config-lgsm/sof2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/sof2server/_default.cfg @@ -110,8 +110,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/solserver/_default.cfg b/lgsm/config-default/config-lgsm/solserver/_default.cfg index 2a923d554..d1f853dca 100644 --- a/lgsm/config-default/config-lgsm/solserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/solserver/_default.cfg @@ -10,13 +10,11 @@ ## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters ip="0.0.0.0" -port="23073" -maxplayers="32" maplist="mapslist.txt" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ -parms="-b ${ip} -p ${port} -l ${maxplayers} -m ${maplist} -c ${servercfg}" +parms="-b ${ip} -m ${maplist} -c ${servercfg}" } #### LinuxGSM Settings #### @@ -102,6 +100,12 @@ ansi="on" ## Message Display Time | https://docs.linuxgsm.com/features/message-display-time sleeptime="0.5" +## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd +# Server appid +appid="638500" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" + ## Stop Mode | https://docs.linuxgsm.com/features/stop-mode # 1: tmux kill # 2: CTRL+c @@ -111,8 +115,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode @@ -121,8 +125,8 @@ stopmode="2" # 3: gamedig # 4: gsquery # 5: tcp -querymode="5" -querytype="" +querymode="4" +querytype="soldat" ## Game Server Details # Do not edit diff --git a/lgsm/config-default/config-lgsm/squadserver/_default.cfg b/lgsm/config-default/config-lgsm/squadserver/_default.cfg index f75bd2667..81eb50c01 100644 --- a/lgsm/config-default/config-lgsm/squadserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/squadserver/_default.cfg @@ -121,8 +121,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ss3server/_default.cfg b/lgsm/config-default/config-lgsm/ss3server/_default.cfg index f5ab99168..9032678a4 100644 --- a/lgsm/config-default/config-lgsm/ss3server/_default.cfg +++ b/lgsm/config-default/config-lgsm/ss3server/_default.cfg @@ -120,8 +120,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/stserver/_default.cfg b/lgsm/config-default/config-lgsm/stserver/_default.cfg index 60fb0ebfa..581c1481a 100644 --- a/lgsm/config-default/config-lgsm/stserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/stserver/_default.cfg @@ -126,8 +126,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/svenserver/_default.cfg b/lgsm/config-default/config-lgsm/svenserver/_default.cfg index 3036470b7..72b3acadd 100644 --- a/lgsm/config-default/config-lgsm/svenserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/svenserver/_default.cfg @@ -123,8 +123,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -139,7 +139,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Sven Co-op" -engine="goldsource" +engine="goldsrc" glibc="2.24" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/terrariaserver/_default.cfg b/lgsm/config-default/config-lgsm/terrariaserver/_default.cfg index 574e18345..3f941122f 100644 --- a/lgsm/config-default/config-lgsm/terrariaserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/terrariaserver/_default.cfg @@ -123,8 +123,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="7" ## Query mode diff --git a/lgsm/config-default/config-lgsm/tf2server/_default.cfg b/lgsm/config-default/config-lgsm/tf2server/_default.cfg index 5655d9c9e..31eefeb12 100644 --- a/lgsm/config-default/config-lgsm/tf2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/tf2server/_default.cfg @@ -129,8 +129,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/tfcserver/_default.cfg b/lgsm/config-default/config-lgsm/tfcserver/_default.cfg index e9158641b..ccd4988e0 100644 --- a/lgsm/config-default/config-lgsm/tfcserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/tfcserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Team Fortress Classic" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/ts3server/_default.cfg b/lgsm/config-default/config-lgsm/ts3server/_default.cfg index 54fd8ac0e..3a511b394 100644 --- a/lgsm/config-default/config-lgsm/ts3server/_default.cfg +++ b/lgsm/config-default/config-lgsm/ts3server/_default.cfg @@ -111,8 +111,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/tsserver/_default.cfg b/lgsm/config-default/config-lgsm/tsserver/_default.cfg index 232087699..f73622b42 100644 --- a/lgsm/config-default/config-lgsm/tsserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/tsserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="The Specialists" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/tuserver/_default.cfg b/lgsm/config-default/config-lgsm/tuserver/_default.cfg index 36521c885..ff4165e45 100644 --- a/lgsm/config-default/config-lgsm/tuserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/tuserver/_default.cfg @@ -126,8 +126,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/twserver/_default.cfg b/lgsm/config-default/config-lgsm/twserver/_default.cfg index 4762f3fdc..461c97059 100644 --- a/lgsm/config-default/config-lgsm/twserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/twserver/_default.cfg @@ -123,8 +123,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/untserver/_default.cfg b/lgsm/config-default/config-lgsm/untserver/_default.cfg index 713ccb7d2..ef0fe4c24 100644 --- a/lgsm/config-default/config-lgsm/untserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/untserver/_default.cfg @@ -126,8 +126,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ut2k4server/_default.cfg b/lgsm/config-default/config-lgsm/ut2k4server/_default.cfg index 8e1d6fc55..9c4164c72 100644 --- a/lgsm/config-default/config-lgsm/ut2k4server/_default.cfg +++ b/lgsm/config-default/config-lgsm/ut2k4server/_default.cfg @@ -109,8 +109,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/ut3server/_default.cfg b/lgsm/config-default/config-lgsm/ut3server/_default.cfg index 421ce42b3..b42227859 100644 --- a/lgsm/config-default/config-lgsm/ut3server/_default.cfg +++ b/lgsm/config-default/config-lgsm/ut3server/_default.cfg @@ -14,18 +14,23 @@ port="7777" queryport="6500" defaultmap="VCTF-Suspense" game="UTGameContent.UTVehicleCTFGame_Content" -mutators="" #"UTGame.UTMutator_Instagib,UTGame.UTMutator_LowGrav" +# Example: mutators="UTGame.UTMutator_Instagib,UTGame.UTMutator_LowGrav" +mutators="" isdedicated="true" islanmatch="false" usesstats="false" shouldadvertise="true" pureserver="1" allowjoininprogress="true" +# Required: GameSpy Username and password +# https://docs.linuxgsm.com/game-servers/unreal-tournament-3#server-gamespy-login +gsusername="" +gspassword="" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters -# Edit with care | List of game types and mutators : https://docs.linuxgsm.com/game-servers/unreal-tournament-3 +# Edit with care | List of game types and mutators: https://docs.linuxgsm.com/game-servers/unreal-tournament-3 fn_parms(){ -parms="server ${defaultmap}?Game=${game}?bIsDedicated=${isdedicated}?bIsLanMatch=${islanmatch}?bUsesStats=${usesstats}?bShouldAdvertise=${shouldadvertise}?PureServer=${pureserver}?bAllowJoinInProgress=${allowjoininprogress}?Mutator=${mutators}?ConfigSubDir=${selfname} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}" +parms="server ${defaultmap}?Game=${game}?bIsDedicated=${isdedicated}?bIsLanMatch=${islanmatch}?bUsesStats=${usesstats}?bShouldAdvertise=${shouldadvertise}?PureServer=${pureserver}?bAllowJoinInProgress=${allowjoininprogress}?Mutator=${mutators}?ConfigSubDir=${selfname} -login=${gsusername} -password=${gspassword} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}" } #### LinuxGSM Settings #### @@ -120,8 +125,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode @@ -130,8 +135,8 @@ stopmode="2" # 3: gamedig # 4: gsquery # 5: tcp -querymode="1" -querytype="" +querymode="2" +querytype="ut3" ## Game Server Details # Do not edit diff --git a/lgsm/config-default/config-lgsm/ut99server/_default.cfg b/lgsm/config-default/config-lgsm/ut99server/_default.cfg index b74e0b14e..caab7ffea 100644 --- a/lgsm/config-default/config-lgsm/ut99server/_default.cfg +++ b/lgsm/config-default/config-lgsm/ut99server/_default.cfg @@ -109,8 +109,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/utserver/_default.cfg b/lgsm/config-default/config-lgsm/utserver/_default.cfg index fe8da5aca..40d6cc526 100644 --- a/lgsm/config-default/config-lgsm/utserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/utserver/_default.cfg @@ -113,8 +113,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/vsserver/_default.cfg b/lgsm/config-default/config-lgsm/vsserver/_default.cfg index 484929179..1eaa9ff86 100644 --- a/lgsm/config-default/config-lgsm/vsserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/vsserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="9" ## Query mode @@ -140,7 +140,7 @@ querytype="protocol-valve" ## Game Server Details # Do not edit gamename="Vampire Slayer" -engine="goldsource" +engine="goldsrc" glibc="2.3.4" #### Directories #### diff --git a/lgsm/config-default/config-lgsm/wetserver/_default.cfg b/lgsm/config-default/config-lgsm/wetserver/_default.cfg index e52be9249..54ee3d25b 100644 --- a/lgsm/config-default/config-lgsm/wetserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/wetserver/_default.cfg @@ -105,8 +105,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/wfserver/_default.cfg b/lgsm/config-default/config-lgsm/wfserver/_default.cfg index f5da24af7..1ddbd7746 100644 --- a/lgsm/config-default/config-lgsm/wfserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/wfserver/_default.cfg @@ -110,8 +110,8 @@ sleeptime="0.5" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/wurmserver/_default.cfg b/lgsm/config-default/config-lgsm/wurmserver/_default.cfg index 47b0fbc0b..e131fc28b 100644 --- a/lgsm/config-default/config-lgsm/wurmserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/wurmserver/_default.cfg @@ -115,8 +115,8 @@ steammaster="false" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="2" ## Query mode diff --git a/lgsm/config-default/config-lgsm/zmrserver/_default.cfg b/lgsm/config-default/config-lgsm/zmrserver/_default.cfg index db1853930..b22f79fc2 100644 --- a/lgsm/config-default/config-lgsm/zmrserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/zmrserver/_default.cfg @@ -124,8 +124,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/config-default/config-lgsm/zpsserver/_default.cfg b/lgsm/config-default/config-lgsm/zpsserver/_default.cfg index bfeceda7e..279f7258a 100644 --- a/lgsm/config-default/config-lgsm/zpsserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/zpsserver/_default.cfg @@ -129,8 +129,8 @@ steammaster="true" # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion stopmode="3" ## Query mode diff --git a/lgsm/data/name-left.csv b/lgsm/data/name-left.csv new file mode 100644 index 000000000..9a47b4baf --- /dev/null +++ b/lgsm/data/name-left.csv @@ -0,0 +1,108 @@ +admiring +adoring +affectionate +agitated +amazing +angry +awesome +beautiful +blissful +bold +boring +brave +busy +charming +clever +cool +compassionate +competent +condescending +confident +cranky +crazy +dazzling +determined +distracted +dreamy +eager +ecstatic +elastic +elated +elegant +eloquent +epic +exciting +fervent +festive +flamboyant +focused +friendly +frosty +funny +gallant +gifted +goofy +gracious +great +happy +hardcore +heuristic +hopeful +hungry +infallible +inspiring +interesting +intelligent +jolly +jovial +keen +kind +laughing +loving +lucid +magical +mystifying +modest +musing +naughty +nervous +nice +nifty +nostalgic +objective +optimistic +peaceful +pedantic +pensive +practical +priceless +quirky +quizzical +recursing +relaxed +reverent +romantic +sad +serene +sharp +silly +sleepy +stoic +strange +stupefied +suspicious +sweet +tender +thirsty +trusting +unruffled +upbeat +vibrant +vigilant +vigorous +wizardly +wonderful +xenodochial +youthful +zealous +zen \ No newline at end of file diff --git a/lgsm/data/name-right.csv b/lgsm/data/name-right.csv new file mode 100644 index 000000000..8e04d85b4 --- /dev/null +++ b/lgsm/data/name-right.csv @@ -0,0 +1,237 @@ +albattani +allen +almeida +antonelli +agnesi +archimedes +ardinghelli +aryabhata +austin +babbage +banach +banzai +bardeen +bartik +bassi +beaver +bell +benz +bhabha +bhaskara +black +blackburn +blackwell +bohr +booth +borg +bose +bouman +boyd +brahmagupta +brattain +brown +buck +burnell +cannon +carson +cartwright +carver +cerf +chandrasekhar +chaplygin +chatelet +chatterjee +chebyshev +cohen +chaum +clarke +colden +cori +cray +curran +curie +darwin +davinci +dewdney +dhawan +diffie +dijkstra +dirac +driscoll +dubinsky +easley +edison +einstein +elbakyan +elgamal +elion +ellis +engelbart +euclid +euler +faraday +feistel +fermat +fermi +feynman +franklin +gagarin +galileo +galois +ganguly +gates +gauss +germain +goldberg +goldstine +goldwasser +golick +goodall +gould +greider +grothendieck +haibt +hamilton +haslett +hawking +hellman +heisenberg +hermann +herschel +hertz +heyrovsky +hodgkin +hofstadter +hoover +hopper +hugle +hypatia +ishizaka +jackson +jang +jemison +jennings +jepsen +johnson +joliot +jones +kalam +kapitsa +kare +keldysh +keller +kepler +khayyam +khorana +kilby +kirch +knuth +kowalevski +lalande +lamarr +lamport +leakey +leavitt +lederberg +lehmann +lewin +lichterman +liskov +lovelace +lumiere +mahavira +margulis +matsumoto +maxwell +mayer +mccarthy +mcclintock +mclaren +mclean +mcnulty +mendel +mendeleev +meitner +meninsky +merkle +mestorf +mirzakhani +moore +morse +murdock +moser +napier +nash +neumann +newton +nightingale +nobel +noether +northcutt +noyce +panini +pare +pascal +pasteur +payne +perlman +pike +poincare +poitras +proskuriakova +ptolemy +raman +ramanujan +ride +montalcini +ritchie +rhodes +robinson +roentgen +rosalind +rubin +saha +sammet +sanderson +satoshi +shamir +shannon +shaw +shirley +shockley +shtern +sinoussi +snyder +solomon +spence +stonebraker +sutherland +swanson +swartz +swirles +taussig +tereshkova +tesla +tharp +thompson +torvalds +tu +turing +varahamihira +vaughan +visvesvaraya +volhard +villani +wescoff +wilbur +wiles +williams +williamson +wilson +wing +wozniak +wright +wu +yalow +yonath +zhukovsky \ No newline at end of file diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index 9f30d599a..9c5d243c5 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -1,17 +1,21 @@ +ac,acserver,Assetto Corsa ahl,ahlserver,Action half-life ahl2,ahl2server,Action: Source ark,arkserver,ARK: Survival Evolved arma3,arma3server,ARMA 3 +av,avserver,Avorion bb,bbserver,BrainBread bb2,bb2server,BrainBread 2 bd,bdserver,Base Defense bf1942,bf1942server,Battlefield 1942 +bfv,bfvserver,Battlefield: Vietnam bmdm,bmdmserver,Black Mesa: Deathmatch bo,boserver,Ballistic Overkill bs,bsserver,Blade Symphony bt,btserver,Barotrauma bt1944,bt1944server,Battalion 1944 cc,ccserver,Codename CURE +cmw,cmwserver,Chivalry: Medieval Warfare cod,codserver,Call of Duty cod2,cod2server,Call of Duty 2 cod4,cod4server,Call of Duty 4 @@ -53,6 +57,7 @@ mc,mcserver,Minecraft mcb,mcbserver,Minecraft Bedrock mh,mhserver,MORDHAU mohaa,mohaaserver,Medal of Honor: Allied Assault +mom,momserver,Memories of Mars mta,mtaserver,Multi Theft Auto mumble,mumbleserver,Mumble nd,ndserver,Nuclear Dawn @@ -103,4 +108,4 @@ wet,wetserver,Wolfenstein: Enemy Territory wf,wfserver,Warfork wurm,wurmserver,Wurm Unlimited zmr,zmrserver,Zombie Master: Reborn -zps,zpsserver,Zombie Panic! Source +zps,zpsserver,Zombie Panic! Source \ No newline at end of file diff --git a/lgsm/functions/alert.sh b/lgsm/functions/alert.sh index d09f9eb93..5f8fe156e 100644 --- a/lgsm/functions/alert.sh +++ b/lgsm/functions/alert.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Overall function for managing alerts. -local modulename="ALERT" -local commandaction="Alert" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_alert_log(){ info_distro.sh @@ -100,104 +99,104 @@ fn_alert_log if [ "${postalert}" == "on" ]&&[ -n "${postalert}" ]; then exitbypass=1 command_postdetails.sh -elif [ "${postalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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" -elif [ -z "${posttarget}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${posttarget}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "posttarget not set" fn_script_error "posttarget not set" -elif [ -z "${postdays}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${postdays}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "postdays not set" fn_script_error "postdays not set" fi if [ "${discordalert}" == "on" ]&&[ -n "${discordalert}" ]; then alert_discord.sh -elif [ "${discordalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${discordtoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Discord token not set" - echo -e " * https://docs.linuxgsm.com/alerts/discord" + echo -e "* https://docs.linuxgsm.com/alerts/discord" fn_script_error "Discord token not set" fi if [ "${emailalert}" == "on" ]&&[ -n "${email}" ]; then alert_email.sh -elif [ "${emailalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${email}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Email not set" fn_script_log_error "Email not set" fi if [ "${iftttalert}" == "on" ]&&[ -n "${iftttalert}" ]; then alert_ifttt.sh -elif [ "${iftttalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${ifttttoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "IFTTT token not set" - echo -e " * https://docs.linuxgsm.com/alerts/ifttt" + echo -e "* https://docs.linuxgsm.com/alerts/ifttt" fn_script_error "IFTTT token not set" fi if [ "${mailgunalert}" == "on" ]&&[ -n "${mailgunalert}" ]; then alert_mailgun.sh -elif [ "${mailgunalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${mailguntoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Mailgun token not set" - echo -e " * https://docs.linuxgsm.com/alerts/mailgun" + echo -e "* https://docs.linuxgsm.com/alerts/mailgun" fn_script_error "Mailgun token not set" fi if [ "${pushbulletalert}" == "on" ]&&[ -n "${pushbullettoken}" ]; then alert_pushbullet.sh -elif [ "${pushbulletalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${pushbullettoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Pushbullet token not set" - echo -e " * https://docs.linuxgsm.com/alerts/pushbullet" + echo -e "* https://docs.linuxgsm.com/alerts/pushbullet" fn_script_error "Pushbullet token not set" fi if [ "${pushoveralert}" == "on" ]&&[ -n "${pushoveralert}" ]; then alert_pushover.sh -elif [ "${pushoveralert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${pushovertoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Pushover token not set" - echo -e " * https://docs.linuxgsm.com/alerts/pushover" + echo -e "* https://docs.linuxgsm.com/alerts/pushover" fn_script_error "Pushover token not set" fi if [ "${telegramalert}" == "on" ]&&[ -n "${telegramtoken}" ]; then alert_telegram.sh -elif [ "${telegramalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${telegramtoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Telegram token not set." - echo -e " * https://docs.linuxgsm.com/alerts/telegram" + echo -e "* https://docs.linuxgsm.com/alerts/telegram" fn_script_error "Telegram token not set." -elif [ -z "${telegramchatid}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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" + echo -e "* https://docs.linuxgsm.com/alerts/telegram" fn_script_error "Telegram chat id not set." fi if [ "${slackalert}" == "on" ]&&[ -n "${slackalert}" ]; then alert_slack.sh -elif [ "${slackalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; 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}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${slacktoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Slack token not set" - echo -e " * https://docs.linuxgsm.com/alerts/slack" + echo -e "* https://docs.linuxgsm.com/alerts/slack" fn_script_error "Slack token not set" fi diff --git a/lgsm/functions/alert_discord.sh b/lgsm/functions/alert_discord.sh index c088df281..3ed12fe97 100644 --- a/lgsm/functions/alert_discord.sh +++ b/lgsm/functions/alert_discord.sh @@ -5,9 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Discord alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if ! command -v jq > /dev/null; then fn_print_fail_nl "Sending Discord alert: jq is missing." diff --git a/lgsm/functions/alert_email.sh b/lgsm/functions/alert_email.sh index 43eddfa58..f69f8f408 100644 --- a/lgsm/functions/alert_email.sh +++ b/lgsm/functions/alert_email.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Sends email alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "Sending Email alert: ${email}" fn_sleep_time diff --git a/lgsm/functions/alert_ifttt.sh b/lgsm/functions/alert_ifttt.sh index 26a50114f..376dfed3a 100644 --- a/lgsm/functions/alert_ifttt.sh +++ b/lgsm/functions/alert_ifttt.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Sends IFTTT alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$(cat < /dev/null; then fn_print_fail_nl "Sending Slack alert: jq is missing." diff --git a/lgsm/functions/alert_telegram.sh b/lgsm/functions/alert_telegram.sh index 6d7403660..33662b756 100644 --- a/lgsm/functions/alert_telegram.sh +++ b/lgsm/functions/alert_telegram.sh @@ -4,9 +4,7 @@ # Website: https://bytegaming.de # Description: Sends Telegram Messenger alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$(cat </dev/null)" ]; then - cmd="echo steamcmd steam/question select \"I AGREE\" | sudo debconf-set-selections; echo steamcmd steam/license note '' | sudo debconf-set-selections; sudo dpkg --add-architecture i386; sudo apt update; sudo apt -y install ${array_deps_missing[@]}" + cmd="echo steamcmd steam/question select \"I AGREE\" | sudo debconf-set-selections; echo steamcmd steam/license note '' | sudo debconf-set-selections; sudo dpkg --add-architecture i386; sudo apt-get update; sudo apt-get -y install ${array_deps_missing[*]}" eval "${cmd}" elif [ "$(command -v dnf 2>/dev/null)" ]; then - cmd="sudo dnf -y install ${array_deps_missing[@]}" + cmd="sudo dnf -y install ${array_deps_missing[*]}" eval "${cmd}" elif [ "$(command -v yum 2>/dev/null)" ]; then - cmd="sudo yum -y install ${array_deps_missing[@]}" + cmd="sudo yum -y install ${array_deps_missing[*]}" eval "${cmd}" fi if [ $? != 0 ]; then @@ -264,15 +271,15 @@ fn_found_missing_deps(){ fn_print_warning_nl "Manually install dependencies." fn_script_log_warn "Manually install dependencies." if [ "$(command -v dpkg-query 2>/dev/null)" ]; then - echo -e " sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}" + echo -e " sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[*]}" elif [ "$(command -v dnf 2>/dev/null)" ]; then - echo -e " sudo dnf install ${array_deps_missing[@]}" + echo -e " sudo dnf install ${array_deps_missing[*]}" elif [ "$(command -v yum 2>/dev/null)" ]; then - echo -e " sudo yum install ${array_deps_missing[@]}" + echo -e " sudo yum install ${array_deps_missing[*]}" fi if [ "${steamcmdfail}" ]; then echo -e "" - if [ "${function_selfname}" == "command_install.sh" ]; then + if [ "${commandname}" == "INSTALL" ]; then fn_print_failure_nl "Missing dependencies required to run SteamCMD." fn_script_log_fatal "Missing dependencies required to run SteamCMD." core_exit.sh @@ -290,15 +297,15 @@ fn_found_missing_deps(){ fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies." echo -e "" if [ "$(command -v dpkg-query 2>/dev/null)" ]; then - echo -e "sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}" + echo -e "sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[*]}" elif [ "$(command -v dnf 2>/dev/null)" ]; then - echo -e "sudo dnf install ${array_deps_missing[@]}" + echo -e "sudo dnf install ${array_deps_missing[*]}" elif [ "$(command -v yum 2>/dev/null)" ]; then - echo -e "sudo yum install ${array_deps_missing[@]}" + echo -e "sudo yum install ${array_deps_missing[*]}" fi if [ "${steamcmdfail}" ]; then echo -e "" - if [ "${function_selfname}" == "command_install.sh" ]; then + if [ "${commandname}" == "INSTALL" ]; then fn_print_failure_nl "Missing dependencies required to run SteamCMD." fn_script_log_fatal "Missing dependencies required to run SteamCMD." core_exit.sh @@ -309,11 +316,11 @@ fn_found_missing_deps(){ fi echo -e "" fi - if [ "${function_selfname}" == "command_install.sh" ]; then + if [ "${commandname}" == "INSTALL" ]; then sleep 5 fi else - if [ "${function_selfname}" == "command_install.sh" ]; then + if [ "${commandname}" == "INSTALL" ]; then fn_print_information_nl "Required dependencies already installed." fn_script_log_info "Required dependencies already installed." fi @@ -322,7 +329,7 @@ fn_found_missing_deps(){ fn_check_loop(){ # Loop though required depenencies. - for deptocheck in "${array_deps_required[@]}" + for deptocheck in ${array_deps_required[*]} do fn_deps_detector done @@ -339,18 +346,23 @@ fn_deps_build_debian(){ # LinuxGSM requirements. array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python3 tar bzip2 gzip unzip binutils bc jq tmux netcat ) - # All servers except ts3, mumble, GTA and minecraft servers require libstdc++6 and lib32gcc1. + # All servers except ts3, mumble, GTA and minecraft servers require lib32stdc++6 and lib32gcc1. if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then if [ "${arch}" == "x86_64" ]; then - array_deps_required+=( lib32gcc1 lib32stdc++6 ) + # lib32gcc1 is now called lib32gcc-s1 in debian 11 + if [ "${distroid}" == "debian" ]&&[ "${distroversion}" == "11" ]; then + array_deps_required+=( lib32gcc-s1 lib32stdc++6 ) + else + array_deps_required+=( lib32gcc1 lib32stdc++6 ) + fi else array_deps_required+=( lib32stdc++6 ) fi fi # If requires steamcmd. if [ "${appid}" ]; then - # Will not use apt if non-free repo is missing - if [ "${distroid}" == "debian" ]&& ! grep -qE "^deb .*non-free" /etc/apt/sources.list; then + # Will not use apt if non-free repo is missing or Ubuntu 14.04 + if [ "${distroversion}" == "14.04" ]||[ "${distroid}" == "debian" ]&& ! grep -qE "^deb .*non-free" /etc/apt/sources.list; then : else array_deps_required+=( steamcmd ) @@ -368,8 +380,11 @@ fn_deps_build_debian(){ # 7 Days to Die elif [ "${shortname}" == "sdtd" ]; then array_deps_required+=( telnet expect ) - # No More Room in Hell, Counter-Strike: Source, Garry's Mod and Zombie Panic: Source - elif [ "${shortname}" == "nmrih" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "zps" ]; then + # Battlefield: Vietnam + elif [ "${shortname}" == "bfv" ]; then + array_deps_required+=( libncurses5:i386 libstdc++5:i386 ) + # Battlefield 1942, Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source + elif [ "${shortname}" == "bf1942" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "zmr" ]||[ "${shortname}" == "zps" ]; then if [ "${arch}" == "x86_64" ]; then array_deps_required+=( libtinfo5:i386 ) else @@ -378,12 +393,6 @@ fn_deps_build_debian(){ # Brainbread 2, Don't Starve Together & Team Fortress 2 elif [ "${shortname}" == "bb2" ]||[ "${shortname}" == "dst" ]||[ "${shortname}" == "tf2" ]; then array_deps_required+=( libcurl4-gnutls-dev:i386 ) - if [ "${shortname}" == "tf2" ]; then - array_deps_required+=( libtcmalloc-minimal4:i386 ) - fi - # Battlefield: 1942 - elif [ "${shortname}" == "bf1942" ]; then - array_deps_required+=( libncurses5:i386 ) # Call of Duty & Medal of Honor: Allied Assault elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]||[ "${shortname}" == "mohaa" ]; then array_deps_required+=( libstdc++5:i386 ) @@ -417,9 +426,6 @@ fn_deps_build_debian(){ # GoldenEye: Source elif [ "${shortname}" == "ges" ]; then array_deps_required+=( zlib1g:i386 libldap-2.4-2:i386 ) - # Serious Sam 3: BFE - elif [ "${shortname}" == "ss3" ]; then - array_deps_required+=( libxrandr2:i386 libglu1-mesa:i386 libxtst6:i386 libusb-1.0-0-dev:i386 libxxf86vm1:i386 libopenal1:i386 libssl1.0.0:i386 libgtk2.0-0:i386 libdbus-glib-1-2:i386 libnm-glib-dev:i386 ) # Sven Co-op elif [ "${shortname}" == "sven" ]; then array_deps_required+=( libssl1.1:i386 zlib1g:i386 ) @@ -486,18 +492,15 @@ fn_deps_build_redhat(){ # 7 Days to Die elif [ "${shortname}" == "sdtd" ]; then array_deps_required+=( telnet expect ) - # No More Room in Hell, Counter-Strike: Source, Garry's Mod and Zombie Panic: Source - elif [ "${shortname}" == "nmrih" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "zps" ]; then + # Battlefield: Vietnam + elif [ "${shortname}" == "bfv" ]; then + array_deps_required+=( compat-libstdc++-33.i686 glibc.i686 ) + # Battlefield 1942, Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source + elif [ "${shortname}" == "bf1942" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "zmr" ]||[ "${shortname}" == "zps" ]; then array_deps_required+=( ncurses-libs.i686 ) # Brainbread 2, Don't Starve Together & Team Fortress 2 elif [ "${shortname}" == "bb2" ]||[ "${shortname}" == "dst" ]||[ "${shortname}" == "tf2" ]; then array_deps_required+=( libcurl.i686 ) - if [ "${shortname}" == "tf2" ]; then - array_deps_required+=( gperftools-libs.i686 ) - fi - # Battlefield: 1942 - elif [ "${shortname}" == "bf1942" ]; then - array_deps_required+=( ncurses-libs.i686 ) # Call of Duty & Medal of Honor: Allied Assault elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]||[ "${shortname}" == "mohaa" ]; then array_deps_required+=( compat-libstdc++-33.i686 ) @@ -531,9 +534,7 @@ fn_deps_build_redhat(){ # GoldenEye: Source elif [ "${shortname}" == "ges" ]; then array_deps_required+=( zlib.i686 openldap.i686 ) - # Serious Sam 3: BFE - elif [ "${shortname}" == "ss3" ]; then - : # not compatible + # Sven Co-op elif [ "${shortname}" == "sven" ]; then : # not compatible # Unreal Engine @@ -561,7 +562,7 @@ fn_deps_build_redhat(){ fn_check_loop } -if [ "${function_selfname}" == "command_install.sh" ]; then +if [ "${commandname}" == "INSTALL" ]; then if [ "$(whoami)" == "root" ]; then echo -e "" echo -e "${lightyellow}Checking Dependencies as root${default}" diff --git a/lgsm/functions/check_executable.sh b/lgsm/functions/check_executable.sh index 3643d3e0d..8623dc303 100644 --- a/lgsm/functions/check_executable.sh +++ b/lgsm/functions/check_executable.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Checks if server executable exists. -local modulename="CHECK" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Check if executable exists if [ ! -f "${executabledir}/${execname}" ]; then diff --git a/lgsm/functions/check_glibc.sh b/lgsm/functions/check_glibc.sh index 0c6e5a70d..02f7ad459 100644 --- a/lgsm/functions/check_glibc.sh +++ b/lgsm/functions/check_glibc.sh @@ -4,7 +4,7 @@ # Website: https://linuxgsm.com # Description: Checks if the server has the correct Glibc version. -local modulename="CHECK" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_distro.sh diff --git a/lgsm/functions/check_ip.sh b/lgsm/functions/check_ip.sh index b421639d3..d8c4f3ed5 100644 --- a/lgsm/functions/check_ip.sh +++ b/lgsm/functions/check_ip.sh @@ -5,7 +5,7 @@ # Description: Automatically identifies the server interface IP. # If multiple interfaces are detected the user will need to manually set using ip="0.0.0.0". -local modulename="CHECK" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "${travistest}" != "1" ]; then if [ ! -f "/bin/ip" ]; then @@ -23,10 +23,10 @@ if [ "${travistest}" != "1" ]; then fn_print_dots "Check IP" # Multiple interfaces. if [ "${getipwc}" -ge "2" ]; then - if [ "${function_selfname}" == "command_details.sh" ]; then - fn_print_warn "Check IP: Multiple IP addresses found." + if [ "${commandname}" == "details" ]; then + fn_print_warn "Check IP: Multiple IP addresses found." else - fn_print_fail "Check IP: Multiple IP addresses found." + fn_print_fail "Check IP: Multiple IP addresses found." fi echo -en "\n" # IP is set within game config. @@ -44,18 +44,14 @@ if [ "${travistest}" != "1" ]; then echo -en "\n" echo -en "Set ip=\"0.0.0.0\" to one of the following:\n" fn_script_log_fatal "Multiple IP addresses found." - if [ "${legacymode}" == "1" ]; then - fn_script_log_fatal "Specify the IP you want to bind within the ${selfname} script." - else - fn_script_log_fatal "Specify the IP you want to bind within: ${configdirserver}." - fi + fn_script_log_fatal "Specify the IP you want to bind within: ${configdirserver}." fi echo -en "${getip}\n" echo -en "\n" echo -en "https://linuxgsm.com/network-interfaces\n" echo -en "" # Do not exit for details and postdetails commands. - if [ "${function_selfname}" != "command_details.sh" ]||[ "${function_selfname}" != "command_postdetails.sh" ]; then + if [ "${commandname}" != "DETAILS" ]||[ "${commandname}" != "POST-DETAILS" ]; then fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n" core_exit.sh else @@ -76,8 +72,8 @@ if [ "${travistest}" != "1" ]; then fn_script_log_fatal "IP address not set in game config." fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}." fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n" - if [ "${function_selfname}" != "command_details.sh" ]; then - core_exit.sh + if [ "${commandname}" != "DETAILS" ]; then + core_exit.sh fi else fn_print_info_nl "Check IP: ${getip}" diff --git a/lgsm/functions/check_last_update.sh b/lgsm/functions/check_last_update.sh new file mode 100644 index 000000000..52e4cfce0 --- /dev/null +++ b/lgsm/functions/check_last_update.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# LinuxGSM check_last_update.sh function +# Author: Daniel Gibbs +# Website: https://linuxgsm.com +# Description: Checks lock file to see when last update happened. +# Will reboot server if instance not rebooted since update. + +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +if [ -f "${lockdir}/${selfname}-laststart.lock" ]; then + laststart=$(cat "${lockdir}/${selfname}-laststart.lock") +fi +if [ -f "${lockdir}/lastupdate.lock" ]; then + lastupdate=$(cat "${lockdir}/lastupdate.lock") +fi + +check_status.sh +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 + fi +fi diff --git a/lgsm/functions/check_logs.sh b/lgsm/functions/check_logs.sh index 9c4b31495..694b1678a 100644 --- a/lgsm/functions/check_logs.sh +++ b/lgsm/functions/check_logs.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Checks if log files exist. -local modulename="CHECK" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_check_logs(){ fn_print_dots "Checking for log files" diff --git a/lgsm/functions/check_permissions.sh b/lgsm/functions/check_permissions.sh index 67e586c45..7f95f5da7 100644 --- a/lgsm/functions/check_permissions.sh +++ b/lgsm/functions/check_permissions.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks ownership & permissions of scripts, files and directories. -local modulename="CHECK" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_check_ownership(){ if [ -f "${rootdir}/${selfname}" ]; then @@ -229,7 +229,7 @@ fn_sys_perm_error_process(){ if [ "$(whoami)" != "root" ]; then fn_check_ownership fn_check_permissions - if [ "${function_selfname}" == "command_start.sh" ]; then + if [ "${commandname}" == "START" ]; then fn_sys_perm_error_process fi fi diff --git a/lgsm/functions/check_root.sh b/lgsm/functions/check_root.sh index 8f62674f7..b6886938f 100644 --- a/lgsm/functions/check_root.sh +++ b/lgsm/functions/check_root.sh @@ -4,11 +4,10 @@ # Website: https://linuxgsm.com # Description: Checks if the user tried to run the script as root. -local modulename="CHECK" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "$(whoami)" = "root" ]; then - if [ "${function_selfname}" != "command_install.sh" ]; then + if [ "${commandname}" != "INSTALL" ]; then fn_print_fail_nl "Do NOT run this script as root!" if [ -d "${lgsmlogdir}" ]; then fn_script_log_fatal "${selfname} attempted to run as root." diff --git a/lgsm/functions/check_status.sh b/lgsm/functions/check_status.sh index 67025a5e7..178adcf6b 100644 --- a/lgsm/functions/check_status.sh +++ b/lgsm/functions/check_status.sh @@ -5,7 +5,6 @@ # Website: https://linuxgsm.com # Description: Checks the process status of the server. Either online or offline. -local modulename="CHECK" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -status=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${selfname}") +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 5673e9ee8..aa4140bbe 100644 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -4,13 +4,26 @@ # Website: https://linuxgsm.com # Description: Checks if SteamCMD is installed correctly. -local modulename="CHECK" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_steamcmd(){ + if [ ${shortname} == "ark" ]&&[ "${installsteamcmd}" == "1" ]; then + steamcmddir="${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" + fi if [ ! -d "${steamcmddir}" ]; then - mkdir -pv "${steamcmddir}" + mkdir -p "${steamcmddir}" fi - fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${tmpdir}" "steamcmd_linux.tar.gz" + remote_fileurl="${1}" + remote_fileurl_backup="${2}" + remote_fileurl_name="${3}" + remote_fileurl_backup_name="${4}" + local_filedir="${5}" + local_filename="${6}" + chmodx="${7:-0}" + run="${8:-0}" + forcedl="${9:-0}" + md5="${10:-0}" + fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "" "" "" "${tmpdir}" "steamcmd_linux.tar.gz" "" "norun" "noforce" "nomd5" fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" chmod +x "${steamcmddir}/steamcmd.sh" } @@ -18,18 +31,10 @@ fn_install_steamcmd(){ fn_check_steamcmd_user(){ # Checks if steamuser is setup. if [ "${steamuser}" == "username" ]; then - if [ "${legacymode}" == "1" ]; then - fn_print_fail_nl "Steam login not set. Update steamuser in ${selfname}" - else - fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}" - fi + fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}" echo -e " * Change steamuser=\"username\" to a valid steam login." if [ -d "${lgsmlogdir}" ]; then - if [ "${legacymode}" == "1" ]; then - fn_script_log_fatal "Steam login not set. Update steamuser in ${selfname}" - else - fn_script_log_fatal "Steam login not set. Update steamuser in ${configdirserver}" - fi + fn_script_log_fatal "Steam login not set. Update steamuser in ${configdirserver}" fi core_exit.sh fi @@ -47,28 +52,88 @@ 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 [ "${function_selfname}" == "command_install.sh" ]; then + if [ "${commandname}" == "INSTALL" ]; then fn_install_steamcmd else - fn_print_error_nl "SteamCMD is missing" - fn_script_log_error "SteamCMD is missing" + fn_print_warn_nl "SteamCMD is missing" + fn_script_log_warn "SteamCMD is missing" fn_install_steamcmd fi - elif [ "${function_selfname}" == "command_install.sh" ]; then + elif [ "${commandname}" == "INSTALL" ]; then fn_print_information "SteamCMD is already installed..." fn_print_ok_eol_nl fi } +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 + + # Create Steam installation directory. + if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then + mkdir -p "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" + fi + + # Create common Steam directory. + if [ ! -d "${HOME}/.steam" ]; then + mkdir -p "${HOME}/.steam" + fi + + # Symbolic links to Steam installation directory. + if [ ! -L "${HOME}/.steam/root" ]; then + if [ -d "${HOME}/.steam/root" ]; then + rm "${HOME}/.steam/root" + fi + ln -s "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" "${HOME}/.steam/root" + fi + + if [ ! -L "${HOME}/.steam/steam" ]; then + if [ -d "${HOME}/.steam/steam" ]; then + rm -rf "${HOME}/.steam/steam" + fi + ln -s "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" "${HOME}/.steam/steam" + fi +} + +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 + rm -rf "${rootdir:?}/steamcmd" + fi + + if [ -d "${HOME}/Steam" ]&&[ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then + rm -rf "${HOME}/Steam" + fi +} + +fn_check_steamcmd_ark(){ + # Checks if SteamCMD exists in + # Engine/Binaries/ThirdParty/SteamCMD/Linux + # to allow ark mods to work + if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then + installsteamcmd=1 + if [ "${commandname}" == "INSTALL" ]; then + fn_install_steamcmd + else + fn_print_warn_nl "ARK mods SteamCMD is missing" + fn_script_log_warn "ARK mods SteamCMD is missing" + fn_install_steamcmd + fi + elif [ "${commandname}" == "INSTALL" ]; then + fn_print_information "ARK mods SteamCMD is already installed..." + fn_print_ok_eol_nl + fi +} + fn_check_steamcmd_clear(){ # Will remove steamcmd dir if steamcmd package is installed. -if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${steamcmddir}" ]; then +if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${rootdir}/steamcmd" ]; then rm -rf "${steamcmddir:?}" exitcode=$? if [ ${exitcode} -ne 0 ]; then - fn_script_log_fatal "Removing ${steamcmddir}" + fn_script_log_fatal "Removing ${rootdir}/steamcmd" else - fn_script_log_pass "Removing ${steamcmddir}" + fn_script_log_pass "Removing ${rootdir}/steamcmd" fi fi } @@ -81,7 +146,12 @@ fn_check_steamcmd_exec(){ fi } -fn_check_steamcmd fn_check_steamcmd_clear +fn_check_steamcmd +if [ ${shortname} == "ark" ]; then + fn_check_steamcmd_ark +fi +fn_check_steamcmd_dir +fn_check_steamcmd_dir_legacy fn_check_steamcmd_user fn_check_steamcmd_exec diff --git a/lgsm/functions/check_system_dir.sh b/lgsm/functions/check_system_dir.sh index 9a4863a5a..ce7ff5ba5 100644 --- a/lgsm/functions/check_system_dir.sh +++ b/lgsm/functions/check_system_dir.sh @@ -4,10 +4,9 @@ # Website: https://linuxgsm.com # Description: Checks if systemdir/serverfiles is accessible. -local modulename="CHECK" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -if [ "${function_selfname}" != "command_validate.sh" ]; then +if [ "${commandname}" != "VALIDATE" ]; then checkdir="${serverfiles}" else checkdir="${systemdir}" diff --git a/lgsm/functions/check_system_requirements.sh b/lgsm/functions/check_system_requirements.sh index 139b2b6af..8b7db5a3c 100644 --- a/lgsm/functions/check_system_requirements.sh +++ b/lgsm/functions/check_system_requirements.sh @@ -5,8 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks RAM requirements -local modulename="CHECK" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_distro.sh diff --git a/lgsm/functions/check_tmuxception.sh b/lgsm/functions/check_tmuxception.sh index 06cb40de1..4f5fd2e29 100644 --- a/lgsm/functions/check_tmuxception.sh +++ b/lgsm/functions/check_tmuxception.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks if run from tmux or screen -local modulename="CHECK" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_check_is_in_tmux(){ if [ "${TMUX}" ]; then diff --git a/lgsm/functions/check_version.sh b/lgsm/functions/check_version.sh new file mode 100644 index 000000000..6db78091d --- /dev/null +++ b/lgsm/functions/check_version.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# LinuxGSM command_version.sh function +# Author: Daniel Gibbs +# Website: https://linuxgsm.com +# Description: Will run update-lgsm if gameserver.sh and modules version does not match +# this will allow gameserver.sh to update - useful for multi instance servers. + +if [ -n "${modulesversion}" ]&&[ -n "${version}" ]&&[ "${version}" != "${modulesversion}" ]; then + exitbypass=1 + echo -e "" + fn_print_error_nl "LinuxGSM version mismatch" + echo -e "" + echo -e "* ${selfname}: ${version}" + echo -e "* modules: ${modulesversion}" + echo -e "" + fn_sleep_time + fn_script_log_error "LinuxGSM Version mismatch: ${selfname}: ${version}: modules: ${modulesversion}" + command_update_linuxgsm.sh +fi diff --git a/lgsm/functions/command_backup.sh b/lgsm/functions/command_backup.sh index d7871a38e..537e86f1c 100644 --- a/lgsm/functions/command_backup.sh +++ b/lgsm/functions/command_backup.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Creates a .tar.gz file in the backup directory. -local modulename="BACKUP" -local commandaction="Backup" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="BACKUP" +commandaction="Backing up" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh @@ -22,15 +22,15 @@ fn_backup_trap(){ fn_print_removed_eol_nl fn_script_log_info "Backup ${backupname}.tar.gz: REMOVED" # Remove lock file. - rm -f "${tmpdir:?}/.backup.lock" + rm -f "${lockdir:?}/backup.lock" core_exit.sh } -# Check if a backup is pending or has been aborted using .backup.lock. +# Check if a backup is pending or has been aborted using backup.lock. fn_backup_check_lockfile(){ - if [ -f "${tmpdir}/.backup.lock" ]; then + 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: ${tmpdir}/.backup.lock" + fn_script_log_error "Lock file found: Backup is currently running: ${lockdir}/backup.lock" core_exit.sh fi } @@ -54,7 +54,7 @@ fn_backup_init(){ else daysago="${lastbackupdaysago} days ago" fi - echo -e " * Previous backup was created ${daysago}, total size ${lastbackupsize}" + echo -e "* Previous backup was created ${daysago}, total size ${lastbackupsize}" fi } @@ -68,13 +68,12 @@ fn_backup_stop_server(){ elif [ "${stoponbackup}" == "off" ]; then serverstopped="no" fn_print_warn_nl "${selfname} is currently running" - echo -e " * Although unlikely; creating a backup while ${selfname} is running might corrupt the backup." + echo -e "* Although unlikely; creating a backup while ${selfname} is running might corrupt the backup." fn_script_log_warn "${selfname} is currently running" fn_script_log_warn "Although unlikely; creating a backup while ${selfname} is running might corrupt the backup" # Server is running and will be stopped if stoponbackup=on or unset. else - fn_print_warn_nl "${selfname} will be stopped during the backup" - fn_script_log_warn "${selfname} will be stopped during the backup" + fn_stop_warning serverstopped="yes" exitbypass=1 command_stop.sh @@ -116,9 +115,9 @@ fn_backup_migrate_olddir(){ fn_backup_create_lockfile(){ # Create lockfile. - date '+%s' > "${tmpdir}/.backup.lock" + date '+%s' > "${lockdir}/backup.lock" fn_script_log_info "Lockfile generated" - fn_script_log_info "${tmpdir}/.backup.lock" + fn_script_log_info "${lockdir}/backup.lock" # trap to remove lockfile on quit. trap fn_backup_trap INT } @@ -139,12 +138,12 @@ fn_backup_compression(){ core_exit.sh fi - tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${tmpdir}/.backup.lock" ./. + tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}/backup.lock" ./. local exitcode=$? if [ ${exitcode} -ne 0 ]; then fn_print_fail_eol fn_script_log_fatal "Backup in progress: FAIL" - echo -e "${tarcmd}" | tee -a "${lgsmlog}" + echo -e "${extractcmd}" | tee -a "${lgsmlog}" fn_print_fail_nl "Starting backup" fn_script_log_fatal "Starting backup" else @@ -153,7 +152,7 @@ fn_backup_compression(){ fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')" fi # Remove lock file - rm -f "${tmpdir:?}/.backup.lock" + rm -f "${lockdir:?}/backup.lock" } # Clear old backups according to maxbackups and maxbackupdays variables. @@ -174,7 +173,7 @@ fn_backup_prune(){ # If maxbackups greater or equal to backupsoutdatedcount, then it is over maxbackupdays. if [ "${backupquotadiff}" -ge "${backupsoudatedcount}" ]; then # Display how many backups will be cleared. - echo -e " * Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit" + echo -e "* Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit" fn_script_log_info "Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit" fn_sleep_time fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)" @@ -186,7 +185,7 @@ fn_backup_prune(){ # If maxbackupdays is used over maxbackups. elif [ "${backupquotadiff}" -lt "${backupsoudatedcount}" ]; then # Display how many backups will be cleared. - echo -e " * Pruning: ${backupsoudatedcount} backup(s) are older than ${maxbackupdays} days." + echo -e "* Pruning: ${backupsoudatedcount} backup(s) are older than ${maxbackupdays} days." fn_script_log_info "Pruning: ${backupsoudatedcount} backup(s) older than ${maxbackupdays} days." fn_sleep_time fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)." @@ -201,11 +200,9 @@ fn_backup_prune(){ } fn_backup_relpath() { - # Written by CedarLUG as a "realpath --relative-to" alternative in bash. - + # Written by CedarLUG as a "realpath --relative-to" alternative in bash. # Populate an array of tokens initialized from the rootdir components. - declare -a rdirtoks=($(readlink -f "${rootdir}" | sed "s/\// /g")) - + declare -a rdirtoks=($(readlink -f "${rootdir}" | sed "s/\// /g")) if [ ${#rdirtoks[@]} -eq 0 ]; then fn_print_fail_nl "Problem assessing rootdir during relative path assessment" fn_script_log_fatal "Problem assessing rootdir during relative path assessment: ${rootdir}" @@ -213,7 +210,7 @@ fn_backup_relpath() { fi # Populate an array of tokens initialized from the backupdir components. - declare -a bdirtoks=($(readlink -f "${backupdir}" | sed "s/\// /g")) + declare -a bdirtoks=($(readlink -f "${backupdir}" | sed "s/\// /g")) if [ ${#bdirtoks[@]} -eq 0 ]; then fn_print_fail_nl "Problem assessing backupdir during relative path assessment" fn_script_log_fatal "Problem assessing backupdir during relative path assessment: ${rootdir}" @@ -222,31 +219,46 @@ 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 - [[ "${rdirtoks[$base]}" != "${bdirtoks[$base]}" ]] && break - done + 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 - echo -n "../" - done + 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 - echo -n "${bdirtoks[$x]}/" - done + 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)) ]}" - else - echo + if (( "$base" < "${#bdirtoks[@]}" )) ; then + echo -e "${bdirtoks[ $(( ${#bdirtoks[@]} - 1)) ]}" + else + echo + fi +} + +fn_stop_warning(){ + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup" + fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break fi + done + fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during backup" } # Restart the server if it was stopped for the backup. diff --git a/lgsm/functions/command_console.sh b/lgsm/functions/command_console.sh index 796f24454..18e674652 100644 --- a/lgsm/functions/command_console.sh +++ b/lgsm/functions/command_console.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Gives access to the server tmux console. -local modulename="CONSOLE" -local commandaction="Console" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="CONSOLE" +commandaction="Access console" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh fn_print_header @@ -26,7 +26,7 @@ check_status.sh if [ "${status}" != "0" ]; then fn_print_ok_nl "Accessing console" fn_script_log_pass "Console accessed" - tmux attach-session -t "${selfname}" + tmux attach-session -t "${sessionname}" fn_print_ok_nl "Closing console" fn_script_log_pass "Console closed" else diff --git a/lgsm/functions/command_debug.sh b/lgsm/functions/command_debug.sh index f3e2a0cc1..5aeb0d5e1 100644 --- a/lgsm/functions/command_debug.sh +++ b/lgsm/functions/command_debug.sh @@ -4,18 +4,21 @@ # Website: https://linuxgsm.com # Description: Runs the server without tmux and directly from the terminal. -local modulename="DEBUG" -local commandaction="Debug" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DEBUG" +commandaction="Debuging" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Trap to remove lockfile on quit. fn_lockfile_trap(){ # Remove lockfile. - rm -f "${rootdir:?}/${lockselfname}" + rm -f "${lockdir:?}/${selfname}.lock" # resets terminal. Servers can sometimes mess up the terminal on exit. reset - fn_print_ok_nl "Closing debug" - fn_script_log_pass "Debug closed" + fn_print_dots "Stopping debug" + fn_print_ok_nl "Stopping debug" + fn_script_log_pass "Stopping debug" + # remove trap. + trap - INT core_exit.sh } @@ -62,20 +65,12 @@ if [ "${extip}" ]; then echo -e "${lightblue}Internet IP:\t${default}${extip}:${port}" fi fi -# Listed on Master Server. -if [ "${displaymasterserver}" ]; then - if [ "${displaymasterserver}" == "true" ]; then - echo -e "${lightblue}Master Server:\t${green}${displaymasterserver}${default}" - else - echo -e "${lightblue}Master Server:\t${red}${displaymasterserver}${default}" - fi -fi # Server password. if [ "${serverpassword}" ]; then echo -e "${lightblue}Server password:\t${default}${serverpassword}" fi echo -e "${lightblue}Start parameters:${default}" -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then +if [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then echo -e "${executable} ${parms} -debug" else echo -e "${executable} ${parms}" @@ -93,35 +88,35 @@ fn_print_info_nl "Stopping any running servers" fn_script_log_info "Stopping any running servers" exitbypass=1 command_stop.sh +unset exitbypass fn_print_dots "Starting debug" fn_script_log_info "Starting debug" fn_print_ok_nl "Starting debug" # Create lockfile. -date '+%s' > "${rootdir}/${lockselfname}" +date '+%s' > "${lockdir}/${selfname}.lock" fn_script_log_info "Lockfile generated" -fn_script_log_info "${rootdir}/${lockselfname}" -# trap to remove lockfile on quit. -trap fn_lockfile_trap INT +fn_script_log_info "${lockdir}/${selfname}.lock" cd "${executabledir}" || exit # Note: do not add double quotes to ${executable} ${parms}. -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then +if [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then ${executable} ${parms} -debug -elif [ "${engine}" == "realvirtuality" ]; then +elif [ "${shortname}" == "arma3" ]; then # Arma3 requires semicolons in the module list, which need to # be escaped for regular (tmux) loading, but need to be # stripped when loading straight from the console. ${executable} ${parms//\\;/;} elif [ "${engine}" == "quake" ]; then - ${executable} ${parms} -condebug + ${executable} ${parms} -condebug else ${executable} ${parms} fi +fn_lockfile_trap + fn_print_dots "Stopping debug" fn_print_ok_nl "Stopping debug" -# remove trap. -trap - INT +fn_script_log_info "Stopping debug" core_exit.sh diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index 461dc78f5..c2abc0ba0 100644 --- a/lgsm/functions/command_details.sh +++ b/lgsm/functions/command_details.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Displays server information. -local modulename="DETAILS" -local commandaction="Details" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DETAILS" +commandaction="Viewing details" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Run checks and gathers details to display. check.sh @@ -15,7 +15,9 @@ info_config.sh info_parms.sh info_distro.sh info_messages.sh -query_gamedig.sh +if [ "${querymode}" == "2" ]||[ "${querymode}" == "3" ]; then + query_gamedig.sh +fi fn_info_message_distro fn_info_message_server_resource fn_info_message_gameserver_resource diff --git a/lgsm/functions/command_dev_clear_functions.sh b/lgsm/functions/command_dev_clear_functions.sh index 51878a381..0c2faa375 100644 --- a/lgsm/functions/command_dev_clear_functions.sh +++ b/lgsm/functions/command_dev_clear_functions.sh @@ -4,6 +4,10 @@ # Website: https://linuxgsm.com # Description: Deletes the contents of the functions dir. +commandname="DEV-CLEAR-MODULES" +commandaction="Clearing modules" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + echo -e "=================================" echo -e "Clear Functions" echo -e "=================================" @@ -11,6 +15,8 @@ echo -e "" if fn_prompt_yn "Do you want to delete all functions?" Y; then rm -rfv "${functionsdir:?}/"* rm -rfv "${configdirdefault:?}/"* + fn_script_log_info "Cleared modules directory" + fn_script_log_info "Cleared default config directory" fi core_exit.sh diff --git a/lgsm/functions/command_dev_debug.sh b/lgsm/functions/command_dev_debug.sh index ba80921c6..962b01e7f 100644 --- a/lgsm/functions/command_dev_debug.sh +++ b/lgsm/functions/command_dev_debug.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Dev only: Enables debugging log to be saved to dev-debug.log. -local modulename="DEV-DEBUG" -local commandaction="Dev-Debug" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DEV-DEBUG" +commandaction="Developer debug" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ -f "${rootdir}/.dev-debug" ]; then rm "${rootdir:?}/.dev-debug" diff --git a/lgsm/functions/command_dev_detect_deps.sh b/lgsm/functions/command_dev_detect_deps.sh index b308c3579..04f37d696 100644 --- a/lgsm/functions/command_dev_detect_deps.sh +++ b/lgsm/functions/command_dev_detect_deps.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Detects dependencies the server binary requires. -local modulename="DETECT-DEPS" -local commandaction="Detect-Deps" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DEV-DETECT-DEPS" +commandaction="Developer detect deps" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "=================================" echo -e "Dependencies Checker" @@ -40,7 +40,7 @@ touch "${tmpdir}/.depdetect_debian_list" while read -r lib; do echo -e "${lib}" - local 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 @@ -51,7 +51,7 @@ while read -r lib; do fi done - local 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 @@ -62,7 +62,7 @@ while read -r lib; do fi done - local 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. diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/functions/command_dev_detect_glibc.sh index 0ffc7e0a7..2289bb818 100644 --- a/lgsm/functions/command_dev_detect_glibc.sh +++ b/lgsm/functions/command_dev_detect_glibc.sh @@ -5,9 +5,9 @@ # Description: Automatically detects the version of GLIBC that is required. # Can check a file or directory recursively. -local modulename="DETECT-GLIBC" -local commandaction="Detect-Glibc" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DEV-DETECT-GLIBC" +commandaction="Developer detect glibc" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "=================================" echo -e "glibc Requirements Checker" @@ -33,7 +33,7 @@ fi echo -e "" -local 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 diff --git a/lgsm/functions/command_dev_detect_ldd.sh b/lgsm/functions/command_dev_detect_ldd.sh index f612366bf..850845179 100644 --- a/lgsm/functions/command_dev_detect_ldd.sh +++ b/lgsm/functions/command_dev_detect_ldd.sh @@ -5,9 +5,9 @@ # Description: Automatically detects required deps using ldd. # Can check a file or directory recursively. -local modulename="DETECT-LDD" -local commandaction="Detect-LDD" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DEV-DETECT-LDD" +commandaction="Developer detect ldd" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "=================================" echo -e "Shared Object dependencies Checker" diff --git a/lgsm/functions/command_dev_query_raw.sh b/lgsm/functions/command_dev_query_raw.sh index 78ba80e77..22ed232ec 100644 --- a/lgsm/functions/command_dev_query_raw.sh +++ b/lgsm/functions/command_dev_query_raw.sh @@ -4,14 +4,24 @@ # Website: https://linuxgsm.com # Description: Raw gamedig output of the server. -local modulename="QUERY-RAW" -local commandaction="Query Raw" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DEV-QUERY-RAW" +commandaction="Developer query raw" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +check.sh +info_config.sh +info_parms.sh echo -e "" echo -e "Query Port - Raw Output" echo -e "==================================================================" echo -e "" +echo -e "Ports" +echo -e "=================================" +echo -e "" +echo -e "PORT: ${port}" +echo -e "QUERY PORT: ${queryport}" +echo -e "" echo -e "Gamedig Raw Output" echo -e "=================================" echo -e "" @@ -22,14 +32,10 @@ if [ ! "$(command -v jq 2>/dev/null)" ]; then fn_print_failure_nl "jq not installed" fi -check.sh -info_config.sh -info_parms.sh - query_gamedig.sh echo -e "${gamedigcmd}" echo"" -echo -e "${gamedigraw}" | jq +echo "${gamedigraw}" | jq echo -e "" echo -e "gsquery Raw Output" @@ -75,4 +81,5 @@ else echo -e "TCP query FAIL" fi +exitcode=0 core_exit.sh diff --git a/lgsm/functions/command_donate.sh b/lgsm/functions/command_donate.sh index e979339f1..9bb7f2faf 100644 --- a/lgsm/functions/command_donate.sh +++ b/lgsm/functions/command_donate.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Shows ways to donate. -local modulename="CONSOLE" -local commandaction="Console" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DONATE" +commandaction="Donate" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_ascii_logo echo -e "${lightyellow}Support LinuxGSM${default}" @@ -16,8 +16,8 @@ echo -e "Been using LinuxGSM?" echo -e "Consider donating to support development." echo -e "" echo -e "* ${lightblue}Patreon:${default} https://linuxgsm.com/patreon" +echo -e "* ${lightblue}GitHub:${default} https://github.com/sponsors/dgibbs64" echo -e "* ${lightblue}PayPal:${default} https://linuxgsm.com/paypal" -echo -e "* ${lightblue}Ko-Fi:${default} https://linuxgsm.com/ko-fi" echo -e "" echo -e "LinuxGSM est. 2012" diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh index 12a33e8e1..f6a5897db 100644 --- a/lgsm/functions/command_fastdl.sh +++ b/lgsm/functions/command_fastdl.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Creates a FastDL directory. -local modulename="FASTDL" -local commandaction="FastDL" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="FASTDL" +commandaction="Fastdl" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh @@ -77,7 +77,6 @@ fn_clear_old_fastdl(){ fn_print_ok_eol_nl fn_script_log_pass "Clearing existing FastDL directory ${fastdldir}" fi - fn_sleep_time fi } @@ -95,7 +94,6 @@ fn_fastdl_dirs(){ fn_print_ok_eol_nl fn_script_log_pass "Creating web directory ${webdir}" fi - fn_sleep_time fi if [ ! -d "${fastdldir}" ]; then echo -en "creating fastdl directory ${fastdldir}..." @@ -109,7 +107,6 @@ fn_fastdl_dirs(){ fn_print_ok_eol_nl fn_script_log_pass "Creating fastdl directory ${fastdldir}" fi - fn_sleep_time fi } @@ -135,7 +132,7 @@ fn_human_readable_file_size(){ local factor="${item%:*}" local abbrev="${item#*:}" if [[ "${bytes}" -ge "${factor}" ]]; then - local size=$(bc -l <<< "${bytes} / ${factor}") + size=$(bc -l <<< "${bytes} / ${factor}") printf "%.*f %s\n" "${precision}" "${size}" "${abbrev}" break fi diff --git a/lgsm/functions/command_install.sh b/lgsm/functions/command_install.sh index caab4ee89..9a6b64e98 100644 --- a/lgsm/functions/command_install.sh +++ b/lgsm/functions/command_install.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Overall function for the installer. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="INSTALL" +commandaction="Installing" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh if [ "$(whoami)" = "root" ]; then diff --git a/lgsm/functions/command_install_resources_mta.sh b/lgsm/functions/command_install_resources_mta.sh index 5874818a6..053982e0b 100644 --- a/lgsm/functions/command_install_resources_mta.sh +++ b/lgsm/functions/command_install_resources_mta.sh @@ -4,15 +4,15 @@ # Website: https://linuxgsm.com # Description: Installs the default resources for Multi Theft Auto. -local modulename="DEFAULT_RESOURCES" -local commandaction="Default Resources" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DEFAULT-RESOURCES" +commandaction="Default Resources" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_resources(){ echo -e "" echo -e "Installing Default Resources" echo -e "=================================" - fn_fetch_file "http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip" "${tmpdir}" "mtasa-resources-latest.zip" "nochmodx" "norun" "noforce" "nomd5" + fn_fetch_file "http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip" "" "" "" "${tmpdir}" "mtasa-resources-latest.zip" "nochmodx" "norun" "noforce" "nomd5" fn_dl_extract "${tmpdir}" "mtasa-resources-latest.zip" "${resourcesdir}" echo -e "Default Resources Installed." } diff --git a/lgsm/functions/command_mods_install.sh b/lgsm/functions/command_mods_install.sh index 1bef36c25..d3c517461 100644 --- a/lgsm/functions/command_mods_install.sh +++ b/lgsm/functions/command_mods_install.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: List and installs available mods along with mods_list.sh and mods_core.sh. -local modulename="MODS" -local commandaction="addons/mods" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="MODS-INSTALL" +commandaction="Installing mods" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh mods_core.sh diff --git a/lgsm/functions/command_mods_remove.sh b/lgsm/functions/command_mods_remove.sh index cec994fea..35fd41d5f 100644 --- a/lgsm/functions/command_mods_remove.sh +++ b/lgsm/functions/command_mods_remove.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Uninstall mods along with mods_list.sh and mods_core.sh. -local modulename="MODS" -local commandaction="Mods Remove" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="MODS-REMOVE" +commandaction="Removing mods" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh mods_core.sh @@ -87,7 +87,6 @@ if [ ${exitcode} -ne 0 ]; then else fn_print_ok_eol_nl fi -fn_sleep_time # Remove file list. echo -en "removing ${modcommand}-files.txt..." fn_sleep_time diff --git a/lgsm/functions/command_mods_update.sh b/lgsm/functions/command_mods_update.sh index 8d0146f09..165b4ea98 100644 --- a/lgsm/functions/command_mods_update.sh +++ b/lgsm/functions/command_mods_update.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Updates installed mods along with mods_list.sh and mods_core.sh. -local modulename="MODS" -local commandaction="Mods Update" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="MODS-UPDATE" +commandaction="Updating mods" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh mods_core.sh diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh index ae7d25388..3a333a578 100644 --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/functions/command_monitor.sh @@ -6,28 +6,26 @@ # Description: Monitors server by checking for running processes # then passes to gamedig and gsquery. -local modulename="MONITOR" -local commandaction="Monitor" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="MONITOR" +commandaction="Monitoring" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_monitor_check_lockfile(){ # Monitor does not run it lockfile is not found. - if [ ! -f "${rootdir}/${lockselfname}" ]; then + if [ ! -f "${lockdir}/${selfname}.lock" ]; then fn_print_dots "Checking lockfile: " fn_print_checking_eol fn_script_log_info "Checking lockfile: CHECKING" - fn_sleep_time fn_print_error "Checking lockfile: No lockfile found: " fn_print_error_eol_nl fn_script_log_error "Checking lockfile: No lockfile found: ERROR" - fn_sleep_time - echo -en "* Start ${selfname} to run monitor." + echo -e "* Start ${selfname} to run monitor." core_exit.sh fi # Fix if lockfile is not unix time or contains letters - if [[ "$(cat "${rootdir}/${lockselfname}")" =~ [A-Za-z] ]]; then - date '+%s' > "${rootdir}/${lockselfname}" + if [ -f "${lockdir}/${selfname}.lock" ]&&[[ "$(cat "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then + date '+%s' > "${lockdir}/${selfname}.lock" fi } @@ -37,11 +35,9 @@ fn_monitor_check_update(){ fn_print_dots "Checking active updates: " fn_print_checking_eol fn_script_log_info "Checking active updates: CHECKING" - fn_sleep_time fn_print_error_nl "Checking active updates: SteamCMD is currently checking for updates: " fn_print_error_eol fn_script_log_error "Checking active updates: SteamCMD is currently checking for updates: ERROR" - fn_sleep_time core_exit.sh fi } @@ -50,18 +46,15 @@ fn_monitor_check_session(){ fn_print_dots "Checking session: " fn_print_checking_eol fn_script_log_info "Checking session: CHECKING" - fn_sleep_time # uses status var from check_status.sh if [ "${status}" != "0" ]; then fn_print_ok "Checking session: " fn_print_ok_eol_nl fn_script_log_pass "Checking session: OK" - fn_sleep_time else fn_print_error "Checking session: " fn_print_fail_eol_nl fn_script_log_fatal "Checking session: FAIL" - fn_sleep_time alert="restart" alert.sh fn_script_log_info "Checking session: Monitor is restarting ${selfname}" @@ -75,12 +68,14 @@ fn_monitor_check_queryport(){ if [ -z "${queryport}" ]||[ "${queryport}" == "0" ]; then fn_print_dots "Checking port: " fn_print_checking_eol - fn_script_log_info "Checking session: CHECKING" - fn_sleep_time - fn_print_error "Checking port: Unable to query as queryport is not set: " - fn_print_error_eol_nl - fn_script_log_error "Checking port: Unable to query as queryport is not set: ERROR" - fn_sleep_time + fn_script_log_info "Checking port: CHECKING" + if [ -n "${rconenabled}" ]&&[ "${rconenabled}" != "true" ]&&[ ${shortname} == "av" ]; then + fn_print_warn "Checking port: Unable to query as rconport, rcon not enabled: " + fn_script_log_warn "Checking port: Unable to query rconport, rcon not enabled: WARN" + else + fn_print_error "Checking port: Unable to query queryport is not set: " + fn_script_log_error "Checking port: Unable to query as queryport is not set: ERROR" + fi core_exit.sh fi } @@ -106,14 +101,14 @@ for queryattempt in {1..5}; do fn_print_dots "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_querying_eol fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : QUERYING" - fn_sleep_time # querydelay - if [ "$(cat "${rootdir}/${lockselfname}")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then + if [ "$(cat "${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_sleep_time + fn_script_log_info "Server started: $(date -d @$(cat lgsm/lock/bmdmserver.lock))" + fn_script_log_info "Current time: $(date)" monitorpass=1 core_exit.sh # will use query method selected in fn_monitor_loop @@ -133,13 +128,8 @@ for queryattempt in {1..5}; do fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_ok_eol_nl fn_script_log_pass "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt}: OK" - fn_sleep_time monitorpass=1 - # send LinuxGSM stats if monitor is OK. - if [ "${stats}" == "on" ]||[ "${stats}" == "y" ]; then - info_stats.sh - fi - if [ "${querystatus}" == "0" ]; then + if [ "${querystatus}" == "0" ]; then # Add query data to log. if [ "${gdname}" ]; then fn_script_log_info "Server name: ${gdname}" @@ -147,12 +137,20 @@ for queryattempt in {1..5}; do 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 core_exit.sh else @@ -160,7 +158,6 @@ for queryattempt in {1..5}; do fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_fail_eol fn_script_log_warn "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt}: FAIL" - fn_sleep_time # Monitor will try gamedig (if supported) for first 30s then gsquery before restarting. if [ "${querymethod}" == "gsquery" ]||[ "${querymethod}" == "tcp" ]; then # gsquery will fail if longer than 60s @@ -169,7 +166,6 @@ for queryattempt in {1..5}; do fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_fail_eol_nl fn_script_log_warn "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt}: FAIL" - fn_sleep_time # Send alert if enabled. alert="restartquery" alert.sh @@ -185,7 +181,8 @@ for queryattempt in {1..5}; do # 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}: WAIT" + fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: ${cyan}WAIT${default}" + sleep 0.5 totalseconds=$((totalseconds + 1)) if [ "${seconds}" == "15" ]; then break @@ -230,7 +227,7 @@ fn_monitor_loop(){ monitorflag=1 check.sh -logs.sh +core_logs.sh info_config.sh info_parms.sh diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 12554565f..a0afa2905 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Strips sensitive information out of Details output -local modulename="POSTDETAILS" -local commandaction="Postdetails" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="POST-DETAILS" +commandaction="Posting details" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Set posttarget to the appropriately-defined post destination. @@ -74,14 +74,13 @@ else fn_info_message_ports fn_info_message_select_engine fn_info_message_statusbottom - } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${postdetailslog}" > /dev/null 2>&1 + } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a "${postdetailslog}" > /dev/null 2>&1 fi - +# Pastebin if [ "${posttarget}" == "http://pastebin.com" ] ; then - fn_print_dots "Posting details to pastbin.com for ${postexpire}" + fn_print_dots "pastbin.com for ${postexpire}" # grab the return from 'value' from an initial visit to pastebin. - csrftoken=$(curl -s "${posttarget}" | - sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') + csrftoken=$(curl -s "${posttarget}" | sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') # # Use the csrftoken to then post the content. # @@ -93,29 +92,31 @@ if [ "${posttarget}" == "http://pastebin.com" ] ; then awk '/^location: / { print $2 }' | sed "s/\n//g") # Output the resulting link. - fn_print_ok_nl "Posting details to pastbin.com for ${postexpire}" + fn_print_ok_nl "pastbin.com for ${postexpire}" + fn_script_log_pass "pastbin.com for ${postexpire}" pdurl="${posttarget}${link}" - echo -e " Please share the following url for support: ${pdurl}" +# Hastebin elif [ "${posttarget}" == "https://hastebin.com" ] ; then - fn_print_dots "Posting details to hastebin.com" + fn_print_dots "hastebin.com" # hastebin is a bit simpler. If successful, the returned result # should look like: {"something":"key"}, putting the reference that # we need in "key". TODO - error handling. -CedarLUG link=$(curl -H "HTTP_X_REQUESTED_WITH:XMLHttpRequest" -s -d "$(<${postdetailslog})" "${posttarget}/documents" | cut -d\" -f4) - fn_print_ok_nl "Posting details to hastebin.com for ${postexpire}" + fn_print_ok_nl "hastebin.com for ${postexpire}" + fn_script_log_pass "hastebin.com for ${postexpire}" pdurl="${posttarget}/${link}" - echo -e "Please share the following url for support: ${pdurl}" +# Termbin elif [ "${posttarget}" == "https://termbin.com" ] ; then - fn_print_dots "Posting details to termbin.com" + fn_print_dots "termbin.com" link=$(cat "${postdetailslog}" | nc termbin.com 9999 | tr -d '\n\0') - fn_print_ok_nl "Posting details to termbin.com" + fn_print_ok_nl "termbin.com for 30D" + fn_script_log_pass "termbin.com for 30D" pdurl="${link}" - echo -e "Please share the following url for support: " - echo -e "${pdurl}" -else - fn_print_warn_nl "Review output in: ${postdetailslog}" - core_exit.sh fi +echo -e "" +echo -e "Please share the following url for support: " +echo -e "${pdurl}" +fn_script_log_info "${pdurl}" if [ -z "${exitbypass}" ]; then core_exit.sh diff --git a/lgsm/functions/command_restart.sh b/lgsm/functions/command_restart.sh index 56b6d7872..8a08c04ff 100644 --- a/lgsm/functions/command_restart.sh +++ b/lgsm/functions/command_restart.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Restarts the server. -local modulename="RESTART" -local commandaction="Restarting" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="MODS-INSTALL" +commandaction="Restarting" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_config.sh exitbypass=1 diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh index bf5c65146..d0487e5d4 100644 --- a/lgsm/functions/command_start.sh +++ b/lgsm/functions/command_start.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Starts the server. -local modulename="START" -local commandaction="Starting" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="START" +commandaction="Starting" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_start_teamspeak3(){ if [ ! -f "${servercfgfullpath}" ]; then @@ -62,13 +62,16 @@ fn_start_tmux(){ fi # Create lockfile - date > "${rootdir}/${lockselfname}" + date '+%s' > "${lockdir}/${selfname}.lock" cd "${executabledir}" || exit - tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${selfname}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp" + tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${sessionname}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp" # Create logfile. touch "${consolelog}" + # Create last start lock file + date +%s > "${lockdir}/${selfname}-laststart.lock" + # Get tmux version. tmuxversion=$(tmux -V | sed "s/tmux //" | sed -n '1 p') # Tmux compiled from source will return "master", therefore ignore it. @@ -76,7 +79,7 @@ fn_start_tmux(){ fn_script_log "Tmux version: master (user compiled)" echo -e "Tmux version: master (user compiled)" >> "${consolelog}" if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then - tmux pipe-pane -o -t "${selfname}" "exec cat >> '${consolelog}'" + tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'" fi elif [ "${tmuxversion}" ]; then # Get the digit version of tmux. @@ -94,19 +97,19 @@ fn_start_tmux(){ Currently installed: $(tmux -V)" > "${consolelog}" # Console logging enable or not set. elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then - tmux pipe-pane -o -t "${selfname}" "exec cat >> '${consolelog}'" + tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'" fi else echo -e "Unable to detect tmux version" >> "${consolelog}" fn_script_log_warn "Unable to detect tmux version" fi -# Console logging disabled. -if [ "${consolelogging}" == "off" ]; then - echo -e "Console logging disabled by user" >> "${consolelog}" - fn_script_log_info "Console logging disabled by user" -fi -fn_sleep_time + # Console logging disabled. + if [ "${consolelogging}" == "off" ]; then + echo -e "Console logging disabled by user" >> "${consolelog}" + fn_script_log_info "Console logging disabled by user" + fi + fn_sleep_time # If the server fails to start. check_status.sh @@ -119,7 +122,7 @@ fn_sleep_time echo -e "" echo -e "Command" echo -e "=================================" - echo -e "tmux new-session -d -s \"${selfname}\" \"${executable} ${parms}\"" | tee -a "${lgsmlog}" + echo -e "tmux new-session -d -s \"${sessionname}\" \"${executable} ${parms}\"" | tee -a "${lgsmlog}" echo -e "" echo -e "Error" echo -e "=================================" @@ -153,7 +156,6 @@ fn_sleep_time fi fi fi - core_exit.sh else fn_print_ok "${servername}" @@ -163,13 +165,12 @@ fn_sleep_time echo -en "\n" } - check.sh -fn_print_dots "${servername}" # Is the server already started. # $status comes from check_status.sh, which is run by check.sh for this command if [ "${status}" != "0" ]; then + fn_print_dots "${servername}" fn_print_info_nl "${servername} is already running" fn_script_log_error "${servername} is already running" if [ -z "${exitbypass}" ]; then @@ -180,15 +181,19 @@ if [ -z "${fixbypass}" ]; then fix.sh fi info_config.sh -logs.sh +core_logs.sh # Will check for updates is updateonstart is yes. if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then exitbypass=1 unset updateonstart command_update.sh + commandname="START" + commandaction="Starting" fi +fn_print_dots "${servername}" + if [ "${shortname}" == "ts3" ]; then fn_start_teamspeak3 else diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index 40e3f92e3..6ea4f4d7a 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -5,16 +5,16 @@ # Website: https://linuxgsm.com # Description: Stops the server. -local modulename="STOP" -local commandaction="Stopping" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="STOP" +commandaction="Stopping" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Attempts graceful shutdown by sending 'CTRL+c'. fn_stop_graceful_ctrlc(){ fn_print_dots "Graceful: CTRL+c" fn_script_log_info "Graceful: CTRL+c" # Sends quit. - tmux send-keys -t "${selfname}" 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 @@ -33,7 +33,6 @@ fn_stop_graceful_ctrlc(){ fn_print_fail_eol_nl fn_script_log_error "Graceful: CTRL+c: FAIL" fi - fn_sleep_time } # Attempts graceful shutdown by sending a specified command. @@ -43,7 +42,7 @@ fn_stop_graceful_cmd(){ fn_print_dots "Graceful: sending \"${1}\"" fn_script_log_info "Graceful: sending \"${1}\"" # Sends specific stop command. - tmux send -t "${selfname}" "${1}" ENTER > /dev/null 2>&1 + tmux send -t "${sessionname}" "${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 check_status.sh @@ -62,18 +61,17 @@ fn_stop_graceful_cmd(){ fn_print_fail_eol_nl fn_script_log_error "Graceful: sending \"${1}\": FAIL" fi - fn_sleep_time } -# Attempts graceful shutdown of goldsource using rcon 'quit' command. +# Attempts graceful shutdown of goldsrc using rcon 'quit' command. # There is only a 3 second delay before a forced a tmux shutdown -# as Goldsource servers 'quit' command does a restart rather than shutdown. -fn_stop_graceful_goldsource(){ +# as GoldSrc servers 'quit' command does a restart rather than shutdown. +fn_stop_graceful_goldsrc(){ fn_print_dots "Graceful: sending \"quit\"" fn_script_log_info "Graceful: sending \"quit\"" # sends quit - tmux send -t "${selfname}" quit ENTER > /dev/null 2>&1 - # Waits 3 seconds as goldsource servers restart with the quit command. + tmux send -t "${sessionname}" quit ENTER > /dev/null 2>&1 + # Waits 3 seconds as goldsrc servers restart with the quit command. for seconds in {1..3}; do sleep 1 fn_print_dots "Graceful: sending \"quit\": ${seconds}" @@ -178,7 +176,35 @@ fn_stop_graceful_sdtd(){ fn_print_fail_eol_nl fn_script_log_warn "Graceful: telnet: expect not installed: FAIL" fi - fn_sleep_time +} + +# Attempts graceful shutdown by sending /save /stop. +fn_stop_graceful_avorion(){ + fn_print_dots "Graceful: /save /stop" + fn_script_log_info "Graceful: /save /stop" + # Sends /save. + tmux send-keys -t "${sessionname}" /save ENTER > /dev/null 2>&1 + sleep 5 + # Sends /quit. + tmux send-keys -t "${sessionname}" /stop ENTER > /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 + if [ "${status}" == "0" ]; then + fn_print_ok "Graceful: /save /stop: ${seconds}: " + fn_print_ok_eol_nl + fn_script_log_pass "Graceful: /save /stop: OK: ${seconds} seconds" + break + fi + sleep 1 + fn_print_dots "Graceful: /save /stop: ${seconds}" + done + check_status.sh + if [ "${status}" != "0" ]; then + fn_print_error "Graceful: /save /stop: " + fn_print_fail_eol_nl + fn_script_log_error "Graceful: /save /stop: FAIL" + fi } fn_stop_graceful_select(){ @@ -199,16 +225,18 @@ fn_stop_graceful_select(){ elif [ "${stopmode}" == "8" ]; then fn_stop_graceful_sdtd elif [ "${stopmode}" == "9" ]; then - fn_stop_graceful_goldsource + fn_stop_graceful_goldsrc + elif [ "${stopmode}" == "10" ]; then + fn_stop_graceful_avorion fi } fn_stop_tmux(){ fn_print_dots "${servername}" - fn_script_log_info "tmux kill-session: ${servername}" + fn_script_log_info "tmux kill-session: ${sessionname}: ${servername}" # Kill tmux session. - tmux kill-session -t "${selfname}" > /dev/null 2>&1 - fn_sleep_time + tmux kill-session -t "${sessionname}" > /dev/null 2>&1 + sleep 0.5 check_status.sh if [ "${status}" == "0" ]; then fn_print_ok_nl "${servername}" @@ -241,8 +269,8 @@ fn_print_dots "${servername}" info_config.sh fn_stop_pre_check # Remove lockfile. -if [ -f "${rootdir}/${lockselfname}" ]; then - rm -f "${rootdir:?}/${lockselfname}" +if [ -f "${lockdir}/${selfname}.lock" ]; then + rm -f "${lockdir:?}/${selfname}.lock" fi if [ -z "${exitbypass}" ]; then diff --git a/lgsm/functions/command_test_alert.sh b/lgsm/functions/command_test_alert.sh index 77ff0d079..5d1c11885 100644 --- a/lgsm/functions/command_test_alert.sh +++ b/lgsm/functions/command_test_alert.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Sends a test alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="TEST-ALERT" +commandaction="Sending Alert" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "${servername}" check.sh diff --git a/lgsm/functions/command_ts3_server_pass.sh b/lgsm/functions/command_ts3_server_pass.sh index dfe9c5824..8ff799e6e 100644 --- a/lgsm/functions/command_ts3_server_pass.sh +++ b/lgsm/functions/command_ts3_server_pass.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Changes TS3 serveradmin password. -local modulename="PASSWORD-CHANGE" -local commandaction="Password Change" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="CHANGE-PASSWORD" +commandaction="Changing password" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_serveradmin_password_prompt(){ fn_print_header diff --git a/lgsm/functions/command_update.sh b/lgsm/functions/command_update.sh index 332e23bab..b7b85ae95 100644 --- a/lgsm/functions/command_update.sh +++ b/lgsm/functions/command_update.sh @@ -4,13 +4,14 @@ # Website: https://linuxgsm.com # Description: Handles updating of servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="UPDATE" +commandaction="Updating" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "" check.sh -logs.sh +core_logs.sh +check_last_update.sh if [ "${shortname}" == "ts3" ]; then update_ts3.sh diff --git a/lgsm/functions/command_update_functions.sh b/lgsm/functions/command_update_functions.sh index e325b781a..e69de29bb 100644 --- a/lgsm/functions/command_update_functions.sh +++ b/lgsm/functions/command_update_functions.sh @@ -1,13 +0,0 @@ -#!/bin/bash -# LinuxGSM command_update_functions.sh function -# Author: Daniel Gibbs -# Website: https://linuxgsm.com -# Description: Deletes the functions dir to allow re-downloading of functions from GitHub. -# Legacy Command - -command_update_linuxgsm.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function -} - -command_update_linuxgsm.sh diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/functions/command_update_linuxgsm.sh index ce8864c80..c32bf321f 100644 --- a/lgsm/functions/command_update_linuxgsm.sh +++ b/lgsm/functions/command_update_linuxgsm.sh @@ -4,113 +4,197 @@ # Website: https://linuxgsm.com # Description: Deletes the functions dir to allow re-downloading of functions from GitHub. -local modulename="UPDATE LINUXGSM" -local commandaction="Update LinuxGSM" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="UPDATE-LGSM" +commandaction="Updating LinuxGSM" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_print_dots "Updating LinuxGSM" check.sh + +fn_print_dots "" fn_script_log_info "Updating LinuxGSM" -echo -en "\n" -if [ -z "${legacymode}" ]; then - # Check and update _default.cfg. - echo -en " checking config _default.cfg...\c" - config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg")) - if [ "${config_file_diff}" != "" ]; then - fn_print_update_eol_nl - fn_script_log_info "checking config _default.cfg: UPDATE" - rm -f "${configdirdefault:?}/config-lgsm/${gameservername}/_default.cfg" - fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforce" "nomd5" - alert="config" - alert.sh +fn_print_dots "Selecting repo" +fn_script_log_info "Selecting repo" +# Select remotereponame +curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1>/dev/null +if [ $? != "0" ]; then + curl -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" + core_exit.sh else - fn_print_ok_eol_nl - fn_script_log_info "checking config _default.cfg: OK" + remotereponame="Bitbucket" + fn_print_ok_nl "Selecting repo: ${remotereponame}" fi +else + remotereponame="GitHub" + fn_print_ok_nl "Selecting repo: ${remotereponame}" +fi - echo -en " checking linuxgsm.sh...\c" +# Check linuxsm.sh +echo -en "checking ${remotereponame} linuxgsm.sh...\c" +if [ "${remotereponame}" == "GitHub" ]; then + curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1>/dev/null +else + curl -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1>/dev/null +fi +if [ $? != "0" ]; then + fn_print_fail_eol_nl + fn_script_log_fatal "Checking ${remotereponame} linuxgsm.sh" + fn_script_log_fatal "Curl returned error: $?" + core_exit.sh +fi + +if [ "${remotereponame}" == "GitHub" ]; then tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh")) - if [ "${tmp_script_diff}" != "" ]; then - fn_print_update_eol_nl - fn_script_log_info "checking linuxgsm.sh: UPDATE" - rm -f "${tmpdir:?}/linuxgsm.sh" - fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "nochmodx" "norun" "noforcedl" "nomd5" - # Compare selfname against linuxgsm.sh in the tmp dir. Ignoring server specific vars. +else + tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh")) +fi + +if [ "${tmp_script_diff}" != "" ]; then + fn_print_update_eol_nl + fn_script_log_update "Checking ${remotereponame} linuxgsm.sh" + rm -f "${tmpdir:?}/linuxgsm.sh" + fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "nochmodx" "norun" "noforcedl" "nomd5" +else + fn_print_ok_eol_nl + fn_script_log_pass "Checking ${remotereponame} linuxgsm.sh" +fi + +# Check gameserver.sh +# Compare gameserver.sh against linuxgsm.sh in the tmp dir. +# Ignoring server specific vars. +echo -en "checking ${selfname}...\c" +fn_script_log_info "Checking ${selfname}" +script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}")) +if [ "${script_diff}" != "" ]; then + fn_print_update_eol_nl + fn_script_log_update "Checking ${selfname}" + echo -en "backup ${selfname}...\c" + fn_script_log_info "Backup ${selfname}" + if [ ! -d "${backupdir}/script" ]; then + mkdir -p "${backupdir}/script" + fi + cp "${rootdir}/${selfname}" "${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak" + if [ $? -ne 0 ]; then + fn_print_fail_eol_nl + fn_script_log_fatal "Backup ${selfname}" + core_exit.sh else - fn_script_log_info "checking linuxgsm.sh: OK" fn_print_ok_eol_nl + fn_script_log_pass "Backup ${selfname}" + echo -e "backup location ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak" + fn_script_log_pass "Backup location ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak" fi - echo -en " checking ${selfname}...\c" - script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}")) - if [ "${script_diff}" != "" ]; then - fn_print_update_eol_nl - echo -en " backup ${selfname}...\c" - mkdir -p "${backupdir}/script/" - cp "${rootdir}/${selfname}" "${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak" - if [ $? -ne 0 ]; then - fn_print_fail_eol_nl - core_exit.sh - else - fn_print_ok_eol_nl - echo -e " Backup: ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak" - fi - echo -en " fetching ${selfname}...\c" - cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}" - sed -i "s/shortname=\"core\"/shortname=\"${shortname}\"/g" "${rootdir}/${selfname}" - sed -i "s/gameservername=\"core\"/gameservername=\"${gameservername}\"/g" "${rootdir}/${selfname}" - sed -i "s/gamename=\"core\"/gamename=\"${gamename}\"/g" "${rootdir}/${selfname}" - exitcode=$? - if [ "${exitcode}" != "0" ]; then - fn_print_fail_eol_nl - core_exit.sh - else - fn_print_ok_eol_nl - fi + + echo -en "copying ${selfname}...\c" + fn_script_log_info "copying ${selfname}" + cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}" + sed -i "s+shortname=\"core\"+shortname=\"${shortname}\"+g" "${rootdir}/${selfname}" + sed -i "s+gameservername=\"core\"+gameservername=\"${gameservername}\"+g" "${rootdir}/${selfname}" + sed -i "s+gamename=\"core\"+gamename=\"${gamename}\"+g" "${rootdir}/${selfname}" + sed -i "s+githubuser=\"GameServerManagers\"+githubuser=\"${githubuser}\"+g" "${rootdir}/${selfname}" + sed -i "s+githubrepo=\"LinuxGSM\"+githubrepo=\"${githubrepo}\"+g" "${rootdir}/${selfname}" + sed -i "s+githubbranch=\"master\"+githubbranch=\"${githubbranch}\"+g" "${rootdir}/${selfname}" + + if [ $? != "0" ]; then + fn_print_fail_eol_nl + fn_script_log_fatal "copying ${selfname}" + core_exit.sh else fn_print_ok_eol_nl + fn_script_log_pass "copying ${selfname}" fi +else + fn_print_ok_eol_nl + fn_script_log_info "Checking ${selfname}" +fi + +# Check _default.cfg. +echo -en "checking ${remotereponame} config _default.cfg...\c" +fn_script_log_info "Checking ${remotereponame} config _default.cfg" +if [ "${remotereponame}" == "GitHub" ]; then + curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null +else + curl -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 + fn_script_log_fatal "Checking ${remotereponame} config _default.cfg" + fn_script_log_fatal "Curl returned error: $?" + core_exit.sh +fi + +if [ "${remotereponame}" == "GitHub" ]; then + config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg")) +else + config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg")) +fi + +if [ "${config_file_diff}" != "" ]; then + fn_print_update_eol_nl + fn_script_log_update "Checking ${remotereponame} config _default.cfg" + rm -f "${configdirdefault:?}/config-lgsm/${gameservername:?}/_default.cfg" + fn_fetch_file_github "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "nochmodx" "norun" "noforce" "nomd5" + alert="config" + alert.sh +else + fn_print_ok_eol_nl + fn_script_log_pass "Checking ${remotereponame} config _default.cfg" fi -# Check and update functions. -if [ "${functionsdir}" ]; then +# Check and update modules. +if [ -n "${functionsdir}" ]; then if [ -d "${functionsdir}" ]; then cd "${functionsdir}" || exit for functionfile in * do - echo -en " checking function ${functionfile}...\c" + # check if module exists in the repo and remove if missing. + # commonly used if module names change. + echo -en "checking ${remotereponame} module ${functionfile}...\c" github_file_url_dir="lgsm/functions" - get_function_file=$(curl --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}") - exitcode=$? - function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}")) - if [ ${exitcode} -ne 0 ]; then - fn_print_fail_eol_nl - echo -en " removing unknown function ${functionfile}...\c" - fn_script_log_fatal "removing unknown function ${functionfile}" + if [ "${remotereponame}" == "GitHub" ]; then + curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}" 1>/dev/null + else + curl -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}" 1>/dev/null + fi + if [ $? -ne 0 ]; then + fn_print_error_eol_nl + fn_script_log_error "Checking ${remotereponame} module ${functionfile}" + echo -en "removing module ${functionfile}...\c" if ! rm -f "${functionfile:?}"; then fn_print_fail_eol_nl + fn_script_log_fatal "Removing module ${functionfile}" core_exit.sh else fn_print_ok_eol_nl + fn_script_log_pass "Removing module ${functionfile}" fi - elif [ "${function_file_diff}" != "" ]; then - fn_print_update_eol_nl - fn_script_log_info "checking function ${functionfile}: UPDATE" - rm -rf "${functionsdir:?}/${functionfile}" - fn_update_function else - fn_print_ok_eol_nl + # compare file + if [ "${remotereponame}" == "GitHub" ]; then + function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}")) + else + function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}")) + fi + + # results + if [ "${function_file_diff}" != "" ]; then + fn_print_update_eol_nl + fn_script_log_update "Checking ${remotereponame} module ${functionfile}" + rm -rf "${functionsdir:?}/${functionfile}" + fn_update_function + else + fn_print_ok_eol_nl + fn_script_log_pass "Checking ${remotereponame} module ${functionfile}" + fi fi done fi fi -if [ "${exitcode}" != "0" ]&&[ -n "${exitcode}" ]; then - fn_print_fail "Updating functions" - fn_script_log_fatal "Updating functions" -else - fn_print_ok "Updating functions" - fn_script_log_pass "Updating functions" -fi +fn_print_ok_nl "Updating functions" +fn_script_log_pass "Updating functions" core_exit.sh diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh index 020c26e96..c22750988 100644 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/functions/command_validate.sh @@ -4,56 +4,90 @@ # Website: https://linuxgsm.com # Description: Runs a server validation. -local modulename="VALIDATE" -local commandaction="Validate" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="VALIDATE" +commandaction="Validating" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_validation(){ - fn_print_info "Validating files: SteamCMD" - echo -e "" - echo -e "* Validating may overwrite some customised files." - echo -e "* https://docs.linuxgsm.com/commands/validate" - fn_script_log_info "Validating files: SteamCMD" - sleep 3 +fn_validate(){ + fn_script_log_warn "Validating server: SteamCMD: Validate might overwrite some customised files" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Validating server: SteamCMD: Validate might overwrite some customised files: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "Validating server: SteamCMD: Validate might overwrite some customised files" + fn_print_start_nl "Validating server: SteamCMD" + fn_script_log_info "Validating server: SteamCMD" if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit fi - # Detects if unbuffer command is available for 32 bit distributions only. + # Detects if unbuffer command is available, for 32 bit distributions only. info_distro.sh if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then unbuffer="stdbuf -i0 -o0 -e0" fi + # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. if [ "${appid}" == "90" ]; then - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}" - elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then - ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -beta "${branch}" validate +quit| tee -a "${scriptlog}" - else + # If using a specific branch. + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}" + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}" + fi + ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit + local exitcode=$? + # All other servers. + elif [ -n "${branch}" ]; then ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}" + elif [ "${shortname}" == "ac" ]||[ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}" fi - if [ $? != 0 ]; then - fn_print_fail_nl "Validating files: SteamCMD" - fn_script_log_fatal "Validating files: SteamCMD: FAIL" + + exitcode=$? + fn_print_dots "Validating server: SteamCMD" + if [ "${exitcode}" != "0" ]; then + fn_print_fail_nl "Validating server: SteamCMD" + fn_script_log_fatal "Validating server: SteamCMD: FAIL" else - fn_print_ok_nl "Validating files: SteamCMD" - fn_script_log_pass "Validating files: SteamCMD: OK" + fn_print_ok_nl "Validating server: SteamCMD" + fn_script_log_pass "Validating server: SteamCMD: OK" fi - fix.sh + core_exit.sh +} +fn_stop_warning(){ + fn_print_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation" + fn_script_log_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "Validating server: SteamCMD: ${selfname} will be stopped during validation" } -fn_print_dots "Validating files:" -fn_print_dots "Validating files: SteamCMD" +fn_print_dots "Validating server" +fn_print_dots "Validating server: SteamCMD" check.sh -check_status.sh if [ "${status}" != "0" ]; then + fn_stop_warning exitbypass=1 command_stop.sh - fn_validation "${appid}" + fn_validate exitbypass=1 command_start.sh else - fn_validation + fn_validate fi core_exit.sh diff --git a/lgsm/functions/command_wipe.sh b/lgsm/functions/command_wipe.sh index dde48e23a..5b5abf552 100644 --- a/lgsm/functions/command_wipe.sh +++ b/lgsm/functions/command_wipe.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Wipes server data, useful after updates for some games like Rust -local modulename="WIPE" -local commandaction="Wipe" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="WIPE" +commandaction="Wiping" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh fn_print_header diff --git a/lgsm/functions/compress_unreal2_maps.sh b/lgsm/functions/compress_unreal2_maps.sh index bc7a9ffb8..3580c20c9 100644 --- a/lgsm/functions/compress_unreal2_maps.sh +++ b/lgsm/functions/compress_unreal2_maps.sh @@ -4,8 +4,9 @@ # Website: https://linuxgsm.com # Description: Compresses unreal maps. -local commandaction="Unreal Map Compressor" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="MAP-COMPRESSOR" +commandaction="Compressing maps" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh fn_print_header diff --git a/lgsm/functions/compress_ut99_maps.sh b/lgsm/functions/compress_ut99_maps.sh index 9f24ff9a3..677f5aaa2 100644 --- a/lgsm/functions/compress_ut99_maps.sh +++ b/lgsm/functions/compress_ut99_maps.sh @@ -4,8 +4,9 @@ # Website: https://linuxgsm.com # Description: Compresses unreal maps. -local commandaction="Unreal Map Compressor" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="MAP-COMPRESSOR" +commandaction="Compressing maps" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh fn_print_header diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index c3281505d..89ee784db 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -17,9 +17,7 @@ # fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" # fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd" -local modulename="DOWNLOAD" -local commandaction="Download" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Emptys contents of the LinuxGSM tmpdir. fn_clear_tmp(){ @@ -42,7 +40,7 @@ fn_dl_md5(){ if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then echo -en "verifying ${local_filename} with MD5..." fn_sleep_time - local md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}') + md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}') if [ "${md5sumcmd}" != "${md5}" ]; then fn_print_fail_eol_nl echo -e "${local_filename} returned MD5 checksum: ${md5sumcmd}" @@ -77,9 +75,9 @@ fn_dl_extract(){ if [ "${mime}" == "application/gzip" ]||[ "${mime}" == "application/x-gzip" ]; then extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdir}") elif [ "${mime}" == "application/x-bzip2" ]; then - tarcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdir}") + extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdir}") elif [ "${mime}" == "application/x-xz" ]; then - tarcmd=$(tar -xf "${local_filedir}/${local_filename}" -C "${extractdir}") + extractcmd=$(tar -xf "${local_filedir}/${local_filename}" -C "${extractdir}") elif [ "${mime}" == "application/zip" ]; then extractcmd=$(unzip -qo -d "${extractdir}" "${local_filedir}/${local_filename}") fi @@ -114,54 +112,99 @@ fn_fetch_trap(){ fn_fetch_file(){ remote_fileurl="${1}" - local_filedir="${2}" - local_filename="${3}" - chmodx="${4:-0}" - run="${5:-0}" - forcedl="${6:-0}" - md5="${7:-0}" + remote_fileurl_backup="${2}" + remote_fileurl_name="${3}" + remote_fileurl_backup_name="${4}" + local_filedir="${5}" + local_filename="${6}" + chmodx="${7:-0}" + run="${8:-0}" + forcedl="${9:-0}" + md5="${10:-0}" # Download file if missing or download forced. if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then - 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 - echo -en "downloading ${local_filename}..." - fn_sleep_time - echo -en "\033[1K" - curlcmd=$(curl --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}") - echo -en "downloading ${local_filename}..." + # 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 ) else - echo -en " fetching ${local_filename}...\c" - curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) + # counter set to 1 to not allow second try + counter=1 + remote_fileurls_array=( remote_fileurl ) fi - local exitcode=$? - if [ ${exitcode} -ne 0 ]; then - fn_print_fail_eol_nl - if [ -f "${lgsmlog}" ]; then - fn_script_log_fatal "Downloading ${local_filename}" - echo -e "${remote_fileurl}" >> "${lgsmlog}" - echo -e "${curlcmd}" >> "${lgsmlog}" + for remote_fileurl_array in "${remote_fileurls_array[@]}" + do + if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then + fileurl="${remote_fileurl}" + fileurl_name="${remote_fileurl_name}" + elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then + fileurl="${remote_fileurl_backup}" + fileurl_name="${remote_fileurl_backup_name}" fi - echo -e "${remote_fileurl}" - echo -e "${curlcmd}" - core_exit.sh - else - fn_print_ok_eol_nl - if [ -f "${lgsmlog}" ]; then - fn_script_log_pass "Downloading ${local_filename}" + counter=$((counter+1)) + if [ ! -d "${local_filedir}" ]; then + mkdir -p "${local_filedir}" fi - fi - # Remove trap. - trap - INT - # Make file executable if chmodx is set. - if [ "${chmodx}" == "chmodx" ]; then - chmod +x "${local_filedir}/${local_filename}" - 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 + echo -en "downloading ${local_filename}..." + fn_sleep_time + echo -en "\033[1K" + curlcmd=$(curl --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}") + echo -en "downloading ${local_filename}..." + else + echo -en "fetching ${fileurl_name} ${local_filename}...\c" + curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}" 2>&1) + fi + 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 + rm "${local_filedir:?}/${local_filename:?}" + local exitcode=2 + fi + fi + + # On first try will error. On second try will fail. + if [ ${exitcode} -ne 0 ]; then + if [ ${counter} -ge 2 ]; then + fn_print_fail_eol_nl + if [ -f "${lgsmlog}" ]; then + fn_script_log_fatal "Downloading ${local_filename}" + fn_script_log_fatal "${fileurl}" + fi + core_exit.sh + else + fn_print_error_eol_nl + if [ -f "${lgsmlog}" ]; then + fn_script_log_error "Downloading ${local_filename}" + fn_script_log_error "${fileurl}" + fi + fi + else + fn_print_ok_eol + sleep 0.3 + echo -en "\033[2K\\r" + if [ -f "${lgsmlog}" ]; then + fn_script_log_pass "Downloading ${local_filename}" + fi + + # Make file executable if chmodx is set. + if [ "${chmodx}" == "chmodx" ]; then + chmod +x "${local_filedir}/${local_filename}" + fi + + # Remove trap. + trap - INT + + break + fi + done fi if [ -f "${local_filedir}/${local_filename}" ]; then @@ -189,13 +232,23 @@ fn_fetch_file(){ # forcedl: Optional, force re-download of file even if exists # md5: Optional, set an md5 sum and will compare it against the file. -# Fetches any files from the GitHub repo. +# Fetches files from the Git repo. fn_fetch_file_github(){ github_file_url_dir="${1}" github_file_url_name="${2}" - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - - remote_fileurl="${githuburl}" + if [ "${legacymode}" == "1" ]; then + # For legacy versions - code can be removed at a future date + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + elif [ "${githubbranch}" == "master" ]&&[ "${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 + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + fi + remote_fileurl_name="GitHub" + remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" local_filename="${github_file_url_name}" chmodx="${4:-0}" @@ -203,15 +256,22 @@ fn_fetch_file_github(){ forcedl="${6:-0}" md5="${7:-0}" # Passes vars to the file download function. - fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } +# Fetches config files from the Git repo. fn_fetch_config(){ github_file_url_dir="${1}" github_file_url_name="${2}" - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - - remote_fileurl="${githuburl}" + if [ "${githubbranch}" == "master" ]&&[ "${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 + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + fi + remote_fileurl_name="GitHub" + remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" local_filename="${4}" chmodx="nochmodx" @@ -219,16 +279,22 @@ fn_fetch_config(){ forcedl="noforce" md5="nomd5" # Passes vars to the file download function. - fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } -# Fetches functions. +# Fetches modules from the Git repo during first download. fn_fetch_function(){ github_file_url_dir="lgsm/functions" github_file_url_name="${functionfile}" - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - - remote_fileurl="${githuburl}" + if [ "${githubbranch}" == "master" ]&&[ "${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 + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + fi + remote_fileurl_name="GitHub" + remote_fileurl_backup_name="Bitbucket" local_filedir="${functionsdir}" local_filename="${github_file_url_name}" chmodx="chmodx" @@ -236,23 +302,31 @@ fn_fetch_function(){ forcedl="noforce" md5="nomd5" # Passes vars to the file download function. - fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } +# Fetches modules from the Git repo during update-lgsm. fn_update_function(){ - exitbypass=1 github_file_url_dir="lgsm/functions" github_file_url_name="${functionfile}" - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - - remote_fileurl="${githuburl}" + if [ "${githubbranch}" == "master" ]&&[ "${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 + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + fi + remote_fileurl_name="GitHub" + remote_fileurl_backup_name="Bitbucket" local_filedir="${functionsdir}" local_filename="${github_file_url_name}" chmodx="chmodx" run="norun" forcedl="noforce" md5="nomd5" - fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + # Passes vars to the file download function. + fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + } # Check that curl is installed diff --git a/lgsm/functions/core_exit.sh b/lgsm/functions/core_exit.sh index ee7e9c6c8..e2b439abd 100644 --- a/lgsm/functions/core_exit.sh +++ b/lgsm/functions/core_exit.sh @@ -4,10 +4,12 @@ # Website: https://linuxgsm.com # Description: Handles exiting of LinuxGSM by running and reporting an exit code. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + fn_exit_dev_debug(){ if [ -f "${rootdir}/.dev-debug" ]; then echo -e "" - echo -e "${function_selfname} exiting with code: ${exitcode}" + echo -e "${functionselfname} exiting with code: ${exitcode}" if [ -f "${rootdir}/dev-debug.log" ]; then grep "functionfile=" "${rootdir}/dev-debug.log" | sed 's/functionfile=//g' > "${rootdir}/dev-debug-function-order.log" fi @@ -23,21 +25,34 @@ fi if [ "${exitbypass}" ]; then unset exitbypass elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then + # List LinuxGSM version in logs + fn_script_log_info "LinuxGSM version: ${version}" if [ "${exitcode}" == "1" ]; then - fn_script_log_fatal "${function_selfname} exiting with code: ${exitcode}" + fn_script_log_fatal "${functionselfname} exiting with code: ${exitcode}" elif [ "${exitcode}" == "2" ]; then - fn_script_log_error "${function_selfname} exiting with code: ${exitcode}" + fn_script_log_error "${functionselfname} exiting with code: ${exitcode}" elif [ "${exitcode}" == "3" ]; then - fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}" + fn_script_log_warn "${functionselfname} exiting with code: ${exitcode}" else - fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}" + fn_script_log_warn "${functionselfname} exiting with code: ${exitcode}" fi fn_exit_dev_debug # remove trap. trap - INT exit "${exitcode}" +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}" + fn_exit_dev_debug + # remove trap. + trap - INT + exit "${exitcode}" else - fn_script_log_pass "${function_selfname} exiting with code: ${exitcode}" + # List LinuxGSM version in logs + fn_script_log_info "LinuxGSM version: ${version}" + fn_print_error "No exit code set" + fn_script_log_pass "${functionselfname} exiting with code: NOT SET" fn_exit_dev_debug # remove trap. trap - INT diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index 482007273..3a8f85aab 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -5,6 +5,10 @@ # Description: Defines all functions to allow download and execution of functions using fn_fetch_function. # This function is called first before any other function. Without this file other functions will not load. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +modulesversion="v20.3.3" + # Core core_dl.sh(){ @@ -188,6 +192,11 @@ 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 @@ -228,6 +237,11 @@ functionfile="${FUNCNAME[0]}" fn_fetch_function } +check_version.sh(){ +functionfile="${FUNCNAME[0]}" +fn_fetch_function +} + # Compress compress_unreal2_maps.sh(){ @@ -296,11 +310,21 @@ 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_cmw.sh(){ +functionfile="${FUNCNAME[0]}" +fn_fetch_function +} + fix_csgo.sh(){ functionfile="${FUNCNAME[0]}" fn_fetch_function @@ -316,6 +340,11 @@ functionfile="${FUNCNAME[0]}" fn_fetch_function } +fix_hw.sh(){ +functionfile="${FUNCNAME[0]}" +fn_fetch_function +} + fix_ins.sh(){ functionfile="${FUNCNAME[0]}" fn_fetch_function @@ -386,6 +415,11 @@ functionfile="${FUNCNAME[0]}" fn_fetch_function } +fix_tu.sh(){ +functionfile="${FUNCNAME[0]}" +fn_fetch_function +} + fix_ut3.sh(){ functionfile="${FUNCNAME[0]}" fn_fetch_function @@ -521,7 +555,7 @@ fn_fetch_function } # Logs -logs.sh(){ +core_logs.sh(){ functionfile="${FUNCNAME[0]}" fn_fetch_function } @@ -706,6 +740,11 @@ if [ ! -d "${tmpdir}" ]; then mkdir -p "${tmpdir}" fi +# Creates lock dir if missing +if [ ! -d "${lockdir}" ]; then + mkdir -p "${lockdir}" +fi + # Calls on-screen messages (bootstrap) core_messages.sh diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index 7216dc765..fe31f488f 100644 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -4,7 +4,7 @@ # Website: https://linuxgsm.com # Description: getopt arguments. -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ### Define all commands here. ## User commands | Trigger commands | Description @@ -15,7 +15,7 @@ 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 hastebin (removing passwords)." ) +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." ) @@ -61,7 +61,7 @@ currentopt=( "${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monit currentopt+=( "${cmd_update_linuxgsm[@]}" ) # Exclude noupdate games here. -if [ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]&&[ "${shortname}" != "bf1942" ]&&[ "${shortname}" != "samp" ]; then +if [ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]&&[ "${shortname}" != "bf1942" ]&&[ "${shortname}" != "bfv" ]&&[ "${shortname}" != "samp" ]; then currentopt+=( "${cmd_update[@]}" ) # force update for SteamCMD only or MTA. if [ "${appid}" ]||[ "${shortname}" == "mta" ]; then @@ -167,14 +167,15 @@ fn_opt_usage(){ fi done } | column -s $'\t' -t + fn_script_log_pass "Display commands" core_exit.sh } -# Check if user commands exist and run corresponding scripts, or display script usage. +# Check if command existw and run corresponding scripts, or display script usage. if [ -z "${getopt}" ]; then fn_opt_usage fi -# Command exists. +# If command exists. for i in "${optcommands[@]}"; do if [ "${i}" == "${getopt}" ] ; then # Seek and run command. @@ -185,8 +186,10 @@ for i in "${optcommands[@]}"; do if [ "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then # Run command. 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}" core_exit.sh - break fi done done @@ -194,7 +197,7 @@ for i in "${optcommands[@]}"; do done # If we're executing this, it means command was not found. -echo -e "${red}Unknown command${default}: $0 ${getopt}" -exitcode=2 +fn_print_error2_nl "Unknown command: $0 ${getopt}" +fn_script_log_error "Unknown command: $0 ${getopt}" fn_opt_usage core_exit.sh diff --git a/lgsm/functions/core_legacy.sh b/lgsm/functions/core_legacy.sh index c3efe7b63..3450d5842 100644 --- a/lgsm/functions/core_legacy.sh +++ b/lgsm/functions/core_legacy.sh @@ -4,8 +4,18 @@ # Website: https://linuxgsm.com # Description: Code for backwards compatability with older versions of LinuxGSM. +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 ) +for legacy_version in "${legacy_versions_array[@]}" +do + if [ "${version}" == "${legacy_version}" ]; then + legacymode=1 + fi +done + if [ -z "${serverfiles}" ]; then - legacymode=1 serverfiles="${filesdir}" fi @@ -26,7 +36,7 @@ if [ -z "${lgsmlogdate}" ]; then fi if [ -z "${steamcmddir}" ]; then - steamcmddir="${rootdir}/steamcmd" + steamcmddir="${HOME}/.steam/steamcmd" fi if [ -z "${lgsmdir}" ]; then diff --git a/lgsm/functions/logs.sh b/lgsm/functions/core_logs.sh similarity index 92% rename from lgsm/functions/logs.sh rename to lgsm/functions/core_logs.sh index dc55456ef..00c4d0662 100644 --- a/lgsm/functions/logs.sh +++ b/lgsm/functions/core_logs.sh @@ -1,12 +1,11 @@ #!/bin/bash -# LinuxGSM logs.sh function +# LinuxGSM core_logs.sh function # Author: Daniel Gibbs # Contributor: UltimateByte # Website: https://linuxgsm.com # Description: Acts as a log rotator, removing old logs. -local modulename="LOGS" -local commandaction="Log-Manager" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Check if logfile variable and file exist, create logfile if it doesn't exist. if [ "${consolelog}" ]; then @@ -17,7 +16,7 @@ fi # For games not displaying a console, and having logs into their game directory. check_status.sh -if [ "${status}" != "0" ]&&[ "${function_selfname}" == "command_start.sh" ]&&[ -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}" @@ -41,8 +40,7 @@ if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ]; # Setting up counting variables scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0" fn_sleep_time - fn_print_ok_nl "Starting" - fn_print_info_nl "Removing logs older than ${logdays} days" + fn_print_info "Removing logs older than ${logdays} days" fn_script_log_info "Removing logs older than ${logdays} days" # Logging logfiles to be removed according to "${logdays}", counting and removing them. # Script logfiles. @@ -100,6 +98,6 @@ if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ]; # Count total amount of files removed. countlogs=$((scriptcount + consolecount + gamecount + srcdscount + smcount + ulxcount + darkrpcount)) # Job done. - fn_print_ok_nl "Removed ${countlogs} log files" + fn_print_ok "Removed ${countlogs} log files" fn_script_log "Removed ${countlogs} log files" fi diff --git a/lgsm/functions/core_messages.sh b/lgsm/functions/core_messages.sh index dc83f3c57..8a13cc6ea 100644 --- a/lgsm/functions/core_messages.sh +++ b/lgsm/functions/core_messages.sh @@ -5,6 +5,8 @@ # Website: https://linuxgsm.com # Description: Defines on-screen messages such as [ OK ] and how script logs look. +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(){ @@ -46,7 +48,7 @@ fn_sleep_time(){ ## Feb 28 14:56:58 ut99-server: Monitor: fn_script_log(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then + if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ${1}" >> "${lgsmlog}" else echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${1}" >> "${lgsmlog}" @@ -58,7 +60,7 @@ fn_script_log(){ fn_script_log_pass(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then + if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: PASS: ${1}" >> "${lgsmlog}" else echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: PASS: ${1}" >> "${lgsmlog}" @@ -70,7 +72,7 @@ fn_script_log_pass(){ ## Feb 28 14:56:58 ut99-server: Monitor: FATAL: fn_script_log_fatal(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then + if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: FATAL: ${1}" >> "${lgsmlog}" else echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: FATAL: ${1}" >> "${lgsmlog}" @@ -82,7 +84,7 @@ fn_script_log_fatal(){ ## Feb 28 14:56:58 ut99-server: Monitor: ERROR: fn_script_log_error(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then + if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ERROR: ${1}" >> "${lgsmlog}" else echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ERROR: ${1}" >> "${lgsmlog}" @@ -94,7 +96,7 @@ fn_script_log_error(){ ## Feb 28 14:56:58 ut99-server: Monitor: WARN: fn_script_log_warn(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then + if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: WARN: ${1}" >> "${lgsmlog}" else echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: WARN: ${1}" >> "${lgsmlog}" @@ -106,7 +108,7 @@ fn_script_log_warn(){ ## Feb 28 14:56:58 ut99-server: Monitor: INFO: fn_script_log_info(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then + if [ -n "${commandname}" ]; then echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: INFO: ${1}" >> "${lgsmlog}" else echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: INFO: ${1}" >> "${lgsmlog}" @@ -114,6 +116,17 @@ fn_script_log_info(){ fi } +## Feb 28 14:56:58 ut99-server: Monitor: INFO: +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}" + else + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: UPDATE: ${1}" >> "${lgsmlog}" + fi + fi +} + # On-Screen - Automated functions ################################## @@ -180,18 +193,18 @@ fn_print_fail_nl(){ # [ ERROR ] fn_print_error(){ if [ "${commandaction}" ]; then - echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${selfname}: $*" + echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*" else - echo -en "${creeol}[${red}ERROR ${default}] $*" + echo -en "${creeol}[${red} ERROR ${default}] $*" fi fn_sleep_time } fn_print_error_nl(){ if [ "${commandaction}" ]; then - echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${selfname}: $*" + echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*" else - echo -en "${creeol}[${red}ERROR ${default}] $*" + echo -en "${creeol}[${red} ERROR ${default}] $*" fi fn_sleep_time echo -en "\n" @@ -237,6 +250,26 @@ fn_print_info_nl(){ echo -en "\n" } +# [ START ] +fn_print_start(){ + if [ "${commandaction}" ]; then + echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${lightgreen} START ${default}] $*" + fi + fn_sleep_time +} + +fn_print_start_nl(){ + if [ "${commandaction}" ]; then + echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${lightgreen} START ${default}] $*" + fi + fn_sleep_time + echo -en "\n" +} + # On-Screen - Interactive messages ################################## @@ -332,100 +365,133 @@ fn_prompt_yn(){ # OK fn_print_ok_eol(){ echo -en "${green}OK${default}" + fn_sleep_time } fn_print_ok_eol_nl(){ echo -e "${green}OK${default}" + fn_sleep_time } # FAIL fn_print_fail_eol(){ echo -en "${red}FAIL${default}" + fn_sleep_time } fn_print_fail_eol_nl(){ echo -e "${red}FAIL${default}" + fn_sleep_time } # ERROR fn_print_error_eol(){ echo -en "${red}ERROR${default}" + fn_sleep_time } fn_print_error_eol_nl(){ echo -e "${red}ERROR${default}" + fn_sleep_time +} + +# WAIT +fn_print_wait_eol(){ + echo -en "${cyan}WAIT${default}" + fn_sleep_time +} + +fn_print_wait_eol_nl(){ + echo -e "${cyan}WAIT${default}" + fn_sleep_time } # WARN fn_print_warn_eol(){ echo -en "${lightyellow}WARN${default}" + fn_sleep_time } fn_print_warn_eol_nl(){ echo -e "${lightyellow}WARN${default}" + fn_sleep_time } # INFO fn_print_info_eol(){ - echo -en "${red}INFO${default}" + echo -en "${cyan}INFO${default}" + fn_sleep_time } fn_print_info_eol_nl(){ - echo -e "${red}INFO${default}" + echo -e "${cyan}INFO${default}" + fn_sleep_time } # QUERYING fn_print_querying_eol(){ echo -en "${cyan}QUERYING${default}" + fn_sleep_time } fn_print_querying_eol_nl(){ echo -e "${cyan}QUERYING${default}" + fn_sleep_time } # CHECKING fn_print_checking_eol(){ echo -en "${cyan}CHECKING${default}" + fn_sleep_time } fn_print_checking_eol_nl(){ echo -e "${cyan}CHECKING${default}" + fn_sleep_time } # DELAY fn_print_delay_eol(){ echo -en "${green}DELAY${default}" + fn_sleep_time } fn_print_delay_eol_nl(){ echo -e "${green}DELAY${default}" + fn_sleep_time } # CANCELED fn_print_canceled_eol(){ - echo -en "${yellow}CANCELED${default}" + echo -en "${lightyellow}CANCELED${default}" + fn_sleep_time } fn_print_canceled_eol_nl(){ - echo -e "${yellow}CANCELED${default}" + echo -e "${lightyellow}CANCELED${default}" + fn_sleep_time } # REMOVED fn_print_removed_eol(){ echo -en "${red}REMOVED${default}" + fn_sleep_time } fn_print_removed_eol_nl(){ echo -e "${red}REMOVED${default}" + fn_sleep_time } # UPDATE fn_print_update_eol(){ echo -en "${cyan}UPDATE${default}" + fn_sleep_time } fn_print_update_eol_nl(){ echo -e "${cyan}UPDATE${default}" + fn_sleep_time } fn_print_ascii_logo(){ diff --git a/lgsm/functions/core_trap.sh b/lgsm/functions/core_trap.sh index 4c9db3579..f943c5c33 100644 --- a/lgsm/functions/core_trap.sh +++ b/lgsm/functions/core_trap.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Handles CTRL-C trap to give an exit code. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + fn_exit_trap(){ echo -e "" core_exit.sh diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh index 3b5a58965..a42f0e51d 100644 --- a/lgsm/functions/fix.sh +++ b/lgsm/functions/fix.sh @@ -5,8 +5,7 @@ # Description: Overall function for managing fixes. # Runs functions that will fix an issue. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Messages that are displayed for some fixes. fn_fix_msg_start(){ @@ -32,7 +31,7 @@ fn_fix_msg_end(){ } # Fixes that are run on start. -if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; then +if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then if [ "${appid}" ]; then fix_steamcmd.sh fi @@ -43,10 +42,14 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th fix_ark.sh elif [ "${shortname}" == "csgo" ]; then fix_csgo.sh + elif [ "${shortname}" == "cmw" ]; then + fix_cmw.sh elif [ "${shortname}" == "dst" ]; then fix_dst.sh elif [ "${shortname}" == "ges" ]; then fix_ges.sh + elif [ "${shortname}" == "hw" ]; then + fix_hw.sh elif [ "${shortname}" == "ins" ]; then fix_ins.sh elif [ "${shortname}" == "nmrih" ]; then @@ -71,6 +74,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th fix_terraria.sh elif [ "${shortname}" == "ts3" ]; then fix_ts3.sh + elif [ "${shortname}" == "tu" ]; then + fix_tu.sh elif [ "${shortname}" == "mcb" ]; then fix_mcb.sh elif [ "${shortname}" == "mta" ]; then @@ -85,13 +90,16 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th fi # Fixes that are run on install only. -if [ "${function_selfname}" == "command_install.sh" ]; then - if [ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then +if [ "${commandname}" == "INSTALL" ]; then + if [ "${shortname}" == "av" ]||[ "${shortname}" == "cmw" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then echo -e "" echo -e "Applying Post-Install Fixes" echo -e "=================================" fn_sleep_time - if [ "${shortname}" == "kf" ]; then + postinstall=1 + if [ "${shortname}" == "av" ]; then + fix_av.sh + elif [ "${shortname}" == "kf" ]; then fix_kf.sh elif [ "${shortname}" == "kf2" ]; then fix_kf2.sh diff --git a/lgsm/functions/fix_ark.sh b/lgsm/functions/fix_ark.sh index 1a2bbc5b0..3c1355b1e 100644 --- a/lgsm/functions/fix_ark.sh +++ b/lgsm/functions/fix_ark.sh @@ -4,21 +4,54 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with ARK: Survival Evolved. -# removes the symlink if broken. fixes issue with older versions of LinuxGSM linking to /home/arkserver/steamcmd -# rather than ${HOME}/.steam. This fix could be deprecated eventually. -if [ ! -e "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]||[ ! -e "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]; then - fixname="broken steamcmd symlink" - fn_fix_msg_start - rm -f "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux" - rm -f "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" - fn_fix_msg_end -fi +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -# Symlinking the SteamCMD directory into the correct ARK directory so that the mods auto-management will work. -if [ ! -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]||[ ! -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]; then - fixname="steamcmd symlink" +# removes mulitple appworkshop_346110.acf if found. +steamappsfilewc=$(find ${HOME} -name appworkshop_346110.acf | wc -l) +if [ "${steamappsfilewc}" -gt "1" ]; then + fixname="multiple appworkshop acf files" fn_fix_msg_start - ln -s "${HOME}/.steam/steamcmd" "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" - ln -s "${HOME}/Steam/steamapps" "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" + find ${HOME} -name appworkshop_346110.acf -exec rm -f {} \; fn_fix_msg_end +elif [ "${steamappsfilewc}" -eq "1" ]; then + # Steam mods directory selecter + # 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) + + # removes the symlink if exists. + # fixes issue with older versions of LinuxGSM linking to /home/arkserver/steamcmd + if [ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]; then + fixname="broken SteamCMD symlink" + fn_fix_msg_start + unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux" + fn_fix_msg_end + check_steamcmd.sh + fi + + # removed ARK steamcmd directory if steamcmd is missing. + if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then + fixname="remove invalid ARK SteamCMD directory" + fn_fix_msg_start + rm -rf "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux" + fn_fix_msg_end + check_steamcmd.sh + 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 + fixname="incorrect steamapps symlink" + fn_fix_msg_start + unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" + fn_fix_msg_end + fi + + # Put symlink to steamapps directory into the ARK SteamCMD directory to link the downloaded mods to the correct location. + if [ ! -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]; then + fixname="steamapps symlink" + fn_fix_msg_start + ln -s "${steamappspath}" "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" + fn_fix_msg_end + fi fi diff --git a/lgsm/functions/fix_arma3.sh b/lgsm/functions/fix_arma3.sh index de9785e51..f71fcde7b 100644 --- a/lgsm/functions/fix_arma3.sh +++ b/lgsm/functions/fix_arma3.sh @@ -4,14 +4,12 @@ # Website: https://linuxgsm.com # Description: Resolves an issue with ARMA3. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: 20150 Segmentation fault (core dumped) error. -if [ ! -d "${HOME}/.local/share/Arma 3" ]||[ ! -d "${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 "${HOME}/.local/share/Arma 3 - Other Profiles" + mkdir -p "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3 - Other Profiles" fn_fix_msg_end fi diff --git a/lgsm/functions/fix_av.sh b/lgsm/functions/fix_av.sh new file mode 100644 index 000000000..3edf7862b --- /dev/null +++ b/lgsm/functions/fix_av.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# LinuxGSM fix_av.sh function +# Author: Christian Birk +# Website: https://linuxgsm.com +# Description: Resolves startup issue with Avorion + +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" + +if [ "${postinstall}" == "1" ]; then + fn_parms(){ + parms="--datapath ${avdatapath} --galaxy-name ${selfname} --init-folders-only" + } + + fn_print_information "starting ${gamename} server to generate configs." + fn_sleep_time + # go to the executeable dir and start the init of the server + cd "${systemdir}" || return 2 + fn_parms + "${executabledir}/${executable}" ${parms} +fi diff --git a/lgsm/functions/fix_cmw.sh b/lgsm/functions/fix_cmw.sh new file mode 100644 index 000000000..7dc502be6 --- /dev/null +++ b/lgsm/functions/fix_cmw.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# LinuxGSM fix_cmw.sh function +# Author: Christian Birk +# Website: https://linuxgsm.com +# Description: Resolves the issue of the not starting server on linux + +fixname="steam_appid.txt" + +if [ ! -f "${executabledir}/steam_appid.txt" ]; then + fn_fix_msg_start + echo 219640 > "${executabledir}/steam_appid.txt" + fn_fix_msg_end +fi + + +if [ ! -f "${executabledir}/lib/steamclient.so" ]; then + fixname="steamclient.so" + fn_fix_msg_start + if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then + cp "${steamcmddir}/linux32/steamclient.so" "${executabledir}/lib/steamclient.so" + elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then + cp "${steamcmddir}/linux32/steamclient.so" "${executabledir}/lib/steamclient.so" + fi + fn_fix_msg_end +fi + +if [ ! -f "${servercfgfullpath}" ]; then + fn_fix_msg_start + fixname="copy config" + mkdir "${servercfgdir}" + cp "${systemdir}/UDKGame/Config/"*.ini "${servercfgdir}" + fn_fix_msg_end +fi diff --git a/lgsm/functions/fix_csgo.sh b/lgsm/functions/fix_csgo.sh index 0ea098eed..6b213d388 100644 --- a/lgsm/functions/fix_csgo.sh +++ b/lgsm/functions/fix_csgo.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with CS:GO. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: server not always creating steam_appid.txt file. if [ ! -f "${serverfiles}/steam_appid.txt" ]; then diff --git a/lgsm/functions/fix_dst.sh b/lgsm/functions/fix_dst.sh index 46c17756b..b203e1cd8 100644 --- a/lgsm/functions/fix_dst.sh +++ b/lgsm/functions/fix_dst.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Don't Starve Together. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +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. diff --git a/lgsm/functions/fix_ges.sh b/lgsm/functions/fix_ges.sh index bbd08c645..6065f9ba8 100644 --- a/lgsm/functions/fix_ges.sh +++ b/lgsm/functions/fix_ges.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with GoldenEye: Source. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: MALLOC_CHECK_ needing to be set to 0. export MALLOC_CHECK_=0 diff --git a/lgsm/functions/fix_hw.sh b/lgsm/functions/fix_hw.sh new file mode 100644 index 000000000..6230f7b46 --- /dev/null +++ b/lgsm/functions/fix_hw.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# LinuxGSM fix_hw.sh function +# Author: Daniel Gibbs +# Website: https://linuxgsm.com +# Description: Resolves various issues with Hurtworld. + +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +if [ "${shortname}" == "hw" ]; then + # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so. + if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then + fixname="steamclient.so x86" + fn_fix_msg_start + if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then + cp "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}" + elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then + cp "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}" + else + : + fi + fn_fix_msg_end + fi + if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" ]; then + fixname="steamclient.so x86_64" + fn_fix_msg_start + if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then + cp "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}" + elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then + cp "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}" + else + : + fi + fn_fix_msg_end + fi +fi diff --git a/lgsm/functions/fix_ins.sh b/lgsm/functions/fix_ins.sh index 8bd3f310b..f41dffbd4 100644 --- a/lgsm/functions/fix_ins.sh +++ b/lgsm/functions/fix_ins.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Insurgency. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: ./srcds_linux: error while loading shared libraries: libtier0.so: cannot open shared object file: No such file or directory. @@ -13,7 +12,7 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/bin" # Fixes: issue #529 - gamemode not passed to debug or start. -if [ "${function_selfname}" == "command_debug.sh" ]; then +if [ "${commandname}" == "DEBUG" ]; then defaultmap="\"${defaultmap}\"" else defaultmap="\\\"${defaultmap}\\\"" diff --git a/lgsm/functions/fix_kf.sh b/lgsm/functions/fix_kf.sh index 0ce05184b..f0c29ee6f 100644 --- a/lgsm/functions/fix_kf.sh +++ b/lgsm/functions/fix_kf.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Killing Floor. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "Applying WebAdmin ROOst.css fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" diff --git a/lgsm/functions/fix_kf2.sh b/lgsm/functions/fix_kf2.sh index 7cc1be568..77edd77e8 100644 --- a/lgsm/functions/fix_kf2.sh +++ b/lgsm/functions/fix_kf2.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Killing Floor 2. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_parms(){ parms="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\"" diff --git a/lgsm/functions/fix_mcb.sh b/lgsm/functions/fix_mcb.sh index 5352fdee8..691647fb7 100644 --- a/lgsm/functions/fix_mcb.sh +++ b/lgsm/functions/fix_mcb.sh @@ -2,10 +2,9 @@ # LinuxGSM fix_mcb.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Resolves possible startup issue with Minecraft Bedrock +# Description: Resolves possible startup issue with Minecraft Bedrock. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # official docs state that the server should be started with: LD_LIBRARY_PATH=. ./bedrock_server export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" diff --git a/lgsm/functions/fix_mta.sh b/lgsm/functions/fix_mta.sh index 236a2336b..549101a68 100644 --- a/lgsm/functions/fix_mta.sh +++ b/lgsm/functions/fix_mta.sh @@ -3,15 +3,14 @@ # Author: Daniel Gibbs # Contributor: ChaosMTA # Website: https://linuxgsm.com -# Description: Installs the libmysqlclient for database functions on the server -local commandname="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +# Description: Installs the libmysqlclient for database functions on the server. + +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ ! -f "${lgsmdir}/lib/libmysqlclient.so.16" ]; then fixname="libmysqlclient16" fn_fix_msg_start_nl fn_sleep_time - fn_fetch_file "https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16" "${lgsmdir}/lib" "libmysqlclient.so.16" "chmodx" "norun" "noforce" "6c188e0f8fb5d7a29f4bc413b9fed6c2" + fn_fetch_file "https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16" "" "" "" "${lgsmdir}/lib" "libmysqlclient.so.16" "chmodx" "norun" "noforce" "6c188e0f8fb5d7a29f4bc413b9fed6c2" fn_fix_msg_end fi diff --git a/lgsm/functions/fix_nmrih.sh b/lgsm/functions/fix_nmrih.sh index 8dd5f592c..2c9d8c743 100644 --- a/lgsm/functions/fix_nmrih.sh +++ b/lgsm/functions/fix_nmrih.sh @@ -1,13 +1,15 @@ #!/bin/bash # LinuxGSM fix_nmrih.sh function # Author: Denperidge -# Description: Create symlinks for renamed No More Room In Hell serverfiles +# Description: Create symlinks for renamed No More Room In Hell serverfiles. # Solution from Steam Community post: https://steamcommunity.com/app/224260/discussions/2/1732089092441769414/ +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + ln -s "${serverfiles}/bin/vphysics_srv.so" "${serverfiles}/bin/vphysics.so" ln -s "${serverfiles}/bin/studiorender_srv.so" "${serverfiles}/bin/studiorender.so" ln -s "${serverfiles}/bin/soundemittersystem_srv.so" "${serverfiles}/bin/soundemittersystem.so" ln -s "${serverfiles}/bin/shaderapiempty_srv.so" "${serverfiles}/bin/shaderapiempty.so" ln -s "${serverfiles}/bin/scenefilecache_srv.so" "${serverfiles}/bin/scenefilecache.so" ln -s "${serverfiles}/bin/replay_srv.so" "${serverfiles}/bin/replay.so" -ln -s "${serverfiles}/bin/materialsystem_srv.so" "${serverfiles}/bin/materialsystem.so" \ No newline at end of file +ln -s "${serverfiles}/bin/materialsystem_srv.so" "${serverfiles}/bin/materialsystem.so" diff --git a/lgsm/functions/fix_onset.sh b/lgsm/functions/fix_onset.sh index 299e448fa..630245844 100644 --- a/lgsm/functions/fix_onset.sh +++ b/lgsm/functions/fix_onset.sh @@ -2,11 +2,9 @@ # LinuxGSM fix_onset.sh function # Author: Frédéric C. # Website: https://linuxgsm.com -# Description: Resolves various issues with Onset +# Description: Resolves various issues with Onset. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" diff --git a/lgsm/functions/fix_ro.sh b/lgsm/functions/fix_ro.sh index e7ced52ad..9f08d56d7 100644 --- a/lgsm/functions/fix_ro.sh +++ b/lgsm/functions/fix_ro.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Red Orchestra. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "Applying WebAdmin ROOst.css fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" diff --git a/lgsm/functions/fix_rust.sh b/lgsm/functions/fix_rust.sh index bb70724db..9ceff7b29 100644 --- a/lgsm/functions/fix_rust.sh +++ b/lgsm/functions/fix_rust.sh @@ -2,10 +2,9 @@ # LinuxGSM fix_rust.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Resolves startup issue with Rust +# Description: Resolves startup issue with Rust. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: [Raknet] Server Shutting Down (Shutting Down). export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${systemdir}/RustDedicated_Data/Plugins/x86_64" diff --git a/lgsm/functions/fix_rw.sh b/lgsm/functions/fix_rw.sh index 73cafcf2e..b02ec343e 100644 --- a/lgsm/functions/fix_rw.sh +++ b/lgsm/functions/fix_rw.sh @@ -2,9 +2,8 @@ # LinuxGSM fix_rw.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Resolves startup issue with Rising World +# Description: Resolves various issues with Rising World. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" diff --git a/lgsm/functions/fix_sdtd.sh b/lgsm/functions/fix_sdtd.sh index 005fb8f6c..91c94897a 100644 --- a/lgsm/functions/fix_sdtd.sh +++ b/lgsm/functions/fix_sdtd.sh @@ -2,9 +2,8 @@ # LinuxGSM fix_sdtd.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Resolves startup issue with 7 Days to Die +# Description: Resolves various issues with 7 Days to Die. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" diff --git a/lgsm/functions/fix_sfc.sh b/lgsm/functions/fix_sfc.sh index ce42211fb..874d6eca7 100644 --- a/lgsm/functions/fix_sfc.sh +++ b/lgsm/functions/fix_sfc.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Source Forts Classic. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ ! -f "${serverfiles}/bin/datacache.so" ]; then ln -s "${serverfiles}/bin/datacache_srv.so" "${serverfiles}/bin/datacache.so" diff --git a/lgsm/functions/fix_sof2.sh b/lgsm/functions/fix_sof2.sh index 11af88522..51224c8e0 100644 --- a/lgsm/functions/fix_sof2.sh +++ b/lgsm/functions/fix_sof2.sh @@ -2,10 +2,8 @@ # LinuxGSM fix_rust.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Resolves startup issue with Soldier of Fortune 2 - -local modulename="FIX" -local commandaction="Fix" +# Description: Resolves various issues with Soldier of Fortune 2. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: error while loading shared libraries: libcxa.so.1 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" diff --git a/lgsm/functions/fix_ss3.sh b/lgsm/functions/fix_ss3.sh index 1c81f87ae..6bea53861 100644 --- a/lgsm/functions/fix_ss3.sh +++ b/lgsm/functions/fix_ss3.sh @@ -4,14 +4,21 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Serious Sam 3. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -# Fixes https://steamcommunity.com/app/41070/discussions/0/353916981477716386/ -if [ "$(diff "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Bin/steamclient.so" >/dev/null)" ]; then +# Fixes: https://steamcommunity.com/app/41070/discussions/0/353916981477716386/ +if [ ! -f "${serverfiles}/Bin/steamclient.so" ]||[ "$(diff "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Bin/steamclient.so" 2>/dev/null)" ]; then fixname="steamclient.so" fn_fix_msg_start cp -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Bin/steamclient.so" fn_fix_msg_end fi + +# Fixes: .steam/bin32/libsteam.so: cannot open shared object file: No such file or directory +if [ ! -f "${HOME}/.steam/bin32/libsteam.so" ]; then + fixname="libsteam.so" + fn_fix_msg_start + mkdir -pv "${HOME}/.steam/bin32" >> "${lgsmlog}" + cp "${serverfiles}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" >> "${lgsmlog}" + fn_fix_msg_end +fi diff --git a/lgsm/functions/fix_steamcmd.sh b/lgsm/functions/fix_steamcmd.sh index 3f4907d15..0a2f774f1 100644 --- a/lgsm/functions/fix_steamcmd.sh +++ b/lgsm/functions/fix_steamcmd.sh @@ -4,80 +4,30 @@ # Website: https://linuxgsm.com # Description: Resolves various issues related to SteamCMD. -local modulename="FIX" -local commandaction="Fix" -function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -# Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so. +# Helps fix: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so. +if [ ! -f "${HOME}/.steam/sdk64/steamclient.so" ]; then + fixname="steamclient.so sdk64" + fn_fix_msg_start + mkdir -pv "${HOME}/.steam/sdk64" >> "${lgsmlog}" + if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then + cp "${steamcmddir}/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}" + elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then + cp "${steamcmddir}/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}" + fi + fn_fix_msg_end +fi + +# Helps fix: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so. if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then - fixname="steamclient.so" + fixname="steamclient.so sdk32" fn_fix_msg_start mkdir -pv "${HOME}/.steam/sdk32" >> "${lgsmlog}" if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then - cp -v "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}" + cp "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}" elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then - cp -v "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}" - else - $?=2 + cp "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}" fi fn_fix_msg_end fi - -if [ "${shortname}" == "bt" ]; then - # Fixes: [S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed. - if [ ! -L "${executabledir}/lib64/steamclient.so" ]; then - fixname="steamclient.so x86_64" - fn_fix_msg_start - if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then - cp -v "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${executabledir}/lib64/steamclient.so" >> "${lgsmlog}" - elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then - cp -v "${steamcmddir}/linux64/steamclient.so" "${executabledir}/lib64/steamclient.so" >> "${lgsmlog}" - else - $?=2 - fi - fn_fix_msg_end - fi -elif [ "${shortname}" == "ss3" ]; then - # Fixes: .steam/bin32/libsteam.so: cannot open shared object file: No such file or directory - if [ ! -f "${HOME}/.steam/bin32/libsteam.so" ]; then - fixname="libsteam.so" - fn_fix_msg_start - mkdir -pv "${HOME}/.steam/bin32" >> "${lgsmlog}" - cp "${serverfiles}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" >> "${lgsmlog}" - fn_fix_msg_end - fi -elif [ "${shortname}" == "hw" ]; then - # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so. - if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then - fixname="steamclient.so x86" - fn_fix_msg_start - if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then - cp -v "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}" - elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then - cp -v "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}" - else - : - fi - fn_fix_msg_end - fi - if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" ]; then - fixname="steamclient.so x86_64" - fn_fix_msg_start - if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then - cp -v "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}" - elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then - cp -v "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}" - else - : - fi - fn_fix_msg_end - fi -elif [ "${shortname}" == "tu" ]; then - # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so. - if [ ! -f "${executabledir}/steamclient.so" ]; then - fixname="steamclient.so" - fn_fix_msg_start - cp -v "${serverfiles}/linux64/steamclient.so" "${executabledir}/steamclient.so" >> "${lgsmlog}" - fn_fix_msg_end - fi -fi diff --git a/lgsm/functions/fix_terraria.sh b/lgsm/functions/fix_terraria.sh index 8d9af0947..712416bd8 100644 --- a/lgsm/functions/fix_terraria.sh +++ b/lgsm/functions/fix_terraria.sh @@ -4,8 +4,6 @@ # Website: https://linuxgsm.com # Description: Resolves an issue with Terraria. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export TERM=xterm diff --git a/lgsm/functions/fix_tf2.sh b/lgsm/functions/fix_tf2.sh index b0e9ce1ce..59b841226 100644 --- a/lgsm/functions/fix_tf2.sh +++ b/lgsm/functions/fix_tf2.sh @@ -4,9 +4,7 @@ # Website: https://github.com/vectorsigma # Description: Resolves various issues with Team Fortress 2. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +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 diff --git a/lgsm/functions/fix_ts3.sh b/lgsm/functions/fix_ts3.sh index 2a921d91d..b019012f7 100644 --- a/lgsm/functions/fix_ts3.sh +++ b/lgsm/functions/fix_ts3.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Teamspeak 3. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: makes libmariadb2 available #1924. if [ ! -f "${serverfiles}/libmariadb.so.2" ]; then diff --git a/lgsm/functions/fix_tu.sh b/lgsm/functions/fix_tu.sh new file mode 100644 index 000000000..1f01fd7b3 --- /dev/null +++ b/lgsm/functions/fix_tu.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# LinuxGSM fix_tu.sh function +# Author: Daniel Gibbs +# Website: https://linuxgsm.com +# Description: Resolves various issues with Tower Unite. + +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +if [ "${shortname}" == "tu" ]; then + # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so. + if [ ! -f "${executabledir}/steamclient.so" ]; then + fixname="steamclient.so" + fn_fix_msg_start + cp -v "${serverfiles}/linux64/steamclient.so" "${executabledir}/steamclient.so" >> "${lgsmlog}" + fn_fix_msg_end + fi +fi diff --git a/lgsm/functions/fix_unt.sh b/lgsm/functions/fix_unt.sh index 2c27e2f31..60f3d2edf 100644 --- a/lgsm/functions/fix_unt.sh +++ b/lgsm/functions/fix_unt.sh @@ -2,10 +2,9 @@ # LinuxGSM fix_rust.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Resolves startup issue with Unturned +# Description: Resolves startup issue with Unturned. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # steamclient.so: cannot open shared object file: No such file or directory export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" diff --git a/lgsm/functions/fix_ut.sh b/lgsm/functions/fix_ut.sh index 7c8c12458..f9c81348a 100644 --- a/lgsm/functions/fix_ut.sh +++ b/lgsm/functions/fix_ut.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Unreal Tournament. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" #Set Binary Executable echo -e "chmod +x ${executabledir}/${executable}" diff --git a/lgsm/functions/fix_ut2k4.sh b/lgsm/functions/fix_ut2k4.sh index 70ed0465d..fa2d29bf5 100644 --- a/lgsm/functions/fix_ut2k4.sh +++ b/lgsm/functions/fix_ut2k4.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Unreal Tournament 2004. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "applying WebAdmin ut2003.css fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" diff --git a/lgsm/functions/fix_ut3.sh b/lgsm/functions/fix_ut3.sh index 3b5537d67..e6c018d00 100644 --- a/lgsm/functions/fix_ut3.sh +++ b/lgsm/functions/fix_ut3.sh @@ -2,11 +2,9 @@ # LinuxGSM fix_ut2.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Resolves various issues with configs in Unreal Tournament 3. +# Description: Resolves various issues with Unreal Tournament 3. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_parms(){ parms="server VCTF-Suspense?Game=UTGameContent.UTVehicleCTFGame_Content?bIsDedicated=true?bIsLanMatch=false?bUsesStats=false?bShouldAdvertise=false?PureServer=1?bAllowJoinInProgress=true?ConfigSubDir=${selfname} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}" diff --git a/lgsm/functions/fix_wurm.sh b/lgsm/functions/fix_wurm.sh index 756636cac..809651d55 100644 --- a/lgsm/functions/fix_wurm.sh +++ b/lgsm/functions/fix_wurm.sh @@ -2,7 +2,9 @@ # LinuxGSM fix_wurm.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Resolves various issues with ARK: Survival Evolved. +# Description: Resolves various issues with Wurm Unlimited. + +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Copies steamclient.so to correct location. if [ ! -f "${serverfiles}/nativelibs" ]; then diff --git a/lgsm/functions/fix_zmr.sh b/lgsm/functions/fix_zmr.sh index 25deec45f..1825fa327 100644 --- a/lgsm/functions/fix_zmr.sh +++ b/lgsm/functions/fix_zmr.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Zombie Master: Reborn. -local modulename="FIX" -local commandaction="Fix" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ ! -f "${serverfiles}/bin/datacache.so" ]; then ln -s "${serverfiles}/bin/datacache_srv.so" "${serverfiles}/bin/datacache.so" diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index 796843e49..65dbd9623 100644 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Gets specific details from config files. -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ## Examples of filtering to get info from config files. # sed 's/foo//g' - remove foo @@ -14,6 +14,31 @@ local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") # grep -v "foo" filter out lines that contain foo # cut -f1 -d "/" remove everything after / + +fn_info_config_assettocorsa(){ + if [ ! -f "${servercfgfullpath}" ]; then + httpport="${zero}" + port="${zero}" + queryport="${zero}" + servername="${unavailable}" + adminpassword="${unavailable}" + else + httpport=$(grep "HTTP_PORT" "${servercfgfullpath}" | tr -cd '[:digit:]') + port=$(grep "TCP_PORT" "${servercfgfullpath}" | tr -cd '[:digit:]') + queryport="${port}" + 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 + httpport=${httpport:-"0"} + port=${port:-"0"} + queryport=${queryport:-"0"} + servername=${servername:-"NOT SET"} + adminpassword=${adminpassword:-"NOT SET"} + + fi +} + fn_info_config_justcause2(){ if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -156,7 +181,7 @@ fn_info_config_bf1942(){ queryport="${zero}" else - servername=$(grep "game.serverName " "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/game.serverName //g' | tr -d '=\";,:' | xargs) + servername=$(grep "game.serverName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/game.serverName //g' | tr -d '=\";,:' | xargs) serverpassword=$(grep "game.serverPassword" "${servercfgfullpath}" | sed -e 's/^ *//g' -e '/^--/d' -e 's/game.serverPassword//g' | tr -d '=\";,:' | xargs) maxplayers=$(grep "game.serverMaxPlayers" "${servercfgfullpath}" | grep -v "\--" | tr -cd '[:digit:]') port=$(grep "game.serverPort" "${servercfgfullpath}" | grep -v "\--" | tr -cd '[:digit:]') @@ -174,6 +199,50 @@ fn_info_config_bf1942(){ fi } +fn_info_config_bfv(){ + if [ ! -f "${servercfgfullpath}" ]; then + servername="${unavailable}" + serverpassword="${unavailable}" + maxplayers="${zero}" + port="${zero}" + queryport="${zero}" + else + + servername=$(grep "game.serverName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/game.serverName//g' | tr -d '=\";,:' | xargs) + serverpassword=$(grep "game.serverPassword" "${servercfgfullpath}" | sed -e 's/^ *//g' -e '/^--/d' -e 's/game.serverPassword//g' | tr -d '=\";,:' | xargs) + maxplayers=$(grep "game.serverMaxPlayers" "${servercfgfullpath}" | grep -v "\--" | tr -cd '[:digit:]') + port=$(grep "game.serverPort" "${servercfgfullpath}" | grep -v "\--" | tr -cd '[:digit:]') + queryport="23000" + + ip=$(grep "game.serverIP" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/game.serverIP//g' | tr -d '=\";,:' | xargs) + ipsetinconfig=1 + ipinconfigvar="game.serverIP" + + # Not Set + servername=${servername:-"NOT SET"} + serverpassword=${serverpassword:-"NOT SET"} + maxplayers=${maxplayers:-"0"} + port=${port:-"0"} + fi +} + +fn_info_config_chivalry(){ + if [ ! -f "${servercfgfullpath}" ]; then + servername="${unavailable}" + serverpassword="${unavailable}" + adminpassword="${unavailable}" + else + servername=$(egrep "^ServerName" "${servercfgfullpath}" | sed 's/^ServerName=//') + adminpassword=$(egrep "^AdminPassword" "${servercfgfullpath}" | sed 's/^AdminPassword=//') + + # Not Set + servername=${servername:-"NOT SET"} + serverpassword=${serverpassword:-"NOT SET"} + adminpassword=${adminpassword:-"NOT SET"} + port=${port:-"0"} + fi +} + fn_info_config_cod(){ if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -392,7 +461,7 @@ fn_info_config_minecraft_bedrock(){ maxplayers="${zero}" port="${zero}" port6="${zero}" - queryport="${zero}" + queryport="${zero}" gamemode="${unavailable}" gameworld="${unavailable}" else @@ -400,7 +469,7 @@ fn_info_config_minecraft_bedrock(){ maxplayers=$(grep "max-players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') port=$(grep "server-port\b" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') port6=$(grep "server-portv6\b" "${servercfgfullpath}" | sed 's/v6//g' | grep -v "#" | tr -cd '[:digit:]') - queryport=${port} + queryport=${port} gamemode=$(grep "gamemode" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/gamemode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') gameworld=$(grep "level-name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/level-name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') @@ -409,12 +478,26 @@ fn_info_config_minecraft_bedrock(){ maxplayers=${maxplayers:-"NOT SET"} port=${port:-"NOT SET"} port6=${port6:-"NOT SET"} - queryport=${queryport:-"NOT SET"} + queryport=${queryport:-"NOT SET"} gamemode=${gamemode:-"NOT SET"} gameworld=${gameworld:-"NOT SET"} fi } +fn_info_config_mofm(){ + if [ ! -f "${servercfgfullpath}" ]; then + servername="${unavailable}" + serverpassword="${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]*$//') + serverpassword=$(grep "ServerPassword" "${servercfgfullpath}" | sed -e 's/^ *//g' -e '/^--/d' -e 's/ServerPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + + # Not Set + servername=${servername:-"NOT SET"} + serverpassword=${serverpassword:-"NOT SET"} + fi +} + fn_info_config_onset(){ if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -434,7 +517,7 @@ fn_info_config_onset(){ maxplayers=${maxplayers:-"NOT SET"} port=${port:-"NOT SET"} httpport=${httpport:-"NOT SET"} - queryport=${queryport:-"NOT SET"} + queryport=${queryport:-"NOT SET"} fi } @@ -847,7 +930,7 @@ fn_info_config_teamspeak3(){ queryport=$(grep "query_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') fileport=$(grep "filetransfer_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') - ip=$(grep "voice_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/voice_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + ip=$(grep "voice_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/voice_ip//g' | sed 's/,.*//' | tr -d '=\";,' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') ipsetinconfig=1 ipinconfigvar="voice_ip" @@ -1042,13 +1125,16 @@ fn_info_config_unreal3(){ servername="${unavailable}" serverpassword="${unavailable}" adminpassword="${unavailable}" + maxplayers="${unavailable}" webadminenabled="${unavailable}" webadminport="${zero}" 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]*$//') + serverpassword=$(grep "GamePassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/GamePassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') adminpassword=$(grep "AdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + maxplayers=$(grep "MaxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') webadminenabled=$(grep "bEnabled" "${servercfgdir}/UTWeb.ini" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bEnabled//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') webadminport=$(grep "ListenPort" "${servercfgdir}/UTWeb.ini" | grep -v "#" | tr -cd '[:digit:]') webadminuser="Admin" @@ -1058,7 +1144,7 @@ fn_info_config_unreal3(){ servername=${servername:-"NOT SET"} serverpassword=${serverpassword:-"NOT SET"} adminpassword=${adminpassword:-"NOT SET"} - port=${port:-"0"} + maxplayers=${maxplayers:-"NOT SET"} webadminenabled=${webadminenabled:-"NOT SET"} webadminport=${webadminport:-"0"} webadminuser=${webadminuser:-"NOT SET"} @@ -1074,7 +1160,7 @@ fn_info_config_ut(){ # Not set servername=${servername:-"NOT SET"} - fi + fi } fn_info_config_warfork(){ @@ -1369,21 +1455,73 @@ fn_info_config_mordhau(){ fi } -fn_info_config_soldat(){ + +fn_info_config_avorion() { if [ ! -f "${servercfgfullpath}" ]; then + maxplayers="${unavailable}" servername="${unavailable}" serverpassword="${unavailable}" + rconpassword="${unavailable}" + rconport="${unavailable}" + rconenabled="${unavailable}" + queryport="${unavailable}" + else + maxplayers=$(grep "maxPlayers=" "${servercfgfullpath}" | sed 's/maxPlayers=//') + servername=$(grep "name=" "${servercfgfullpath}" | sed 's/name=//') + serverpassword=$(grep "password=" "${servercfgfullpath}" | sed 's/password=//') + rconpassword=$(grep "rconPassword=" "${servercfgfullpath}" | sed 's/rconPassword=//') + rconport=$(grep "rconPort=" "${servercfgfullpath}" | sed 's/rconPort=//') + if [ -n "${rconpassword}" ]; then + rconenabled="true" + queryport="${rconport}" + fi + + # Not set + maxplayers=${maxplayers:-"NOT SET"} + servername=${servername:-"NOT SET"} + serverpassword=${serverpassword:-"NOT SET"} + rconpassword=${rconpassword:-"NOT SET"} + rconport=${rconport:-"0"} + rconenabled=${rconenabled:-"false"} + queryport=${queryport:-"0"} + fi +} + +fn_info_config_soldat(){ + if [ ! -f "${servercfgfullpath}" ]; then adminpassword="${unavailable}" + maxplayers="${unavailable}" + port="${zero}" + queryport="${zero}" + servername="${unavailable}" + serverpassword="${unavailable}" else - servername=$(grep "Server_Name" "${servercfgfullpath}" | awk -F '=' '{print $2}') - serverpassword=$(grep "Game_Password" "${servercfgfullpath}" | awk -F '=' '{print $2}') - adminpassword=$(grep "Admin_Password" "${servercfgfullpath}" | awk -F '=' '{print $2}') + adminpassword=$(grep "Admin_Password=" "${servercfgfullpath}" | awk -F '=' '{print $2}') + maxplayers=$(grep "Max_Players=" "${servercfgfullpath}" | tr -cd '[:digit:]') + port=$(grep "Port=" "${servercfgfullpath}" | tr -cd '[:digit:]') + queryport="${port}" + servername=$(grep "Server_Name=" "${servercfgfullpath}" | awk -F '=' '{print $2}') + serverpassword=$(grep "Game_Password=" "${servercfgfullpath}" | awk -F '=' '{print $2}') + + # Not set + adminpassword=${adminpassword:-"NOT SET"} + maxplayers=${maxplayers:-"0"} + port=${port:-"23073"} + queryport=${queryport:-"23083"} + servername=${servername:-"NOT SET"} + serverpassword=${serverpassword:-"NOT SET"} fi } +# Assetto Corsa +if [ "${shortname}" == "ac" ]; then + fn_info_config_assettocorsa # ARK: Survival Evolved -if [ "${shortname}" == "ark" ]; then +elif [ "${shortname}" == "ark" ]; then fn_info_config_ark +# Avorion +elif [ "${shortname}" == "av" ]; then + fn_info_config_avorion # Ballistic Overkill elif [ "${shortname}" == "bo" ]; then fn_info_config_ballistic_overkill @@ -1396,6 +1534,12 @@ elif [ "${shortname}" == "bt1944" ]; then # Battlefield: 1942 elif [ "${shortname}" == "bf1942" ]; then fn_info_config_bf1942 +# Battlefield: Vietnam +elif [ "${shortname}" == "bfv" ]; then + fn_info_config_bfv +# Chivalry: Medieval Warfare +elif [ "${shortname}" == "cmw" ]; then + fn_info_config_chivalry # Call of Duty elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]; then fn_info_config_cod @@ -1432,6 +1576,9 @@ elif [ "${shortname}" == "kf2" ]; then # Medal of Honor: Allied Assault elif [ "${shortname}" == "mohaa" ]; then fn_info_config_mohaa +# Memories of Mars +elif [ "${shortname}" == "mofm" ]; then + fn_info_config_mofm # QuakeWorld elif [ "${shortname}" == "qw" ]; then fn_info_config_quakeworld @@ -1484,7 +1631,7 @@ elif [ "${shortname}" == "sol" ]; then elif [ "${shortname}" == "sof2" ]; then fn_info_config_sof2 # Source Engine Games -elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then +elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then fn_info_config_source # Starbound elif [ "${shortname}" == "sb" ]; then @@ -1515,7 +1662,7 @@ elif [ "${engine}" == "unreal" ]; then fn_info_config_unreal # Unreal 2 engine elif [ "${engine}" == "unreal2" ]; then - fn_info_config_unreal2 + fn_info_config_unreal2 # Unreal 3 engine elif [ "${engine}" == "unreal3" ]; then fn_info_config_unreal3 diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index d6cfc95f9..1e2a519f4 100644 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -5,11 +5,11 @@ # Description: Variables providing useful info on the Operating System such as disk and performace info. # Used for command_details.sh, command_debug.sh and alert.sh. -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ### Game Server pid if [ "${status}" == "1" ]; then - gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}"| grep "^${selfname}"|awk '{print $2}') + gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $2}') fi ### Distro information @@ -263,9 +263,9 @@ fi if [ "$(command -v jq 2>/dev/null)" ]; then if [ "${ip}" ]&&[ "${port}" ]; then if [ "${steammaster}" == "true" ]; then - masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l) + masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l 2>/dev/null) if [ "${masterserver}" == "0" ]; then - masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l) + masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]|.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 d79b6321e..53d049592 100644 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Defines server info messages for details and alerts. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + # Standard Details # This applies to all engines @@ -105,10 +107,10 @@ fn_info_message_server_resource(){ echo -e "" { echo -e "${lightyellow}Network${default}" - if [ "${netint}" ]; then + if [ -n "${netint}" ]; then echo -e "${lightblue}Interface:\t${default}${netint}" fi - if [ "${netlink}" ]; then + if [ -n "${netlink}" ]; then echo -e "${lightblue}Link Speed:\t${default}${netlink}" fi echo -e "${lightblue}IP:\t${default}${ip}" @@ -174,19 +176,19 @@ fn_info_message_gameserver(){ fn_messages_separator { # Server name - if [ "${gdname}" ]; then + if [ -n "${gdname}" ]; then echo -e "${lightblue}Server name:\t${default}${gdname}" - elif [ "${servername}" ]; then + elif [ -n "${servername}" ]; then echo -e "${lightblue}Server name:\t${default}${servername}" fi # Server description - if [ "${serverdescription}" ]; then + if [ -n "${serverdescription}" ]; then echo -e "${lightblue}Server Description:\t${default}${serverdescription}" fi # Branch - if [ "${branch}" ]; then + if [ -n "${branch}" ]; then echo -e "${lightblue}Branch:\t${default}${branch}" fi @@ -198,174 +200,170 @@ fn_info_message_gameserver(){ fi # Internet ip - if [ "${extip}" ]; then + if [ -n "${extip}" ]; then if [ "${ip}" != "${extip}" ]; then echo -e "${lightblue}Internet IP:\t${default}${extip}:${port}" fi fi # Display ip - if [ "${displayip}" ]; then + if [ -n "${displayip}" ]; then echo -e "${lightblue}Display IP:\t${default}${displayip}:${port}" fi # Server password - if [ "${serverpassword}" ]; then + if [ -n "${serverpassword}" ]; then echo -e "${lightblue}Server password:\t${default}${serverpassword}" fi # Query enabled (Starbound) - if [ "${queryenabled}" ]; then + if [ -n "${queryenabled}" ]; then echo -e "${lightblue}Query enabled:\t${default}${queryenabled}" fi # RCON enabled (Starbound) - if [ "${rconenabled}" ]; then - echo -e "${lightblue}RCON enabled:\t${default}${rconpassword}" + if [ -n "${rconenabled}" ]; then + echo -e "${lightblue}RCON enabled:\t${default}${rconenabled}" fi # RCON password - if [ "${rconpassword}" ]; then + if [ -n "${rconpassword}" ]; then echo -e "${lightblue}RCON password:\t${default}${rconpassword}" fi # RCON web (Rust) - if [ "${rconweb}" ]; then + if [ -n "${rconweb}" ]; then echo -e "${lightblue}RCON web:\t${default}${rconweb}" fi # Admin password - if [ "${adminpassword}" ]; then + if [ -n "${adminpassword}" ]; then echo -e "${lightblue}Admin password:\t${default}${adminpassword}" fi # Stats password (Quake Live) - if [ "${statspassword}" ]; then + if [ -n "${statspassword}" ]; then echo -e "${lightblue}Stats password:\t${default}${statspassword}" fi # Players if [ "${querystatus}" != "0" ]; then - if [ "${maxplayers}" ]; then + if [ -n "${maxplayers}" ]; then echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}" fi else - if [ "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then + if [ -n "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then echo -e "${lightblue}Players:\t${default}${gdplayers}/${gdmaxplayers}" - - elif [ "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then + elif [ -n "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then echo -e "${lightblue}Players:\t${default}${gdplayers}/${maxplayers}" - elif [ -z "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then echo -e "${lightblue}Players:\t${default}0/${gdmaxplayers}" - - elif [ "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then - echo -e "${lightblue}Players:\t${default}${gdplayers}|∞" - + elif [ -n "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then + echo -e "${lightblue}Players:\t${default}${gdplayers}/∞" elif [ -z "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]&&[ -n "${maxplayers}" ]; then echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}" fi fi # Bots - if [ "${gdbots}" ]; then + if [ -n "${gdbots}" ]; then echo -e "${lightblue}Bots:\t${default}${gdbots}" fi # Current map - if [ "${gdmap}" ]; then + if [ -n "${gdmap}" ]; then echo -e "${lightblue}Current map:\t${default}${gdmap}" fi # Default map - if [ "${defaultmap}" ]; then + if [ -n "${defaultmap}" ]; then echo -e "${lightblue}Default map:\t${default}${defaultmap}" fi - if [ "${defaultscenario}" ]; then + if [ -n "${defaultscenario}" ]; then # Current scenario - if [ "${gdgamemode}" ]; then + if [ -n "${gdgamemode}" ]; then echo -e "${lightblue}Current scenario:\t${default}${gdgamemode}" fi else # Current game mode - if [ "${gdgamemode}" ]; then + if [ -n "${gdgamemode}" ]; then echo -e "${lightblue}Current game mode:\t${default}${gdgamemode}" fi fi # Default scenario - if [ "${defaultscenario}" ]; then + if [ -n "${defaultscenario}" ]; then echo -e "${lightblue}Default scenario:\t${default}${defaultscenario}" fi # Game type - if [ "${gametype}" ]; then + if [ -n "${gametype}" ]; then echo -e "${lightblue}Game type:\t${default}${gametype}" fi # Game mode - if [ "${gamemode}" ]; then + if [ -n "${gamemode}" ]; then echo -e "${lightblue}Game mode:\t${default}${gamemode}" fi # Game world - if [ "${gameworld}" ]; then + if [ -n "${gameworld}" ]; then echo -e "${lightblue}Game world:\t${default}${gameworld}" fi # Tick rate - if [ "${tickrate}" ]; then + if [ -n "${tickrate}" ]; then echo -e "${lightblue}Tick rate:\t${default}${tickrate}" fi # Sharding (Don't Starve Together) - if [ "${sharding}" ]; then + if [ -n "${sharding}" ]; then echo -e "${lightblue}Sharding:\t${default}${sharding}" fi # Master (Don't Starve Together) - if [ "${master}" ]; then + if [ -n "${master}" ]; then echo -e "${lightblue}Master:\t${default}${master}" fi # Shard (Don't Starve Together) - if [ "${shard}" ]; then + if [ -n "${shard}" ]; then echo -e "${lightblue}Shard:\t${default}${shard}" fi # Cluster (Don't Starve Together) - if [ "${cluster}" ]; then + if [ -n "${cluster}" ]; then echo -e "${lightblue}Cluster:\t${default}${cluster}" fi # Cave (Don't Starve Together) - if [ "${cave}" ]; then + if [ -n "${cave}" ]; then echo -e "${lightblue}Cave:\t${default}${cave}" fi # Creativemode (Hurtworld) - if [ "${creativemode}" ]; then + if [ -n "${creativemode}" ]; then echo -e "${lightblue}Creativemode:\t${default}${creativemode}" fi # TeamSpeak dbplugin - if [ "${dbplugin}" ]; then + if [ -n "${dbplugin}" ]; then echo -e "${lightblue}dbplugin:\t${default}${dbplugin}" fi # ASE (Multi Theft Auto) - if [ "${ase}" ]; then + if [ -n "${ase}" ]; then echo -e "${lightblue}ASE:\t${default}${ase}" fi # Save interval (Rust) - if [ "${saveinterval}" ]; then + if [ -n "${saveinterval}" ]; then echo -e "${lightblue}ASE:\t${default}${saveinterval} s" fi # Random map rotation mode (Squad and Post Scriptum) - if [ "${randommap}" ]; then + if [ -n "${randommap}" ]; then echo -e "${lightblue}Map rotation:\t${default}${randommap}" fi @@ -375,7 +373,7 @@ fn_info_message_gameserver(){ fi # Listed on Master server - if [ "${displaymasterserver}" ]; then + if [ -n "${displaymasterserver}" ]; then if [ "${displaymasterserver}" == "true" ]; then echo -e "${lightblue}Master server:\t${green}${displaymasterserver}${default}" else @@ -421,12 +419,12 @@ fn_info_message_script(){ echo -e "${lightblue}Script name:\t${default}${selfname}" # LinuxGSM version - if [ "${version}" ]; then + if [ -n "${version}" ]; then echo -e "${lightblue}LinuxGSM version:\t${default}${version}" fi # glibc required - if [ "${glibc}" ]; then + if [ -n "${glibc}" ]; then if [ "${glibc}" == "null" ]; then # Glibc is not required. : @@ -456,7 +454,7 @@ fn_info_message_script(){ # Telegram alert echo -e "${lightblue}Telegram alert:\t${default}${telegramalert}" # Update on start - if [ "${updateonstart}" ]; then + if [ -n "${updateonstart}" ]; then echo -e "${lightblue}Update on start:\t${default}${updateonstart}" fi @@ -467,7 +465,7 @@ fn_info_message_script(){ echo -e "${lightblue}Location:\t${default}${rootdir}" # Config file location - if [ "${servercfgfullpath}" ]; then + if [ -n "${servercfgfullpath}" ]; then if [ -f "${servercfgfullpath}" ]; then echo -e "${lightblue}Config file:\t${default}${servercfgfullpath}" elif [ -d "${servercfgfullpath}" ]; then @@ -478,7 +476,7 @@ fn_info_message_script(){ fi # Network config file location (ARMA 3) - if [ "${networkcfgfullpath}" ]; then + if [ -n "${networkcfgfullpath}" ]; then echo -e "${lightblue}Network config file:\t${default}${networkcfgfullpath}" fi } | column -s $'\t' -t @@ -558,7 +556,7 @@ fn_info_message_ports(){ fi done # engines/games that require editing the parms. - local ports_edit_array=( "goldsource" "Factorio" "Hurtworld" "iw3.0" "ioquake3" "qfusion" "Rust" "Soldat" "spark" "source" "starbound" "unreal4" "realvirtuality" "Unturned" ) + local ports_edit_array=( "Avorion" "goldsrc" "Factorio" "Hurtworld" "iw3.0" "ioquake3" "qfusion" "Rust" "Soldat" "spark" "source" "starbound" "unreal4" "realvirtuality" "Unturned" ) for port_edit in "${ports_edit_array[@]}" do if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then @@ -585,7 +583,7 @@ fn_info_logs(){ echo -e "${selfname} Logs" echo -e "=================================" - if [ "${lgsmlog}" ]; then + if [ -n "${lgsmlog}" ]; then echo -e "\nScript log\n===================" if [ ! "$(ls -A "${lgsmlogdir}")" ]; then echo -e "${lgsmlogdir} (NO LOG FILES)" @@ -598,7 +596,7 @@ fn_info_logs(){ echo -e "" fi - if [ "${consolelog}" ]; then + if [ -n "${consolelog}" ]; then echo -e "\nConsole log\n====================" if [ ! "$(ls -A "${consolelogdir}")" ]; then echo -e "${consolelogdir} (NO LOG FILES)" @@ -611,7 +609,7 @@ fn_info_logs(){ echo -e "" fi - if [ "${gamelogdir}" ]; then + if [ -n "${gamelogdir}" ]; then echo -e "\nServer log\n===================" if [ ! "$(ls -A "${gamelogdir}")" ]; then echo -e "${gamelogdir} (NO LOG FILES)" @@ -626,6 +624,16 @@ fn_info_logs(){ # Engine/Game Specific details +fn_info_message_assettocorsa(){ + echo -e "netstat -atunp| grep acServer" + echo -e "" + { + echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}" + echo -e "> Game\tINBOUND\t${port}\tudp" + echo -e "> HTTP\tINBOUND\t${port}\tudp" + } | column -s $'\t' -t +} + fn_info_message_ark(){ echo -e "netstat -atunp | grep ShooterGame" echo -e "" @@ -641,6 +649,16 @@ fn_info_message_ark(){ } | column -s $'\t' -t } +fn_info_message_avorion() { + echo "netstat -atunp | grep Avorion" + echo -e "" + { + echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" + echo -e "> Game\tINBOUND\t${port}\tudp" + echo -e "> RCON\tINBOUND\t${rconport}\ttcp" + } | column -s $'\t' -t +} + fn_info_message_ballisticoverkill(){ echo -e "netstat -atunp | grep BODS.x86" echo -e "" @@ -685,6 +703,18 @@ fn_info_message_coduo(){ } | column -s $'\t' -t } +fn_info_message_chivalry(){ + fn_info_message_password_strip + echo -e "netstat -atunp | grep UDKGame" + echo -e "" + { + echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}" + echo -e "> Game\tINBOUND\t${port}\tudp" + echo -e "> Query\tINBOUND\t${queryport}\tudp" + echo -e "> RCON\tINBOUND\t27960\ttcp" + } | column -s $'\t' -t +} + fn_info_message_cod2(){ echo -e "netstat -atunp | grep cod2_lnxded" echo -e "" @@ -754,7 +784,7 @@ fn_info_message_factorio(){ } | column -s $'\t' -t } -fn_info_message_goldsource(){ +fn_info_message_goldsrc(){ echo -e "netstat -atunp | grep hlds_linux" echo -e "" { @@ -855,6 +885,16 @@ fn_info_message_mohaa(){ } | column -s $'\t' -t } +fn_info_message_mom(){ + echo -e "netstat -atunp | grep MemoriesOfMar" + echo -e "" + { + echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}" + echo -e "> Game\tINBOUND\t${port}\tudp" + echo -e "> BeaconPort\tINBOUND\t${beaconport}\tudp" + } | column -s $'\t' -t +} + fn_info_message_mumble(){ echo -e "netstat -atunp | grep murmur" echo -e "" @@ -966,6 +1006,16 @@ fn_info_message_bf1942(){ } | column -s $'\t' -t } +fn_info_message_bfv(){ + echo -e "netstat -atunp | grep bfv_linded" + echo -e "" + { + echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}" + echo -e "> Game\tINBOUND\t${port}\tudp" + echo -e "> Query\tINBOUND\t${queryport}\tudp" + } | column -s $'\t' -t +} + fn_info_message_risingworld(){ echo -e "netstat -atunp | grep java" echo -e "" @@ -1355,7 +1405,7 @@ fn_info_message_soldat() { { echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}" echo -e "> Game\tINBOUND\t${port}\tudp" - echo -e "> RCON\tINBOUND\t${port}\ttcp" + echo -e "> Query\tINBOUND\t${queryport}\tudp" echo -e "> FILES\tINBOUND\t$((port+10))\ttcp" } | column -s $'\t' -t } @@ -1372,8 +1422,12 @@ fn_info_message_warfork(){ fn_info_message_select_engine(){ # Display details depending on game or engine. - if [ "${shortname}" == "ark" ]; then + if [ "${shortname}" == "ac" ]; then + fn_info_message_assettocorsa + elif [ "${shortname}" == "ark" ]; then fn_info_message_ark + elif [ "${shortname}" == "av" ]; then + fn_info_message_avorion elif [ "${shortname}" == "arma3" ]; then fn_info_message_arma3 elif [ "${shortname}" == "bo" ]; then @@ -1382,6 +1436,8 @@ fn_info_message_select_engine(){ fn_info_message_barotrauma elif [ "${shortname}" == "bt1944" ]; then fn_info_message_battalion1944 + elif [ "${shortname}" == "cmw" ]; then + fn_info_message_chivalry elif [ "${shortname}" == "cod" ]; then fn_info_message_cod elif [ "${shortname}" == "coduo" ]; then @@ -1416,6 +1472,8 @@ fn_info_message_select_engine(){ fn_info_message_minecraft_bedrock elif [ "${shortname}" == "onset" ]; then fn_info_message_onset + elif [ "${shortname}" == "mom" ]; then + fn_info_message_mom elif [ "${shortname}" == "pz" ]; then fn_info_message_projectzomboid elif [ "${shortname}" == "pstbs" ]; then @@ -1442,7 +1500,7 @@ fn_info_message_select_engine(){ fn_info_message_sof2 elif [ "${shortname}" == "sol" ]; then fn_info_message_soldat - elif [ "${shortname}" == "st" ]; then + elif [ "${shortname}" == "sb" ]; then fn_info_message_starbound elif [ "${shortname}" == "sbots" ]; then fn_info_message_sbots @@ -1470,8 +1528,10 @@ fn_info_message_select_engine(){ fn_info_message_mta elif [ "${shortname}" == "mumble" ]; then fn_info_message_mumble - elif [ "${engine}" == "bf1942" ]; then + elif [ "${shortname}" == "bf1942" ]; then fn_info_message_bf1942 + elif [ "${shortname}" == "bfv" ]; then + fn_info_message_bfv elif [ "${shortname}" == "rtcw" ]; then fn_info_message_rtcw elif [ "${shortname}" == "rust" ]; then @@ -1484,8 +1544,8 @@ fn_info_message_select_engine(){ fn_info_message_risingworld elif [ "${shortname}" == "wet" ]; then fn_info_message_wolfensteinenemyterritory - elif [ "${engine}" == "goldsource" ]; then - fn_info_message_goldsource + elif [ "${engine}" == "goldsrc" ]; then + fn_info_message_goldsrc elif [ "${engine}" == "source" ]; then fn_info_message_source elif [ "${engine}" == "spark" ]; then @@ -1503,7 +1563,7 @@ fn_info_message_select_engine(){ # Separator is different for details fn_messages_separator(){ - if [ "${function_selfname}" == "command_details.sh" ]; then + if [ "${commandname}" == "details" ]; then printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = else echo -e "=================================" @@ -1512,7 +1572,7 @@ fn_messages_separator(){ # Removes the passwords form all but details fn_info_message_password_strip(){ - if [ "${function_selfname}" != "command_details.sh" ]; then + if [ "${commandname}" != "DETAILS" ]; then if [ "${serverpassword}" ]; then serverpassword="********" fi diff --git a/lgsm/functions/info_parms.sh b/lgsm/functions/info_parms.sh index 50c3a28e8..809d2cfc6 100644 --- a/lgsm/functions/info_parms.sh +++ b/lgsm/functions/info_parms.sh @@ -4,7 +4,7 @@ # Website: https://linuxgsm.com # Description: If specific parms are not set then this will be displayed in details. -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ## Examples of filtering to get info from config files # sed 's/foo//g' - remove foo @@ -88,6 +88,11 @@ fn_info_parms_mohaa(){ defaultmap=${defaultmap:-"NOT SET"} } +fn_info_parms_mom(){ + port=${port:-"7777"} + beaconport=${queryport:-"15000"} +} + fn_info_parms_mta(){ queryport=$((port + 123)) } @@ -182,15 +187,6 @@ fn_info_parms_sof2(){ defaultmap=${defaultmap:-"NOT SET"} } -fn_info_parms_soldat(){ - port=${port:-"0"} - queryport=${port:-"0"} - servername=${servername:-"NOT SET"} - serverpassword=${serverpassword:-"NOT SET"} - adminpassword=${adminpassword:-"NOT SET"} - maxplayers=${maxplayers:-"0"} -} - fn_info_parms_ss3(){ port=${port:-"0"} queryport=$((port + 1)) @@ -219,8 +215,6 @@ fn_info_parms_unreal3(){ port=${port:-"0"} queryport=${queryport:-"0"} defaultmap=${defaultmap:-"NOT SET"} - serverpassword=${serverpassword:-"NOT SET"} - adminpassword=${adminpassword:-"NOT SET"} } fn_info_parms_unturned(){ @@ -261,6 +255,9 @@ elif [ "${shortname}" == "kf2" ]; then fn_info_parms_kf2 elif [ "${shortname}" == "mohaa" ]; then fn_info_parms_mohaa +#Memories of Mars +elif [ "${shortname}" == "mom" ]; then + fn_info_parms_mom # Project Zomboid elif [ "${shortname}" == "pz" ]; then fn_info_parms_projectzomboid @@ -284,12 +281,10 @@ elif [ "${shortname}" == "sof2" ]; then # Sticky Bots elif [ "${shortname}" == "sbots" ]; then fn_info_parms_stickybots -elif [ "${shortname}" == "sol" ]; then - fn_info_parms_soldat # Serious Sam elif [ "${shortname}" == "ss3" ]; then fn_info_parms_ss3 -elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then +elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then fn_info_parms_source # Spark elif [ "${engine}" == "spark" ]; then diff --git a/lgsm/functions/info_stats.sh b/lgsm/functions/info_stats.sh index 078639fe6..9bdee07fd 100644 --- a/lgsm/functions/info_stats.sh +++ b/lgsm/functions/info_stats.sh @@ -2,73 +2,148 @@ # LinuxGSM info_stats.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Optional Stats to send to LinuxGSM Developer -# Uses Google analytics +# Description: Collect optional Stats sent to LinuxGSM project. +# Uses Google analytics. + +local modulegroup="INFO" +local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_distro.sh -# generate uuid -if [ ! -f "${datadir}/uuid.txt" ]; then - mkdir -p "${datadir}" - touch "${datadir}/uuid.txt" - if [ "$(command -v uuidgen 2>/dev/null)" ]; then - uuidgen > "${datadir}/uuid.txt" + +# remove uuid that was used in v20.2.0 and below +if [ -f "${datadir}/uuid.txt" ]; then + rm "${datadir:?}/uuid.txt" +fi + +# generate uuid's +# this consists of a standard uuid and a docker style name +# 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 + # download dictionary words + if [ ! -f "${datadir}/name-left.csv" ]; then + fn_fetch_file_github "lgsm/data" "name-left.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5" + fi + if [ ! -f "${datadir}/name-right.csv" ]; then + fn_fetch_file_github "lgsm/data" "name-right.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5" + fi + + # generate instance uuid + if [ -n "$(command -v uuidgen 2>/dev/null)" ]; then + uuid="$(uuidgen)" else - cat /proc/sys/kernel/random/uuid > "${datadir}/uuid.txt" + uuid="$(cat /proc/sys/kernel/random/uuid)" + fi + + nameleft="$(shuf -n 1 "${datadir}/name-left.csv")" + 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 + echo "${nameleft}_${nameright}_${uuid}" > "${datadir}/uuid-install.txt" fi fi -uuid=$(cat "${datadir}/uuid.txt") +uuidinstance=$(cat "${datadir}/uuid-${selfname}.txt") +uuidinstall=$(cat "${datadir}/uuid-install.txt") +# machine-id is a unique id set on OS install +uuidhardware=$(cat "/etc/machine-id") + # results are rounded up to reduce number of different results in analytics. # nearest 100Mhz. -cpuusedmhzroundup=$(((cpuusedmhz + 99) / 100 * 100)) +cpuusedmhzroundup="$(((cpuusedmhz + 99) / 100 * 100))" # nearest 100MB -memusedroundup=$(((memused + 99) / 100 * 100)) +memusedroundup="$(((memused + 99) / 100 * 100))" + +# Spliting the metrics in to 3 propertys allows more accurate metrics on numbers of invidual instances, installs and hardware. +# Instance Property - UA-165287622-1 +# Install Property - UA-165287622-2 +# Hardware Property - UA-165287622-3 ## Distro. -curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=distro" -d "ea=${distroname}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=distro" -d "ea=${distroname}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=distro" -d "ea=${distroname}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=distro" -d "ea=${distroname}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=distro" -d "ea=${distroname}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + ## Game Server Name. -curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=game" -d "ea=${gamename}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=game" -d "ea=${gamename}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=game" -d "ea=${gamename}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=game" -d "ea=${gamename}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=game" -d "ea=${gamename}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + ## LinuxGSM Version. -curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=version" -d "ea=${version}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=version" -d "ea=${version}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=version" -d "ea=${version}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=version" -d "ea=${version}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=version" -d "ea=${version}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 ## CPU usage of a game server. -if [ "${cpuusedmhzroundup}" ]; then - curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=cpuused" -d "ea=${cpuusedmhzroundup}MHz" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +if [ -n "${cpuusedmhzroundup}" ]; then + curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=cpuused" -d "ea=${cpuusedmhzroundup}MHz" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=cpuused" -d "ea=${cpuusedmhzroundup}MHz" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=cpuused" -d "ea=${cpuusedmhzroundup}MHz" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=cpuused" -d "ea=${cpuusedmhzroundup}MHz" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 fi ## Ram usage of a game server. -if [ "${memusedroundup}" ]; then - curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=ramused" -d "ea=${memusedroundup}MB" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +if [ -n "${memusedroundup}" ]; then + curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=ramused" -d "ea=${memusedroundup}MB" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=ramused" -d "ea=${memusedroundup}MB" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=ramused" -d "ea=${memusedroundup}MB" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=ramused" -d "ea=${memusedroundup}MB" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 fi ## Disk usage of a game server. -if [ "${serverfilesdu}" ]; then - curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=diskused" -d "ea=${serverfilesdu}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +if [ -n "${serverfilesdu}" ]; then + curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=diskused" -d "ea=${serverfilesdu}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=diskused" -d "ea=${serverfilesdu}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=diskused" -d "ea=${serverfilesdu}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=diskused" -d "ea=${serverfilesdu}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 fi ## CPU Model. -if [ "${cpumodel}" ]; then - curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=servercpu" -d "ea=${cpumodel} ${cpucores} cores" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +if [ -n "${cpumodel}" ]; then + curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=servercpu" -d "ea=${cpumodel} ${cpucores} cores" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=servercpu" -d "ea=${cpumodel} ${cpucores} cores" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=servercpu" -d "ea=${cpumodel} ${cpucores} cores" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=servercpu" -d "ea=${cpumodel} ${cpucores} cores" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + fi ## CPU Frequency. -if [ "${cpufreqency}" ]; then - curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=servercpufreq" -d "ea=${cpufreqency} x${cpucores}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +if [ -n "${cpufreqency}" ]; then + curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=servercpufreq" -d "ea=${cpufreqency} x${cpucores}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=servercpufreq" -d "ea=${cpufreqency} x${cpucores}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=servercpufreq" -d "ea=${cpufreqency} x${cpucores}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=servercpufreq" -d "ea=${cpufreqency} x${cpucores}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 fi ## Server RAM. -if [ "${physmemtotal}" ]; then - curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=serverram" -d "ea=${physmemtotal}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +if [ -n "${physmemtotal}" ]; then + curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=serverram" -d "ea=${physmemtotal}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=serverram" -d "ea=${physmemtotal}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=serverram" -d "ea=${physmemtotal}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=serverram" -d "ea=${physmemtotal}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 fi ## Server Disk. -if [ "${totalspace}" ]; then - curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=serverdisk" -d "ea=${totalspace}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 +if [ -n "${totalspace}" ]; then + curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=serverdisk" -d "ea=${totalspace}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=serverdisk" -d "ea=${totalspace}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=serverdisk" -d "ea=${totalspace}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 + curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=serverdisk" -d "ea=${totalspace}" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1 fi ## Summary Stats -curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuid}" -d "t=event" -d "ec=summary" -d "ea=GAME: ${gamename} | DISTRO: ${distroname} | CPU MODEL: ${cpumodel} ${cpucores} cores | RAM: ${physmemtotal} | DISK: ${totalspace}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-655379-31" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=summary" -d "ea=GAME: ${gamename} | DISTRO: ${distroname} | CPU MODEL: ${cpumodel} ${cpucores} cores | RAM: ${physmemtotal} | DISK: ${totalspace}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=summary" -d "ea=GAME: ${gamename} | DISTRO: ${distroname} | CPU MODEL: ${cpumodel} ${cpucores} cores | RAM: ${physmemtotal} | DISK: ${totalspace}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-2" -d "aip=1" -d "cid=${uuidinstall}" -d "t=event" -d "ec=summary" -d "ea=GAME: ${gamename} | DISTRO: ${distroname} | CPU MODEL: ${cpumodel} ${cpucores} cores | RAM: ${physmemtotal} | DISK: ${totalspace}" -d "v=1" > /dev/null 2>&1 +curl https://www.google-analytics.com/collect -d "tid=UA-165287622-3" -d "aip=1" -d "cid=${uuidhardware}" -d "t=event" -d "ec=summary" -d "ea=GAME: ${gamename} | DISTRO: ${distroname} | CPU MODEL: ${cpumodel} ${cpucores} cores | RAM: ${physmemtotal} | DISK: ${totalspace}" -d "v=1" > /dev/null 2>&1 fn_script_log_info "Send LinuxGSM stats" -fn_script_log_info "* UUID: ${uuid}" +fn_script_log_info "* uuid-${selfname}: ${uuidinstance}" +fn_script_log_info "* uuid-install: ${uuidinstall}" +fn_script_log_info "* uuid-hardware: ${uuidhardware}" fn_script_log_info "* Game Name: ${gamename}" fn_script_log_info "* Distro Name: ${distroname}" fn_script_log_info "* Game Server CPU Used: ${cpuusedmhzroundup}MHz" diff --git a/lgsm/functions/install_complete.sh b/lgsm/functions/install_complete.sh index 70f4e5345..62eec08a2 100644 --- a/lgsm/functions/install_complete.sh +++ b/lgsm/functions/install_complete.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Prints installation completion message and hints. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "=================================" diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index 1837d4084..63589b81c 100644 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Creates default server configs. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Checks if server cfg dir exists, creates it if it doesn't. fn_check_cfgdir(){ @@ -27,7 +25,7 @@ fn_fetch_default_config(){ mkdir -p "${lgsmdir}/config-default/config-game" githuburl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master" for config in "${array_configs[@]}"; do - fn_fetch_file "${githuburl}/${gamedirname}/${config}" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "forcedl" "nomd5" + fn_fetch_file "${githuburl}/${gamedirname}/${config}" "${remote_fileurl_backup}" "GitHub" "Bitbucket" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "forcedl" "nomd5" done } @@ -144,21 +142,50 @@ fn_set_dst_config_vars(){ echo -e "" } +# Lists local config file locations +fn_list_config_locations(){ + echo -e "" + echo -e "${lightyellow}Config File Locations${default}" + echo -e "=================================" + if [ -n "${servercfgfullpath}" ]; then + if [ -f "${servercfgfullpath}" ]; then + echo -e "Game Server Config File: ${servercfgfullpath}" + elif [ -d "${servercfgfullpath}" ]; then + echo -e "Game Server Config Dir: ${servercfgfullpath}" + else + echo -e "Config file: ${red}${servercfgfullpath} (${red}FILE MISSING${default})" + fi + fi + echo -e "LinuxGSM Config: ${lgsmdir}/config-lgsm/${gameservername}" + echo -e "Documentation: https://docs.linuxgsm.com/configuration/game-server-config" + echo -e "" +} + if [ "${shortname}" == "sdtd" ]; then gamedirname="7DaysToDie" fn_default_config_local + fn_list_config_locations +elif [ "${shortname}" == "ac" ]; then + gamedirname="AssettoCorsa" + 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "ark" ]; then gamedirname="ARKSurvivalEvolved" fn_check_cfgdir @@ -166,6 +193,7 @@ elif [ "${shortname}" == "ark" ]; then fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "arma3" ]; then gamedirname="Arma3" fn_check_cfgdir @@ -173,18 +201,21 @@ elif [ "${shortname}" == "arma3" ]; then 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "bo" ]; then gamedirname="BaseDefense" array_configs+=( server.cfg ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "bt" ]; then gamedirname="Barotrauma" fn_check_cfgdir @@ -192,6 +223,7 @@ elif [ "${shortname}" == "bt" ]; then fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "bt1944" ]; then gamedirname="Battalion1944" fn_check_cfgdir @@ -199,120 +231,147 @@ elif [ "${shortname}" == "bt1944" ]; then 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 ) 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 ) + 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "dods" ]; then gamedirname="DayOfDefeatSource" 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "dst" ]; then gamedirname="DontStarveTogether" fn_check_cfgdir @@ -320,138 +379,161 @@ elif [ "${shortname}" == "dst" ]; then 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "ges" ]; then gamedirname="GoldenEyeSource" 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "mc" ]; then gamedirname="Minecraft" 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "mh" ]; then gamedirname="Mordhau" fn_check_cfgdir @@ -459,41 +541,55 @@ elif [ "${shortname}" == "mh" ]; then 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 ) 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "mta" ]; then gamedirname="MultiTheftAuto" fn_check_cfgdir array_configs+=( acl.xml mtaserver.conf vehiclecolors.conf ) fn_fetch_default_config fn_default_config_remote + fn_list_config_locations +elif [ "${shotname}" == "mom" ];then + gamedirname="MemoriesofMars" + 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 ) fn_fetch_default_config fn_default_config_remote + fn_list_config_locations elif [ "${shortname}" == "pvkii" ]; then gamedirname="PiratesVikingandKnightsII" array_configs+=( server.cfg ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "pz" ]; then gamedirname="ProjectZomboid" fn_check_cfgdir @@ -501,30 +597,35 @@ elif [ "${shortname}" == "pz" ]; then 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "q2" ]; then gamedirname="Quake2" 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 ) 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 ) 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 ) @@ -537,113 +638,132 @@ elif [ "${shortname}" == "qw" ]; then 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "rust" ]; then gamedirname="Rust" fn_check_cfgdir array_configs+=( server.cfg ) fn_fetch_default_config fn_default_config_remote + fn_list_config_locations elif [ "${shortname}" == "samp" ]; then gamedirname="SanAndreasMultiplayer" array_configs+=( server.cfg ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "ss3" ]; then gamedirname="SeriousSam3BFE" array_configs+=( server.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 ) 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) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "tu" ]; then gamedirname="TowerUnite" fn_check_cfgdir @@ -651,64 +771,75 @@ elif [ "${shortname}" == "tu" ]; then 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "wurm" ]; then gamedirname="WurmUnlimited" 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 ) 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 ) fn_fetch_default_config fn_default_config_remote fn_set_config_vars + fn_list_config_locations fi diff --git a/lgsm/functions/install_dst_token.sh b/lgsm/functions/install_dst_token.sh index 247280a56..7eab2a153 100644 --- a/lgsm/functions/install_dst_token.sh +++ b/lgsm/functions/install_dst_token.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Configures Don't Starve Together cluster with given token. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Enter ${gamename} Cluster Token${default}" diff --git a/lgsm/functions/install_eula.sh b/lgsm/functions/install_eula.sh index d7893b16c..cd51954d0 100644 --- a/lgsm/functions/install_eula.sh +++ b/lgsm/functions/install_eula.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Gets user to accept the EULA. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + if [ "${shortname}" == "ts3" ]; then eulaurl="https://www.teamspeak.com/en/privacy-and-terms" elif [ "${shortname}" == "mc" ]; then @@ -25,7 +27,7 @@ if [ -z "${autoinstall}" ]; then if ! fn_prompt_yn "Continue?" Y; then core_exit.sh fi -elif [ "${function_selfname}" == "command_start.sh" ]; then +elif [ "${commandname}" == "START" ]; then fn_print_info "By continuing you are indicating your agreement to the EULA." echo -e "" sleep 5 diff --git a/lgsm/functions/install_factorio_save.sh b/lgsm/functions/install_factorio_save.sh index 5abdc4069..71690a7a7 100644 --- a/lgsm/functions/install_factorio_save.sh +++ b/lgsm/functions/install_factorio_save.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Creates the initial save file for Factorio -local modulename="INSTALL" -local commandaction="Install" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Creating initial Factorio savefile${default}" diff --git a/lgsm/functions/install_gslt.sh b/lgsm/functions/install_gslt.sh index 3162f669c..27d384936 100644 --- a/lgsm/functions/install_gslt.sh +++ b/lgsm/functions/install_gslt.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Configures GSLT. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Game Server Login Token${default}" diff --git a/lgsm/functions/install_header.sh b/lgsm/functions/install_header.sh index bd2e4524b..f67860dd4 100644 --- a/lgsm/functions/install_header.sh +++ b/lgsm/functions/install_header.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Prints installation header. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" clear fn_print_ascii_logo diff --git a/lgsm/functions/install_logs.sh b/lgsm/functions/install_logs.sh index bb4fdd2b8..21c63ccbb 100644 --- a/lgsm/functions/install_logs.sh +++ b/lgsm/functions/install_logs.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Creates log directories. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "${checklogs}" != "1" ]; then echo -e "" @@ -98,5 +96,4 @@ if [ -d "${rootdir}/Steam/logs" ]; then fi fi fi -fn_sleep_time fn_script_log_info "Logs installed" diff --git a/lgsm/functions/install_modules.sh b/lgsm/functions/install_modules.sh new file mode 100644 index 000000000..c512b69a3 --- /dev/null +++ b/lgsm/functions/install_modules.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# LinuxGSM install_modules.sh function +# Author: Daniel Gibbs +# Website: https://linuxgsm.com +# Description: Downloads all modules on install + +echo -e "" +echo -e "${lightyellow}Downloading LinuxGSM Modules${default}" +echo -e "=================================" + +fn_fetch_file "https://github.com/GameServerManagers/LinuxGSM/archive/master.tar.gz" "${tmpdir}" "master.tar.gz" "nochmodx" "norun" "noforce" "nomd5" +fn_dl_extract "${tmpdir}" "master.tar.gz" "${tmpdir}" +cp "${tmpdir}/LinuxGSM-master/lgsm/functions"/*.sh "${functionsdir}" +cp "${tmpdir}/LinuxGSM-master/lgsm/functions"/*.py "${functionsdir}" +chmod +x "${functionsdir}"/* +command_update_linuxgsm.sh diff --git a/lgsm/functions/install_mta_resources.sh b/lgsm/functions/install_mta_resources.sh index fb7bb012b..194d9f546 100644 --- a/lgsm/functions/install_mta_resources.sh +++ b/lgsm/functions/install_mta_resources.sh @@ -5,9 +5,7 @@ # Website: https://linuxgsm.com # Description: Installs the libmysqlclient for database functions on the server and optionally installs default resources required to run the server -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_information_nl "${gamename} will not function without resources!" echo -e " * install default resources using ./${selfname} install-default-resources" diff --git a/lgsm/functions/install_retry.sh b/lgsm/functions/install_retry.sh index 15cbf938e..2d6e3df7b 100644 --- a/lgsm/functions/install_retry.sh +++ b/lgsm/functions/install_retry.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Asks for installation retry after failure. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if fn_prompt_yn "Retry install?" Y; then command_install.sh; core_exit.sh diff --git a/lgsm/functions/install_server_dir.sh b/lgsm/functions/install_server_dir.sh index 006264a06..cfd586dc4 100644 --- a/lgsm/functions/install_server_dir.sh +++ b/lgsm/functions/install_server_dir.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Creates the server directory. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Server Directory${default}" diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index f2ea6c3ea..b24000464 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -4,69 +4,67 @@ # Website: https://linuxgsm.com # Description: Installs server files. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_server_files(){ if [ "${shortname}" == "ahl" ]; then - remote_fileurl="http://linuxgsm.download/ActionHalfLife/action_halflife-1.0.tar.bz2"; local_filedir="${tmpdir}"; local_filename="action_halflife-1.0.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="31430e670692b2eeaa0d1217db4dcb73" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="bf1942_lnxded-1.61-hacked-to-1.612.full.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="a86a5d3cd64ca59abcc9bb9f777c2e5d" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="brainbread-v1.2-linuxserver.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="5c729a7e9eecfa81b71a6a1f7267f0fd" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="cod-lnxded-1.5-large.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="19629895a4cf6fd8f6d1ee198b5304cd" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="coduo-lnxded-1.51b-full.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="f1804ef13036e2b4ab535db000b19e97" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="cod2-lnxded-1.3-full.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="078128f83d06dc3d7699428dc2870214" + 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_1772_dedrun.tar.bz2"; local_filedir="${tmpdir}"; local_filename="cod4x18_1772_dedrun.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="de29f29d79f9cc24574b838daa501e46" + remote_fileurl="http://linuxgsm.download/CallOfDuty4/cod4x18_1790_lnxded.tar.xz"; local_filedir="${tmpdir}"; local_filename="cod4x18_1790_lnxded.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="30609db2afde09d22498fbab3a427d11" elif [ "${shortname}" == "codwaw" ]; then - remote_fileurl="http://linuxgsm.download/CallOfDutyWorldAtWar/codwaw-lnxded-1.7-full.tar.bz2"; local_filedir="${tmpdir}"; local_filename="codwaw-lnxded-1.7-full.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="0489697ff3bf678c109bfb377d1b7895" + 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.75-i386-et-260b.tar.bz2"; local_filedir="${tmpdir}"; local_filename="etlegacy-v2.75-i386-et-260b.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="92d7d4c26e0a295daed78cef623eeabb" + remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/etlegacy-v2.76-i386-et-260b.tar.xz"; local_filedir="${tmpdir}"; local_filename="etlegacy-v2.75-i386-et-260b.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="178a00233cec1e25b69d130107ce1a79" elif [ "${shortname}" == "ges" ]; then - remote_fileurl="http://linuxgsm.download/GoldenEyeSource/GoldenEye_Source_v5.0.6_full_server.tar.bz2"; local_filedir="${tmpdir}"; local_filename="GoldenEye_Source_v5.0.6_full_server.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="c45c16293096706e8b5e2cd64a6f2931" + remote_fileurl="http://linuxgsm.download/GoldenEyeSource/GoldenEye_Source_v5.0.6_full_server.tar.xz"; local_filedir="${tmpdir}"; local_filename="GoldenEye_Source_v5.0.6_full_server.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="e31481f280eed40c9145816bd4f6dc45" elif [ "${shortname}" == "mohaa" ]; then - remote_fileurl="http://linuxgsm.download/MedalofHonorAlliedAssault/moh_revival_v1.12_RC3.5.1.tar.bz2"; local_filedir="${tmpdir}"; local_filename="moh_revival_v1.12_RC3.5.1.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="9d5924486a0cf5e46dd063216aad05c1" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="ns_dedicated_server_v32.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="499cf63324b76925ada6baf5f2eacd67" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="quake2-3.20-glibc-i386-full-linux2.0.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="0b8c7e2d51f40b56b328c69e986e7c5f" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="quake3-1.32c-x86-full-linux.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="fd7258d827474f67663dda297bff4306" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="nquake.server.linux.190506.full.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="74405ec030463c5e1175e776ab572d32" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="iortcw-1.51c-x86_64-server-linux-20190507.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="6a3be9700372b228d1187422464e4212" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="SFClassic-1.0-RC7-fix.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="e0d4cfd298a8a356053f92b1fa7d1002" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="sof2gold-1.03.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="871b1dc0dafeeace65b198119e8fa200" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="ts-3-linux-final.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="38e8a8325339f85a7745117802f940b7" + 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-2-ultimate-linux.tar.bz2"; local_filedir="${tmpdir}"; local_filename="ut2004-server-3369-2-ultimate-linux.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54" + 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-451-ultimate-linux.tar.bz2"; local_filedir="${tmpdir}"; local_filename="ut99-server-451-ultimate-linux.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="49cb24d0550ff6ddeaba6007045c6edd" + remote_fileurl="http://linuxgsm.download/UnrealTournament99/ut99-server-451-ultimate-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="ut99-server-451-ultimate-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="42c6839f8cb95907eeef71a1838aa1f7" elif [ "${shortname}" == "ut" ]; then - remote_fileurl="http://linuxgsm.download/UnrealTournament/UnrealTournament-Server-XAN-3525360-Linux.zip"; local_filedir="${tmpdir}"; local_filename="UnrealTournament-Server-XAN-3525360-Linux.zip"; chmodx="noexecute" run="norun"; force="noforce"; md5="cad730ad6793ba6261f9a341ad7396eb" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="UT3-linux-server-2.1.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2527437b46f1b47f20228d27d72395a6" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="vs_l-6.0_full.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="38a79e44b98578bbdc5b15818493a066" + 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.bz2"; local_filedir="${tmpdir}"; local_filename="enemy-territory.260b.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="f833f514bfcdd46b42c111f83350c5a7" + 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" - elif [ "${shortname}" == "sol" ]; then - remote_fileurl="https://static.soldat.pl/downloads/soldatserver2.8.1_1.7.1.zip"; local_filedir="${tmpdir}"; local_filename="soldatserver2.8.1_1.7.1.zip"; chmodx="nochmodx" run="norun"; force="noforce"; md5="994409c28520425965dec5c71ccb55e1" elif [ "${shortname}" == "zmr" ]; then - remote_fileurl="http://linuxgsm.download/ZombieMasterReborn/zombie_master_reborn_b5_2.tar.bz2"; local_filedir="${tmpdir}"; local_filename="zombie_master_reborn_b5_2.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="d52ef2db376f5d21e3a4ceca85ec8761" + remote_fileurl="http://linuxgsm.download/ZombieMasterReborn/zombie_master_reborn_b5_2.tar.xz"; local_filedir="${tmpdir}"; local_filename="zombie_master_reborn_b5_2.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="4b9b9832e863d03981a40c26065792a6" fi - fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + fn_fetch_file "${remote_fileurl}" "" "" "" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}" } @@ -105,22 +103,45 @@ fn_install_server_files_steamcmd(){ fi if [ "${counter}" -le "4" ]; then + # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. if [ "${appid}" == "90" ]; then - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit - local exitcode=$? + # If using a specific branch. + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit + fi + elif [ "${shortname}" == "ac" ]; then + ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit + # All other servers. else - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit - local exitcode=$? + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update -beta "${branch}" +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit + fi fi + local exitcode=$? elif [ "${counter}" -ge "5" ]; then - if [ "${engine}" == "goldsource" ]; then - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" validate +quit + # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. + if [ "${appid}" == "90" ]; then + # If using a specific branch. + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" validate +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" validate +quit + fi local exitcode=$? - elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then - ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -beta "${branch}" -validate +quit + elif [ "${shortname}" == "ac" ]||[ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then + ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit local exitcode=$? + # All other servers. else - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit + fi local exitcode=$? fi fi @@ -131,14 +152,18 @@ fn_install_server_files_steamcmd(){ fi done - # Goldsource servers commonly fail to download all the server files required. + # GoldSrc (appid 90) servers commonly fail to download all the server files required. # Validating a few of times may reduce the chance of this issue. - if [ "${engine}" == "goldsource" ]; then - fn_print_information_nl "Goldsource servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue." + if [ "${appid}" == "90" ]; then + fn_print_information_nl "GoldSrc servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue." counter="0" while [ "${counter}" -le "4" ]; do counter=$((counter+1)) - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" validate +quit + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" validate +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" validate +quit + fi local exitcode=$? done fi diff --git a/lgsm/functions/install_squad_license.sh b/lgsm/functions/install_squad_license.sh index cd8ba87b6..b17b1ab7e 100644 --- a/lgsm/functions/install_squad_license.sh +++ b/lgsm/functions/install_squad_license.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Configures the Squad server's license. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Squad Server License${default}" diff --git a/lgsm/functions/install_stats.sh b/lgsm/functions/install_stats.sh index 4a00edd49..355b7fa67 100644 --- a/lgsm/functions/install_stats.sh +++ b/lgsm/functions/install_stats.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Enabled LinuxGSM Stats. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}LinuxGSM Stats${default}" diff --git a/lgsm/functions/install_steamcmd.sh b/lgsm/functions/install_steamcmd.sh index 9a2415079..40acf435b 100644 --- a/lgsm/functions/install_steamcmd.sh +++ b/lgsm/functions/install_steamcmd.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Downloads SteamCMD on install. -local modulename="INSTALL" -local commandaction="Install" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Installing SteamCMD${default}" diff --git a/lgsm/functions/install_ts3db.sh b/lgsm/functions/install_ts3db.sh index cf8831dd3..a77a0ea38 100644 --- a/lgsm/functions/install_ts3db.sh +++ b/lgsm/functions/install_ts3db.sh @@ -5,9 +5,7 @@ # Website: https://linuxgsm.com # Description: Installs the database server MariaDB for TeamSpeak 3. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_ts3db_mariadb(){ if [ ! -f "${serverfiles}/libts3db_mariadb.so" ]; then diff --git a/lgsm/functions/install_ut2k4_key.sh b/lgsm/functions/install_ut2k4_key.sh index c5eff82e6..144ac278e 100644 --- a/lgsm/functions/install_ut2k4_key.sh +++ b/lgsm/functions/install_ut2k4_key.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Activates ut2k4 server with given key. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Enter ${gamename} CD Key${default}" diff --git a/lgsm/functions/mods_core.sh b/lgsm/functions/mods_core.sh index 68f791dbd..da2576207 100644 --- a/lgsm/functions/mods_core.sh +++ b/lgsm/functions/mods_core.sh @@ -5,9 +5,7 @@ # Website: https://linuxgsm.com # Description: Core functions for mods list/install/update/remove -local modulename="MODS" -local commandaction="Mods" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Files and Directories. modsdir="${lgsmdir}/mods" @@ -20,7 +18,7 @@ modsinstalledlistfullpath="${modsdir}/${modsinstalledlist}" # Download management. fn_mod_install_files(){ - fn_fetch_file "${modurl}" "${modstmpdir}" "${modfilename}" + fn_fetch_file "${modurl}" "" "" "" "${modstmpdir}" "${modfilename}" # Check if variable is valid checking if file has been downloaded and exists. if [ ! -f "${modstmpdir}/${modfilename}" ]; then fn_print_failure "An issue occurred downloading ${modprettyname}" @@ -61,7 +59,6 @@ fn_mod_lowercase(){ else fn_print_ok_eol_nl fi - fn_sleep_time fi } @@ -84,7 +81,6 @@ fn_mod_create_filelist(){ if [ -f "${modsdir}/.removedfiles.tmp" ]; then cat "${modsdir}/.removedfiles.tmp" >> "${modsdir}/${modcommand}-files.txt" fi - fn_sleep_time } # Copy the mod into serverfiles. @@ -394,7 +390,6 @@ fn_create_mods_dir(){ fn_print_ok_eol_nl fn_script_log_pass "Creating mod download dir ${modsdir}" fi - fn_sleep_time fi # Create mod install directory. if [ ! -d "${modinstalldir}" ]; then @@ -409,7 +404,6 @@ fn_create_mods_dir(){ fn_print_ok_eol_nl fn_script_log_pass "Creating mod install directory ${modinstalldir}" fi - fn_sleep_time fi # Create lgsm/data/${modsinstalledlist}. diff --git a/lgsm/functions/mods_list.sh b/lgsm/functions/mods_list.sh index 8037f1eed..6485faa45 100644 --- a/lgsm/functions/mods_list.sh +++ b/lgsm/functions/mods_list.sh @@ -8,9 +8,7 @@ # Usage: Then add this array to the mods_global_array. # Usage: If needed, you can scrape the download URL first. -local modulename="MODS" -local commandaction="List Mods" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Get a proper URL for mods that don't provide a good one (optional) fn_script_log_info "Retrieving latest mods URLs" @@ -39,7 +37,7 @@ get5url="${get5downloadurl}" # Oxide oxiderustlatestlink="https://umod.org/games/rust/download/develop" # fix for linux build 06.09.2019 oxidehurtworldlatestlink=$(curl -sL https://api.github.com/repos/OxideMod/Oxide.Hurtworld/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep "Oxide.Hurtworld.zip") -oxidesdtdlatestlink=$(curl -sL https://api.github.com/repos/OxideMod/Oxide.SevenDaysToDie/releases/latest | grep browser_download_url | cut -d '"' -f 4) +oxidesdtdlatestlink=$(curl -sL https://api.github.com/repos/OxideMod/Oxide.SevenDaysToDie/releases/latest | jq -r '.assets[]|select(.browser_download_url | contains("linux")) | .browser_download_url' ) # Define mods information (required) diff --git a/lgsm/functions/query_gamedig.sh b/lgsm/functions/query_gamedig.sh index 4f1bc5638..071645b49 100644 --- a/lgsm/functions/query_gamedig.sh +++ b/lgsm/functions/query_gamedig.sh @@ -5,6 +5,8 @@ # Description: Querys a gameserver using node-gamedig. # https://github.com/sonicsnes/node-gamedig +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 @@ -14,31 +16,34 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; # checks if query is working null = pass. gamedigcmd=$(echo -e "gamedig --type \"${querytype}\" --host \"${ip}\" --query_port \"${queryport}\"|jq") gamedigraw=$(gamedig --type "${querytype}" --host "${ip}" --query_port "${queryport}") - querystatus=$(echo -e "${gamedigraw}" | jq '.error|length') + querystatus=$(echo "${gamedigraw}" | jq '.error|length') if [ "${querystatus}" != "null" ]; then gamedigcmd=$(echo -e "gamedig --type \"${querytype}\" --host \"${ip}\" --port \"${queryport}\"|jq") gamedigraw=$(gamedig --type "${querytype}" --host "${ip}" --port "${queryport}") - querystatus=$(echo -e "${gamedigraw}" | jq '.error|length') - + querystatus=$(echo "${gamedigraw}" | jq '.error|length') fi # server name. - gdname=$(echo -e "${gamedigraw}" | jq -re '.name') + gdname=$(echo "${gamedigraw}" | jq -re '.name') if [ "${gdname}" == "null" ]; then unset gdname fi # numplayers. - gdplayers=$(echo -e "${gamedigraw}" | jq -re '.players') + if [ "${querytype}" == "minecraft" ]; then + gdplayers=$(echo "${gamedigraw}" | jq -re '.players | length-1') + else + gdplayers=$(echo "${gamedigraw}" | jq -re '.players | length') + fi if [ "${gdplayers}" == "null" ]; then unset gdplayers - elif [ "${gdplayers}" == "[]" ]; then + elif [ "${gdplayers}" == "[]" ] || [ "${gdplayers}" == "-1" ]; then gdplayers=0 fi # maxplayers. - gdmaxplayers=$(echo -e "${gamedigraw}" | jq -re '.maxplayers') + gdmaxplayers=$(echo "${gamedigraw}" | jq -re '.maxplayers') if [ "${gdmaxplayers}" == "null" ]; then unset maxplayers elif [ "${gdmaxplayers}" == "[]" ]; then @@ -46,19 +51,19 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; fi # current map. - gdmap=$(echo -e "${gamedigraw}" | jq -re '.map') + gdmap=$(echo "${gamedigraw}" | jq -re '.map') if [ "${gdmap}" == "null" ]; then unset gdmap fi # current gamemode. - gdgamemode=$(echo -e "${gamedigraw}" | jq -re '.raw.rules.GameMode_s') + gdgamemode=$(echo "${gamedigraw}" | jq -re '.raw.rules.GameMode_s') if [ "${gdgamemode}" == "null" ]; then unset gdgamemode fi # numbots. - gdbots=$(echo -e "${gamedigraw}" | jq -re '.raw.numbots') + gdbots=$(echo "${gamedigraw}" | jq -re '.bots | length') if [ "${gdbots}" == "null" ]||[ "${gdbots}" == "0" ]; then unset gdbots fi diff --git a/lgsm/functions/query_gsquery.py b/lgsm/functions/query_gsquery.py index f6e3ce168..376f704b7 100644 --- a/lgsm/functions/query_gsquery.py +++ b/lgsm/functions/query_gsquery.py @@ -17,16 +17,18 @@ class gsquery: self.server_response_timeout = 5 self.default_buffer_length = 1024 # - sourcequery=['protocol-valve','avalanche3.0','barotrauma','madness','quakelive','realvirtuality','refractor','source','goldsource','spark','starbound','unity3d','unreal4','wurm'] + 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: self.query_prompt_string = b'\xFF\xFF\xFF\xFFTSource Engine Query\0' elif self.option.engine in idtech2query: @@ -41,12 +43,16 @@ class gsquery: 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: self.query_prompt_string = b'\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08' + elif self.option.engine in 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: self.query_prompt_string = b'\x5C\x69\x6E\x66\x6F\x5C' elif self.option.engine in unreal2query: self.query_prompt_string = b'\x79\x00\x00\x00\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 unreal3query: + self.query_prompt_string = b'\xFE\xFD\x09\x00\x00\x00\x00' self.connected = False self.response = None @@ -81,7 +87,7 @@ class gsquery: # Response. if self.response is None: self.fatal_error('No response', 3) - if len(self.response) < 10: + if len(self.response) < 5: sys.exit('Short response.', 3) else: self.exit_success(str(self.response)) @@ -116,7 +122,7 @@ if __name__ == '__main__': action='store', dest='engine', default=False, - help='Engine type: protocol-valve protocol-quake3 protocol-quake3 protocol-gamespy1 protocol-unreal2 minecraft minecraftbe jc2mp mumbleping teeworlds' + help='Engine type: protocol-valve protocol-quake3 protocol-quake3 protocol-gamespy1 protocol-unreal2 ut3 minecraft minecraftbe jc2mp mumbleping soldat teeworlds' ) parser.add_option( '-v', '--verbose', diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh index e5a3a4397..5ff67c448 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/functions/update_factorio.sh @@ -4,12 +4,10 @@ # Website: https://linuxgsm.com # Description: Handles updating of Factorio servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_factorio_dl(){ - fn_fetch_file "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" + fn_fetch_file "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" "" "" "" "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" "" "norun" "noforce" "nomd5" fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" cp -R "${tmpdir}/factorio/"* "${serverfiles}" @@ -22,12 +20,13 @@ fn_update_factorio_dl(){ fn_print_fail_eol_nl fn_script_log_fatal "Copying to ${serverfiles}" core_exit.sh + fn_clear_tmp fi } fn_update_factorio_localbuild(){ # Gets local build info. - fn_print_dots "Checking for update: ${remotelocation}: checking local build" + fn_print_dots "Checking local build: ${remotelocation}" # Uses executable to find local build. cd "${executabledir}" || exit if [ -f "${executable}" ]; then @@ -45,14 +44,14 @@ 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 [ "${installer}" != "1" ]; then - fn_print_dots "Checking for update: ${remotelocation}: checking remote build" + fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh else - fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_print_ok "Checking remote build: ${remotelocation}" fn_script_log_pass "Checking remote build" fi else @@ -68,6 +67,7 @@ fn_update_factorio_remotebuild(){ 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 @@ -76,9 +76,10 @@ fn_update_factorio_compare(){ echo -e "Update available" echo -e "* Local build: ${red}${localbuild} ${factorioarch}${default}" echo -e "* Remote build: ${green}${remotebuild} ${factorioarch}${default}" - if [ -v "${branch}" ]; then + if [ -n "${branch}" ]; then echo -e "* Branch: ${branch}" fi + echo -en "\n" fn_script_log_info "Update available" fn_script_log_info "Local build: ${localbuild} ${factorioarch}" fn_script_log_info "Remote build: ${remotebuild} ${factorioarch}" @@ -86,18 +87,8 @@ fn_update_factorio_compare(){ fn_script_log_info "Branch: ${branch}" fi fn_script_log_info "${localbuild} > ${remotebuild}" - fn_sleep_time - echo -en "\n" - echo -en "applying update.\r" - sleep 1 - echo -en "applying update..\r" - sleep 1 - echo -en "applying update...\r" - sleep 1 - echo -en "\n" unset updateonstart - check_status.sh # If server stopped. if [ "${status}" == "0" ]; then @@ -109,6 +100,7 @@ fn_update_factorio_compare(){ command_stop.sh # If server started. else + fn_stop_warning exitbypass=1 command_stop.sh exitbypass=1 @@ -116,6 +108,7 @@ fn_update_factorio_compare(){ exitbypass=1 command_start.sh fi + date +%s > "${lockdir}/lastupdate.lock" alert="update" alert.sh else @@ -127,6 +120,7 @@ fn_update_factorio_compare(){ if [ -v "${branch}" ]; then echo -e "* Branch: ${branch}" fi + echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild} ${factorioarch}" fn_script_log_info "Remote build: ${remotebuild} ${factorioarch}" @@ -136,6 +130,21 @@ fn_update_factorio_compare(){ fi } +fn_stop_warning(){ + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update" +} + # The location where the builds are checked and downloaded. remotelocation="factorio.com" @@ -154,6 +163,7 @@ if [ "${installer}" == "1" ]; then fn_update_factorio_remotebuild fn_update_factorio_dl else + fn_print_dots "Checking for update" fn_print_dots "Checking for update: ${remotelocation}" fn_script_log_info "Checking for update: ${remotelocation}" fn_update_factorio_localbuild diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index 706aa7832..556097bd6 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Minecraft servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_minecraft_dl(){ if [ "${branch}" == "release" ]; then @@ -16,7 +14,7 @@ fn_update_minecraft_dl(){ fi latestmcbuildurl=$(curl -s "${latestmcreleaselink}" | jq -r '.downloads.server.url') - fn_fetch_file "${latestmcbuildurl}" "${tmpdir}" "minecraft_server.${remotebuild}.jar" + fn_fetch_file "${latestmcbuildurl}" "" "" "" "${tmpdir}" "minecraft_server.${remotebuild}.jar" "" "norun" "noforce" "nomd5" echo -e "copying to ${serverfiles}...\c" cp "${tmpdir}/minecraft_server.${remotebuild}.jar" "${serverfiles}/minecraft_server.jar" local exitcode=$? @@ -28,20 +26,21 @@ fn_update_minecraft_dl(){ else fn_print_fail_eol_nl fn_script_log_fatal "Copying to ${serverfiles}" + fn_clear_tmp core_exit.sh fi } fn_update_minecraft_localbuild(){ # Gets local build info. - fn_print_dots "Checking for update: ${remotelocation}: checking local build" + fn_print_dots "Checking local build: ${remotelocation}" # Uses log file to gather info. # Gives time for log file to generate. if [ ! -f "${serverfiles}/logs/latest.log" ]; then - fn_print_error "Checking for update: ${remotelocation}: checking local build" - fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no log files" - fn_script_log_error "No log file found" - fn_print_info_nl "Checking for update: ${remotelocation}: checking local build: forcing server restart" + 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" + fn_script_log_error "No log files containing version info" fn_script_log_info "Forcing server restart" exitbypass=1 command_stop.sh @@ -51,7 +50,7 @@ fn_update_minecraft_localbuild(){ # Check again, allow time to generate logs. while [ ! -f "${serverfiles}/logs/latest.log" ]; do sleep 1 - fn_print_info "Checking for update: ${remotelocation}: checking local build: waiting for log file: ${totalseconds}" + fn_print_info "Checking local build: ${remotelocation}: waiting for log file: ${totalseconds}" if [ -v "${loopignore}" ]; then loopignore=1 fn_script_log_info "Waiting for log file to generate" @@ -59,7 +58,7 @@ fn_update_minecraft_localbuild(){ if [ "${totalseconds}" -gt "120" ]; then localbuild="0" - fn_print_error "Checking for update: ${remotelocation}: waiting for log file: missing log file" + fn_print_error "Checking local build: ${remotelocation}: waiting for log file: missing log file" fn_script_log_error "Missing log file" fn_script_log_error "Set localbuild to 0" fi @@ -76,7 +75,7 @@ fn_update_minecraft_localbuild(){ # Gives time for var to generate. totalseconds=0 for seconds in {1..120}; do - fn_print_info "Checking for update: ${remotelocation}: checking local build: waiting for local build: ${totalseconds}" + fn_print_info "Checking local build: ${remotelocation}: waiting for local build: ${totalseconds}" if [ -z "${loopignore}" ]; then loopignore=1 fn_script_log_info "Waiting for local build to generate" @@ -92,11 +91,11 @@ fn_update_minecraft_localbuild(){ if [ -z "${localbuild}" ]; then localbuild="0" - fn_print_error "Checking for update: ${remotelocation}: waiting for local build: missing local build info" + fn_print_error "Checking local build: ${remotelocation}: waiting for local build: missing local build info" fn_script_log_error "Missing local build info" fn_script_log_error "Set localbuild to 0" else - fn_print_ok "Checking for update: ${remotelocation}: checking local build" + fn_print_ok "Checking local build: ${remotelocation}" fn_script_log_pass "Checking local build" fi } @@ -110,14 +109,14 @@ fn_update_minecraft_remotebuild(){ fi if [ "${installer}" != "1" ]; then - fn_print_dots "Checking for update: ${remotelocation}: checking remote build" + fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh else - fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_print_ok "Checking remote build: ${remotelocation}" fn_script_log_pass "Checking remote build" fi else @@ -139,6 +138,7 @@ fn_update_minecraft_compare(){ echo -e "Update available" echo -e "* Local build: ${red}${localbuild}${default}" echo -e "* Remote build: ${green}${remotebuild}${default}" + echo -en "\n" if [ -n "${branch}" ]; then echo -e "* Branch: ${branch}" fi @@ -146,18 +146,8 @@ fn_update_minecraft_compare(){ fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" fn_script_log_info "${localbuild} > ${remotebuild}" - fn_sleep_time - echo -en "\n" - echo -en "applying update.\r" - sleep 1 - echo -en "applying update..\r" - sleep 1 - echo -en "applying update...\r" - sleep 1 - echo -en "\n" unset updateonstart - check_status.sh # If server stopped. if [ "${status}" == "0" ]; then @@ -169,6 +159,7 @@ fn_update_minecraft_compare(){ command_stop.sh # If server started. else + fn_stop_warning exitbypass=1 command_stop.sh exitbypass=1 @@ -176,6 +167,7 @@ fn_update_minecraft_compare(){ exitbypass=1 command_start.sh fi + date +%s > "${lockdir}/lastupdate.lock" alert="update" alert.sh else @@ -187,6 +179,7 @@ fn_update_minecraft_compare(){ if [ -n "${branch}" ]; then echo -e "* Branch: ${branch}" fi + echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" @@ -196,6 +189,21 @@ fn_update_minecraft_compare(){ fi } +fn_stop_warning(){ + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update" +} + # The location where the builds are checked and downloaded. remotelocation="mojang.com" @@ -203,6 +211,7 @@ if [ "${installer}" == "1" ]; then fn_update_minecraft_remotebuild fn_update_minecraft_dl else + fn_print_dots "Checking for update" fn_print_dots "Checking for update: ${remotelocation}" fn_script_log_info "Checking for update: ${remotelocation}" fn_update_minecraft_localbuild diff --git a/lgsm/functions/update_minecraft_bedrock.sh b/lgsm/functions/update_minecraft_bedrock.sh index 00989d52c..61cad6854 100644 --- a/lgsm/functions/update_minecraft_bedrock.sh +++ b/lgsm/functions/update_minecraft_bedrock.sh @@ -4,13 +4,11 @@ # Website: https://linuxgsm.com # Description: Handles updating of Minecraft Bedrock servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_minecraft_dl(){ latestmcbuildurl=$(curl -s "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*zip') - fn_fetch_file "${latestmcbuildurl}" "${tmpdir}" "bedrock_server.${remotebuild}.zip" + fn_fetch_file "${latestmcbuildurl}" "" "" "" "${tmpdir}" "bedrock_server.${remotebuild}.zip" echo -e "Extracting to ${serverfiles}...\c" if [ "${installer}" == "1" ]; then unzip -oq "${tmpdir}/bedrock_server.${remotebuild}.zip" -x "server.properties" -d "${serverfiles}" @@ -26,49 +24,50 @@ fn_update_minecraft_dl(){ else fn_print_fail_eol_nl fn_script_log_fatal "Extracting to ${serverfiles}" + fn_clear_tmp core_exit.sh fi } fn_update_minecraft_localbuild(){ # Gets local build info. - fn_print_dots "Checking for update: ${remotelocation}: checking local build" + fn_print_dots "Checking local build: ${remotelocation}" # Uses log file to gather info. # Log is generated and cleared on startup but filled on shutdown. - - localbuild=$(grep Version $(ls -tr "${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 for update: ${remotelocation}: checking local build" - fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no log files containing version info" + 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" fn_script_log_error "No log files containing version info" - fn_print_info_nl "Checking for update: ${remotelocation}: checking local build: forcing server restart" fn_script_log_info "Forcing server restart" check_status.sh - if [ "${status}" != "0" ]; then - exitbypass=1 - command_stop.sh - else + # If server stopped. + if [ "${status}" == "0" ]; then exitbypass=1 command_start.sh sleep 3 exitbypass=1 command_stop.sh + # If server started. + else + exitbypass=1 + command_stop.sh fi 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 localbuild="0" - fn_print_error "Checking for update: ${remotelocation}: waiting for local build: missing local build info" + fn_print_error "Checking local build: ${remotelocation}: waiting for local build: missing local build info" fn_script_log_error "Missing local build info" fn_script_log_error "Set localbuild to 0" else - fn_print_ok "Checking for update: ${remotelocation}: checking local build" + fn_print_ok "Checking local build: ${remotelocation}" fn_script_log_pass "Checking local build" fi } @@ -77,14 +76,14 @@ fn_update_minecraft_remotebuild(){ # Gets remote build info. remotebuild=$(curl -s "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]") if [ "${installer}" != "1" ]; then - fn_print_dots "Checking for update: ${remotelocation}: checking remote build" + fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh else - fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_print_ok "Checking remote build: ${remotelocation}" fn_script_log_pass "Checking remote build" fi else @@ -108,22 +107,13 @@ fn_update_minecraft_compare(){ echo -e "Update available" echo -e "* Local build: ${red}${localbuild}${default}" echo -e "* Remote build: ${green}${remotebuild}${default}" + echo -en "\n" fn_script_log_info "Update available" fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" fn_script_log_info "${localbuild} > ${remotebuild}" - fn_sleep_time - echo -en "\n" - echo -en "applying update.\r" - sleep 1 - echo -en "applying update..\r" - sleep 1 - echo -en "applying update...\r" - sleep 1 - echo -en "\n" unset updateonstart - check_status.sh # If server stopped. if [ "${status}" == "0" ]; then @@ -135,6 +125,7 @@ fn_update_minecraft_compare(){ command_stop.sh # If server started. else + fn_stop_warning exitbypass=1 command_stop.sh exitbypass=1 @@ -142,6 +133,7 @@ fn_update_minecraft_compare(){ exitbypass=1 command_start.sh fi + date +%s > "${lockdir}/lastupdate.lock" alert="update" alert.sh else @@ -150,12 +142,28 @@ fn_update_minecraft_compare(){ echo -e "No update available" echo -e "* Local build: ${green}${localbuild}${default}" echo -e "* Remote build: ${green}${remotebuild}${default}" + echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" fi } +fn_stop_warning(){ + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update" +} + # The location where the builds are checked and downloaded. remotelocation="minecraft.net" @@ -163,7 +171,7 @@ if [ "${installer}" == "1" ]; then fn_update_minecraft_remotebuild fn_update_minecraft_dl else - check_status.sh + fn_print_dots "Checking for update" fn_print_dots "Checking for update: ${remotelocation}" fn_script_log_info "Checking for update: ${remotelocation}" fn_update_minecraft_localbuild diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh index 373b3e823..5aaecc122 100644 --- a/lgsm/functions/update_mta.sh +++ b/lgsm/functions/update_mta.sh @@ -4,22 +4,20 @@ # Website: https://linuxgsm.com # Description: Handles updating of Multi Theft Auto servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_mta_dl(){ - fn_fetch_file "http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz" "${tmpdir}" "multitheftauto_linux_x64.tar.gz" + fn_fetch_file "http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz" "" "" "" "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "" "norun" "noforce" "nomd5" mkdir "${tmpdir}/multitheftauto_linux_x64" fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "${tmpdir}/multitheftauto_linux_x64" echo -e "copying to ${serverfiles}...\c" cp -R "${tmpdir}/multitheftauto_linux_x64/multitheftauto_linux_x64/"* "${serverfiles}" local exitcode=$? + fn_clear_tmp if [ "${exitcode}" == "0" ]; then fn_print_ok_eol_nl fn_script_log_pass "Copying to ${serverfiles}" chmod u+x "${serverfiles}/mta-server64" - fn_clear_tmp else fn_print_fail_eol_nl fn_script_log_fatal "Copying to ${serverfiles}" @@ -29,14 +27,14 @@ fn_update_mta_dl(){ fn_update_mta_localbuild(){ # Gets local build info. - fn_print_dots "Checking for update: ${remotelocation}: checking local build" + fn_print_dots "Checking local build: ${remotelocation}" # Uses log file to gather info. # Gives time for log file to generate. if [ ! -f "${serverfiles}/mods/deathmatch/logs/server.log" ]; then - fn_print_error "Checking for update: ${remotelocation}: checking local build" - fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no log files" - fn_script_log_error "No log file found" - fn_print_info_nl "Checking for update: ${remotelocation}: checking local build: forcing server restart" + 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" + fn_script_log_error "No log files containing version info" fn_script_log_info "Forcing server restart" exitbypass=1 command_stop.sh @@ -46,7 +44,7 @@ fn_update_mta_localbuild(){ # Check again, allow time to generate logs. while [ ! -f "${serverfiles}/mods/deathmatch/logs/server.log" ]; do sleep 1 - fn_print_info "Checking for update: ${remotelocation}: checking local build: waiting for log file: ${totalseconds}" + fn_print_info "Checking local build: ${remotelocation}: waiting for log file: ${totalseconds}" if [ -v "${loopignore}" ]; then loopignore=1 fn_script_log_info "Waiting for log file to generate" @@ -54,7 +52,7 @@ fn_update_mta_localbuild(){ if [ "${totalseconds}" -gt "120" ]; then localbuild="0" - fn_print_error "Checking for update: ${remotelocation}: waiting for log file: missing log file" + fn_print_error "Checking local build: ${remotelocation}: waiting for log file: missing log file" fn_script_log_error "Missing log file" fn_script_log_error "Set localbuild to 0" fi @@ -69,10 +67,9 @@ fn_update_mta_localbuild(){ if [ -z "${localbuild}" ]; then # Gives time for var to generate. - end=$((SECONDS+120)) totalseconds=0 - while [ "${SECONDS}" -lt "${end}" ]; do - fn_print_info "Checking for update: ${remotelocation}: checking local build: waiting for local build: ${totalseconds}" + for seconds in {1..120}; do + fn_print_info "Checking local build: ${remotelocation}: waiting for local build: ${totalseconds}" if [ -z "${loopignore}" ]; then loopignore=1 fn_script_log_info "Waiting for local build to generate" @@ -88,11 +85,11 @@ fn_update_mta_localbuild(){ if [ -z "${localbuild}" ]; then localbuild="0" - fn_print_error "Checking for update: ${remotelocation}: waiting for local build: missing local build info" + fn_print_error "Checking local build: ${remotelocation}: waiting for local build: missing local build info" fn_script_log_error "Missing local build info" fn_script_log_error "Set localbuild to 0" else - fn_print_ok "Checking for update: ${remotelocation}: checking local build" + fn_print_ok "Checking local build: ${remotelocation}" fn_script_log_pass "Checking local build" fi } @@ -104,14 +101,14 @@ fn_update_mta_remotebuild(){ maintenanceversion=$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MAINTENANCE" | awk '{ print $3 }' | sed 's/\r//g') remotebuild="${majorversion}.${minorversion}.${maintenanceversion}" if [ "${installer}" != "1" ]; then - fn_print_dots "Checking for update: ${remotelocation}: checking remote build" + fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh else - fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_print_ok "Checking remote build: ${remotelocation}" fn_script_log_pass "Checking remote build" fi else @@ -141,22 +138,13 @@ fn_update_mta_compare(){ echo -e "Update ${mtaupdatestatus}:" echo -e "* Local build: ${red}${localbuild}${default}" echo -e "* Remote build: ${green}${remotebuild}${default}" + echo -en "\n" fn_script_log_info "Update available" fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" fn_script_log_info "${localbuild} > ${remotebuild}" - fn_sleep_time - echo -en "\n" - echo -en "applying update.\r" - sleep 1 - echo -en "applying update..\r" - sleep 1 - echo -en "applying update...\r" - sleep 1 - echo -en "\n" unset updateonstart - check_status.sh # If server stopped. if [ "${status}" == "0" ]; then @@ -168,6 +156,7 @@ fn_update_mta_compare(){ command_stop.sh # If server started. else + fn_stop_warning exitbypass=1 command_stop.sh exitbypass=1 @@ -175,6 +164,7 @@ fn_update_mta_compare(){ exitbypass=1 command_start.sh fi + date +%s > "${lockdir}/lastupdate.lock" alert="update" alert.sh else @@ -183,12 +173,28 @@ fn_update_mta_compare(){ echo -e "No update available" echo -e "* Local build: ${green}${localbuild}${default}" echo -e "* Remote build: ${green}${remotebuild}${default}" + echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" fi } +fn_stop_warning(){ + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update" +} + # The location where the builds are checked and downloaded. remotelocation="linux.mtasa.com" @@ -196,6 +202,7 @@ if [ "${installer}" == "1" ]; then fn_update_mta_remotebuild fn_update_mta_dl else + fn_print_dots "Checking for update" fn_print_dots "Checking for update: ${remotelocation}" fn_script_log_info "Checking for update: ${remotelocation}" fn_update_mta_localbuild diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh index c17bd8036..ee6a2b0ad 100644 --- a/lgsm/functions/update_mumble.sh +++ b/lgsm/functions/update_mumble.sh @@ -4,12 +4,10 @@ # Website: https://linuxgsm.com # Description: Handles updating of Mumble servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" 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" + 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" "nomd5" fn_dl_extract "${tmpdir}" "murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" cp -R "${tmpdir}/murmur-static_${mumblearch}-${remotebuild}/"* "${serverfiles}" @@ -21,22 +19,23 @@ fn_update_mumble_dl(){ else fn_print_fail_eol_nl fn_script_log_fatal "Copying to ${serverfiles}" + fn_clear_tmp core_exit.sh fi } fn_update_mumble_localbuild(){ # Gets local build info. - fn_print_dots "Checking for update: ${remotelocation}: checking local build" + 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}') - fn_print_ok "Checking for update: ${remotelocation}: checking local build" + fn_print_ok "Checking local build: ${remotelocation}" fn_script_log_pass "Checking local build" else localbuild="0" - fn_print_error "Checking for update: ${remotelocation}: checking local build" + fn_print_error "Checking local build: ${remotelocation}" fn_script_log_error "Checking local build" fi } @@ -45,14 +44,14 @@ 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 [ "${installer}" != "1" ]; then - fn_print_dots "Checking for update: ${remotelocation}: checking remote build" + fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh else - fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_print_ok "Checking remote build: ${remotelocation}" fn_script_log_pass "Checking remote build" fi else @@ -76,22 +75,13 @@ fn_update_mumble_compare(){ echo -e "Update available" echo -e "* Local build: ${red}${localbuild} ${mumblearch}${default}" echo -e "* Remote build: ${green}${remotebuild} ${mumblearch}${default}" + echo -en "\n" fn_script_log_info "Update available" fn_script_log_info "Local build: ${localbuild} ${mumblearch}" fn_script_log_info "Remote build: ${remotebuild} ${mumblearch}" fn_script_log_info "${localbuild} > ${remotebuild}" - fn_sleep_time - echo -en "\n" - echo -en "applying update.\r" - sleep 1 - echo -en "applying update..\r" - sleep 1 - echo -en "applying update...\r" - sleep 1 - echo -en "\n" unset updateonstart - check_status.sh # If server stopped. if [ "${status}" == "0" ]; then @@ -103,6 +93,7 @@ fn_update_mumble_compare(){ command_stop.sh # If server started. else + fn_stop_warning exitbypass=1 command_stop.sh exitbypass=1 @@ -110,6 +101,7 @@ fn_update_mumble_compare(){ exitbypass=1 command_start.sh fi + date +%s > "${lockdir}/lastupdate.lock" alert="update" alert.sh else @@ -118,12 +110,28 @@ fn_update_mumble_compare(){ echo -e "No update available" echo -e "* Local build: ${green}${localbuild} ${mumblearch}${default}" echo -e "* Remote build: ${green}${remotebuild} ${mumblearch}${default}" + echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild} ${mumblearch}" fn_script_log_info "Remote build: ${remotebuild} ${mumblearch}" fi } +fn_stop_warning(){ + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update" +} + # The location where the builds are checked and downloaded. remotelocation="mumble.info" diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index 5268ee5fd..7c9644933 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -4,13 +4,10 @@ # Website: https://linuxgsm.com # Description: Handles updating using SteamCMD. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_steamcmd_dl(){ info_config.sh - # Detects if unbuffer command is available for 32 bit distributions only. info_distro.sh if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then @@ -19,28 +16,35 @@ fn_update_steamcmd_dl(){ if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit fi + + # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. if [ "${appid}" == "90" ]; then - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" - elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then - ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${scriptlog}" + # If using a specific branch. + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit | tee -a "${lgsmlog}" + fi + elif [ "${shortname}" == "ac" ]||[ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then + ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit + # All other servers. else - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit | tee -a "${lgsmlog}" + fi fi fix.sh } fn_update_steamcmd_localbuild(){ # Gets local build info. - fn_print_dots "Checking for update: ${remotelocation}: checking local build" + fn_print_dots "Checking local build: ${remotelocation}" fn_appmanifest_check # Uses appmanifest to find local build. localbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) - # Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD. - if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then - rm -f "${HOME}/Steam/appcache/appinfo.vdf" - fi - # Set branch for updateinfo. IFS=' ' read -ra branchsplits <<< "${branch}" if [ "${#branchsplits[@]}" -gt 1 ]; then @@ -48,7 +52,16 @@ fn_update_steamcmd_localbuild(){ else branchname="public" fi - fn_sleep_time + + # Checks if localbuild variable has been set. + if [ -z "${localbuild}" ]||[ "${localbuild}" == "null" ]; then + fn_print_fail "Checking local build: ${remotelocation}" + fn_script_log_fatal "Checking local build" + core_exit.sh + else + fn_print_ok "Checking local build: ${remotelocation}" + fn_script_log_pass "Checking local build" + fi } fn_update_steamcmd_remotebuild(){ @@ -56,16 +69,22 @@ fn_update_steamcmd_remotebuild(){ if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit fi + + # Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD. + if [ "$(find "${HOME}" -type f -name "appinfo.vdf" | wc -l)" -ne "0" ]; then + find "${HOME}" -type f -name "appinfo.vdf" -exec rm -f {} \; + fi + remotebuild=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed '1,/branches/d' | sed "1,/${branchname}/d" | grep -m 1 buildid | tr -cd '[:digit:]') if [ "${installer}" != "1" ]; then - fn_print_dots "Checking for update: ${remotelocation}: checking remote build" + fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh else - fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_print_ok "Checking remote build: ${remotelocation}" fn_script_log_pass "Checking remote build" fi else @@ -90,6 +109,7 @@ fn_update_steamcmd_compare(){ echo -e "* Branch: ${branch}" fi echo -e "https://steamdb.info/app/${appid}/" + echo -en "\n" fn_script_log_info "Update available" fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" @@ -97,24 +117,15 @@ fn_update_steamcmd_compare(){ fn_script_log_info "Branch: ${branch}" fi fn_script_log_info "${localbuild} > ${remotebuild}" - fn_sleep_time - echo -en "\n" - echo -en "applying update.\r" - sleep 1 - echo -en "applying update..\r" - sleep 1 - echo -en "applying update...\r" - sleep 1 - echo -en "\n" unset updateonstart - check_status.sh # If server stopped. if [ "${status}" == "0" ]; then fn_update_steamcmd_dl # If server started. else + fn_stop_warning exitbypass=1 command_stop.sh exitbypass=1 @@ -122,6 +133,7 @@ fn_update_steamcmd_compare(){ exitbypass=1 command_start.sh fi + date +%s > "${lockdir}/lastupdate.lock" alert="update" alert.sh else @@ -134,6 +146,7 @@ fn_update_steamcmd_compare(){ echo -e "* Branch: ${branch}" fi echo -e "https://steamdb.info/app/${appid}/" + echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" @@ -153,7 +166,6 @@ fn_appmanifest_check(){ # Multiple or no matching appmanifest files may sometimes be present. # This error is corrected if required. if [ "${appmanifestfilewc}" -ge "2" ]; then - fn_sleep_time fn_print_error "Multiple appmanifest_${appid}.acf files found" fn_script_log_error "Multiple appmanifest_${appid}.acf files found" fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files" @@ -162,10 +174,11 @@ fn_appmanifest_check(){ done appmanifestfilewc1="${appmanifestfilewc}" fn_appmanifest_info + # if error can not be resolved. if [ "${appmanifestfilewc}" -ge "2" ]; then fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" fn_script_log_fatal "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" - echo -e " * Check user permissions" + echo -e "* Check user permissions" for appfile in ${appmanifestfile}; do echo -e " ${appfile}" done @@ -192,24 +205,43 @@ fn_appmanifest_check(){ fi } +fn_stop_warning(){ + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update" +} + # The location where the builds are checked and downloaded. remotelocation="SteamCMD" - -check.sh +check_steamcmd.sh if [ "${forceupdate}" == "1" ]; then # forceupdate bypasses update checks. check_status.sh if [ "${status}" != "0" ]; then + fn_stop_warning exitbypass=1 command_stop.sh fn_update_steamcmd_dl + date +%s > "${lockdir}/lastupdate.lock" exitbypass=1 command_start.sh else fn_update_steamcmd_dl + date +%s > "${lockdir}/lastupdate.lock" fi else + fn_print_dots "Checking for update" + fn_print_dots "Checking for update: ${remotelocation}" fn_update_steamcmd_localbuild fn_update_steamcmd_remotebuild fn_update_steamcmd_compare diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index 893d34205..a5cc0dd60 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Teamspeak 3 servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_ts3_dl(){ if [ "${ts3arch}" == "amd64" ]; then @@ -14,7 +12,7 @@ fn_update_ts3_dl(){ elif [ "${ts3arch}" == "x86" ]; then remotebuildurl=$(curl -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86.mirrors."teamspeak.com"') fi - fn_fetch_file "${remotebuildurl}" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${remotebuild}.tar.bz2" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${remotebuild}.tar.bz2" "" "norun" "noforce" "nomd5" fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${remotebuild}.tar.bz2" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${serverfiles}" @@ -26,21 +24,21 @@ fn_update_ts3_dl(){ else fn_print_fail_eol_nl fn_script_log_fatal "Copying to ${serverfiles}" + fn_clear_tmp core_exit.sh fi } fn_update_ts3_localbuild(){ # Gets local build info. - fn_print_dots "Checking for update: ${remotelocation}: checking local build" - fn_sleep_time + fn_print_dots "Checking local build: ${remotelocation}" # Uses log file to gather info. # Gives time for log file to generate. if [ ! -d "${serverfiles}/logs" ]||[ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; then - fn_print_error "Checking for update: ${remotelocation}: checking local build" - fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no log files" - fn_script_log_error "No log file found" - fn_print_info_nl "Checking for update: ${remotelocation}: checking local build: forcing server restart" + 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" + fn_script_log_error "No log files containing version info" fn_script_log_info "Forcing server restart" exitbypass=1 command_stop.sh @@ -50,7 +48,7 @@ fn_update_ts3_localbuild(){ # Check again, allow time to generate logs. while [ ! -d "${serverfiles}/logs" ]||[ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; do sleep 1 - fn_print_info "Checking for update: ${remotelocation}: checking local build: waiting for log file: ${totalseconds}" + fn_print_info "Checking local build: ${remotelocation}: waiting for log file: ${totalseconds}" if [ -v "${loopignore}" ]; then loopignore=1 fn_script_log_info "Waiting for log file to generate" @@ -58,7 +56,7 @@ fn_update_ts3_localbuild(){ if [ "${totalseconds}" -gt "120" ]; then localbuild="0" - fn_print_error "Checking for update: ${remotelocation}: waiting for log file: missing log file" + fn_print_error "Checking local build: ${remotelocation}: waiting for log file: missing log file" fn_script_log_error "Missing log file" fn_script_log_error "Set localbuild to 0" fi @@ -73,16 +71,15 @@ fn_update_ts3_localbuild(){ if [ -z "${localbuild}" ]; then # Gives time for var to generate. - end=$((SECONDS+120)) totalseconds=0 - while [ "${SECONDS}" -lt "${end}" ]; do - fn_print_info "Checking for update: ${remotelocation}: checking local build: waiting for local build: ${totalseconds}" + for seconds in {1..120}; do + fn_print_info "Checking local build: ${remotelocation}: waiting for local build: ${totalseconds}" if [ -z "${loopignore}" ]; then loopignore=1 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}" ]; then + if [ "${localbuild}" ]||[ "${seconds}" == "120" ]; then break fi sleep 1 @@ -92,11 +89,11 @@ fn_update_ts3_localbuild(){ if [ -z "${localbuild}" ]; then localbuild="0" - fn_print_error "Checking for update: ${remotelocation}: waiting for local build: missing local build info" + fn_print_error "Checking local build: ${remotelocation}: waiting for local build: missing local build info" fn_script_log_error "Missing local build info" fn_script_log_error "Set localbuild to 0" else - fn_print_ok "Checking for update: ${remotelocation}: checking local build" + fn_print_ok "Checking local build: ${remotelocation}" fn_script_log_pass "Checking local build" fi } @@ -109,14 +106,14 @@ fn_update_ts3_remotebuild(){ remotebuild=$(curl -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86.version') fi if [ "${installer}" != "1" ]; then - fn_print_dots "Checking for update: ${remotelocation}: checking remote build" + fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh else - fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_print_ok "Checking remote build: ${remotelocation}" fn_script_log_pass "Checking remote build" fi else @@ -144,18 +141,8 @@ fn_update_ts3_compare(){ fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" fn_script_log_info "${localbuild} > ${remotebuild}" - fn_sleep_time - echo -en "\n" - echo -en "applying update.\r" - sleep 1 - echo -en "applying update..\r" - sleep 1 - echo -en "applying update...\r" - sleep 1 - echo -en "\n" unset updateonstart - check_status.sh # If server stopped. if [ "${status}" == "0" ]; then @@ -167,6 +154,7 @@ fn_update_ts3_compare(){ command_stop.sh # If server started. else + fn_stop_warning exitbypass=1 command_stop.sh exitbypass=1 @@ -174,6 +162,7 @@ fn_update_ts3_compare(){ exitbypass=1 command_start.sh fi + date +%s > "${lockdir}/lastupdate.lock" alert="update" alert.sh else @@ -182,6 +171,7 @@ fn_update_ts3_compare(){ echo -e "No update available" echo -e "* Local build: ${green}${localbuild}${default}" echo -e "* Remote build: ${green}${remotebuild}${default}" + echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuild}" @@ -200,6 +190,21 @@ else core_exit.sh fi +fn_stop_warning(){ + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update" +} + # The location where the builds are checked and downloaded. remotelocation="teamspeak.com" @@ -207,6 +212,7 @@ if [ "${installer}" == "1" ]; then fn_update_ts3_remotebuild fn_update_ts3_dl else + fn_print_dots "Checking for update" fn_print_dots "Checking for update: ${remotelocation}" fn_script_log_info "Checking for update: ${remotelocation}" fn_update_ts3_localbuild diff --git a/linuxgsm.sh b/linuxgsm.sh index dcef2be1f..aececaed8 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -1,7 +1,7 @@ #!/bin/bash # Project: Game Server Managers - LinuxGSM # Author: Daniel Gibbs -# License: MIT License, Copyright (c) 2019 Daniel Gibbs +# License: MIT License, Copyright (c) 2020 Daniel Gibbs # Purpose: Linux Game Server Management Script # Contributors: https://linuxgsm.com/contrib # Documentation: https://docs.linuxgsm.com @@ -20,20 +20,22 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.1.2" +version="v20.3.3" shortname="core" gameservername="core" +commandname="CORE" rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") -lockselfname=".${selfname}.lock" +sessionname=$(echo "${selfname}" | cut -f1 -d".") lgsmdir="${rootdir}/lgsm" logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" -steamcmddir="${rootdir}/steamcmd" +steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" functionsdir="${lgsmdir}/functions" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" +lockdir="${lgsmdir}/lock" serverlist="${datadir}/serverlist.csv" serverlistmenu="${datadir}/serverlistmenu.csv" configdir="${lgsmdir}/config-lgsm" @@ -58,46 +60,97 @@ core_functions.sh(){ # Fetches the core functions required before passed off to core_dl.sh. fn_bootstrap_fetch_file(){ remote_fileurl="${1}" - local_filedir="${2}" - local_filename="${3}" - chmodx="${4:-0}" - run="${5:-0}" - forcedl="${6:-0}" - md5="${7:-0}" + remote_fileurl_backup="${2}" + remote_fileurl_name="${3}" + remote_fileurl_backup_name="${4}" + local_filedir="${5}" + local_filename="${6}" + chmodx="${7:-0}" + run="${8:-0}" + forcedl="${9:-0}" + md5="${10:-0}" # Download file if missing or download forced. if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then - if [ ! -d "${local_filedir}" ]; then - mkdir -p "${local_filedir}" + # 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 ) + else + # counter set to 1 to not allow second try + counter=1 + remote_fileurls_array=( remote_fileurl ) fi - # If curl exists download file. - if [ "$(command -v curl 2>/dev/null)" ]; then - # Trap to remove part downloaded files. - echo -en " fetching ${local_filename}...\c" - curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) + for remote_fileurl_array in "${remote_fileurls_array[@]}" + do + if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then + fileurl="${remote_fileurl}" + fileurl_name="${remote_fileurl_name}" + elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then + fileurl="${remote_fileurl_backup}" + fileurl_name="${remote_fileurl_backup_name}" + fi + 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. + + echo -en "fetching ${fileurl_name} ${local_filename}...\c" + curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}" 2>&1) + 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 + rm "${local_filedir:?}/${local_filename:?}" + local exitcode=2 + fi + fi + + # On first try will error. On second try will fail. if [ ${exitcode} -ne 0 ]; then - echo -e "FAIL" - if [ -f "${lgsmlog}" ]; then - echo -e "${remote_fileurl}" | tee -a "${lgsmlog}" - echo -e "${curlcmd}" | tee -a "${lgsmlog}" + if [ ${counter} -ge 2 ]; then + echo -e "FAIL" + if [ -f "${lgsmlog}" ]; then + fn_script_log_fatal "Downloading ${local_filename}" + fn_script_log_fatal "${fileurl}" + fi + core_exit.sh + else + echo -e "ERROR" + if [ -f "${lgsmlog}" ]; then + fn_script_log_error "Downloading ${local_filename}" + fn_script_log_error "${fileurl}" + fi fi - exit 1 else - echo -e "OK" + echo -en "OK" + sleep 0.3 + echo -en "\033[2K\\r" + if [ -f "${lgsmlog}" ]; then + fn_script_log_pass "Downloading ${local_filename}" + fi + + # Make file executable if chmodx is set. + if [ "${chmodx}" == "chmodx" ]; then + chmod +x "${local_filedir}/${local_filename}" + fi + + # Remove trap. + trap - INT + + break fi - else - echo -e "[ FAIL ] Curl is not installed" - exit 1 - fi - # Make file chmodx if chmodx is set. - if [ "${chmodx}" == "chmodx" ]; then - chmod +x "${local_filedir}/${local_filename}" - fi + done fi if [ -f "${local_filedir}/${local_filename}" ]; then - # Run file if run is set. + # Execute file if run is set. if [ "${run}" == "run" ]; then # shellcheck source=/dev/null source "${local_filedir}/${local_filename}" @@ -108,9 +161,15 @@ fn_bootstrap_fetch_file(){ fn_bootstrap_fetch_file_github(){ github_file_url_dir="${1}" github_file_url_name="${2}" - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - - remote_fileurl="${githuburl}" + if [ "${githubbranch}" == "master" ]&&[ "${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 + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + fi + remote_fileurl_name="GitHub" + remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" local_filename="${github_file_url_name}" chmodx="${4:-0}" @@ -118,7 +177,7 @@ fn_bootstrap_fetch_file_github(){ forcedl="${6:-0}" md5="${7:-0}" # Passes vars to the file download function. - fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } # Installer menu. @@ -320,10 +379,9 @@ else fi if [ ! -f "${configdirserver}/_default.cfg" ]; then mkdir -p "${configdirserver}" - echo -en " copying _default.cfg...\c" + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" - exitcode=$? - if [ ${exitcode} -ne 0 ]; then + if [ $? -ne 0 ]; then echo -e "FAIL" exit 1 else @@ -332,11 +390,10 @@ else else function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") if [ "${function_file_diff}" != "" ]; then - fn_print_warn_nl "_default.cfg has been altered. reloading config." - echo -en " copying _default.cfg...\c" + fn_print_warn_nl "_default.cfg has altered. reloading config." + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" - exitcode=$? - if [ ${exitcode} -ne 0 ]; then + if [ $? -ne 0 ]; then echo -e "FAIL" exit 1 else diff --git a/tests/tests_defaultcfg/defaultcfg_1.txt b/tests/tests_defaultcfg/defaultcfg_1.txt index 9a4df6c0b..505b6b1f0 100644 --- a/tests/tests_defaultcfg/defaultcfg_1.txt +++ b/tests/tests_defaultcfg/defaultcfg_1.txt @@ -39,8 +39,8 @@ # 6: q # 7: exit # 8: 7 Days to Die -# 9: Gold Source -# 10: Teamspeak 3 +# 9: GoldSrc +# 10: Avorion ## Game Server Details # Do not edit #### Directories #### diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index 67008f883..da71c2b5a 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -1,7 +1,7 @@ #!/bin/bash # Project: Game Server Managers - LinuxGSM # Author: Daniel Gibbs -# License: MIT License, Copyright (c) 2019 Daniel Gibbs +# License: MIT License, Copyright (c) 2020 Daniel Gibbs # Purpose: Travis CI Tests: Factorio | Linux Game Server Management Script # Contributors: https://linuxgsm.com/contrib # Documentation: https://docs.linuxgsm.com @@ -20,20 +20,22 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v19.9.0" +version="v20.3.3" shortname="fctr" gameservername="fctrserver" +commandname="CORE" rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") -lockselfname=".${selfname}.lock" +sessionname=$(echo "${selfname}" | cut -f1 -d".") lgsmdir="${rootdir}/lgsm" logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" -steamcmddir="${rootdir}/steamcmd" +steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" functionsdir="${lgsmdir}/functions" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" +lockdir="${lgsmdir}/lock" serverlist="${datadir}/serverlist.csv" serverlistmenu="${datadir}/serverlistmenu.csv" configdir="${lgsmdir}/config-lgsm" @@ -41,15 +43,13 @@ configdirserver="${configdir}/${gameservername}" configdirdefault="${lgsmdir}/config-default" userinput="${1}" -# Allows for testing not on Travis CI -if [ ! -v TRAVIS ]; then +# Allows for testing not on Travis CI. +# if using travis for tests +if [ -z "${TRAVIS}" ]; then TRAVIS_BRANCH="develop" TRAVIS_BUILD_DIR="${rootdir}" -else - selfname="travis" - travistest="1" fi - +travistest="1" ## GitHub Branch Select # Allows for the use of different function files # from a different repo and/or branch. @@ -67,46 +67,97 @@ core_functions.sh(){ # Fetches the core functions required before passed off to core_dl.sh. fn_bootstrap_fetch_file(){ remote_fileurl="${1}" - local_filedir="${2}" - local_filename="${3}" - chmodx="${4:-0}" - run="${5:-0}" - forcedl="${6:-0}" - md5="${7:-0}" + remote_fileurl_backup="${2}" + remote_fileurl_name="${3}" + remote_fileurl_backup_name="${4}" + local_filedir="${5}" + local_filename="${6}" + chmodx="${7:-0}" + run="${8:-0}" + forcedl="${9:-0}" + md5="${10:-0}" # Download file if missing or download forced. if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then - if [ ! -d "${local_filedir}" ]; then - mkdir -p "${local_filedir}" + # 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 ) + else + # counter set to 1 to not allow second try + counter=1 + remote_fileurls_array=( remote_fileurl ) fi - # If curl exists download file. - if [ "$(command -v curl 2>/dev/null)" ]; then - # Trap to remove part downloaded files. - echo -en " fetching ${local_filename}...\c" - curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) + for remote_fileurl_array in "${remote_fileurls_array[@]}" + do + if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then + fileurl="${remote_fileurl}" + fileurl_name="${remote_fileurl_name}" + elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then + fileurl="${remote_fileurl_backup}" + fileurl_name="${remote_fileurl_backup_name}" + fi + 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. + + echo -en "fetching ${fileurl_name} ${local_filename}...\c" + curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}" 2>&1) + 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 + rm "${local_filedir:?}/${local_filename:?}" + local exitcode=2 + fi + fi + + # On first try will error. On second try will fail. if [ ${exitcode} -ne 0 ]; then - echo -e "FAIL" - if [ -f "${lgsmlog}" ]; then - echo -e "${remote_fileurl}" | tee -a "${lgsmlog}" - echo -e "${curlcmd}" | tee -a "${lgsmlog}" + if [ ${counter} -ge 2 ]; then + echo -e "FAIL" + if [ -f "${lgsmlog}" ]; then + fn_script_log_fatal "Downloading ${local_filename}" + fn_script_log_fatal "${fileurl}" + fi + core_exit.sh + else + echo -e "ERROR" + if [ -f "${lgsmlog}" ]; then + fn_script_log_error "Downloading ${local_filename}" + fn_script_log_error "${fileurl}" + fi fi - exit 1 + else - echo -e "OK" + echo -en "OK" + sleep 0.3 + echo -en "\033[2K\\r" + if [ -f "${lgsmlog}" ]; then + fn_script_log_pass "Downloading ${local_filename}" + fi + + # Make file executable if chmodx is set. + if [ "${chmodx}" == "chmodx" ]; then + chmod +x "${local_filedir}/${local_filename}" + fi + + # Remove trap. + trap - INT + + break fi - else - echo -e "[ FAIL ] Curl is not installed" - exit 1 - fi - # Make file chmodx if chmodx is set. - if [ "${chmodx}" == "chmodx" ]; then - chmod +x "${local_filedir}/${local_filename}" - fi + done fi if [ -f "${local_filedir}/${local_filename}" ]; then - # Run file if run is set. + # Execute file if run is set. if [ "${run}" == "run" ]; then # shellcheck source=/dev/null source "${local_filedir}/${local_filename}" @@ -117,9 +168,15 @@ fn_bootstrap_fetch_file(){ fn_bootstrap_fetch_file_github(){ github_file_url_dir="${1}" github_file_url_name="${2}" - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - - remote_fileurl="${githuburl}" + if [ "${githubbranch}" == "master" ]&&[ "${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 + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + fi + remote_fileurl_name="GitHub" + remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" local_filename="${github_file_url_name}" chmodx="${4:-0}" @@ -127,7 +184,7 @@ fn_bootstrap_fetch_file_github(){ forcedl="${6:-0}" md5="${7:-0}" # Passes vars to the file download function. - fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } # Installer menu. @@ -329,7 +386,7 @@ else fi if [ ! -f "${configdirserver}/_default.cfg" ]; then mkdir -p "${configdirserver}" - echo -en " copying _default.cfg...\c" + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" exitcode=$? if [ ${exitcode} -ne 0 ]; then @@ -342,7 +399,7 @@ else function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") if [ "${function_file_diff}" != "" ]; then fn_print_warn_nl "_default.cfg has been altered. reloading config." - echo -en " copying _default.cfg...\c" + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" exitcode=$? if [ ${exitcode} -ne 0 ]; then @@ -353,19 +410,24 @@ else fi fi fi + # shellcheck source=/dev/null source "${configdirserver}/_default.cfg" # Load the common.cfg config. If missing download it. if [ ! -f "${configdirserver}/common.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null source "${configdirserver}/common.cfg" else + # shellcheck source=/dev/null source "${configdirserver}/common.cfg" fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" else + # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" fi @@ -377,7 +439,7 @@ else # Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off. fn_ansi_loader # Prevents running of core_exit.sh for Travis-CI. - if [ -z "${travistest}" ]; then + if [ "${travistest}" != "1" ]; then getopt=$1 core_getopt.sh fi @@ -392,15 +454,6 @@ fn_currentstatus_tmux(){ fi } -fn_currentstatus_ts3(){ - check_status.sh - if [ "${status}" != "0" ]; then - currentstatus="ONLINE" - else - currentstatus="OFFLINE" - fi -} - fn_setstatus(){ fn_currentstatus_tmux echo"" @@ -490,10 +543,61 @@ echo -e "" echo -e "=================================" echo -e "Server Tests" echo -e "Using: ${gamename}" -echo -e "Testing Branch: $TRAVIS_BRANCH" +echo -e "Testing Branch: ${TRAVIS_BRANCH}" +echo -e "=================================" + +echo -e "" +echo -e "Tests Summary" echo -e "=================================" +echo -e "0.0 - Pre-test Tasks" +echo -e "0.1 - Create log dir's" +echo -e "0.2 - Enable dev-debug" +echo -e "" +echo -e "1.0 - Pre-install tests" +echo -e "1.1 - start - no files" +echo -e "1.2 - getopt" +echo -e "1.3 - getopt with incorrect args" +echo -e "" +echo -e "2.0 - Installation" +echo -e "2.1 - install" +echo -e "" +echo -e "3.0 - Start/Stop/Restart Tests" +echo -e "3.1 - start" +echo -e "3.2 - start - online" +echo -e "3.3 - start - updateonstart" +echo -e "3.4 - stop" +echo -e "3.5 - stop - offline" +echo -e "3.6 - restart" +echo -e "3.7 - restart - offline" +echo -e "" +echo -e "4.0 - Update Tests" +echo -e "4.1 - update" +echo -e "4.2 - update-lgsm" +echo -e "" +echo -e "5.0 - Monitor Tests" +echo -e "5.1 - monitor - online" +echo -e "5.2 - monitor - offline - with lockfile" +echo -e "5.3 - monitor - offline - no lockfile" +echo -e "5.4 - test-alert" +echo -e "" +echo -e "6.0 - Details Tests" +echo -e "6.1 - details" +echo -e "6.2 - postdetails" +echo -e "" +echo -e "7.0 - Backup Tests" +echo -e "7.1 - backup" +echo -e "" +echo -e "8.0 - Development Tools Tests" +echo -e "8.1 - dev - detect glibc" +echo -e "8.2 - dev - detect ldd" +echo -e "8.3 - dev - detect deps" +echo -e "8.4 - dev - query-raw" echo -e "" +echo -e "9.0 - Donate" +echo -e "9.1 - donate" +echo -e "" + echo -e "0.0 - Pre-test Tasks" echo -e "==================================================================" echo -e "Description:" @@ -543,7 +647,7 @@ echo -e "test script reaction to missing server files." echo -e "Command: ./${gameservername} start" echo -e "" # Allows for testing not on Travis CI -if [ ! -v TRAVIS ]; then +if [ -z "${TRAVIS}" ]; then ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" @@ -591,7 +695,7 @@ getopt="abc123" set -x core_getopt.sh ) -fn_test_result_fail +fn_test_result_pass echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' @@ -601,7 +705,7 @@ echo -e "2.0 - Installation" echo -e "==================================================================" echo -e "" -echo -e "2.0 - install" +echo -e "2.1 - install" echo -e "=================================" echo -e "Description:" echo -e "install ${gamename} server." @@ -777,10 +881,31 @@ echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +echo -e "" +echo -e "4.2 - update-lgsm" +echo -e "=================================" +echo -e "Description:" +echo -e "update LinuxGSM." +echo -e "" +echo -e "Command: ./jc2server update-lgam" +requiredstatus="ONLINE" +fn_setstatus +( + exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_update_linuxgsm.sh +) +fn_test_result_pass +echo -e "run order" +echo -e "=================" +grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' + echo -e "" echo -e "5.0 - Monitor Tests" echo -e "==================================================================" echo -e "" +info_config.sh echo -e "Server IP - Port: ${ip}:${port}" echo -e "Server IP - Query Port: ${ip}:${queryport}" @@ -812,7 +937,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="OFFLINE" fn_setstatus fn_print_info_nl "creating lockfile." -date '+%s' > "${rootdir}/${lockselfname}" +date '+%s' > "${lockdir}/${selfname}.lock" ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" @@ -1003,6 +1128,30 @@ echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +echo -e "" + +echo -e "9.0 - Donate" +echo -e "==================================================================" + +echo -e "" +echo -e "9.1 - donate" +echo -e "=================================" +echo -e "Description:" +echo -e "donate." +echo -e "Command: ./${gameservername} donate" +requiredstatus="ONLINE" +fn_setstatus +( + exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_donate.sh +) +fn_test_result_pass +echo -e "run order" +echo -e "=================" +grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' + echo -e "" echo -e "=================================" echo -e "Server Tests - Complete!" @@ -1010,8 +1159,5 @@ echo -e "Using: ${gamename}" echo -e "=================================" requiredstatus="OFFLINE" fn_setstatus -if [ ! -v TRAVIS ]; then - fn_print_info "Tidying up directories." - rm -rfv "${serverfiles:?}" -fi + core_exit.sh diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index 949509814..b52cf1f1b 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -1,7 +1,7 @@ #!/bin/bash # Project: Game Server Managers - LinuxGSM # Author: Daniel Gibbs -# License: MIT License, Copyright (c) 2019 Daniel Gibbs +# License: MIT License, Copyright (c) 2020 Daniel Gibbs # Purpose: Travis CI Tests: Just Cause 2 | Linux Game Server Management Script # Contributors: https://linuxgsm.com/contrib # Documentation: https://docs.linuxgsm.com @@ -20,20 +20,22 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v19.9.0" +version="v20.3.3" shortname="jc2" gameservername="jc2server" +commandname="CORE" rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") -lockselfname=".${selfname}.lock" +sessionname=$(echo "${selfname}" | cut -f1 -d".") lgsmdir="${rootdir}/lgsm" logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" -steamcmddir="${rootdir}/steamcmd" +steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" functionsdir="${lgsmdir}/functions" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" +lockdir="${lgsmdir}/lock" serverlist="${datadir}/serverlist.csv" serverlistmenu="${datadir}/serverlistmenu.csv" configdir="${lgsmdir}/config-lgsm" @@ -41,14 +43,13 @@ configdirserver="${configdir}/${gameservername}" configdirdefault="${lgsmdir}/config-default" userinput="${1}" -# Allows for testing not on Travis CI -if [ ! -v TRAVIS ]; then +# Allows for testing not on Travis CI. +# if using travis for tests +if [ -z "${TRAVIS}" ]; then TRAVIS_BRANCH="develop" TRAVIS_BUILD_DIR="${rootdir}" -else - selfname="travis" - travistest="1" fi +travistest="1" ## GitHub Branch Select # Allows for the use of different function files @@ -67,46 +68,97 @@ core_functions.sh(){ # Fetches the core functions required before passed off to core_dl.sh. fn_bootstrap_fetch_file(){ remote_fileurl="${1}" - local_filedir="${2}" - local_filename="${3}" - chmodx="${4:-0}" - run="${5:-0}" - forcedl="${6:-0}" - md5="${7:-0}" + remote_fileurl_backup="${2}" + remote_fileurl_name="${3}" + remote_fileurl_backup_name="${4}" + local_filedir="${5}" + local_filename="${6}" + chmodx="${7:-0}" + run="${8:-0}" + forcedl="${9:-0}" + md5="${10:-0}" # Download file if missing or download forced. if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then - if [ ! -d "${local_filedir}" ]; then - mkdir -p "${local_filedir}" + # 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 ) + else + # counter set to 1 to not allow second try + counter=1 + remote_fileurls_array=( remote_fileurl ) fi - # If curl exists download file. - if [ "$(command -v curl 2>/dev/null)" ]; then - # Trap to remove part downloaded files. - echo -en " fetching ${local_filename}...\c" - curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) + for remote_fileurl_array in "${remote_fileurls_array[@]}" + do + if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then + fileurl="${remote_fileurl}" + fileurl_name="${remote_fileurl_name}" + elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then + fileurl="${remote_fileurl_backup}" + fileurl_name="${remote_fileurl_backup_name}" + fi + 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. + + echo -en "fetching ${fileurl_name} ${local_filename}...\c" + curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}" 2>&1) + 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 + rm "${local_filedir:?}/${local_filename:?}" + local exitcode=2 + fi + fi + + # On first try will error. On second try will fail. if [ ${exitcode} -ne 0 ]; then - echo -e "FAIL" - if [ -f "${lgsmlog}" ]; then - echo -e "${remote_fileurl}" | tee -a "${lgsmlog}" - echo -e "${curlcmd}" | tee -a "${lgsmlog}" + if [ ${counter} -ge 2 ]; then + echo -e "FAIL" + if [ -f "${lgsmlog}" ]; then + fn_script_log_fatal "Downloading ${local_filename}" + fn_script_log_fatal "${fileurl}" + fi + core_exit.sh + else + echo -e "ERROR" + if [ -f "${lgsmlog}" ]; then + fn_script_log_error "Downloading ${local_filename}" + fn_script_log_error "${fileurl}" + fi fi - exit 1 + else - echo -e "OK" + echo -en "OK" + sleep 0.3 + echo -en "\033[2K\\r" + if [ -f "${lgsmlog}" ]; then + fn_script_log_pass "Downloading ${local_filename}" + fi + + # Make file executable if chmodx is set. + if [ "${chmodx}" == "chmodx" ]; then + chmod +x "${local_filedir}/${local_filename}" + fi + + # Remove trap. + trap - INT + + break fi - else - echo -e "[ FAIL ] Curl is not installed" - exit 1 - fi - # Make file chmodx if chmodx is set. - if [ "${chmodx}" == "chmodx" ]; then - chmod +x "${local_filedir}/${local_filename}" - fi + done fi if [ -f "${local_filedir}/${local_filename}" ]; then - # Run file if run is set. + # Execute file if run is set. if [ "${run}" == "run" ]; then # shellcheck source=/dev/null source "${local_filedir}/${local_filename}" @@ -117,9 +169,15 @@ fn_bootstrap_fetch_file(){ fn_bootstrap_fetch_file_github(){ github_file_url_dir="${1}" github_file_url_name="${2}" - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - - remote_fileurl="${githuburl}" + if [ "${githubbranch}" == "master" ]&&[ "${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 + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + fi + remote_fileurl_name="GitHub" + remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" local_filename="${github_file_url_name}" chmodx="${4:-0}" @@ -127,7 +185,7 @@ fn_bootstrap_fetch_file_github(){ forcedl="${6:-0}" md5="${7:-0}" # Passes vars to the file download function. - fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } # Installer menu. @@ -242,7 +300,7 @@ fn_install_file(){ if [ -e "${local_filename}" ]; then i=2 while [ -e "${local_filename}-${i}" ] ; do - let i++ + (( i++ )) done local_filename="${local_filename}-${i}" fi @@ -329,7 +387,7 @@ else fi if [ ! -f "${configdirserver}/_default.cfg" ]; then mkdir -p "${configdirserver}" - echo -en " copying _default.cfg...\c" + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" exitcode=$? if [ ${exitcode} -ne 0 ]; then @@ -342,7 +400,7 @@ else function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") if [ "${function_file_diff}" != "" ]; then fn_print_warn_nl "_default.cfg has been altered. reloading config." - echo -en " copying _default.cfg...\c" + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" exitcode=$? if [ ${exitcode} -ne 0 ]; then @@ -353,19 +411,24 @@ else fi fi fi + # shellcheck source=/dev/null source "${configdirserver}/_default.cfg" # Load the common.cfg config. If missing download it. if [ ! -f "${configdirserver}/common.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null source "${configdirserver}/common.cfg" else + # shellcheck source=/dev/null source "${configdirserver}/common.cfg" fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" else + # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" fi @@ -377,7 +440,7 @@ else # Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off. fn_ansi_loader # Prevents running of core_exit.sh for Travis-CI. - if [ -z "${travistest}" ]; then + if [ "${travistest}" != "1" ]; then getopt=$1 core_getopt.sh fi @@ -392,15 +455,6 @@ fn_currentstatus_tmux(){ fi } -fn_currentstatus_ts3(){ - check_status.sh - if [ "${status}" != "0" ]; then - currentstatus="ONLINE" - else - currentstatus="OFFLINE" - fi -} - fn_setstatus(){ fn_currentstatus_tmux echo"" @@ -490,9 +544,64 @@ echo -e "" echo -e "=================================" echo -e "Server Tests" echo -e "Using: ${gamename}" -echo -e "Testing Branch: $TRAVIS_BRANCH" +echo -e "Testing Branch: ${TRAVIS_BRANCH}" echo -e "=================================" - +echo -e "" +echo -e "Tests Summary" +echo -e "=================================" +echo -e "0.0 - Pre-test Tasks" +echo -e "0.1 - Create log dir's" +echo -e "0.2 - Enable dev-debug" +echo -e "" +echo -e "1.0 - Pre-install tests" +echo -e "1.1 - start - no files" +echo -e "1.2 - getopt" +echo -e "1.3 - getopt with incorrect args" +echo -e "" +echo -e "2.0 - Installation" +echo -e "2.1 - install" +echo -e "" +echo -e "3.0 - Start/Stop/Restart Tests" +echo -e "3.1 - start" +echo -e "3.2 - start - online" +echo -e "3.3 - start - updateonstart" +echo -e "3.4 - stop" +echo -e "3.5 - stop - offline" +echo -e "3.6 - restart" +echo -e "3.7 - restart - offline" +echo -e "" +echo -e "4.0 - Update Tests" +echo -e "4.1 - update" +echo -e "4.2 - update - change buildid" +echo -e "4.3 - update - change buildid - online" +echo -e "4.4 - update - remove appmanifest file" +echo -e "4.5 - force-update" +echo -e "4.6 - force-update - online" +echo -e "4.7 - validate" +echo -e "4.8 - validate - online" +echo -e "4.9 - update-lgsm" +echo -e "" +echo -e "5.0 - Monitor Tests" +echo -e "5.1 - monitor - online" +echo -e "5.2 - monitor - offline - with lockfile" +echo -e "5.3 - monitor - offline - no lockfile" +echo -e "5.4 - test-alert" +echo -e "" +echo -e "6.0 - Details Tests" +echo -e "6.1 - details" +echo -e "6.2 - postdetails" +echo -e "" +echo -e "7.0 - Backup Tests" +echo -e "7.1 - backup" +echo -e "" +echo -e "8.0 - Development Tools Tests" +echo -e "8.1 - dev - detect glibc" +echo -e "8.2 - dev - detect ldd" +echo -e "8.3 - dev - detect deps" +echo -e "8.4 - dev - query-raw" +echo -e "" +echo -e "9.0 - Donate" +echo -e "9.1 - donate" echo -e "" echo -e "0.0 - Pre-test Tasks" echo -e "==================================================================" @@ -543,7 +652,7 @@ echo -e "test script reaction to missing server files." echo -e "Command: ./${gameservername} start" echo -e "" # Allows for testing not on Travis CI -if [ ! -v TRAVIS ]; then +if [ -z "${TRAVIS}" ]; then ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" @@ -591,7 +700,7 @@ getopt="abc123" set -x core_getopt.sh ) -fn_test_result_fail +fn_test_result_pass echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' @@ -601,7 +710,7 @@ echo -e "2.0 - Installation" echo -e "==================================================================" echo -e "" -echo -e "2.0 - install" +echo -e "2.1 - install" echo -e "=================================" echo -e "Description:" echo -e "install ${gamename} server." @@ -917,6 +1026,26 @@ echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +echo -e "" +echo -e "4.9 - update-lgsm" +echo -e "=================================" +echo -e "Description:" +echo -e "update LinuxGSM." +echo -e "" +echo -e "Command: ./jc2server update-lgam" +requiredstatus="ONLINE" +fn_setstatus +( + exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_update_linuxgsm.sh +) +fn_test_result_pass +echo -e "run order" +echo -e "=================" +grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' + echo -e "" echo -e "Inserting IP address" echo -e "=================================" @@ -935,6 +1064,7 @@ echo -e "" echo -e "5.0 - Monitor Tests" echo -e "==================================================================" echo -e "" +info_config.sh echo -e "Server IP - Port: ${ip}:${port}" echo -e "Server IP - Query Port: ${ip}:${queryport}" @@ -966,7 +1096,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="OFFLINE" fn_setstatus fn_print_info_nl "creating lockfile." -date '+%s' > "${rootdir}/${lockselfname}" +date '+%s' > "${lockdir}/${selfname}.lock" ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" @@ -1164,6 +1294,29 @@ echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +echo -e "" +echo -e "9.0 - Donate" +echo -e "==================================================================" + +echo -e "" +echo -e "9.1 - donate" +echo -e "=================================" +echo -e "Description:" +echo -e "donate." +echo -e "Command: ./${gameservername} donate" +requiredstatus="ONLINE" +fn_setstatus +( + exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_donate.sh +) +fn_test_result_pass +echo -e "run order" +echo -e "=================" +grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' + echo -e "" echo -e "=================================" echo -e "Server Tests - Complete!" @@ -1171,8 +1324,4 @@ echo -e "Using: ${gamename}" echo -e "=================================" requiredstatus="OFFLINE" fn_setstatus -if [ ! -v TRAVIS ]; then - fn_print_info "Tidying up directories." - rm -rfv "${serverfiles:?}" -fi core_exit.sh diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index 9e8bf266c..8d7bab6b6 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -1,7 +1,7 @@ #!/bin/bash # Project: Game Server Managers - LinuxGSM # Author: Daniel Gibbs -# License: MIT License, Copyright (c) 2019 Daniel Gibbs +# License: MIT License, Copyright (c) 2020 Daniel Gibbs # Purpose: Travis CI Tests: Minecraft | Linux Game Server Management Script # Contributors: https://linuxgsm.com/contrib # Documentation: https://docs.linuxgsm.com @@ -20,20 +20,22 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v19.9.0" +version="v20.3.3" shortname="mc" gameservername="mcserver" +commandname="CORE" rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") -lockselfname=".${selfname}.lock" +sessionname=$(echo "${selfname}" | cut -f1 -d".") lgsmdir="${rootdir}/lgsm" logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" -steamcmddir="${rootdir}/steamcmd" +steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" functionsdir="${lgsmdir}/functions" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" +lockdir="${lgsmdir}/lock" serverlist="${datadir}/serverlist.csv" serverlistmenu="${datadir}/serverlistmenu.csv" configdir="${lgsmdir}/config-lgsm" @@ -41,14 +43,13 @@ configdirserver="${configdir}/${gameservername}" configdirdefault="${lgsmdir}/config-default" userinput="${1}" -# Allows for testing not on Travis CI -if [ ! -v TRAVIS ]; then +# Allows for testing not on Travis CI. +# if using travis for tests +if [ -z "${TRAVIS}" ]; then TRAVIS_BRANCH="develop" TRAVIS_BUILD_DIR="${rootdir}" -else - selfname="travis" - travistest="1" fi +travistest="1" ## GitHub Branch Select # Allows for the use of different function files @@ -67,46 +68,97 @@ core_functions.sh(){ # Fetches the core functions required before passed off to core_dl.sh. fn_bootstrap_fetch_file(){ remote_fileurl="${1}" - local_filedir="${2}" - local_filename="${3}" - chmodx="${4:-0}" - run="${5:-0}" - forcedl="${6:-0}" - md5="${7:-0}" + remote_fileurl_backup="${2}" + remote_fileurl_name="${3}" + remote_fileurl_backup_name="${4}" + local_filedir="${5}" + local_filename="${6}" + chmodx="${7:-0}" + run="${8:-0}" + forcedl="${9:-0}" + md5="${10:-0}" # Download file if missing or download forced. if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then - if [ ! -d "${local_filedir}" ]; then - mkdir -p "${local_filedir}" + # 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 ) + else + # counter set to 1 to not allow second try + counter=1 + remote_fileurls_array=( remote_fileurl ) fi - # If curl exists download file. - if [ "$(command -v curl 2>/dev/null)" ]; then - # Trap to remove part downloaded files. - echo -en " fetching ${local_filename}...\c" - curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) + for remote_fileurl_array in "${remote_fileurls_array[@]}" + do + if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then + fileurl="${remote_fileurl}" + fileurl_name="${remote_fileurl_name}" + elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then + fileurl="${remote_fileurl_backup}" + fileurl_name="${remote_fileurl_backup_name}" + fi + 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. + + echo -en "fetching ${fileurl_name} ${local_filename}...\c" + curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}" 2>&1) + 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 + rm "${local_filedir:?}/${local_filename:?}" + local exitcode=2 + fi + fi + + # On first try will error. On second try will fail. if [ ${exitcode} -ne 0 ]; then - echo -e "FAIL" - if [ -f "${lgsmlog}" ]; then - echo -e "${remote_fileurl}" | tee -a "${lgsmlog}" - echo -e "${curlcmd}" | tee -a "${lgsmlog}" + if [ ${counter} -ge 2 ]; then + echo -e "FAIL" + if [ -f "${lgsmlog}" ]; then + fn_script_log_fatal "Downloading ${local_filename}" + fn_script_log_fatal "${fileurl}" + fi + core_exit.sh + else + echo -e "ERROR" + if [ -f "${lgsmlog}" ]; then + fn_script_log_error "Downloading ${local_filename}" + fn_script_log_error "${fileurl}" + fi fi - exit 1 + else - echo -e "OK" + echo -en "OK" + sleep 0.3 + echo -en "\033[2K\\r" + if [ -f "${lgsmlog}" ]; then + fn_script_log_pass "Downloading ${local_filename}" + fi + + # Make file executable if chmodx is set. + if [ "${chmodx}" == "chmodx" ]; then + chmod +x "${local_filedir}/${local_filename}" + fi + + # Remove trap. + trap - INT + + break fi - else - echo -e "[ FAIL ] Curl is not installed" - exit 1 - fi - # Make file chmodx if chmodx is set. - if [ "${chmodx}" == "chmodx" ]; then - chmod +x "${local_filedir}/${local_filename}" - fi + done fi if [ -f "${local_filedir}/${local_filename}" ]; then - # Run file if run is set. + # Execute file if run is set. if [ "${run}" == "run" ]; then # shellcheck source=/dev/null source "${local_filedir}/${local_filename}" @@ -117,9 +169,15 @@ fn_bootstrap_fetch_file(){ fn_bootstrap_fetch_file_github(){ github_file_url_dir="${1}" github_file_url_name="${2}" - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - - remote_fileurl="${githuburl}" + if [ "${githubbranch}" == "master" ]&&[ "${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 + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + fi + remote_fileurl_name="GitHub" + remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" local_filename="${github_file_url_name}" chmodx="${4:-0}" @@ -127,7 +185,7 @@ fn_bootstrap_fetch_file_github(){ forcedl="${6:-0}" md5="${7:-0}" # Passes vars to the file download function. - fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } # Installer menu. @@ -242,7 +300,7 @@ fn_install_file(){ if [ -e "${local_filename}" ]; then i=2 while [ -e "${local_filename}-${i}" ] ; do - let i++ + (( i++ )) done local_filename="${local_filename}-${i}" fi @@ -329,7 +387,7 @@ else fi if [ ! -f "${configdirserver}/_default.cfg" ]; then mkdir -p "${configdirserver}" - echo -en " copying _default.cfg...\c" + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" exitcode=$? if [ ${exitcode} -ne 0 ]; then @@ -342,7 +400,7 @@ else function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") if [ "${function_file_diff}" != "" ]; then fn_print_warn_nl "_default.cfg has been altered. reloading config." - echo -en " copying _default.cfg...\c" + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" exitcode=$? if [ ${exitcode} -ne 0 ]; then @@ -353,19 +411,24 @@ else fi fi fi + # shellcheck source=/dev/null source "${configdirserver}/_default.cfg" # Load the common.cfg config. If missing download it. if [ ! -f "${configdirserver}/common.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null source "${configdirserver}/common.cfg" else + # shellcheck source=/dev/null source "${configdirserver}/common.cfg" fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" else + # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" fi @@ -377,7 +440,7 @@ else # Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off. fn_ansi_loader # Prevents running of core_exit.sh for Travis-CI. - if [ -z "${travistest}" ]; then + if [ "${travistest}" != "1" ]; then getopt=$1 core_getopt.sh fi @@ -392,15 +455,6 @@ fn_currentstatus_tmux(){ fi } -fn_currentstatus_ts3(){ - check_status.sh - if [ "${status}" != "0" ]; then - currentstatus="ONLINE" - else - currentstatus="OFFLINE" - fi -} - fn_setstatus(){ fn_currentstatus_tmux echo"" @@ -490,8 +544,57 @@ echo -e "" echo -e "=================================" echo -e "Server Tests" echo -e "Using: ${gamename}" -echo -e "Testing Branch: $TRAVIS_BRANCH" +echo -e "Testing Branch: ${TRAVIS_BRANCH}" +echo -e "=================================" +echo -e "" +echo -e "Tests Summary" echo -e "=================================" +echo -e "0.0 - Pre-test Tasks" +echo -e "0.1 - Create log dir's" +echo -e "0.2 - Enable dev-debug" +echo -e "" +echo -e "1.0 - Pre-install tests" +echo -e "1.1 - start - no files" +echo -e "1.2 - getopt" +echo -e "1.3 - getopt with incorrect args" +echo -e "" +echo -e "2.0 - Installation" +echo -e "2.1 - install" +echo -e "" +echo -e "3.0 - Start/Stop/Restart Tests" +echo -e "3.1 - start" +echo -e "3.2 - start - online" +echo -e "3.3 - start - updateonstart" +echo -e "3.4 - stop" +echo -e "3.5 - stop - offline" +echo -e "3.6 - restart" +echo -e "3.7 - restart - offline" +echo -e "" +echo -e "4.0 - Update Tests" +echo -e "4.1 - update" +echo -e "4.2 - update-lgsm" +echo -e "" +echo -e "5.0 - Monitor Tests" +echo -e "5.1 - monitor - online" +echo -e "5.2 - monitor - offline - with lockfile" +echo -e "5.3 - monitor - offline - no lockfile" +echo -e "5.4 - test-alert" +echo -e "" +echo -e "6.0 - Details Tests" +echo -e "6.1 - details" +echo -e "6.2 - postdetails" +echo -e "" +echo -e "7.0 - Backup Tests" +echo -e "7.1 - backup" +echo -e "" +echo -e "8.0 - Development Tools Tests" +echo -e "8.1 - dev - detect glibc" +echo -e "8.2 - dev - detect ldd" +echo -e "8.3 - dev - detect deps" +echo -e "8.4 - dev - query-raw" +echo -e "" +echo -e "9.0 - Donate" +echo -e "9.1 - donate" echo -e "" echo -e "0.0 - Pre-test Tasks" @@ -543,7 +646,7 @@ echo -e "test script reaction to missing server files." echo -e "Command: ./${gameservername} start" echo -e "" # Allows for testing not on Travis CI -if [ ! -v TRAVIS ]; then +if [ -z "${TRAVIS}" ]; then ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" @@ -591,7 +694,7 @@ getopt="abc123" set -x core_getopt.sh ) -fn_test_result_fail +fn_test_result_pass echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' @@ -601,7 +704,7 @@ echo -e "2.0 - Installation" echo -e "==================================================================" echo -e "" -echo -e "2.0 - install" +echo -e "2.1 - install" echo -e "=================================" echo -e "Description:" echo -e "install ${gamename} server." @@ -786,6 +889,26 @@ echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +echo -e "" +echo -e "4.2 - update-lgsm" +echo -e "=================================" +echo -e "Description:" +echo -e "update LinuxGSM." +echo -e "" +echo -e "Command: ./jc2server update-lgam" +requiredstatus="ONLINE" +fn_setstatus +( + exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_update_linuxgsm.sh +) +fn_test_result_pass +echo -e "run order" +echo -e "=================" +grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' + echo -e "" echo -e "Inserting IP address" echo -e "=================================" @@ -804,6 +927,7 @@ echo -e "" echo -e "5.0 - Monitor Tests" echo -e "==================================================================" echo -e "" +info_config.sh echo -e "Server IP - Port: ${ip}:${port}" echo -e "Server IP - Query Port: ${ip}:${queryport}" @@ -845,7 +969,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="OFFLINE" fn_setstatus fn_print_info_nl "creating lockfile." -date '+%s' > "${rootdir}/${lockselfname}" +date '+%s' > "${lockdir}/${selfname}.lock" ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" @@ -1050,6 +1174,29 @@ echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +echo -e "" +echo -e "9.0 - Donate" +echo -e "==================================================================" + +echo -e "" +echo -e "9.1 - donate" +echo -e "=================================" +echo -e "Description:" +echo -e "donate." +echo -e "Command: ./${gameservername} donate" +requiredstatus="ONLINE" +fn_setstatus +( + exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_donate.sh +) +fn_test_result_pass +echo -e "run order" +echo -e "=================" +grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' + echo -e "" echo -e "=================================" echo -e "Server Tests - Complete!" @@ -1057,8 +1204,5 @@ echo -e "Using: ${gamename}" echo -e "=================================" requiredstatus="OFFLINE" fn_setstatus -if [ ! -v TRAVIS ]; then - fn_print_info "Tidying up directories." - rm -rfv "${serverfiles:?}" -fi + core_exit.sh diff --git a/tests/tests_shellcheck.sh b/tests/tests_shellcheck.sh index 51784906c..f4bbf4868 100644 --- a/tests/tests_shellcheck.sh +++ b/tests/tests_shellcheck.sh @@ -1,7 +1,7 @@ #!/bin/bash # Project: Game Server Managers - LinuxGSM # Author: Daniel Gibbs -# License: MIT License, Copyright (c) 2019 Daniel Gibbs +# License: MIT License, Copyright (c) 2020 Daniel Gibbs # Purpose: Travis CI Tests: Shellcheck | Linux Game Server Management Script # Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors # Documentation: https://docs.linuxgsm.com/ diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index a9527b68b..fb4f889bf 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -1,7 +1,7 @@ #!/bin/bash # Project: Game Server Managers - LinuxGSM # Author: Daniel Gibbs -# License: MIT License, Copyright (c) 2019 Daniel Gibbs +# License: MIT License, Copyright (c) 2020 Daniel Gibbs # Purpose: Travis CI Tests: Teamspeak 3 | Linux Game Server Management Script # Contributors: https://linuxgsm.com/contrib # Documentation: https://docs.linuxgsm.com @@ -20,20 +20,22 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v19.9.0" +version="v20.3.3" shortname="ts3" gameservername="ts3server" +commandname="CORE" rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") -lockselfname=".${selfname}.lock" +sessionname=$(echo "${selfname}" | cut -f1 -d".") lgsmdir="${rootdir}/lgsm" logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" -steamcmddir="${rootdir}/steamcmd" +steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" functionsdir="${lgsmdir}/functions" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" +lockdir="${lgsmdir}/lock" serverlist="${datadir}/serverlist.csv" serverlistmenu="${datadir}/serverlistmenu.csv" configdir="${lgsmdir}/config-lgsm" @@ -41,14 +43,13 @@ configdirserver="${configdir}/${gameservername}" configdirdefault="${lgsmdir}/config-default" userinput="${1}" -# Allows for testing not on Travis CI -if [ ! -v TRAVIS ]; then +# Allows for testing not on Travis CI. +# if using travis for tests +if [ -z "${TRAVIS}" ]; then TRAVIS_BRANCH="develop" TRAVIS_BUILD_DIR="${rootdir}" -else - selfname="travis" - travistest="1" fi +travistest="1" ## GitHub Branch Select # Allows for the use of different function files @@ -67,46 +68,97 @@ core_functions.sh(){ # Fetches the core functions required before passed off to core_dl.sh. fn_bootstrap_fetch_file(){ remote_fileurl="${1}" - local_filedir="${2}" - local_filename="${3}" - chmodx="${4:-0}" - run="${5:-0}" - forcedl="${6:-0}" - md5="${7:-0}" + remote_fileurl_backup="${2}" + remote_fileurl_name="${3}" + remote_fileurl_backup_name="${4}" + local_filedir="${5}" + local_filename="${6}" + chmodx="${7:-0}" + run="${8:-0}" + forcedl="${9:-0}" + md5="${10:-0}" # Download file if missing or download forced. if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then - if [ ! -d "${local_filedir}" ]; then - mkdir -p "${local_filedir}" + # 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 ) + else + # counter set to 1 to not allow second try + counter=1 + remote_fileurls_array=( remote_fileurl ) fi - # If curl exists download file. - if [ "$(command -v curl 2>/dev/null)" ]; then - # Trap to remove part downloaded files. - echo -en " fetching ${local_filename}...\c" - curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) + for remote_fileurl_array in "${remote_fileurls_array[@]}" + do + if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then + fileurl="${remote_fileurl}" + fileurl_name="${remote_fileurl_name}" + elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then + fileurl="${remote_fileurl_backup}" + fileurl_name="${remote_fileurl_backup_name}" + fi + 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. + + echo -en "fetching ${fileurl_name} ${local_filename}...\c" + curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}" 2>&1) + 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 + rm "${local_filedir:?}/${local_filename:?}" + local exitcode=2 + fi + fi + + # On first try will error. On second try will fail. if [ ${exitcode} -ne 0 ]; then - echo -e "FAIL" - if [ -f "${lgsmlog}" ]; then - echo -e "${remote_fileurl}" | tee -a "${lgsmlog}" - echo -e "${curlcmd}" | tee -a "${lgsmlog}" + if [ ${counter} -ge 2 ]; then + echo -e "FAIL" + if [ -f "${lgsmlog}" ]; then + fn_script_log_fatal "Downloading ${local_filename}" + fn_script_log_fatal "${fileurl}" + fi + core_exit.sh + else + echo -e "ERROR" + if [ -f "${lgsmlog}" ]; then + fn_script_log_error "Downloading ${local_filename}" + fn_script_log_error "${fileurl}" + fi fi - exit 1 + else - echo -e "OK" + echo -en "OK" + sleep 0.3 + echo -en "\033[2K\\r" + if [ -f "${lgsmlog}" ]; then + fn_script_log_pass "Downloading ${local_filename}" + fi + + # Make file executable if chmodx is set. + if [ "${chmodx}" == "chmodx" ]; then + chmod +x "${local_filedir}/${local_filename}" + fi + + # Remove trap. + trap - INT + + break fi - else - echo -e "[ FAIL ] Curl is not installed" - exit 1 - fi - # Make file chmodx if chmodx is set. - if [ "${chmodx}" == "chmodx" ]; then - chmod +x "${local_filedir}/${local_filename}" - fi + done fi if [ -f "${local_filedir}/${local_filename}" ]; then - # Run file if run is set. + # Execute file if run is set. if [ "${run}" == "run" ]; then # shellcheck source=/dev/null source "${local_filedir}/${local_filename}" @@ -117,9 +169,15 @@ fn_bootstrap_fetch_file(){ fn_bootstrap_fetch_file_github(){ github_file_url_dir="${1}" github_file_url_name="${2}" - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - - remote_fileurl="${githuburl}" + if [ "${githubbranch}" == "master" ]&&[ "${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 + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + fi + remote_fileurl_name="GitHub" + remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" local_filename="${github_file_url_name}" chmodx="${4:-0}" @@ -127,7 +185,7 @@ fn_bootstrap_fetch_file_github(){ forcedl="${6:-0}" md5="${7:-0}" # Passes vars to the file download function. - fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" + fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } # Installer menu. @@ -329,7 +387,7 @@ else fi if [ ! -f "${configdirserver}/_default.cfg" ]; then mkdir -p "${configdirserver}" - echo -en " copying _default.cfg...\c" + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" exitcode=$? if [ ${exitcode} -ne 0 ]; then @@ -342,7 +400,7 @@ else function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") if [ "${function_file_diff}" != "" ]; then fn_print_warn_nl "_default.cfg has been altered. reloading config." - echo -en " copying _default.cfg...\c" + echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" exitcode=$? if [ ${exitcode} -ne 0 ]; then @@ -353,19 +411,24 @@ else fi fi fi + # shellcheck source=/dev/null source "${configdirserver}/_default.cfg" # Load the common.cfg config. If missing download it. if [ ! -f "${configdirserver}/common.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null source "${configdirserver}/common.cfg" else + # shellcheck source=/dev/null source "${configdirserver}/common.cfg" fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" else + # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" fi @@ -377,7 +440,7 @@ else # Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off. fn_ansi_loader # Prevents running of core_exit.sh for Travis-CI. - if [ -z "${travistest}" ]; then + if [ "${travistest}" != "1" ]; then getopt=$1 core_getopt.sh fi @@ -392,24 +455,15 @@ fn_currentstatus_tmux(){ fi } -fn_currentstatus_ts3(){ - check_status.sh - if [ "${status}" != "0" ]; then - currentstatus="ONLINE" - else - currentstatus="OFFLINE" - fi -} - fn_setstatus(){ - fn_currentstatus_ts3 + fn_currentstatus_tmux echo"" echo -e "Required status: ${requiredstatus}" counter=0 echo -e "Current status: ${currentstatus}" while [ "${requiredstatus}" != "${currentstatus}" ]; do counter=$((counter+1)) - fn_currentstatus_ts3 + fn_currentstatus_tmux echo -en "New status: ${currentstatus}\\r" if [ "${requiredstatus}" == "ONLINE" ]; then @@ -490,9 +544,58 @@ echo -e "" echo -e "=================================" echo -e "Server Tests" echo -e "Using: ${gamename}" -echo -e "Testing Branch: $TRAVIS_BRANCH" +echo -e "Testing Branch: ${TRAVIS_BRANCH}" echo -e "=================================" +echo -e "" +echo -e "Tests Summary" +echo -e "=================================" +echo -e "0.0 - Pre-test Tasks" +echo -e "0.1 - Create log dir's" +echo -e "0.2 - Enable dev-debug" +echo -e "" +echo -e "1.0 - Pre-install tests" +echo -e "1.1 - start - no files" +echo -e "1.2 - getopt" +echo -e "1.3 - getopt with incorrect args" +echo -e "" +echo -e "2.0 - Installation" +echo -e "2.1 - install" +echo -e "" +echo -e "3.0 - Start/Stop/Restart Tests" +echo -e "3.1 - start" +echo -e "3.2 - start - online" +echo -e "3.3 - start - updateonstart" +echo -e "3.4 - stop" +echo -e "3.5 - stop - offline" +echo -e "3.6 - restart" +echo -e "3.7 - restart - offline" +echo -e "" +echo -e "4.0 - Update Tests" +echo -e "4.1 - update" +echo -e "4.2 - update-lgsm" +echo -e "" +echo -e "5.0 - Monitor Tests" +echo -e "5.1 - monitor - online" +echo -e "5.2 - monitor - offline - with lockfile" +echo -e "5.3 - monitor - offline - no lockfile" +echo -e "5.4 - test-alert" +echo -e "" +echo -e "6.0 - Details Tests" +echo -e "6.1 - details" +echo -e "6.2 - postdetails" +echo -e "" +echo -e "7.0 - Backup Tests" +echo -e "7.1 - backup" +echo -e "" +echo -e "8.0 - Development Tools Tests" +echo -e "8.1 - dev - detect glibc" +echo -e "8.2 - dev - detect ldd" +echo -e "8.3 - dev - detect deps" +echo -e "8.4 - dev - query-raw" +echo -e "" +echo -e "9.0 - Donate" +echo -e "9.1 - donate" echo -e "" echo -e "0.0 - Pre-test Tasks" echo -e "==================================================================" @@ -543,7 +646,7 @@ echo -e "test script reaction to missing server files." echo -e "Command: ./${gameservername} start" echo -e "" # Allows for testing not on Travis CI -if [ ! -v TRAVIS ]; then +if [ -z "${TRAVIS}" ]; then ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" @@ -591,7 +694,7 @@ getopt="abc123" set -x core_getopt.sh ) -fn_test_result_fail +fn_test_result_pass echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' @@ -601,7 +704,7 @@ echo -e "2.0 - Installation" echo -e "==================================================================" echo -e "" -echo -e "2.0 - install" +echo -e "2.1 - install" echo -e "=================================" echo -e "Description:" echo -e "install ${gamename} server." @@ -777,10 +880,31 @@ echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +echo -e "" +echo -e "4.2 - update-lgsm" +echo -e "=================================" +echo -e "Description:" +echo -e "update LinuxGSM." +echo -e "" +echo -e "Command: ./jc2server update-lgam" +requiredstatus="ONLINE" +fn_setstatus +( + exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_update_linuxgsm.sh +) +fn_test_result_pass +echo -e "run order" +echo -e "=================" +grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' + echo -e "" echo -e "5.0 - Monitor Tests" echo -e "==================================================================" echo -e "" +info_config.sh echo -e "Server IP - Port: ${ip}:${port}" echo -e "Server IP - Query Port: ${ip}:${queryport}" @@ -812,7 +936,7 @@ echo -e "Command: ./${gameservername} monitor" requiredstatus="OFFLINE" fn_setstatus fn_print_info_nl "creating lockfile." -date '+%s' > "${rootdir}/${lockselfname}" +date '+%s' > "${lockdir}/${selfname}.lock" ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" BASH_XTRACEFD="5" @@ -1003,6 +1127,29 @@ echo -e "run order" echo -e "=================" grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +echo -e "" +echo -e "9.0 - Donate" +echo -e "==================================================================" + +echo -e "" +echo -e "9.1 - donate" +echo -e "=================================" +echo -e "Description:" +echo -e "donate." +echo -e "Command: ./${gameservername} donate" +requiredstatus="ONLINE" +fn_setstatus +( + exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" + BASH_XTRACEFD="5" + set -x + command_donate.sh +) +fn_test_result_pass +echo -e "run order" +echo -e "=================" +grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' + echo -e "" echo -e "=================================" echo -e "Server Tests - Complete!" @@ -1010,8 +1157,5 @@ echo -e "Using: ${gamename}" echo -e "=================================" requiredstatus="OFFLINE" fn_setstatus -if [ ! -v TRAVIS ]; then - fn_print_info "Tidying up directories." - rm -rfv "${serverfiles:?}" -fi + core_exit.sh