diff --git a/.travis.yml b/.travis.yml index c966220f8..ad13083c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ -language: bash +language: bash node_js dist: xenial sudo: required -language: node_js node_js: - 10 before_script: diff --git a/README.md b/README.md index 7466cc0f9..84743e049 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) [![Under Development](https://badge.waffle.io/GameServerManagers/LinuxGSM.svg?label=status:%20in%20progress&title=In%20Progress)](http://waffle.io/GameServerManagers/LinuxGSM) [![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) [![Discord](https://discordapp.com/api/guilds/127498813903601664/widget.png?style=shield)](https://linuxgsm.com/discord) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://github.com/GameServerManagers/LinuxGSM/blob/master/LICENSE) [![made-with-bash](https://img.shields.io/badge/-Made%20with%20Bash-1f425f.svg?logo=image%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkE3MDg2QTAyQUZCMzExRTVBMkQxRDMzMkJDMUQ4RDk3IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkE3MDg2QTAzQUZCMzExRTVBMkQxRDMzMkJDMUQ4RDk3Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTcwODZBMDBBRkIzMTFFNUEyRDFEMzMyQkMxRDhEOTciIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTcwODZBMDFBRkIzMTFFNUEyRDFEMzMyQkMxRDhEOTciLz4gPC9yZGY6RGVzY3JpcHRpb24%2BIDwvcmRmOlJERj4gPC94OnhtcG1ldGE%2BIDw%2FeHBhY2tldCBlbmQ9InIiPz6lm45hAAADkklEQVR42qyVa0yTVxzGn7d9Wy03MS2ii8s%2BeokYNQSVhCzOjXZOFNF4jx%2BMRmPUMEUEqVG36jo2thizLSQSMd4N8ZoQ8RKjJtooaCpK6ZoCtRXKpRempbTv5ey83bhkAUphz8fznvP8znn%2B%2F3NeEEJgNBoRRSmz0ub%2FfuxEacBg%2FDmYtiCjgo5NG2mBXq%2BH5I1ogMRk9Zbd%2BQU2e1ML6VPLOyf5tvBQ8yT1lG10imxsABm7SLs898GTpyYynEzP60hO3trHDKvMigUwdeaceacqzp7nOI4n0SSIIjl36ao4Z356OV07fSQAk6xJ3XGg%2BLCr1d1OYlVHp4eUHPnerU79ZA%2F1kuv1JQMAg%2BE4O2P23EumF3VkvHprsZKMzKwbRUXFEyTvSIEmTVbrysp%2BWr8wfQHGK6WChVa3bKUmdWou%2BjpArdGkzZ41c1zG%2Fu5uGH4swzd561F%2BuhIT4%2BLnSuPsv9%2BJKIpjNr9dXYOyk7%2FBZrcjIT4eCnoKgedJP4BEqhG77E3NKP31FO7cfQA5K0dSYuLgz2TwCWJSOBzG6crzKK%2BohNfni%2Bx6OMUMMNe%2Fgf7ocbw0v0acKg6J8Ql0q%2BT%2FAXR5PNi5dz9c71upuQqCKFAD%2BYhrZLEAmpodaHO3Qy6TI3NhBpbrshGtOWKOSMYwYGQM8nJzoFJNxP2HjyIQho4PewK6hBktoDcUwtIln4PjOWzflQ%2Be5yl0yCCYgYikTclGlxadio%2BBQCSiW1UXoVGrKYwH4RgMrjU1HAB4vR6LzWYfFUCKxfS8Ftk5qxHoCUQAUkRJaSEokkV6Y%2F%2BJUOC4hn6A39NVXVBYeNP8piH6HeA4fPbpdBQV5KOx0QaL1YppX3Jgk0TwH2Vg6S3u%2BdB91%2B%2FpuNYPYFl5uP5V7ZqvsrX7jxqMXR6ff3gCQSTzFI0a1TX3wIs8ul%2Bq4HuWAAiM39vhOuR1O1fQ2gT%2F26Z8Z5vrl2OHi9OXZn995nLV9aFfS6UC9JeJPfuK0NBohWpCHMSAAsFe74WWP%2BvT25wtP9Bpob6uGqqyDnOtaeumjRu%2ByFu36VntK%2FPA5umTJeUtPWZSU9BCgud661odVp3DZtkc7AnYR33RRC708PrVi1larW7XwZIjLnd7R6SgSqWSNjU1B3F72pz5TZbXmX5vV81Yb7Lg7XT%2FUXriu8XLVqw6c6XqWnBKiiYU%2BMt3wWF7u7i91XlSEITwSAZ%2FCzAAHsJVbwXYFFEAAAAASUVORK5CYII%3D)](https://www.gnu.org/software/bash/) + [![LinuxGSM](https://img.shields.io/badge/-LinuxGSM-2b2b2b.svg?logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAACsAAABACAYAAACDbo5ZAAAGD0lEQVR4AcWYa2wUVRvHz75c2vJ2disXoUBEVIioRAx%2BMIFA1IRwUS6KCCiIKBrvhEYiiGm5iBgk8QOGEgUUDYTttmVZWFr2UmwURS6iYAoCtmisElSsdHdbkT7%2BTzoNy%2BGc2dm54C%2F5Rdkz85x%2FZ86ZOXOYXYhIg3Phx%2FA4PAcv6f%2Btg5vhHJjP3EcZsgsshufJHH%2FAJbDztQ7aG35J1vgCXn%2BtgvrgEbLHYei9FmE3kDOUuh10OGwjZ7gEh7kZ9gNyllK3gnrg7%2BQs56DHjbCDyB0GuRF2ArnDeDfCziF3mO1G2FfJHRa4EXYpuUOxG2GXkzuUuBH2TXKH5W6ELSV3eM%2BNsOUk5yQcAY8p2uvgSPitor3MjbB1UOQXOFBvHwpbhPYWOExvL4SNUOQ7p4P2JTlzhOPmCu0vCu1PQpE2WOhk2MdJjk9y7HNwP1wEPUJbAcmZ6WTYrYolnifbxZBiibnFySHQCkUaLdY7C0V4%2FT5OhF1JcuIW6%2B0lOcvsBi2Ezao3j8Ov7Quwj52w60jNKIs1R5GatVaDDoEXSU4D7GSxbidYT3IuwjusFK0mNUVMwaZNNbl%2B%2F87hoVCom0HthaQmnG3QB0lNPcxlCvz%2B0GtlZTuorCxYYlA%2FDzbY%2FnrAgV3hCVLzCDMgEAi9wMMi9IIM%2FUwnNXWwi5mwRaSmmmXA798xq%2F3Khp420VeE1LyS6eQeBhttSXgzywCCToIUCOyYZvKLOWWwkdfd6ORVpGYJM0F5efDe9mEQHGty2BWTmhVGO4PNBmOoKzMBxmo%2FhD25dWvljSbD5hjMkb9gT9lJq63Mzi1bKkbjloc7xBWtwiRrDASCVRi%2FRxA8if%2BvrawMTzYI%2FACpeUv2KFFtDcUyTKilCHcis8G1Ga7wHpLzG8wVFs1K7jaeUKHZfIxmkj9%2FM4S9x9RGiMEudo0QbCVu9Xqn5PWEwLUk5%2FP0iaXac53I0kAH9Sau4m54lo%2FdTMfyekLYKQZ7ub34AbMMlmw5irC2VYTN0fuVMYMf8JHxJ7L7YYXAlSRnI2%2F8RtH4siTsDMz%2BZ5yS15OEXUxyDjGD1%2BvEq8MG16CDzY6JepKwT6geYbzxb0XjGMl7vwGSgzZIwo4nOa1M8Yr9Afb%2Fj8L21%2FsXaeaNZ2A6KTiEASph%2F0vF80cn4tokqu79fzfCUk2vfF4%2FFdFGEjGPHvg2yWrsDG%2F4%2BqpZB8jPOiXjWk0y5iXdM3XhKUvxBTA9UvHuvNPh%2Bzb%2BWj10z6nwuHWBbQFMvNCjKnn7qd1jS%2Fnx9VX3b6jC%2BbwOr5eMe3%2B83IcW4%2F3qgT%2BUTbA9srGaiHsn8AKiF6Ld%2FxF%2FOx6eeAJXabvK78MTTornNMd6XJTVR7%2Fj9bBjhFxV%2FMc1kJOAy2AeA%2FgrV4mFVDZFCqm8rEJ6qysCAWqK9iaztRJRbWXa4moFTELOav7jY%2FqAvoXp0Gc9NX7bIZl17%2FZl0rC1wRLeno0NvP%2B0CTcYNnS8wW6CtzNANaxzKqo9hRNOQ8rGo7tmSsMe2zWdt2frqVRcm5s2fofCgawDNHRNxnyfqgsYez4y4ADCjRM9H73hsNWafILTQdaFiSTj%2BQ%2FxA6yH7d%2BCmR8XbYr0a7VTF2N4siSsb5qdos3R6%2FjGxpULFfw7EfORnbrI9TAToX0sD40%2F2ylcGdh2Rdhg%2BSf2gka9jRTqK9%2BGwgHz7RTfVbHxirDhivdthYUvMRX8aYAD9lstvi%2B0aDL2DUZ0eCBUNNVG0IP65FLTWqPdiqdC0koHTVXe7iyNRG23QotBEy1RbTAzQyrmnYUT2rLsoA13JpcB4eVC2daBM1g2JGLekmwf5On7EJfngfZTNnVSce8bFjaTmQdvs%2FXmO%2FJVpoXdx3RSUe9O00Fj3nUdy0RLgRHiHXOPGW1h2uKZ07c9rG%2Bxyefp23pQeyBIEQoavYlakrG8fnrY5yHn2fbxXzAgw7m8bT5zkkSk4C7cpmOK21esB%2FXAQ5DzFfTo43%2BF%2FDzf0eZ4wZ3MDSjMcvD6nIeOahGgia%2FyU3HforTPkWkwnakdn0cI9jqfbPjD%2FuQLJr6644snlgX%2FApOMoyd1R5%2FxAAAAAElFTkSuQmCC)](https://linuxgsm.com) [![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) [![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 dedicated game servers. diff --git a/lgsm/config-default/config-lgsm/cod2server/_default.cfg b/lgsm/config-default/config-lgsm/cod2server/_default.cfg index c6a7c27f7..61b0a56e8 100644 --- a/lgsm/config-default/config-lgsm/cod2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/cod2server/_default.cfg @@ -16,7 +16,7 @@ maxplayers="20" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ -parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set dedicated 1 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" +parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set dedicated 2 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" } #### LinuxGSM Settings #### diff --git a/lgsm/config-default/config-lgsm/cod4server/_default.cfg b/lgsm/config-default/config-lgsm/cod4server/_default.cfg index b87a8ef76..a46248950 100644 --- a/lgsm/config-default/config-lgsm/cod4server/_default.cfg +++ b/lgsm/config-default/config-lgsm/cod4server/_default.cfg @@ -16,7 +16,7 @@ maxplayers="32" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ -parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set fs_homepath ${serverfiles} +set sv_authorizemode "-1" +set dedicated 1 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" +parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set fs_homepath ${serverfiles} +set sv_authorizemode "-1" +set dedicated 2 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" } #### LinuxGSM Settings #### diff --git a/lgsm/config-default/config-lgsm/codserver/_default.cfg b/lgsm/config-default/config-lgsm/codserver/_default.cfg index 5f1d480c2..67c6dc918 100644 --- a/lgsm/config-default/config-lgsm/codserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/codserver/_default.cfg @@ -16,7 +16,7 @@ maxplayers="20" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ -parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set dedicated 1 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" +parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set dedicated 2 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" } #### LinuxGSM Settings #### diff --git a/lgsm/config-default/config-lgsm/coduoserver/_default.cfg b/lgsm/config-default/config-lgsm/coduoserver/_default.cfg index 9ed50228e..c61d3f96b 100644 --- a/lgsm/config-default/config-lgsm/coduoserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/coduoserver/_default.cfg @@ -16,7 +16,7 @@ maxplayers="20" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ -parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set dedicated 1 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" +parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set dedicated 2 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" } #### LinuxGSM Settings #### diff --git a/lgsm/config-default/config-lgsm/codwawserver/_default.cfg b/lgsm/config-default/config-lgsm/codwawserver/_default.cfg index 39d21e37e..4296b4b7c 100644 --- a/lgsm/config-default/config-lgsm/codwawserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/codwawserver/_default.cfg @@ -16,7 +16,7 @@ maxplayers="20" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ -parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set dedicated 1 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" +parms="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set dedicated 2 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxplayers} +exec ${servercfg} +map ${defaultmap}" } #### LinuxGSM Settings #### diff --git a/lgsm/config-default/config-lgsm/kfserver/_default.cfg b/lgsm/config-default/config-lgsm/kfserver/_default.cfg index 3d9a1cf76..25b828a1b 100644 --- a/lgsm/config-default/config-lgsm/kfserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/kfserver/_default.cfg @@ -13,8 +13,8 @@ steamuser="username" steampass='password' ## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters -defaultmap="KF-BioticsLab.rom" ip="0.0.0.0" +defaultmap="KF-BioticsLab.rom" ## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ @@ -108,6 +108,7 @@ engine="unreal2" # Edit with care ## Server Specific Directories +serverfiles="${rootdir}/serverfiles" systemdir="${serverfiles}/System" executabledir="${systemdir}" executable="./ucc-bin" @@ -134,3 +135,4 @@ postdetailslog="${lgsmlogdir}/${servicename}-postdetails.log" ## Logs Naming lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log" consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log" +gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%Y-%m-%d-%H:%M:%S').log" diff --git a/lgsm/config-default/config-lgsm/ts3server/_default.cfg b/lgsm/config-default/config-lgsm/ts3server/_default.cfg index e28e99a85..f448c2f09 100644 --- a/lgsm/config-default/config-lgsm/ts3server/_default.cfg +++ b/lgsm/config-default/config-lgsm/ts3server/_default.cfg @@ -7,7 +7,7 @@ # [instance].cfg - applies settings to a specific instance ## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters -# Edit serverfiles/ts3-server.ini after installation +# Edit serverfiles/ts3server.ini after installation #### LinuxGSM Settings #### diff --git a/lgsm/functions/alert.sh b/lgsm/functions/alert.sh index ceeed0304..508c704a6 100644 --- a/lgsm/functions/alert.sh +++ b/lgsm/functions/alert.sh @@ -106,10 +106,10 @@ elif [ "${postalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert fn_script_log_warn "More Info alerts not enabled" elif [ -z "${posttarget}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "posttarget not set" - fn_script_error_warn "posttarget not set" + fn_script_error "posttarget not set" elif [ -z "${postdays}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "postdays not set" - fn_script_error_warn "postdays not set" + fn_script_error "postdays not set" fi if [ "${discordalert}" == "on" ]&&[ -n "${discordalert}" ]; then @@ -120,7 +120,7 @@ elif [ "${discordalert}" != "on" ]&&[ "${function_selfname}" == "command_test_al elif [ -z "${discordtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "Discord token not set" echo " * https://docs.linuxgsm.com/alerts/discord" - fn_script_error_warn "Discord token not set" + fn_script_error "Discord token not set" fi if [ "${emailalert}" == "on" ]&&[ -n "${email}" ]; then @@ -141,7 +141,7 @@ elif [ "${iftttalert}" != "on" ]&&[ "${function_selfname}" == "command_test_aler elif [ -z "${ifttttoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "IFTTT token not set" echo " * https://docs.linuxgsm.com/alerts/ifttt" - fn_script_error_warn "IFTTT token not set" + fn_script_error "IFTTT token not set" fi if [ "${mailgunalert}" == "on" ]&&[ -n "${mailgunalert}" ]; then @@ -152,7 +152,7 @@ elif [ "${mailgunalert}" != "on" ]&&[ "${function_selfname}" == "command_test_al elif [ -z "${mailguntoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "Mailgun token not set" echo " * https://docs.linuxgsm.com/alerts/mailgun" - fn_script_error_warn "Mailgun token not set" + fn_script_error "Mailgun token not set" fi if [ "${pushbulletalert}" == "on" ]&&[ -n "${pushbullettoken}" ]; then @@ -163,7 +163,7 @@ elif [ "${pushbulletalert}" != "on" ]&&[ "${function_selfname}" == "command_test elif [ -z "${pushbullettoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "Pushbullet token not set" echo " * https://docs.linuxgsm.com/alerts/pushbullet" - fn_script_error_warn "Pushbullet token not set" + fn_script_error "Pushbullet token not set" fi if [ "${pushoveralert}" == "on" ]&&[ -n "${pushoveralert}" ]; then @@ -174,7 +174,7 @@ elif [ "${pushoveralert}" != "on" ]&&[ "${function_selfname}" == "command_test_a elif [ -z "${pushovertoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "Pushover token not set" echo " * https://docs.linuxgsm.com/alerts/pushover" - fn_script_error_warn "Pushover token not set" + fn_script_error "Pushover token not set" fi if [ "${telegramalert}" == "on" ]&&[ -n "${telegramtoken}" ]; then @@ -185,9 +185,9 @@ elif [ "${telegramalert}" != "on" ]&&[ "${function_selfname}" == "command_test_a elif [ -z "${telegramtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "Telegram token not set." echo " * https://docs.linuxgsm.com/alerts/telegram" - fn_script_error_warn "Telegram token not set." + fn_script_error "Telegram token not set." elif [ -z "${telegramchatid}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "Telegram chat id not set." echo " * https://docs.linuxgsm.com/alerts/telegram" - fn_script_error_warn "Telegram chat id not set." + fn_script_error "Telegram chat id not set." fi \ No newline at end of file diff --git a/lgsm/functions/check.sh b/lgsm/functions/check.sh index 99c8890e5..0a1768884 100644 --- a/lgsm/functions/check.sh +++ b/lgsm/functions/check.sh @@ -26,7 +26,7 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ "${function_selfname}" check_system_dir.sh fi -local allowed_commands_array=( command_start.sh ) +local allowed_commands_array=( command_start.sh command_debug.sh ) for allowed_command in "${allowed_commands_array[@]}" do if [ "${allowed_command}" == "${function_selfname}" ]; then diff --git a/lgsm/functions/check_executable.sh b/lgsm/functions/check_executable.sh index db9ca411a..c4e7947ef 100644 --- a/lgsm/functions/check_executable.sh +++ b/lgsm/functions/check_executable.sh @@ -2,18 +2,17 @@ # LinuxGSM check_executable.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Checks if executable exists. +# Description: Checks if server executable exists. local commandname="CHECK" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Check if executable exists if [ ! -f "${executabledir}/${execname}" ]; then - fn_script_log_warn "Executable was not found: ${executabledir}/${execname}" + fn_print_fail_nl "executable was not found:" + echo " * ${executabledir}/${execname}" if [ -d "${lgsmlogdir}" ]; then - fn_print_fail_nl "Executable was not found:" - echo " * ${executabledir}/${execname}" + fn_script_log_fatal "Executable was not found: ${executabledir}/${execname}" fi - exitcode="1" core_exit.sh fi diff --git a/lgsm/functions/check_permissions.sh b/lgsm/functions/check_permissions.sh index 7185f070b..f1bca798d 100644 --- a/lgsm/functions/check_permissions.sh +++ b/lgsm/functions/check_permissions.sh @@ -78,7 +78,7 @@ fn_check_permissions(){ # Grab the first and second digit for user and group permission userrootdirperm="${rootdirperm:0:1}" grouprootdirperm="${rootdirperm:1:1}" - if [ "${userrootdirperm}" != "7" ] && [ "${grouprootdirperm}" != "7" ]; then + if [ "${userrootdirperm}" != "7" ]&&[ "${grouprootdirperm}" != "7" ]; then fn_print_fail_nl "Permissions issues found" fn_script_log_fatal "Permissions issues found" fn_print_information_nl "The following directory does not have the correct permissions:" diff --git a/lgsm/functions/check_tmuxception.sh b/lgsm/functions/check_tmuxception.sh index 345083712..1a13bef9c 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 commandname="check" +local commandname="CHECK" fn_check_is_in_tmux(){ if [ -n "${TMUX}" ]; then @@ -17,6 +17,7 @@ fn_check_is_in_tmux(){ core_exit.sh fi } + fn_check_is_in_screen(){ if [ -n "${STY}" ]; then fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a screen session." diff --git a/lgsm/functions/command_dev_query_raw.sh b/lgsm/functions/command_dev_query_raw.sh index 30db99ea5..2b9267501 100644 --- a/lgsm/functions/command_dev_query_raw.sh +++ b/lgsm/functions/command_dev_query_raw.sh @@ -5,7 +5,7 @@ # Description: Raw gamedig output of the server. local commandname="QUERY-RAW" -local commandaction="QUERY-RAW" +local commandaction="Query Raw" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo "=================================" diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh index 36e15391c..19fc1b464 100644 --- a/lgsm/functions/command_fastdl.sh +++ b/lgsm/functions/command_fastdl.sh @@ -31,7 +31,7 @@ fi # Header fn_print_header -echo "More info: https://git.io/vyk9a" +echo "More info: https://docs.linuxgsm.com/commands/fastdl" echo "" # Prompts user for FastDL creation settings diff --git a/lgsm/functions/command_mods_remove.sh b/lgsm/functions/command_mods_remove.sh index 4ecdacfed..7a0eb7dd2 100644 --- a/lgsm/functions/command_mods_remove.sh +++ b/lgsm/functions/command_mods_remove.sh @@ -6,7 +6,7 @@ # Description: Uninstall mods along with mods_list.sh and mods_core.sh. local commandname="MODS" -local commandaction="addons/mods" +local commandaction="Mods Remove" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh index 5849da984..3b36b3376 100644 --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/functions/command_monitor.sh @@ -3,7 +3,7 @@ # Author: Daniel Gibbs # Contributor: UltimateByte # Website: https://linuxgsm.com -# Description: Monitors server by checking for running processes. +# Description: Monitors server by checking for running processes # then passes to gamedig and gsquery. local commandname="MONITOR" @@ -11,7 +11,7 @@ local commandaction="Monitor" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_monitor_loop(){ -# Will query up to 5 times every 15 seconds. +# Monitor will query up to 5 times every 15 seconds. # Query will wait up to 60 seconds to confirm server is down giving server time if changing map. totalseconds=0 for queryattempt in {1..5}; do @@ -33,30 +33,29 @@ for queryattempt in {1..5}; do fi if [ "${querystatus}" == "0" ]; then - # Server query OK + # Server query OK. sleep 0.5 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" - exitcode=0 monitorpass=1 core_exit.sh else - # Server query FAIL + # Server query FAIL. fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt}: FAIL" fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_fail_eol sleep 0.5 - # monitor try gamedig first then gsquery before restarting + # Monitor try gamedig first then gsquery before restarting. if [ "${querymethod}" == "gsquery" ]; then if [ "${totalseconds}" -ge "59" ]; then - # Server query FAIL for over 59 seconds reboot server + # Server query FAIL for over 59 seconds reboot server. fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_fail_eol_nl fn_script_log_error "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt}: FAIL" sleep 0.5 - # Send alert if enabled + # Send alert if enabled. alert="restartquery" alert.sh command_restart.sh @@ -68,7 +67,7 @@ for queryattempt in {1..5}; do fi fi - # Seconds counter + # Seconds counter. for seconds in {1..15}; do fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: WAIT" totalseconds=$((totalseconds + 1)) @@ -82,7 +81,7 @@ done } fn_monitor_check_lockfile(){ - # Monitor does not run it lockfile is not found + # Monitor does not run it lockfile is not found. if [ ! -f "${rootdir}/${lockselfname}" ]; then fn_print_error_nl "Disabled: No lockfile found" fn_script_log_error "Disabled: No lockfile found" @@ -131,8 +130,8 @@ fn_monitor_check_session(){ fn_monitor_query(){ fn_script_log_info "Querying port: query enabled" - # engines that work with query - local allowed_engines_array=( avalanche2.0 avalanche3.0 goldsource idtech2 idtech3 idtech3_ql iw2.0 iw3.0 lwjgl2 madness quake refractor realvirtuality source spark starbound unity3d unreal unreal2 unreal4 wurm ) + # Engines that work with query. + local allowed_engines_array=( avalanche2.0 avalanche3.0 goldsource idtech2 idtech3 idtech3_ql ioquake3 iw2.0 iw3.0 lwjgl2 madness quake refractor realvirtuality source spark starbound unity3d unreal unreal2 unreal4 wurm ) for allowed_engine in "${allowed_engines_array[@]}" do if [ "${allowed_engine}" == "${engine}" ]; then @@ -142,7 +141,7 @@ fn_monitor_query(){ local engine="unreal4" fi - # will first attempt to use gamedig then gsquery + # Will first attempt to use gamedig then gsquery. totalseconds=0 if [ "${shortname}" == "wurm" ]; then local query_methods_array=( gsquery ) @@ -152,7 +151,7 @@ fn_monitor_query(){ for query_method in "${query_methods_array[@]}" do if [ "${query_method}" == "gamedig" ]; then - # will bypass gamedig if not installed + # Will bypass gamedig if not installed. if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then if [ -z "${monitorpass}" ]; then querymethod="${query_method}" @@ -186,7 +185,7 @@ info_parms.sh fn_monitor_check_lockfile fn_monitor_check_update fn_monitor_check_session -# Query has to be enabled in Starbound config +# Query has to be enabled in Starbound config. if [ "${shortname}" == "sb" ]; then if [ "${queryenabled}" == "true" ]; then fn_monitor_query @@ -196,5 +195,4 @@ elif [ "${shortname}" == "ts3" ]||[ "${shortname}" == "eco" ]||[ "${shortname}" else fn_monitor_query fi - core_exit.sh \ No newline at end of file diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index a4a0b96c4..660bb326f 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Strips sensitive information out of Details output -local commandname="postdetails" +local commandname="POSTDETAILS" local commandaction="Postdetails" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/functions/command_update_linuxgsm.sh index 25b028ef7..c4c49aee5 100644 --- a/lgsm/functions/command_update_linuxgsm.sh +++ b/lgsm/functions/command_update_linuxgsm.sh @@ -4,7 +4,7 @@ # Website: https://linuxgsm.com # Description: Deletes the functions dir to allow re-downloading of functions from GitHub. -local commandname="UPDATE LinuxGSM" +local commandname="UPDATE LINUXGSM" local commandaction="Update LinuxGSM" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" diff --git a/lgsm/functions/command_wipe.sh b/lgsm/functions/command_wipe.sh index b476f4da3..fdcbe424d 100644 --- a/lgsm/functions/command_wipe.sh +++ b/lgsm/functions/command_wipe.sh @@ -6,7 +6,7 @@ # Description: Wipes server data, useful after updates for some games like Rust local commandname="WIPE" -local commandaction="data wipe" +local commandaction="Wipe" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index ad5de35ee..3018dcf13 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -21,8 +21,24 @@ local commandname="DOWNLOAD" local commandaction="Download" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +# Emptys contents of the LinuxGSM tmpdir. +fn_clear_tmp(){ + echo -en "clearing LinuxGSM tmp directory..." + if [ -d "${tmpdir}" ]; then + rm -rf "${tmpdir:?}/"* + local exitcode=$? + if [ ${exitcode} -eq 0 ]; then + fn_print_ok_eol_nl + fn_script_log_pass "clearing LinuxGSM tmp directory" + else + fn_print_error_eol_nl + fn_script_log_error "clearing LinuxGSM tmp directory" + fi + fi +} + fn_dl_md5(){ - # Runs MD5 Check if available + # Runs MD5 Check if available. if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then echo -en "verifying ${local_filename} with MD5..." sleep 0.5 @@ -31,20 +47,20 @@ fn_dl_md5(){ fn_print_fail_eol_nl echo "${local_filename} returned MD5 checksum: ${md5sumcmd}" echo "expected MD5 checksum: ${md5}" - fn_script_log_fatal "Verifying ${local_filename} with MD5: FAIL" + fn_script_log_fatal "Verifying ${local_filename} with MD5" fn_script_log_info "${local_filename} returned MD5 checksum: ${md5sumcmd}" fn_script_log_info "Expected MD5 checksum: ${md5}" core_exit.sh else fn_print_ok_eol_nl - fn_script_log_pass "Verifying ${local_filename} with MD5: OK" + fn_script_log_pass "Verifying ${local_filename} with MD5" fn_script_log_info "${local_filename} returned MD5 checksum: ${md5sumcmd}" fn_script_log_info "Expected MD5 checksum: ${md5}" fi fi } -# Extracts bzip2, gzip or zip files +# Extracts bzip2, gzip or zip files. # Extracts can be defined in code like so: # fn_dl_extract "${local_filedir}" "${local_filename}" "${extractdir}" # fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles" @@ -52,7 +68,7 @@ fn_dl_extract(){ local_filedir="${1}" local_filename="${2}" extractdir="${3}" - # extracts archives + # Extracts archives. echo -en "extracting ${local_filename}..." mime=$(file -b --mime-type "${local_filedir}/${local_filename}") if [ ! -d "${extractdir}" ]; then @@ -70,7 +86,7 @@ fn_dl_extract(){ local exitcode=$? if [ ${exitcode} -ne 0 ]; then fn_print_fail_eol_nl - fn_script_log_fatal "Extracting download: FAIL" + fn_script_log_fatal "Extracting download" if [ -f "${lgsmlog}" ]; then echo "${extractcmd}" >> "${lgsmlog}" fi @@ -78,11 +94,11 @@ fn_dl_extract(){ core_exit.sh else fn_print_ok_eol_nl - fn_script_log_pass "Extracting download: OK" + fn_script_log_pass "Extracting download" fi } -# Trap to remove file download if canceled before completed +# Trap to remove file download if canceled before completed. fn_fetch_trap(){ echo "" echo -en "downloading ${local_filename}..." @@ -105,19 +121,20 @@ fn_fetch_file(){ forcedl="${6:-0}" md5="${7:-0}" - # Download file if missing or download forced + # 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 will remove part downloaded files if canceled. trap fn_fetch_trap INT - # larger files show a progress bar + # 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}..." sleep 0.5 - echo -en "downloading ${local_filename}..." + echo -en "\033[1K" curlcmd=$(${curlpath} --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}") + echo -en "downloading ${local_filename}..." else echo -en " fetching ${local_filename}...\c" curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) @@ -126,7 +143,7 @@ fn_fetch_file(){ if [ ${exitcode} -ne 0 ]; then fn_print_fail_eol_nl if [ -f "${lgsmlog}" ]; then - fn_script_log_fatal "Downloading ${local_filename}: FAIL" + fn_script_log_fatal "Downloading ${local_filename}" echo -e "${remote_fileurl}" >> "${lgsmlog}" echo "${curlcmd}" >> "${lgsmlog}" fi @@ -136,12 +153,12 @@ fn_fetch_file(){ else fn_print_ok_eol_nl if [ -f "${lgsmlog}" ]; then - fn_script_log_pass "Downloading ${local_filename}: OK" + fn_script_log_pass "Downloading ${local_filename}" fi fi - # Remove trap + # Remove trap. trap - INT - # Make file executable if chmodx is set + # Make file executable if chmodx is set. if [ "${chmodx}" == "chmodx" ]; then chmod +x "${local_filedir}/${local_filename}" fi @@ -149,15 +166,15 @@ fn_fetch_file(){ if [ -f "${local_filedir}/${local_filename}" ]; then fn_dl_md5 - # Execute file if run is set + # Execute file if run is set. if [ "${run}" == "run" ]; then source "${local_filedir}/${local_filename}" fi fi } -# GitHub file download functions -# Used to simplify downloading specific files from GitHub +# GitHub file download functions. +# Used to simplify downloading specific files from GitHub. # github_file_url_dir: the directory of the file in the GitHub: lgsm/functions # github_file_url_name: the filename of the file to download from GitHub: core_messages.sh @@ -171,7 +188,7 @@ 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 any files from the GitHub repo. fn_fetch_file_github(){ github_file_url_dir="${1}" github_file_url_name="${2}" @@ -184,7 +201,7 @@ fn_fetch_file_github(){ run="${5:-0}" forcedl="${6:-0}" md5="${7:-0}" - # Passes vars to the file download function + # Passes vars to the file download function. fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } @@ -200,11 +217,11 @@ fn_fetch_config(){ run="norun" forcedl="noforce" md5="nomd5" - # Passes vars to the file download function + # Passes vars to the file download function. fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } -# Fetches functions +# Fetches functions. fn_fetch_function(){ github_file_url_dir="lgsm/functions" github_file_url_name="${functionfile}" @@ -217,7 +234,7 @@ fn_fetch_function(){ run="run" forcedl="noforce" md5="nomd5" - # Passes vars to the file download function + # Passes vars to the file download function. fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } @@ -237,7 +254,7 @@ fn_update_function(){ fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } -# Defines curl path +# Defines curl path. curlpath=$(command -v curl 2>/dev/null) if [ "$(basename "${curlpath}")" != "curl" ]; then diff --git a/lgsm/functions/core_exit.sh b/lgsm/functions/core_exit.sh index 91142aaa8..f92d3b129 100644 --- a/lgsm/functions/core_exit.sh +++ b/lgsm/functions/core_exit.sh @@ -37,7 +37,6 @@ elif [ -n "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then trap - INT exit "${exitcode}" else - exitcode=0 fn_script_log_pass "${function_selfname} exiting with code: ${exitcode}" fn_exit_dev_debug # remove trap. diff --git a/lgsm/functions/core_messages.sh b/lgsm/functions/core_messages.sh index 075721999..74ae8cf5d 100644 --- a/lgsm/functions/core_messages.sh +++ b/lgsm/functions/core_messages.sh @@ -318,6 +318,11 @@ fn_print_fail_eol_nl(){ echo -e "${red}FAIL${default}" } +# ERROR +fn_print_error_eol(){ + echo -en "${red}ERROR${default}" +} + # WARN fn_print_warn_eol(){ echo -en "${red}WARN${default}" diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh index c58e1e2d0..6785306f3 100644 --- a/lgsm/functions/fix.sh +++ b/lgsm/functions/fix.sh @@ -29,7 +29,6 @@ fn_fix_msg_end(){ if [ $? -ne 0 ]; then fn_print_error_nl "Applying ${fixname} fix: ${gamename}" fn_script_log_error "Applying ${fixname} fix: ${gamename}" - exitcode=2 else fn_print_ok_nl "Applying ${fixname} fix: ${gamename}" fn_script_log_pass "Applying ${fixname} fix: ${gamename}" diff --git a/lgsm/functions/fix_dst.sh b/lgsm/functions/fix_dst.sh index 80c397442..24debfc9e 100644 --- a/lgsm/functions/fix_dst.sh +++ b/lgsm/functions/fix_dst.sh @@ -10,7 +10,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer) # Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS. -if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" ]; then +if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" ]; then fixname="libcurl-gnutls.so.4 missing" fn_fix_msg_start ln -s "/usr/lib/libcurl.so.4" "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" diff --git a/lgsm/functions/fix_tf2.sh b/lgsm/functions/fix_tf2.sh index 766fc8bfa..df161a1b5 100644 --- a/lgsm/functions/fix_tf2.sh +++ b/lgsm/functions/fix_tf2.sh @@ -9,7 +9,7 @@ local commandaction="Fix" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: Team Fortress 2 Segmentation fault for Red-Hat Distros #2062. -if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/bin/libcurl-gnutls.so.4" ]; then +if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/bin/libcurl-gnutls.so.4" ]; then fixname="libcurl-gnutls.so.4 missing" fn_fix_msg_start ln -s "/usr/lib/libcurl.so.4" "${serverfiles}/bin/libcurl-gnutls.so.4" diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index 60795d56c..11ab3149d 100644 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -224,7 +224,7 @@ fi # Steam Master Server - checks if detected by master server if [ ! "$(command -v jq 2>/dev/null)" ]; then - if [ "${ip}" ] && [ "${port}" ]; then + if [ "${ip}" ]&&[ "${port}" ]; then if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]||[ "${shortname}" == "jc2" ]||[ "${shortname}" == "ql" ]; then masterserver=$(${curlpath} -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l) if [ "${steammaster}" == "1" ]; then diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index f9371cf65..5080334dc 100644 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -1059,7 +1059,7 @@ fn_info_message_unreal(){ if [ "${engine}" == "unreal" ]; then echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp" fi - if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then + if [ "${engine}" != "unreal" ]&&[ "${appid}" != "223250" ]; then echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}" fi if [ "${appid}" == "215360" ]; then diff --git a/lgsm/functions/info_parms.sh b/lgsm/functions/info_parms.sh index 48285fed4..9ac95d477 100644 --- a/lgsm/functions/info_parms.sh +++ b/lgsm/functions/info_parms.sh @@ -95,6 +95,7 @@ fn_info_parms_risingworld(){ fn_info_parms_rtcw(){ port=${port:-"0"} + queryport="${port}" defaultmap=${defaultmap:-"NOT SET"} } diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index c6c3c8713..95e8f0c5f 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -90,7 +90,7 @@ fn_install_server_files_steamcmd(){ if [ "${counter}" -le "4" ]; then if [ "${appid}" == "90" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +quit + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +quit local exitcode=$? else ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit @@ -98,7 +98,7 @@ fn_install_server_files_steamcmd(){ fi elif [ "${counter}" -ge "5" ]; then if [ "${engine}" == "goldsource" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} validate +quit + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} validate +quit local exitcode=$? else ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit @@ -119,14 +119,14 @@ fn_install_server_files_steamcmd(){ counter="0" while [ "${counter}" -le "4" ]; do counter=$((counter+1)) - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} validate +quit + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} validate +quit local exitcode=$? done fi } echo "" -echo "Installing ${shortname} Server" +echo "Installing ${gamename} Server" echo "=================================" sleep 0.5 @@ -144,10 +144,10 @@ elif [ "${shortname}" == "mumble" ]; then elif [ "${shortname}" == "mta" ]; then update_mta.sh elif [ "${shortname}" == "fctr" ]; then - update_factorio.sh - install_factorio_save.sh + update_factorio.sh + install_factorio_save.sh elif [ -z "${appid}" ]||[ "${shortname}" == "ges" ]||[ "${shortname}" == "bd" ]||[ "${shortname}" == "bb" ]||[ "${shortname}" == "ns" ]||[ "${shortname}" == "vs" ]; then - if [ "${shortname}" == "Unreal Tournament" ]; then + if [ "${shortname}" == "ut" ]; then install_unreal_tournament_eula.sh fi fn_install_server_files diff --git a/lgsm/functions/logs.sh b/lgsm/functions/logs.sh index 4f8aaf015..69dbc7deb 100644 --- a/lgsm/functions/logs.sh +++ b/lgsm/functions/logs.sh @@ -17,7 +17,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" ]&&[ "${function_selfname}" == "command_start.sh" ]&&[ -n "${gamelogfile}" ]; then if [ -n "$(find "${systemdir}" -name "gamelog*.log")" ]; then fn_print_info "Moving game logs to ${gamelogdir}" fn_script_log_info "Moving game logs to ${gamelogdir}" diff --git a/lgsm/functions/mods_core.sh b/lgsm/functions/mods_core.sh index 8690b3b19..cf2178b3c 100644 --- a/lgsm/functions/mods_core.sh +++ b/lgsm/functions/mods_core.sh @@ -6,7 +6,7 @@ # Description: Core functions for mods list/install/update/remove local commandname="MODS" -local commandaction="addons/mods" +local commandaction="Mods" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Files and Directories @@ -179,7 +179,6 @@ fn_mod_get_info(){ if [ "${modinfocommand}" == "0" ]; then fn_script_log_error "Could not find information for ${currentmod}" fn_print_error_nl "Could not find information for ${currentmod}" - exitcode="1" core_exit.sh fi } diff --git a/lgsm/functions/query_gamedig.sh b/lgsm/functions/query_gamedig.sh index affef935c..ba5c45f33 100644 --- a/lgsm/functions/query_gamedig.sh +++ b/lgsm/functions/query_gamedig.sh @@ -46,7 +46,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; fi done - local engine_query_array=( idtech3 iw3.0 ) + local engine_query_array=( idtech3 iw3.0 ioquake3 ) for engine_query in "${engine_query_array[@]}" do if [ "${engine_query}" == "${engine}" ]; then diff --git a/lgsm/functions/query_gsquery.py b/lgsm/functions/query_gsquery.py index e5dd40463..74c26eeb7 100644 --- a/lgsm/functions/query_gsquery.py +++ b/lgsm/functions/query_gsquery.py @@ -18,7 +18,7 @@ class gsquery: self.default_buffer_length = 1024 # sourcequery=[ 'avalanche3.0','madness','quakelive','realvirtuality','refractor','source','goldsource','spark','starbound','unity3d', 'unreal4', 'wurm' ] - idtech3query=['idtech3','iw3.0'] + idtech3query=['idtech3','iw3.0','ioquake3'] idtech2query=['idtech2','quake','iw2.0'] minecraftquery=['minecraft','lwjgl2'] if self.option.engine in sourcequery: diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh index a1aa9653d..d01013224 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/functions/update_factorio.sh @@ -1,7 +1,6 @@ #!/bin/bash # LinuxGSM update_factorio.sh function # Author: Daniel Gibbs -# Contributor: Kristian Polso # Website: https://linuxgsm.com # Description: Handles updating of Factorio servers. @@ -10,121 +9,115 @@ local commandaction="Update" local function_selfname="$(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}-${availablebuild}.tar.xz" - fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.xz" "${tmpdir}" + fn_fetch_file "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" + fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" - fn_script_log "Copying to ${serverfiles}" cp -R "${tmpdir}/factorio/"* "${serverfiles}" local exitcode=$? if [ "${exitcode}" == "0" ]; then fn_print_ok_eol_nl + fn_script_log_pass "Copying to ${serverfiles}" + fn_clear_tmp else fn_print_fail_eol_nl + fn_script_log_fatal "Copying to ${serverfiles}" + core_exit.sh fi } -fn_update_factorio_currentbuild(){ - # Get current build info. - # If log file is missing, the server will restart to generate logs. - - if [ -f "${serverfiles}/factorio-current.log" ]; then - currentbuild=$(grep "Loading mod base" "${serverfiles}/factorio-current.log" 2> /dev/null | awk '{print $5}' | tail -1) +fn_update_factorio_localbuild(){ + # Gets local build info. + fn_print_dots "Checking for update: ${remotelocation}: checking local build" + sleep 0.5 + # Uses executable to find local build. + cd "${executabledir}" || exit + if [ -f "${executable}" ]; then + localbuild=$(${executable} --version | grep "Version:" | awk '{print $2}') + fn_print_ok "Checking for update: ${remotelocation}: checking local build" + fn_script_log_pass "Checking local build" + else + localbuild="0" + fn_print_error "Checking for update: ${remotelocation}: checking local build" + fn_script_log_error "Checking local build" fi + sleep 0.5 +} - if [ -z "${currentbuild}" ]; then - fn_print_error "Checking for update: factorio.com" - sleep 0.5 - if [ ! -f "${serverfiles}/factorio-current.log" ]; then - fn_print_error_nl "Checking for update: factorio.com: No logs with server version found" - fn_script_log_error "Checking for update: factorio.com: No logs with server version found" - elif [ -z "${currentbuild}" ]; then - fn_print_error_nl "Checking for update: factorio.com: Current build version not found" - fn_script_log_error "Checking for update: factorio.com: Current build version not found" - fi - sleep 0.5 - fn_print_info_nl "Checking for update: factorio.com: Forcing server restart" - fn_script_log_info "Checking for update: factorio.com: Forcing server restart" +fn_update_factorio_remotebuild(){ + # Gets remote build info. + remotebuild=$(${curlpath} -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" sleep 0.5 - exitbypass=1 - command_stop.sh - exitbypass=1 - command_start.sh - sleep 0.5 - - # Check again and exit if failure. - if [ -f "${serverfiles}/factorio-current.log" ]; then - currentbuild=$(grep "Loading mod base" "${serverfiles}/factorio-current.log" 2> /dev/null | awk '{print $5}' | tail -1) - fi - - if [ ! -f "${serverfiles}/factorio-current.log" ]; then - fn_print_fail_nl "Checking for update: factorio.com: Still No logs with server version found" - fn_script_log_fatal "Checking for update: factorio.com: Still No logs with server version found" - core_exit.sh - elif [ -z "${currentbuild}" ]; then - fn_print_fail_nl "Checking for update: factorio.com: Current build version still not found" - fn_script_log_fatal "Checking for update: factorio.com: Current build version still not found" + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_fatal "Checking remote build" core_exit.sh + else + fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_pass "Checking remote build" + sleep 0.5 fi - fi -} - -fn_update_factorio_availablebuild(){ - # Gets latest build info. - availablebuild=$(${curlpath} -s https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch} | grep -o '[0-9]\.[0-9]\{1,\}\.[0-9]\{1,\}' | head -1) - - # Checks if availablebuild variable has been set. - if [ -v "${availablebuild}" ]; then - fn_print_fail "Checking for update: factorio.com" - sleep 0.5 - fn_print_fail "Checking for update: factorio.com: Not returning version info" - fn_script_log_fatal "Failure! Checking for update: factorio.com: Not returning version info" - core_exit.sh - elif [ "${installer}" == "1" ]; then - : else - fn_print_ok "Checking for update: factorio.com" - fn_script_log_pass "Checking for update: factorio.com" - sleep 0.5 - fi + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_failure "Unable to get remote build" + fn_script_log_fatal "Unable to get remote build" + core_exit.sh + fi + fi } fn_update_factorio_compare(){ + fn_print_dots "Checking for update: ${remotelocation}" + sleep 0.5 # Removes dots so if statement can compare version numbers. - currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]') - availablebuilddigit=$(echo "${availablebuild}" | tr -cd '[:digit:]') - - if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then - echo -e "\n" - echo -e "Update available:" + localbuilddigit=$(echo "${localbuild}" | tr -cd '[:digit:]') + remotebuilddigit=$(echo "${remotebuild}" | tr -cd '[:digit:]') + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + fn_print_ok_nl "Checking for update: ${remotelocation}" sleep 0.5 - echo -e " Current build: ${red}${currentbuild} ${factorioarch} ${branch} ${default}" - echo -e " Available build: ${green}${availablebuild} ${factorioarch} ${branch}${default}" - echo -e "" + echo -en "\n" + echo -e "Update available" + echo -e "* Local build: ${red}${localbuild} ${factorioarch}${default}" + echo -e "* Remote build: ${green}${remotebuild} ${factorioarch}${default}" + if [ -v "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi + fn_script_log_info "Update available" + fn_script_log_info "Local build: ${localbuild} ${factorioarch}" + fn_script_log_info "Remote build: ${remotebuild} ${factorioarch}" + if [ -v "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi + fn_script_log_info "${localbuild} > ${remotebuild}" sleep 0.5 - echo -en "Applying update.\r" + echo -en "\n" + echo -en "applying update.\r" sleep 1 - echo -en "Applying update..\r" + echo -en "applying update..\r" sleep 1 - echo -en "Applying update...\r" + echo -en "applying update...\r" sleep 1 echo -en "\n" - fn_script_log "Update available" - fn_script_log "Current build: ${currentbuild} ${factorioarch}${branch}" - fn_script_log "Available build: ${availablebuild} ${factorioarch}${branch}" - fn_script_log "${currentbuild} > ${availablebuild}" unset updateonstart check_status.sh + # If server stopped. if [ "${status}" == "0" ]; then + exitbypass=1 fn_update_factorio_dl exitbypass=1 command_start.sh exitbypass=1 command_stop.sh + # If server started. else exitbypass=1 command_stop.sh + exitbypass=1 fn_update_factorio_dl exitbypass=1 command_start.sh @@ -132,18 +125,28 @@ fn_update_factorio_compare(){ alert="update" alert.sh else - echo -e "\n" - echo -e "No update available:" - echo -e " Current build: ${green}${currentbuild} ${factorioarch} ${branch}${default}" - echo -e " Available build: ${green}${availablebuild} ${factorioarch} ${branch}${default}" - echo -e "" - fn_print_ok_nl "No update available" - fn_script_log_info "Current build: ${currentbuild} ${factorioarch} ${branch}" - fn_script_log_info "Available build: ${availablebuild} ${factorioarch} ${branch}" + fn_print_ok_nl "Checking for update: ${remotelocation}" + sleep 0.5 + echo -en "\n" + echo -e "No update available" + echo -e "* Local build: ${green}${localbuild} ${factorioarch}${default}" + echo -e "* Remote build: ${green}${remotebuild} ${factorioarch}${default}" + if [ -v "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi + fn_script_log_info "No update available" + fn_script_log_info "Local build: ${localbuild} ${factorioarch}" + fn_script_log_info "Remote build: ${remotebuild} ${factorioarch}" + if [ -v "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi fi } -# Factorio is linux64 only for now. +# The location where the builds are checked and downloaded. +remotelocation="mojang.com" + +# Game server architecture. factorioarch="linux64" if [ "${branch}" == "stable" ]; then @@ -153,14 +156,13 @@ elif [ "${branch}" == "experimental" ]; then fi if [ "${installer}" == "1" ]; then - fn_update_factorio_availablebuild + fn_update_factorio_remotebuild fn_update_factorio_dl else - # Checks for server update from factorio.com - fn_print_dots "Checking for update: factorio.com" - fn_script_log_info "Checking for update: factorio.com" + fn_print_dots "Checking for update: ${remotelocation}" + fn_script_log_info "Checking for update: ${remotelocation}" sleep 0.5 - fn_update_factorio_currentbuild - fn_update_factorio_availablebuild + fn_update_factorio_localbuild + fn_update_factorio_remotebuild fn_update_factorio_compare fi diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index 31c1f0a20..795d3fbfc 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -8,151 +8,200 @@ local commandname="UPDATE" local commandaction="Update" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_dl(){ +fn_update_minecraft_dl(){ latestmcreleaselink=$(${curlpath} -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r '.latest.release as $latest | .versions[] | select(.id == $latest) | .url') latestmcbuildurl=$(${curlpath} -s "${latestmcreleaselink}" | jq -r '.downloads.server.url') - fn_fetch_file "${latestmcbuildurl}" "${tmpdir}" "minecraft_server.${availablebuild}.jar" + fn_fetch_file "${latestmcbuildurl}" "${tmpdir}" "minecraft_server.${remotebuild}.jar" echo -e "copying to ${serverfiles}...\c" - fn_script_log "Copying to ${serverfiles}" - cp "${tmpdir}/minecraft_server.${availablebuild}.jar" "${serverfiles}/minecraft_server.jar" + cp "${tmpdir}/minecraft_server.${remotebuild}.jar" "${serverfiles}/minecraft_server.jar" local exitcode=$? - chmod u+x "${serverfiles}/minecraft_server.jar" - if [ ${exitcode} -eq 0 ]; then + if [ "${exitcode}" == "0" ]; then fn_print_ok_eol_nl + fn_script_log_pass "Copying to ${serverfiles}" + chmod u+x "${serverfiles}/minecraft_server.jar" + fn_clear_tmp else fn_print_fail_eol_nl + fn_script_log_fatal "Copying to ${serverfiles}" + core_exit.sh fi } -fn_update_currentbuild(){ - # Gets current build info - # Checks if current build info is available. If it fails, then a server restart will be forced to generate logs. - if [ ! -f "${consolelogdir}/${servicename}-console.log" ]; then - fn_print_error "Checking for update: mojang.com" +fn_update_minecraft_localbuild(){ + # Gets local build info. + fn_print_dots "Checking for update: ${remotelocation}: checking local build" + sleep 0.5 + # 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" sleep 0.5 - fn_print_error_nl "Checking for update: mojang.com: No logs with server version found" - fn_script_log_error "Checking for update: mojang.com: No logs with server version found" + fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no log files" + fn_script_log_error "No log file found" sleep 0.5 - fn_print_info_nl "Checking for update: mojang.com: Forcing server restart" - fn_script_log_info "Checking for update: mojang.com: Forcing server restart" + fn_print_info_nl "Checking for update: ${remotelocation}: checking local build: forcing server restart" + fn_script_log_info "Forcing server restart" sleep 0.5 exitbypass=1 command_stop.sh exitbypass=1 command_start.sh - sleep 0.5 - # Check again and exit on failure. - if [ ! -f "${consolelogdir}/${servicename}-console.log" ]; then - fn_print_fail_nl "Checking for update: mojang.com: Still No logs with server version found" - fn_script_log_fatal "Checking for update: mojang.com: Still No logs with server version found" - core_exit.sh - fi + totalseconds=0 + # 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}" + if [ -v "${loopignore}" ]; then + loopignore=1 + fn_script_log_info "Waiting for log file to generate" + fi + + if [ "${totalseconds}" -gt "120" ]; then + localbuild="0" + fn_print_error "Checking for update: ${remotelocation}: waiting for log file: missing log file" + fn_script_log_error "Missing log file" + fn_script_log_error "Set localbuild to 0" + sleep 0.5 + fi + + totalseconds=$((totalseconds + 1)) + done fi - # Get current build from logs - currentbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') - if [ -z "${currentbuild}" ]; then - fn_print_error_nl "Checking for update: mojang.com: Current build version not found" - fn_script_log_error "Checking for update: mojang.com: Current build version not found" - sleep 0.5 - fn_print_info_nl "Checking for update: mojang.com: Forcing server restart" - fn_script_log_info "Checking for update: mojang.com: Forcing server restart" - exitbypass=1 - command_stop.sh - exitbypass=1 - command_start.sh - currentbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') - if [ -z "${currentbuild}" ]; then - fn_print_fail_nl "Checking for update: mojang.com: Current build version still not found" - fn_script_log_fatal "Checking for update: mojang.com: Current build version still not found" - core_exit.sh - fi + if [ -z "${localbuild}" ]; then + localbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') fi -} -fn_update_availablebuild(){ - # Gets latest build info. - availablebuild=$(${curlpath} -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r '.latest.release') - # Checks if availablebuild variable has been set - if [ -z "${availablebuild}" ]; then - fn_print_fail "Checking for update: mojang.com" - sleep 0.5 - fn_print_fail "Checking for update: mojang.com: Not returning version info" - fn_script_log_fatal "Failure! Checking for update: mojang.com: Not returning version info" - core_exit.sh - elif [ "${installer}" == "1" ]; then - : + 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}" + if [ -z "${loopignore}" ]; then + loopignore=1 + fn_script_log_info "Waiting for local build to generate" + fi + localbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') 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}") + if [ "${localbuild}" ]; then + break + fi + sleep 1 + totalseconds=$((totalseconds + 1)) + done + fi + + if [ -z "${localbuild}" ]; then + localbuild="0" + fn_print_error "Checking for update: ${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_nl "Checking for update: mojang.com" - fn_script_log_pass "Checking for update: mojang.com" - sleep 0.5 + fn_print_ok "Checking for update: ${remotelocation}: checking local build" + fn_script_log_pass "Checking local build" fi + sleep 0.5 } -fn_update_compare(){ - # Removes dots so if can compare version numbers - currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]') - availablebuilddigit=$(echo "${availablebuild}" | tr -cd '[:digit:]') +fn_update_minecraft_remotebuild(){ + # Gets remote build info. + remotebuild=$(${curlpath} -s "https://launchermeta.${remotelocation}/mc/game/version_manifest.json" | jq -r '.latest.release') + if [ "${installer}" != "1" ]; then + fn_print_dots "Checking for update: ${remotelocation}: checking remote build" + sleep 0.5 + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_fatal "Checking remote build" + core_exit.sh + else + fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_pass "Checking remote build" + sleep 0.5 + fi + else + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_failure "Unable to get remote build" + fn_script_log_fatal "Unable to get remote build" + core_exit.sh + fi + fi +} - if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then - echo -e "\n" - echo -e "Update available:" +fn_update_minecraft_compare(){ + # Removes dots so if statement can compare version numbers. + fn_print_dots "Checking for update: ${remotelocation}" + sleep 0.5 + localbuilddigit=$(echo "${localbuild}" | tr -cd '[:digit:]') + remotebuilddigit=$(echo "${remotebuild}" | tr -cd '[:digit:]') + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + fn_print_ok_nl "Checking for update: ${remotelocation}" sleep 0.5 - echo -e " Current build: ${red}${currentbuild}${default}" - echo -e " Available build: ${green}${availablebuild}${default}" - echo -e "" + echo -en "\n" + echo -e "Update available" + echo -e "* Local build: ${red}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + 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}" sleep 0.5 - echo -en "Applying update.\r" + echo -en "\n" + echo -en "applying update.\r" sleep 1 - echo -en "Applying update..\r" + echo -en "applying update..\r" sleep 1 - echo -en "Applying update...\r" + echo -en "applying update...\r" sleep 1 echo -en "\n" - fn_script_log "Update available" - fn_script_log "Current build: ${currentbuild}" - fn_script_log "Available build: ${availablebuild}" - fn_script_log "${currentbuild} > ${availablebuild}" unset updateonstart check_status.sh + # If server stopped. if [ "${status}" == "0" ]; then - fn_update_dl + exitbypass=1 + fn_update_minecraft_dl exitbypass=1 command_start.sh exitbypass=1 command_stop.sh + # If server started. else exitbypass=1 command_stop.sh - fn_update_dl + exitbypass=1 + fn_update_minecraft_dl exitbypass=1 command_start.sh fi alert="update" alert.sh else - echo -e "\n" - echo -e "No update available:" - echo -e " Current version: ${green}${currentbuild}${default}" - echo -e " Available version: ${green}${availablebuild}${default}" - echo -e "" - fn_print_ok_nl "No update available" - fn_script_log_info "Current build: ${currentbuild}" - fn_script_log_info "Available build: ${availablebuild}" + fn_print_ok_nl "Checking for update: ${remotelocation}" + sleep 0.5 + echo -en "\n" + echo -e "No update available" + echo -e "* Local build: ${green}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + fn_script_log_info "No update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuild}" fi } +# The location where the builds are checked and downloaded. +remotelocation="mojang.com" + if [ "${installer}" == "1" ]; then - fn_update_availablebuild - fn_update_dl + fn_update_minecraft_remotebuild + fn_update_minecraft_dl else - # Checks for server update from mojang.com - fn_print_dots "Checking for update: mojang.com" - fn_script_log_info "Checking for update: mojang.com" + fn_print_dots "Checking for update: ${remotelocation}" + fn_script_log_info "Checking for update: ${remotelocation}" sleep 0.5 - fn_update_currentbuild - fn_update_availablebuild - fn_update_compare + fn_update_minecraft_localbuild + fn_update_minecraft_remotebuild + fn_update_minecraft_compare fi diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh index 85c7b1053..cdd834322 100644 --- a/lgsm/functions/update_mta.sh +++ b/lgsm/functions/update_mta.sh @@ -13,113 +13,174 @@ fn_update_mta_dl(){ mkdir "${tmpdir}/multitheftauto_linux_x64-${fullversion}" fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}/multitheftauto_linux_x64-${fullversion}" echo -e "copying to ${serverfiles}...\c" - fn_script_log "Copying to ${serverfiles}" cp -R "${tmpdir}/multitheftauto_linux_x64-${fullversion}/multitheftauto_linux_x64-${fullversion}/"* "${serverfiles}" local exitcode=$? if [ "${exitcode}" == "0" ]; then fn_print_ok_eol_nl + fn_script_log_pass "Copying to ${serverfiles}" + chmod u+x "${serverfiles}/minecraft_server.jar" + fn_clear_tmp else fn_print_fail_eol_nl + fn_script_log_fatal "Copying to ${serverfiles}" + core_exit.sh fi } -fn_update_mta_currentbuild(){ - # Gets current build info - # Checks if current build info is available. If it fails, then a server restart will be forced to generate logs. - if [ ! -f "${gamelogdir}"/server.log ]; then - fn_print_error "Checking for update: linux.mtasa.com" +fn_update_mta_localbuild(){ + # Gets local build info. + fn_print_dots "Checking for update: ${remotelocation}: checking local build" + sleep 0.5 + # 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" sleep 0.5 - fn_print_error_nl "Checking for update: linux.mtasa.com: No logs with server version found" - fn_script_log_error "Checking for update: linux.mtasa.com: No logs with server version found" + fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no log files" + fn_script_log_error "No log file found" sleep 0.5 - fn_print_info_nl "Checking for update: linux.mtasa.com: Forcing server restart" - fn_script_log_info "Checking for update: linux.mtasa.com: Forcing server restart" + fn_print_info_nl "Checking for update: ${remotelocation}: checking local build: forcing server restart" + fn_script_log_info "Forcing server restart" sleep 0.5 exitbypass=1 command_stop.sh exitbypass=1 command_start.sh - sleep 0.5 - # Check again and exit on failure. - if [ ! -f "${gamelogdir}"/server.log ]; then - fn_print_fail_nl "Checking for update: linux.mtasa.com: Still No logs with server version found" - fn_script_log_fatal "Checking for update: linux.mtasa.com: Still No logs with server version found" - core_exit.sh - fi + totalseconds=0 + # 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}" + if [ -v "${loopignore}" ]; then + loopignore=1 + fn_script_log_info "Waiting for log file to generate" + fi + + if [ "${totalseconds}" -gt "120" ]; then + localbuild="0" + fn_print_error "Checking for update: ${remotelocation}: waiting for log file: missing log file" + fn_script_log_error "Missing log file" + fn_script_log_error "Set localbuild to 0" + sleep 0.5 + fi + + totalseconds=$((totalseconds + 1)) + done fi - # Get current build from logs - currentbuild=$(grep "= Multi Theft Auto: San Andreas v" "${gamelogdir}/server.log" | awk '{ print $7 }' | sed -r 's/^.{1}//' | tail -1) - if [ -z "${currentbuild}" ]; then - fn_print_error_nl "Checking for update: linux.mtasa.com: Current build version not found" - fn_script_log_error "Checking for update: linux.mtasa.com: Current build version not found" - sleep 0.5 - fn_print_info_nl "Checking for update: linux.mtasa.com: Forcing server restart" - fn_script_log_info "Checking for update: linux.mtasa.com: Forcing server restart" - exitbypass=1 - command_stop.sh - exitbypass=1 - command_start.sh - currentbuild=$(grep "= Multi Theft Auto: San Andreas v" "${gamelogdir}/server.log" | awk '{ print $7 }' | sed -r 's/^.{1}//' | tail -1) - if [ -z "${currentbuild}" ]; then - fn_print_fail_nl "Checking for update: linux.mtasa.com: Current build version still not found" - fn_script_log_fatal "Checking for update: linux.mtasa.com: Current build version still not found" - core_exit.sh - fi + if [ -z "${localbuild}" ]; then + localbuild=$(grep "= Multi Theft Auto: San Andreas v" "${serverfiles}/mods/deathmatch/logs/server.log" | awk '{ print $7 }' | sed -r 's/^.{1}//' | tail -1) + fi + + 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}" + if [ -z "${loopignore}" ]; then + loopignore=1 + fn_script_log_info "Waiting for local build to generate" + fi + localbuild=$(grep "= Multi Theft Auto: San Andreas v" "${serverfiles}/mods/deathmatch/logs/server.log" | awk '{ print $7 }' | sed -r 's/^.{1}//' | tail -1) + if [ "${localbuild}" ]; then + break + fi + sleep 1 + totalseconds=$((totalseconds + 1)) + done + fi + + if [ -z "${localbuild}" ]; then + localbuild="0" + fn_print_error "Checking for update: ${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_script_log_pass "Checking local build" fi + sleep 0.5 } -fn_mta_get_availablebuild(){ - fn_fetch_file "https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h" "${tmpdir}" "version.h" # we need to find latest stable version here - local majorversion="$(grep "#define MTASA_VERSION_MAJOR" "${tmpdir}/version.h" | awk '{ print $3 }' | sed 's/\r//g')" - local minorversion="$(grep "#define MTASA_VERSION_MINOR" "${tmpdir}/version.h" | awk '{ print $3 }' | sed 's/\r//g')" - local maintenanceversion="$(grep "#define MTASA_VERSION_MAINTENANCE" "${tmpdir}/version.h" | awk '{ print $3 }' | sed 's/\r//g')" - numversion="${majorversion}${minorversion}${maintenanceversion}" - fullversion="${majorversion}.${minorversion}.${maintenanceversion}" - rm -f "${tmpdir}/version.h" +fn_update_mta_remotebuild(){ + # Gets remote build info. + majorversion="$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MAJOR" | awk '{ print $3 }' | sed 's/\r//g')" + minorversion="$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MINOR" | awk '{ print $3 }' | sed 's/\r//g')" + 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" + sleep 0.5 + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_fatal "Checking remote build" + core_exit.sh + else + fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_pass "Checking remote build" + sleep 0.5 + fi + else + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_failure "Unable to get remote build" + fn_script_log_fatal "Unable to get remote build" + core_exit.sh + fi + fi } fn_update_mta_compare(){ - # Removes dots so if can compare version numbers - currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]') - if [ "${currentbuilddigit}" -ne "${numversion}" ]||[ "${forceupdate}" == "1" ]; then + # Removes dots so if statement can compare version numbers. + fn_print_dots "Checking for update: ${remotelocation}" + sleep 0.5 + localbuilddigit=$(echo "${localbuild}" | tr -cd '[:digit:]') + remotebuilddigit=$(echo "${remotebuild}" | tr -cd '[:digit:]') + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + fn_print_ok_nl "Checking for update: ${remotelocation}" if [ "${forceupdate}" == "1" ]; then # forceupdate bypasses checks, useful for small build changes - mta_update_string="forced" + mtaupdatestatus="forced" else - mta_update_string="available" + mtaupdatestatus="available" fi - echo -e "\n" - echo -e "Update ${mta_update_string}:" sleep 0.5 - echo -e " Current build: ${red}${currentbuild} ${default}" - echo -e " Available build: ${green}${fullversion} ${default}" - echo -e "" + echo -en "\n" + echo -e "Update ${mtaupdatestatus}:" + echo -e "* Local build: ${red}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + 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}" sleep 0.5 - echo -en "Applying update.\r" + echo -en "\n" + echo -en "applying update.\r" sleep 1 - echo -en "Applying update..\r" + echo -en "applying update..\r" sleep 1 - echo -en "Applying update...\r" + echo -en "applying update...\r" sleep 1 echo -en "\n" - fn_script_log "Update ${mta_update_string}" - fn_script_log "Current build: ${currentbuild}" - fn_script_log "Available build: ${fullversion}" - fn_script_log "${currentbuild} > ${fullversion}" unset updateonstart check_status.sh + # If server stopped. if [ "${status}" == "0" ]; then + exitbypass=1 fn_update_mta_dl exitbypass=1 command_start.sh exitbypass=1 command_stop.sh + # If server started. else exitbypass=1 command_stop.sh + exitbypass=1 fn_update_mta_dl exitbypass=1 command_start.sh @@ -127,27 +188,29 @@ fn_update_mta_compare(){ alert="update" alert.sh else - echo -e "\n" - echo -e "No update available:" - echo -e " Current version: ${green}${currentbuild}${default}" - echo -e " Available version: ${green}${fullversion}${default}" - echo -e "" - fn_print_ok_nl "No update available" - fn_script_log_info "Current build: ${currentbuild}" - fn_script_log_info "Available build: ${fullversion}" + fn_print_ok_nl "Checking for update: ${remotelocation}" + sleep 0.5 + echo -en "\n" + echo -e "No update available" + echo -e "* Local build: ${green}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + fn_script_log_info "No update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuild}" fi } +# The location where the builds are checked and downloaded. +remotelocation="linux.mtasa.com" if [ "${installer}" == "1" ]; then - fn_mta_get_availablebuild + fn_update_mta_remotebuild fn_update_mta_dl else - # Checks for server update from linux.mtasa.com using the github repo. - fn_print_dots "Checking for update: linux.mtasa.com" - fn_script_log_info "Checking for update: linux.mtasa.com" + fn_print_dots "Checking for update: ${remotelocation}" + fn_script_log_info "Checking for update: ${remotelocation}" sleep 0.5 - fn_update_mta_currentbuild - fn_mta_get_availablebuild + fn_update_mta_localbuild + fn_update_mta_remotebuild fn_update_mta_compare fi diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh index 6988fc317..ba98449e2 100644 --- a/lgsm/functions/update_mumble.sh +++ b/lgsm/functions/update_mumble.sh @@ -1,137 +1,117 @@ #!/bin/bash # LinuxGSM update_mumble.sh function # Author: Daniel Gibbs -# Contributor: UltimateByte # Website: https://linuxgsm.com -# Description: Handles updating of mumble servers. +# Description: Handles updating of Mumble servers. local commandname="UPDATE" local commandaction="Update" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_mumble_dl(){ - fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${availablebuild}/murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2" - fn_dl_extract "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" + 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_dl_extract "${tmpdir}" "murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" - fn_script_log "Copying to ${serverfiles}" - cp -R "${tmpdir}/murmur-static_${mumblearch}-${availablebuild}/"* "${serverfiles}" + cp -R "${tmpdir}/murmur-static_${mumblearch}-${remotebuild}/"* "${serverfiles}" local exitcode=$? - if [ ${exitcode} -eq 0 ]; then + if [ "${exitcode}" == "0" ]; then fn_print_ok_eol_nl + fn_script_log_pass "Copying to ${serverfiles}" + fn_clear_tmp else fn_print_fail_eol_nl + fn_script_log_fatal "Copying to ${serverfiles}" + core_exit.sh fi } -fn_update_mumble_currentbuild(){ - # Gets current build info - # Checks if current build info is available. If it fails, then a server restart will be forced to generate logs. - if [ ! -f "${consolelogdir}/${servicename}-console.log" ]; then - fn_print_error "Checking for update: GitHub" - sleep 0.5 - fn_print_error_nl "Checking for update: GitHub: No logs with server version found" - fn_script_log_error "Checking for update: GitHub: No logs with server version found" - sleep 0.5 - fn_print_info_nl "Checking for update: GitHub: Forcing server restart" - fn_script_log_info "Checking for update: GitHub: Forcing server restart" - sleep 0.5 - exitbypass=1 - command_stop.sh - exitbypass=1 - command_start.sh - sleep 0.5 - # Check again and exit on failure. - if [ ! -f "${consolelogdir}/${servicename}-console.log" ]; then - fn_print_fail_nl "Checking for update: GitHub: Still No logs with server version found" - fn_script_log_fatal "Checking for update: GitHub: Still No logs with server version found" - core_exit.sh - fi +fn_update_mumble_localbuild(){ + # Gets local build info. + fn_print_dots "Checking for update: ${remotelocation}: checking local build" + sleep 0.5 + # 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_script_log_pass "Checking local build" + else + localbuild="0" + fn_print_error "Checking for update: ${remotelocation}: checking local build" + fn_script_log_error "Checking local build" fi + sleep 0.5 +} - # Get current build from logs - currentbuild=$(cat "${consolelogdir}"/"${servicename}"-console.log 2> /dev/null | sort | grep -E 'Murmur ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | awk '{print $4}') - if [ -z "${currentbuild}" ]; then - fn_print_error_nl "Checking for update: GitHub: Current build version not found" - fn_script_log_error "Checking for update: GitHub: Current build version not found" +fn_update_mumble_remotebuild(){ + # Gets remote build info. + remotebuild=$(${curlpath} -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" sleep 0.5 - fn_print_info_nl "Checking for update: GitHub: Forcing server restart" - fn_script_log_info "Checking for update: GitHub: Forcing server restart" - exitbypass=1 - command_stop.sh - exitbypass=1 - command_start.sh - currentbuild=$(cat "${consolelogdir}"/"${servicename}"-console.log 2> /dev/null | sort | grep -E 'Murmur ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | awk '{print $4}') - if [ -z "${currentbuild}" ]; then - fn_print_fail_nl "Checking for update: GitHub: Current build version still not found" - fn_script_log_fatal "Checking for update: GitHub: Current build version still not found" + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_fatal "Checking remote build" core_exit.sh + else + fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_pass "Checking remote build" + sleep 0.5 fi - fi -} - -fn_update_mumble_arch(){ - # Mumble is x86 only for now - mumblearch="x86" -} - -fn_update_mumble_availablebuild(){ - # Gets latest build info. - availablebuild=$(${curlpath} -s https://api.github.com/repos/mumble-voip/mumble/releases/latest | grep 'murmur-static_x86.*\.bz2"' | tail -1 | awk -F"/" '{ print $8 }') - sleep 0.5 - - # Checks if availablebuild variable has been set - if [ -z "${availablebuild}" ]; then - fn_print_fail "Checking for update: GitHub" - sleep 0.5 - fn_print_fail "Checking for update: GitHub: Not returning version info" - fn_script_log_fatal "Failure! Checking for update: GitHub: Not returning version info" - core_exit.sh - elif [ "${installer}" == "1" ]; then - : else - fn_print_ok "Checking for update: GitHub" - fn_script_log_pass "Checking for update: GitHub" - sleep 0.5 - fi + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_failure "Unable to get remote build" + fn_script_log_fatal "Unable to get remote build" + core_exit.sh + fi + fi } fn_update_mumble_compare(){ - # Removes dots so if can compare version numbers - currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]') - availablebuilddigit=$(echo "${availablebuild}" | tr -cd '[:digit:]') - - if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then - echo -e "\n" - echo -e "Update available:" + # Removes dots so if statement can compare version numbers. + fn_print_dots "Checking for update: ${remotelocation}" + sleep 0.5 + localbuilddigit=$(echo "${localbuild}" | tr -cd '[:digit:]') + remotebuilddigit=$(echo "${remotebuild}" | tr -cd '[:digit:]') + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + fn_print_ok_nl "Checking for update: ${remotelocation}" sleep 0.5 - echo -e " Current build: ${red}${currentbuild} ${mumblearch}${default}" - echo -e " Available build: ${green}${availablebuild} ${mumblearch}${default}" - echo -e "" + echo -en "\n" + echo -e "Update available" + echo -e "* Local build: ${red}${localbuild} ${mumblearch}${default}" + echo -e "* Remote build: ${green}${remotebuild} ${mumblearch}${default}" + 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}" sleep 0.5 - echo -en "Applying update.\r" + echo -en "\n" + echo -en "applying update.\r" sleep 1 - echo -en "Applying update..\r" + echo -en "applying update..\r" sleep 1 - echo -en "Applying update...\r" + echo -en "applying update...\r" sleep 1 echo -en "\n" - fn_script_log "Update available" - fn_script_log "Current build: ${currentbuild}" - fn_script_log "Available build: ${availablebuild}" - fn_script_log "${currentbuild} > ${availablebuild}" unset updateonstart check_status.sh + # If server stopped. if [ "${status}" == "0" ]; then + exitbypass=1 fn_update_mumble_dl exitbypass=1 command_start.sh exitbypass=1 command_stop.sh + # If server started. else exitbypass=1 command_stop.sh + exitbypass=1 fn_update_mumble_dl exitbypass=1 command_start.sh @@ -139,27 +119,32 @@ fn_update_mumble_compare(){ alert="update" alert.sh else - echo -e "\n" - echo -e "No update available:" - echo -e " Current version: ${green}${currentbuild}${default}" - echo -e " Available version: ${green}${availablebuild}${default}" - echo -e "" - fn_print_ok_nl "No update available" - fn_script_log_info "Current build: ${currentbuild}" - fn_script_log_info "Available build: ${availablebuild}" + fn_print_ok_nl "Checking for update: ${remotelocation}" + sleep 0.5 + echo -en "\n" + echo -e "No update available" + echo -e "* Local build: ${green}${localbuild} ${mumblearch}${default}" + echo -e "* Remote build: ${green}${remotebuild} ${mumblearch}${default}" + 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_update_mumble_arch +# The location where the builds are checked and downloaded. +remotelocation="mumble.info" + +# Game server architecture. +mumblearch="x86" + if [ "${installer}" == "1" ]; then - fn_update_mumble_availablebuild + fn_update_mumble_remotebuild fn_update_mumble_dl else - # Checks for server update from github.com - fn_print_dots "Checking for update: github.com" - fn_script_log_info "Checking for update: github.com" + fn_print_dots "Checking for update: ${remotelocation}" + fn_script_log_info "Checking for update: ${remotelocation}" sleep 0.5 - fn_update_mumble_currentbuild - fn_update_mumble_availablebuild + fn_update_mumble_localbuild + fn_update_mumble_remotebuild fn_update_mumble_compare fi diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index 480624f7b..0a38699e5 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -8,16 +8,8 @@ local commandname="UPDATE" local commandaction="Update" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -check.sh - fn_update_steamcmd_dl(){ info_config.sh - fn_print_dots "SteamCMD" - sleep 0.5 - fn_print_ok_nl "SteamCMD" - fn_script_log_info "Starting SteamCMD" - - cd "${steamcmddir}" || exit # Detects if unbuffer command is available for 32 bit distributions only. info_distro.sh @@ -27,17 +19,131 @@ fn_update_steamcmd_dl(){ cd "${steamcmddir}" || exit if [ "${appid}" == "90" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +quit | tee -a "${lgsmlog}" + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +quit | tee -a "${lgsmlog}" else ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit | tee -a "${lgsmlog}" - if [ "${gamename}" == "Classic Offensive" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid_co}" ${branch} +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" + sleep 0.5 + 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 + branchname="${branchsplits[1]}" + else + branchname="public" + fi + sleep 0.5 +} + +fn_update_steamcmd_remotebuild(){ + # Gets remote build info. + cd "${steamcmddir}" || exit + remotebuild=$(./steamcmd.sh +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" + sleep 0.5 + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_fatal "Checking remote build" + core_exit.sh + else + fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_pass "Checking remote build" + sleep 0.5 + fi + else + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_failure "Unable to get remote build" + fn_script_log_fatal "Unable to get remote build" + core_exit.sh + fi + fi +} + +fn_update_steamcmd_compare(){ + fn_print_dots "Checking for update: ${remotelocation}" + sleep 0.5 + if [ "${localbuild}" != "${remotebuild}" ]; then + fn_print_ok_nl "Checking for update: ${remotelocation}" + sleep 0.5 + echo -en "\n" + echo -e "Update available" + echo -e "* Local build: ${red}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + if [ -v "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi + echo -e "https://steamdb.info/app/${appid}/" + fn_script_log_info "Update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuild}" + if [ -v "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi + fn_script_log_info "${localbuild} > ${remotebuild}" + sleep 0.5 + 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 + exitbypass=1 + command_stop.sh + exitbypass=1 + fn_update_steamcmd_dl + exitbypass=1 + command_start.sh + fi + alert="update" + alert.sh + else + fn_print_ok_nl "Checking for update: ${remotelocation}" + sleep 0.5 + echo -en "\n" + echo -e "No update available" + echo -e "* Local build: ${green}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + if [ -v "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi + echo -e "https://steamdb.info/app/${appid}/" + fn_script_log_info "No update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuild}" + if [ -v "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi + fi +} + fn_appmanifest_info(){ appmanifestfile=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf") appmanifestfilewc=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf" | wc -l) @@ -77,7 +183,6 @@ fn_appmanifest_check(){ fn_script_log_info "Forcing update to correct issue" sleep 0.5 fn_update_steamcmd_dl - fn_update_request_log fi elif [ "${appmanifestfilewc}" -eq "0" ]; then fn_print_error_nl "No appmanifest_${appid}.acf found" @@ -87,7 +192,6 @@ fn_appmanifest_check(){ fn_script_log_info "Forcing update to correct issue" sleep 0.5 fn_update_steamcmd_dl - fn_update_request_log fn_appmanifest_info if [ "${appmanifestfilewc}" -eq "0" ]; then fn_print_fail_nl "Still no appmanifest_${appid}.acf found" @@ -97,141 +201,13 @@ fn_appmanifest_check(){ fi } -fn_update_request_log(){ - # Checks for server update requests from server logs. - fn_print_dots "Checking for update: Server logs" - fn_script_log_info "Checking for update: Server logs" - sleep 0.5 - if [ -f "${consolelog}" ]; then - requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}") - else - requestrestart="0" - fi - if [ "${requestrestart}" -ge "1" ]; then - fn_print_ok_nl "Checking for update: Server logs: Update requested" - fn_script_log_pass "Checking for update: Server logs: Update requested" - sleep 0.5 - echo -e "" - 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 [ "${status}" != "0" ]; then - exitbypass=1 - command_stop.sh - fn_update_steamcmd_dl - exitbypass=1 - command_start.sh - else - fn_update_steamcmd_dl - fi - alert="update" - alert.sh - else - fn_print_ok "Checking for update: Server logs: No update requested" - sleep 0.5 - fi -} - -fn_update_steamcmd_check(){ - appid="${1}" - fn_appmanifest_check - # Checks for server update from SteamCMD - fn_print_dots "Checking for update: SteamCMD" - fn_script_log_info "Checking for update: SteamCMD" - sleep 0.5 - - # Gets currentbuild - currentbuild=$(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 - branchname="${branchsplits[1]}" - else - branchname="public" - fi - - # Gets availablebuild info - cd "${steamcmddir}" || exit - availablebuild=$(./steamcmd.sh +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 [ -z "${availablebuild}" ]; then - fn_print_fail "Checking for update: SteamCMD" - sleep 0.5 - fn_print_fail_nl "Checking for update: SteamCMD: Not returning version info" - fn_script_log_fatal "Checking for update: SteamCMD: Not returning version info" - core_exit.sh - else - fn_print_ok "Checking for update: SteamCMD" - fn_script_log_pass "Checking for update: SteamCMD" - sleep 0.5 - fi - - if [ "${currentbuild}" != "${availablebuild}" ]; then - fn_print_ok "Checking for update: SteamCMD: Update available" - fn_script_log_pass "Checking for update: SteamCMD: Update available" - echo -e "\n" - echo -e "Update available:" - sleep 0.5 - echo -e " Current build: ${red}${currentbuild}${default}" - echo -e " Available build: ${green}${availablebuild}${default}" - echo -e " https://steamdb.info/app/${appid}/" - sleep 0.5 - echo "" - echo -en "Applying update.\r" - sleep 1 - echo -en "Applying update..\r" - sleep 1 - echo -en "Applying update...\r" - sleep 1 - echo -en "\n" - fn_script_log_info "Update available" - fn_script_log_info "Current build: ${currentbuild}" - fn_script_log_info "Available build: ${availablebuild}" - fn_script_log_info "${currentbuild} > ${availablebuild}" +# The location where the builds are checked and downloaded. +remotelocation="SteamCMD" - unset updateonstart - check_status.sh - if [ "${status}" != "0" ]; then - exitbypass=1 - command_stop.sh - fn_update_steamcmd_dl - exitbypass=1 - command_start.sh - else - fn_update_steamcmd_dl - fi - alert="update" - alert.sh - else - fn_print_ok "Checking for update: SteamCMD: No update available" - fn_script_log_pass "Checking for update: SteamCMD: No update available" - echo -e "\n" - echo -e "No update available:" - echo -e " Current version: ${green}${currentbuild}${default}" - echo -e " Available version: ${green}${availablebuild}${default}" - echo -e " https://steamdb.info/app/${appid}/" - echo -e "" - fn_script_log_info "Current build: ${currentbuild}" - fn_script_log_info "Available build: ${availablebuild}" - fi -} +check.sh -if [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then - # Goldsource servers bypass checks as fn_update_steamcmd_check does not work for appid 90 servers. - # forceupdate bypasses checks +if [ "${forceupdate}" == "1" ]; then + # forceupdate bypasses update checks. check_status.sh if [ "${status}" != "0" ]; then exitbypass=1 @@ -243,10 +219,7 @@ if [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then fn_update_steamcmd_dl fi else - fn_update_request_log - fn_update_steamcmd_check "${appid}" - # will also check for second appid - if [ "${gamename}" == "Classic Offensive" ]; then - fn_update_steamcmd_check "${appid_co}" - fi + fn_update_steamcmd_localbuild + fn_update_steamcmd_remotebuild + fn_update_steamcmd_compare fi diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index c0657dfcc..e64bd8f3a 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -2,203 +2,183 @@ # LinuxGSM command_ts3.sh function # Author: Daniel Gibbs # Website: https://linuxgsm.com -# Description: Handles updating of teamspeak 3 servers. +# Description: Handles updating of Teamspeak 3 servers. local commandname="UPDATE" local commandaction="Update" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_ts3_dl_legacy(){ - fn_fetch_file "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" - fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" - echo -e "copying to ${serverfiles}...\c" - fn_script_log "Copying to ${serverfiles}" - cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${serverfiles}" - local exitcode=$? - if [ "${exitcode}" == "0" ]; then - fn_print_ok_eol_nl - else - fn_print_fail_eol_nl - fi -} - fn_update_ts3_dl(){ - latestts3releaselink=$(${curlpath} -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86_64.mirrors."teamspeak.com"') - fn_fetch_file "${latestts3releaselink}" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" - fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" + if [ "${ts3arch}" == "amd64" ]; then + remotebuildurl=$(${curlpath} -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86_64.mirrors."teamspeak.com"') + elif [ "${ts3arch}" == "x86" ]; then + remotebuildurl=$(${curlpath} -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_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${remotebuild}.tar.bz2" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" - fn_script_log "Copying to ${serverfiles}" cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${serverfiles}" local exitcode=$? if [ "${exitcode}" == "0" ]; then fn_print_ok_eol_nl + fn_script_log_pass "Copying to ${serverfiles}" + fn_clear_tmp else fn_print_fail_eol_nl + fn_script_log_fatal "Copying to ${serverfiles}" + core_exit.sh fi } -fn_update_ts3_currentbuild(){ - # Gets current build info - # Checks if current build info is available. If it fails, then a server restart will be forced to generate logs. - if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then - fn_print_error "Checking for update: teamspeak.com" +fn_update_ts3_localbuild(){ + # Gets local build info. + fn_print_dots "Checking for update: ${remotelocation}: checking local build" + sleep 0.5 + # 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" sleep 0.5 - fn_print_error_nl "Checking for update: teamspeak.com: No logs with server version found" - fn_script_log_error "Checking for update: teamspeak.com: No logs with server version found" + fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no log files" + fn_script_log_error "No log file found" sleep 0.5 - fn_print_info_nl "Checking for update: teamspeak.com: Forcing server restart" - fn_script_log_info "Checking for update: teamspeak.com: Forcing server restart" + fn_print_info_nl "Checking for update: ${remotelocation}: checking local build: forcing server restart" + fn_script_log_info "Forcing server restart" sleep 0.5 exitbypass=1 command_stop.sh exitbypass=1 command_start.sh - sleep 0.5 - # Check again and exit on failure. - if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then - fn_print_fail_nl "Checking for update: teamspeak.com: Still No logs with server version found" - fn_script_log_fatal "Checking for update: teamspeak.com: Still No logs with server version found" - core_exit.sh - fi + totalseconds=0 + # Check again, allow time to generate logs. + while [ ! -d "${serverfiles}/logs" ]||[ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; do + sleep 1 + fn_print_info "Checking for update: ${remotelocation}: checking local build: waiting for log file: ${totalseconds}" + if [ -v "${loopignore}" ]; then + loopignore=1 + fn_script_log_info "Waiting for log file to generate" + fi + + if [ "${totalseconds}" -gt "120" ]; then + localbuild="0" + fn_print_error "Checking for update: ${remotelocation}: waiting for log file: missing log file" + fn_script_log_error "Missing log file" + fn_script_log_error "Set localbuild to 0" + sleep 0.5 + fi + + totalseconds=$((totalseconds + 1)) + done fi - # Get current build from logs - currentbuild=$(cat $(find ./* -name "ts3server*_0.log" 2> /dev/null | sort | grep -Ev "${rootdir}/.ts3version" | 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}" | sort -V | tail -1) - if [ -z "${currentbuild}" ]; then - fn_print_error_nl "Checking for update: teamspeak.com: Current build version not found" - fn_script_log_error "Checking for update: teamspeak.com: Current build version not found" - sleep 0.5 - fn_print_info_nl "Checking for update: teamspeak.com: Forcing server restart" - fn_script_log_info "Checking for update: teamspeak.com: Forcing server restart" - exitbypass=1 - command_stop.sh - exitbypass=1 - command_start.sh - currentbuild=$(cat $(find ./* -name "ts3server*_0.log" 2> /dev/null | sort | grep -Ev "${rootdir}/.ts3version" | 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}") - if [ -z "${currentbuild}" ]; then - fn_print_fail_nl "Checking for update: teamspeak.com: Current build version still not found" - fn_script_log_fatal "Checking for update: teamspeak.com: Current build version still not found" - core_exit.sh - fi + if [ -z "${localbuild}" ]; then + 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}") fi -} -fn_update_ts3_arch(){ -# Gets the teamspeak server architecture. -info_distro.sh -if [ "${arch}" == "x86_64" ]; then - ts3arch="amd64" -elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then - ts3arch="x86" -else - echo "" - fn_print_failure "Unknown or unsupported architecture: ${arch}" - fn_script_log_fatal "Unknown or unsupported architecture: ${arch}" - core_exit.sh -fi + 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}" + 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}") + if [ "${localbuild}" ]; then + break + fi + sleep 1 + totalseconds=$((totalseconds + 1)) + done + fi + + if [ -z "${localbuild}" ]; then + localbuild="0" + fn_print_error "Checking for update: ${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_script_log_pass "Checking local build" + fi + sleep 0.5 } - -fn_update_ts3_availablebuild(){ - # Gets latest build info. +fn_update_ts3_remotebuild(){ + # Gets remote build info. if [ "${arch}" == "x86_64" ]; then - availablebuild="$(${curlpath} -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86_64.version')" + remotebuild="$(${curlpath} -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86_64.version')" elif [ "${arch}" == "x86" ]; then - availablebuild="$(${curlpath} -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86.version')" + remotebuild="$(${curlpath} -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86.version')" fi - ts3_version_number="${availablebuild}" - # Checks if availablebuild variable has been set - if [ -z "${availablebuild}" ]||[ "${availablebuild}" == "null" ]; then - fn_print_fail "Checking for update: teamspeak.com" - sleep 0.5 - fn_print_fail "Checking for update: teamspeak.com: Not returning version info" - fn_script_log_fatal "Failure! Checking for update: teamspeak.com: Not returning version info" - core_exit.sh - elif [ "${installer}" == "1" ]; then - : - else - fn_print_ok_nl "Checking for update: teamspeak.com" - fn_script_log_pass "Checking for update: teamspeak.com" + if [ "${installer}" != "1" ]; then + fn_print_dots "Checking for update: ${remotelocation}: checking remote build" sleep 0.5 - fi -} - -fn_update_ts3_availablebuild_legacy(){ - # Gets latest build info. - - # Grabs all version numbers but not in correct order. - wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O - | grep -i dir | grep -Eo '.*\/<\/a>' | grep -Eo '[0-9\.?]+' | uniq > "${tmpdir}/.ts3_version_numbers_unsorted.tmp" - - # Sort version numbers - cat "${tmpdir}/.ts3_version_numbers_unsorted.tmp" | sort -r --version-sort -o "${tmpdir}/.ts3_version_numbers_sorted.tmp" - - # Finds directory with most recent server version. - while read -r ts3_version_number; do - wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" - if [ $? -eq 0 ]; then - availablebuild="${ts3_version_number}" - # Break while-loop, if the latest release could be found. - break + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_fatal "Checking remote build" + core_exit.sh + else + fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_script_log_pass "Checking remote build" + sleep 0.5 fi - done < "${tmpdir}/.ts3_version_numbers_sorted.tmp" - - # Tidy up - rm -f "${tmpdir}/.ts3_version_numbers_unsorted.tmp" - rm -f "${tmpdir}/.ts3_version_numbers_sorted.tmp" - - # Checks availablebuild info is available - if [ -z "${availablebuild}" ]; then - fn_print_fail "Checking for update: teamspeak.com" - sleep 0.5 - fn_print_fail "Checking for update: teamspeak.com: Not returning version info" - fn_script_log_fatal "Failure! Checking for update: teamspeak.com: Not returning version info" - core_exit.sh - elif [ "${installer}" == "1" ]; then - : else - fn_print_ok "Checking for update: teamspeak.com" - fn_script_log_pass "Checking for update: teamspeak.com" - sleep 0.5 - fi + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_failure "Unable to get remote build" + fn_script_log_fatal "Unable to get remote build" + core_exit.sh + fi + fi } fn_update_ts3_compare(){ - # Removes dots so if can compare version numbers - currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]') - availablebuilddigit=$(echo "${availablebuild}" | tr -cd '[:digit:]') - - if [ "${currentbuilddigit}" -lt "${availablebuilddigit}" ]; then - echo -e "\n" - echo -e "Update available:" + # Removes dots so if statement can compare version numbers. + fn_print_dots "Checking for update: ${remotelocation}" + sleep 0.5 + localbuilddigit=$(echo "${localbuild}" | tr -cd '[:digit:]') + remotebuilddigit=$(echo "${remotebuild}" | tr -cd '[:digit:]') + if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then + fn_print_ok_nl "Checking for update: ${remotelocation}" sleep 0.5 - echo -e " Current build: ${red}${currentbuild} ${ts3arch}${default}" - echo -e " Available build: ${green}${availablebuild} ${ts3arch}${default}" - echo -e "" + echo -en "\n" + echo -e "Update available" + echo -e "* Local build: ${red}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + 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}" sleep 0.5 - echo -en "Applying update.\r" + echo -en "\n" + echo -en "applying update.\r" sleep 1 - echo -en "Applying update..\r" + echo -en "applying update..\r" sleep 1 - echo -en "Applying update...\r" + echo -en "applying update...\r" sleep 1 echo -en "\n" - fn_script_log "Update available" - fn_script_log "Current build: ${currentbuild}" - fn_script_log "Available build: ${availablebuild}" - fn_script_log "${currentbuild} > ${availablebuild}" unset updateonstart check_status.sh + # If server stopped. if [ "${status}" == "0" ]; then + exitbypass=1 fn_update_ts3_dl exitbypass=1 command_start.sh exitbypass=1 command_stop.sh + # If server started. else exitbypass=1 command_stop.sh + exitbypass=1 fn_update_ts3_dl exitbypass=1 command_start.sh @@ -206,37 +186,41 @@ fn_update_ts3_compare(){ alert="update" alert.sh else - echo -e "\n" - echo -e "No update available:" - echo -e " Current version: ${green}${currentbuild}${default}" - echo -e " Available version: ${green}${availablebuild}${default}" - echo -e "" - fn_print_ok_nl "No update available" - fn_script_log_info "Current build: ${currentbuild}" - fn_script_log_info "Available build: ${availablebuild}" + fn_print_ok_nl "Checking for update: ${remotelocation}" + sleep 0.5 + echo -en "\n" + echo -e "No update available" + echo -e "* Local build: ${green}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + fn_script_log_info "No update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuild}" fi } -fn_update_ts3_arch +# Game server architecture. +info_distro.sh +if [ "${arch}" == "x86_64" ]; then + ts3arch="amd64" +elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then + ts3arch="x86" +else + fn_print_failure "Unknown or unsupported architecture: ${arch}" + fn_script_log_fatal "Unknown or unsupported architecture: ${arch}" + core_exit.sh +fi + +# The location where the builds are checked and downloaded. +remotelocation="teamspeak.com" + if [ "${installer}" == "1" ]; then - # if jq available uses json update checker - if [ "$(command -v jq >/dev/null 2>&1)" ]; then - fn_update_ts3_availablebuild - fn_update_ts3_dl - else - fn_update_ts3_availablebuild_legacy - fn_update_ts3_dl_legacy - fi + fn_update_ts3_remotebuild + fn_update_ts3_dl else - # Checks for server update from teamspeak.com using a mirror dl.4players.de. - fn_print_dots "Checking for update: teamspeak.com" - fn_script_log_info "Checking for update: teamspeak.com" + fn_print_dots "Checking for update: ${remotelocation}" + fn_script_log_info "Checking for update: ${remotelocation}" sleep 0.5 - fn_update_ts3_currentbuild - if [ "$(command -v jq >/dev/null 2>&1)" ]; then - fn_update_ts3_availablebuild - else - fn_update_ts3_availablebuild_legacy - fi + fn_update_ts3_localbuild + fn_update_ts3_remotebuild fn_update_ts3_compare fi diff --git a/linuxgsm.sh b/linuxgsm.sh index 31b1ccd37..d7a274693 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="190217" +version="190301" shortname="core" gameservername="core" rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" @@ -153,7 +153,7 @@ fn_install_menu_bash() { done < ${options} menu_options+=( "Cancel" ) select option in "${menu_options[@]}"; do - if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then + if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then eval "$resultvar=\"${option/%\ */}\"" fi break diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index 7237f7d37..dc0d0b056 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -146,7 +146,7 @@ fn_install_menu_bash() { done < ${options} menu_options+=( "Cancel" ) select option in "${menu_options[@]}"; do - if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then + if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then eval "$resultvar=\"${option/%\ */}\"" fi break diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index 7d2df1e49..573b2dd0e 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -146,7 +146,7 @@ fn_install_menu_bash() { done < ${options} menu_options+=( "Cancel" ) select option in "${menu_options[@]}"; do - if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then + if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then eval "$resultvar=\"${option/%\ */}\"" fi break diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index 235ed0fe0..425ae193e 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -146,7 +146,7 @@ fn_install_menu_bash() { done < ${options} menu_options+=( "Cancel" ) select option in "${menu_options[@]}"; do - if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then + if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then eval "$resultvar=\"${option/%\ */}\"" fi break