diff --git a/.github/request-info.yml b/.github/request-info.yml
new file mode 100644
index 000000000..a1441d5cc
--- /dev/null
+++ b/.github/request-info.yml
@@ -0,0 +1,15 @@
+# Configuration for request-info - https://github.com/behaviorbot/request-info
+
+# *Required* Comment to reply with
+requestInfoReplyComment: >
+ We require more information for this issue.
+ https://linuxgsm.com/support/#guide
+
+# *OPTIONAL* default titles to check against for lack of descriptiveness
+# MUST BE ALL LOWERCASE
+#requestInfoDefaultTitles:
+# - update readme.md
+# - updates
+
+# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
+requestInfoLabelToAdd: Status: needs more info
\ No newline at end of file
diff --git a/.github/support.yml b/.github/support.yml
new file mode 100644
index 000000000..7689688e1
--- /dev/null
+++ b/.github/support.yml
@@ -0,0 +1,15 @@
+# Configuration for support-requests - https://github.com/dessant/support-requests
+
+# Label used to mark issues as support requests
+supportLabel: Type: support
+# Comment to post on issues marked as support requests. Add a link
+# to a support page, or set to `false` to disable
+supportComment: >
+ We use the issue tracker exclusively for bug reports and feature requests.
+ However, this issue appears to be a support request. Please use our
+ support channels to get help with the project.
+ https://linuxgsm.com/support/
+# Whether to close issues marked as support requests
+close: true
+# Whether to lock issues marked as support requests
+lock: false
\ No newline at end of file
diff --git a/.github/welcome.yml b/.github/welcome.yml
new file mode 100644
index 000000000..3d0c15e7d
--- /dev/null
+++ b/.github/welcome.yml
@@ -0,0 +1,21 @@
+# Configuration for welcome - https://github.com/behaviorbot/welcome
+
+# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
+
+# Comment to be posted to on first time issues
+newIssueWelcomeComment: >
+ Thanks for opening your first issue. Be sure to follow the issue template! and guide for posting. https://linuxgsm.com/support/#guide
+
+# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
+
+# Comment to be posted to on PRs from first time contributors in your repository
+newPRWelcomeComment: >
+ Thanks for opening this pull request! Please check out our contributing guidelines.
+
+# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
+
+# Comment to be posted to on pull requests merged by a first time user
+firstPRMergeComment: >
+ Congrats on merging your first pull request! Thank you for supporting LinuxGSM!
+
+# It is recommend to include as many gifs and emojis as possible
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 1ae96fc9c..c5bfa204d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -36,6 +36,8 @@ jobs:
include:
- stage: jobs
script: bash tests/tests_jc2server.sh
+ - # stage name not required
+ script: bash tests/tests_fctrserver.sh
- # stage name not required
script: bash tests/tests_ts3server.sh
- # stage name not required
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 818bed312..5a13b7644 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -36,4 +36,4 @@ This will help us in understanding your code and determining where problems may
Start reading our code and you'll get the hang of it. Explore how functions are organized and you'll see how we strive for readable code.
Please give the following document a read and adjust your code according to its specifications.
-[Syntax & Coding Conventions](https://github.com/GameServerManagers/LinuxGSM/wiki/Syntax-&-Conventions)
\ No newline at end of file
+[Syntax & Coding Conventions](https://github.com/GameServerManagers/LinuxGSM/wiki/Syntax-and-Conventions)
\ No newline at end of file
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
index 689670e99..7f503c4db 100644
--- a/ISSUE_TEMPLATE.md
+++ b/ISSUE_TEMPLATE.md
@@ -1,8 +1,17 @@
Please select the "Preview" tab above to view this message correctly.
-Please note that this is an issue tracker for **LinuxGSM** related bugs and feature requests and **not** for the games themselves.
+Follow **[this guide](https://linuxgsm.com/support/#guide)** to make sure you post the correct info.
+For general support visit the **[steam group](https://linuxgsm.com/steam)**
-**Therefore personal server issues on GitHub will be closed without a kiss.**
+GitHub is **ONLY** for:
+* LinuxGSM bugs
+* feature suggestions
+* code contributions
-Please follow **[this article](https://github.com/GameServerManagers/LinuxGSM/wiki/Support)** for optimal assistance
-and do not forget to remove this text before opening the issue.
+GitHub is **NOT** for:
+* General support
+* Specific game server issues (e.g CS:GO, TF2)
+* Dedicated server issues (e.g Ubuntu, CentOS)
+* Anything not directly related to LinuxGSM development
+
+**Any general support issues on GitHub will be closed.**
\ No newline at end of file
diff --git a/README.md b/README.md
index aa705981f..c7d0c8beb 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
[](https://linuxgsm.com)
[](https://travis-ci.org/GameServerManagers/LinuxGSM)
-[](http://waffle.io/GameServerManagers/LinuxGSM)
+[](http://waffle.io/GameServerManagers/LinuxGSM)
[](https://linuxgsm.com/discord)
[](https://github.com/GameServerManagers/LinuxGSM/blob/master/LICENSE)
[](https://www.gnu.org/software/bash/)
diff --git a/images/icons/centos-icon-32.png b/images/icons/centos-icon-32.png
deleted file mode 100644
index fb03f304e..000000000
Binary files a/images/icons/centos-icon-32.png and /dev/null differ
diff --git a/images/icons/debian-icon-32.png b/images/icons/debian-icon-32.png
deleted file mode 100644
index 93650c5d0..000000000
Binary files a/images/icons/debian-icon-32.png and /dev/null differ
diff --git a/images/icons/ubuntu-icon-32.png b/images/icons/ubuntu-icon-32.png
deleted file mode 100644
index 92be4b5a1..000000000
Binary files a/images/icons/ubuntu-icon-32.png and /dev/null differ
diff --git a/images/logo/README.md b/images/logo/README.md
deleted file mode 100644
index 4c3b9e790..000000000
--- a/images/logo/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# LinuxGSM - Official Logos
-For Reference the original design can be found here.
-http://twolofbees.com/artwork.php?iid=870
\ No newline at end of file
diff --git a/images/logo/apple-touch-icon-precomposed.png b/images/logo/apple-touch-icon-precomposed.png
deleted file mode 100644
index d5dabc953..000000000
Binary files a/images/logo/apple-touch-icon-precomposed.png and /dev/null differ
diff --git a/images/logo/assets/lgsm-font-pt_sans.zip b/images/logo/assets/lgsm-font-pt_sans.zip
deleted file mode 100644
index 15d1b0ff3..000000000
Binary files a/images/logo/assets/lgsm-font-pt_sans.zip and /dev/null differ
diff --git a/images/logo/assets/lgsm-font-source_code_pro.zip b/images/logo/assets/lgsm-font-source_code_pro.zip
deleted file mode 100644
index 2de7decf0..000000000
Binary files a/images/logo/assets/lgsm-font-source_code_pro.zip and /dev/null differ
diff --git a/images/logo/assets/svg/linuxgsm_black_gradiant_vector.svg b/images/logo/assets/svg/linuxgsm_black_gradiant_vector.svg
deleted file mode 100644
index 7d2b129c9..000000000
--- a/images/logo/assets/svg/linuxgsm_black_gradiant_vector.svg
+++ /dev/null
@@ -1,238 +0,0 @@
-
-
-
-
diff --git a/images/logo/assets/svg/linuxgsm_black_gradiant_vector_full.svg b/images/logo/assets/svg/linuxgsm_black_gradiant_vector_full.svg
deleted file mode 100644
index bd6fef8c5..000000000
--- a/images/logo/assets/svg/linuxgsm_black_gradiant_vector_full.svg
+++ /dev/null
@@ -1,304 +0,0 @@
-
-
-
-
diff --git a/images/logo/assets/svg/linuxgsm_black_vector.svg b/images/logo/assets/svg/linuxgsm_black_vector.svg
deleted file mode 100644
index 594b44b1e..000000000
--- a/images/logo/assets/svg/linuxgsm_black_vector.svg
+++ /dev/null
@@ -1,286 +0,0 @@
-
-
-
-
diff --git a/images/logo/assets/svg/linuxgsm_white_vector.svg b/images/logo/assets/svg/linuxgsm_white_vector.svg
deleted file mode 100644
index 5e169f3d3..000000000
--- a/images/logo/assets/svg/linuxgsm_white_vector.svg
+++ /dev/null
@@ -1,248 +0,0 @@
-
-
-
-
diff --git a/images/logo/assets/svg/linuxgsm_white_vector_full.svg b/images/logo/assets/svg/linuxgsm_white_vector_full.svg
deleted file mode 100644
index 676937d60..000000000
--- a/images/logo/assets/svg/linuxgsm_white_vector_full.svg
+++ /dev/null
@@ -1,324 +0,0 @@
-
-
-
-
diff --git a/images/logo/facebook.png b/images/logo/facebook.png
deleted file mode 100644
index d70602c4e..000000000
Binary files a/images/logo/facebook.png and /dev/null differ
diff --git a/images/logo/lgsm-dark-full.png b/images/logo/lgsm-dark-full.png
deleted file mode 100644
index 405c0d7c9..000000000
Binary files a/images/logo/lgsm-dark-full.png and /dev/null differ
diff --git a/images/logo/lgsm-dark-square-114.png b/images/logo/lgsm-dark-square-114.png
deleted file mode 100644
index d5dabc953..000000000
Binary files a/images/logo/lgsm-dark-square-114.png and /dev/null differ
diff --git a/images/logo/lgsm-dark-square-16.png b/images/logo/lgsm-dark-square-16.png
deleted file mode 100644
index e66d2b3be..000000000
Binary files a/images/logo/lgsm-dark-square-16.png and /dev/null differ
diff --git a/images/logo/lgsm-dark-square-184.png b/images/logo/lgsm-dark-square-184.png
deleted file mode 100644
index 9dbce0f28..000000000
Binary files a/images/logo/lgsm-dark-square-184.png and /dev/null differ
diff --git a/images/logo/lgsm-dark-square-24.png b/images/logo/lgsm-dark-square-24.png
deleted file mode 100644
index a05a6e3d7..000000000
Binary files a/images/logo/lgsm-dark-square-24.png and /dev/null differ
diff --git a/images/logo/lgsm-dark-square-512.png b/images/logo/lgsm-dark-square-512.png
deleted file mode 100644
index e56a92932..000000000
Binary files a/images/logo/lgsm-dark-square-512.png and /dev/null differ
diff --git a/images/logo/lgsm-dark-square-64.png b/images/logo/lgsm-dark-square-64.png
deleted file mode 100644
index 65df40ad2..000000000
Binary files a/images/logo/lgsm-dark-square-64.png and /dev/null differ
diff --git a/images/logo/lgsm-light-full.png b/images/logo/lgsm-light-full.png
deleted file mode 100644
index e8dcd92a8..000000000
Binary files a/images/logo/lgsm-light-full.png and /dev/null differ
diff --git a/images/logo/lgsm_full.png b/images/logo/lgsm_full.png
deleted file mode 100644
index 3b1631ab5..000000000
Binary files a/images/logo/lgsm_full.png and /dev/null differ
diff --git a/images/logo/lgsmbutton.png b/images/logo/lgsmbutton.png
deleted file mode 100644
index 9aa7efaa7..000000000
Binary files a/images/logo/lgsmbutton.png and /dev/null differ
diff --git a/images/wallpaper/LinuxGSM_wallpaper.png b/images/wallpaper/LinuxGSM_wallpaper.png
deleted file mode 100644
index 9ba739434..000000000
Binary files a/images/wallpaper/LinuxGSM_wallpaper.png and /dev/null differ
diff --git a/images/wallpaper/LinuxGSM_wallpaper_2.png b/images/wallpaper/LinuxGSM_wallpaper_2.png
deleted file mode 100644
index d4d5e27c3..000000000
Binary files a/images/wallpaper/LinuxGSM_wallpaper_2.png and /dev/null differ
diff --git a/lgsm/config-default/config-lgsm/etlserver/_default.cfg b/lgsm/config-default/config-lgsm/etlserver/_default.cfg
new file mode 100644
index 000000000..f1b711fcc
--- /dev/null
+++ b/lgsm/config-default/config-lgsm/etlserver/_default.cfg
@@ -0,0 +1,104 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT WILL BE OVERWRITTEN!
+# Copy settings from here and use them in either
+# common.cfg - applies settings to every instance
+# [instance].cfg - applies settings to a specific instance
+
+#### Server Settings ####
+
+## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
+fn_parms(){
+ parms="+set net_strict 1 +set fs_homepath ${serverfiles} +exec ${servercfg}"
+}
+
+#### LinuxGSM Settings ####
+
+## Notification Alerts
+# (on|off)
+
+# More info | https://github.com/GameServerManagers/LinuxGSM/wiki/Alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://hastebin.com"
+
+# Discord Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# IFTTT Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/IFTTT
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Mailgun Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/mailgun
+mailgunalert="off"
+mailguntoken="accesstoken"
+mailgundomain="example.com"
+mailgunemailfrom="alert@example.com"
+mailgunemail="email@myemail.com"
+
+# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+
+# Telegram Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Telegram
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+
+## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
+consolelogging="on"
+logdays="7"
+
+#### LinuxGSM Advanced Settings ####
+
+## LinuxGSM Server Details
+# Do not edit
+gamename="ET: Legacy"
+engine="idtech3"
+
+#### Directories ####
+# Edit with care
+
+## Server Specific Directories
+systemdir="${serverfiles}"
+executabledir="${systemdir}"
+executable="./etlded"
+servercfg="${servicename}.cfg"
+servercfgdefault="server.cfg"
+servercfgdir="${systemdir}/etmain"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${rootdir}/backups"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${serverfiles}/Logs"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+lgsmlog="${lgsmlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+alertlog="${lgsmlogdir}/${servicename}-alert.log"
+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"
diff --git a/lgsm/config-default/config-lgsm/rwserver/_default.cfg b/lgsm/config-default/config-lgsm/rwserver/_default.cfg
new file mode 100644
index 000000000..7bf824059
--- /dev/null
+++ b/lgsm/config-default/config-lgsm/rwserver/_default.cfg
@@ -0,0 +1,118 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT WILL BE OVERWRITTEN!
+# Copy settings from here and use them in either
+# common.cfg - applies settings to every instance
+# [instance].cfg - applies settings to a specific instance
+
+#### Server Settings ####
+
+## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
+javaram="2048" # -Xmx$2048M
+
+## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
+fn_parms(){
+parms=""
+}
+
+#### LinuxGSM Settings ####
+
+## Notification Alerts
+# (on|off)
+
+# More info | https://github.com/GameServerManagers/LinuxGSM/wiki/Alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://hastebin.com"
+
+# Discord Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# IFTTT Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/IFTTT
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Mailgun Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/mailgun
+mailgunalert="off"
+mailguntoken="accesstoken"
+mailgundomain="example.com"
+mailgunemailfrom="alert@example.com"
+mailgunemail="email@myemail.com"
+
+# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+
+# Telegram Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Telegram
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+
+## Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update
+updateonstart="off"
+
+## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
+consolelogging="on"
+logdays="7"
+
+#### LinuxGSM Advanced Settings ####
+
+## SteamCMD Settings
+# Server appid
+appid="339010"
+# Steam App Branch Select
+# Allows to opt into the various Steam app branches. Default branch is "".
+# Example: "-beta latest_experimental"
+branch=""
+
+## LinuxGSM Server Details
+# Do not edit
+gamename="Rising World"
+engine="risingworld"
+
+#### Directories ####
+# Edit with care
+
+## Server Specific Directories
+systemdir="${serverfiles}"
+executabledir="${serverfiles}"
+executable="java -Xmx${javaram}m -jar ${serverfiles}/server.jar"
+servercfg="server.properties"
+servercfgdefault="server.properties"
+servercfgdir="${serverfiles}"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${rootdir}/backups"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${systemdir}/logs"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+lgsmlog="${lgsmlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+alertlog="${lgsmlogdir}/${servicename}-alert.log"
+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"
diff --git a/lgsm/config-default/config-lgsm/ut3server/_default.cfg b/lgsm/config-default/config-lgsm/ut3server/_default.cfg
index f701b563d..3469c4940 100644
--- a/lgsm/config-default/config-lgsm/ut3server/_default.cfg
+++ b/lgsm/config-default/config-lgsm/ut3server/_default.cfg
@@ -11,7 +11,7 @@
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
ip="0.0.0.0"
port="7777"
-queryport="25300"
+queryport="6500"
defaultmap="VCTF-Suspense"
game="UTGameContent.UTVehicleCTFGame_Content"
mutators="" #"UTGame.UTMutator_Instagib,UTGame.UTMutator_LowGrav"
diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv
index 7f81f81fb..4dae26adc 100644
--- a/lgsm/data/serverlist.csv
+++ b/lgsm/data/serverlist.csv
@@ -57,6 +57,7 @@ qw,qwserver,Quake World
ro,roserver,Red Orchestra: Ostfront 41-45
ricochet,ricochetserver,Ricochet
rust,rustserver,Rust
+rw,rwserver, Rising World
samp,sampserver,San Andreas Multiplayer
ss3,ss3server,Serious Sam 3: BFE
sb,sbserver,Starbound
@@ -73,4 +74,5 @@ ut2k4,ut2k4server,Unreal Tournament 2004
ut3,ut3server,Unreal Tournament 3
ut99,ut99server,Unreal Tournament 99
wet,wetserver,Wolfenstein: Enemy Territory
+etl,etlserver,ET: Legacy
zps,zpsserver,Zombie Panic! Source
diff --git a/lgsm/functions/alert.sh b/lgsm/functions/alert.sh
index 31df0e18c..07abe0fb7 100644
--- a/lgsm/functions/alert.sh
+++ b/lgsm/functions/alert.sh
@@ -45,12 +45,12 @@ fn_alert_restart(){
}
fn_alert_restart_query(){
- fn_script_log_info "Sending alert: Restarted: ${gsquerycmd}"
+ fn_script_log_info "Sending alert: Restarted: ${servicename}"
alertsubject="Alert - ${servicename} - Restarted"
alertemoji="🚨"
alertsound="2"
alerturl="not enabled"
- alertbody="gsquery.py failed to query: ${gsquerycmd}"
+ alertbody="Unable to query: ${servicename}"
}
fn_alert_update(){
diff --git a/lgsm/functions/alert_discord.sh b/lgsm/functions/alert_discord.sh
index acef4f533..70da55e02 100644
--- a/lgsm/functions/alert_discord.sh
+++ b/lgsm/functions/alert_discord.sh
@@ -39,7 +39,7 @@ json=$(cat </dev/null)" ]; then
- dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null | grep -q -P '^install ok installed'
+ elif [ -n "$(command -v apt 2>/dev/null)" ]; then
+ dpkg-query -W -f='${Status}' "${deptocheck}" 2>/dev/null | grep -q -P '^install ok installed'
depstatus=$?
elif [ -n "$(command -v yum 2>/dev/null)" ]; then
- yum -q list installed ${deptocheck} > /dev/null 2>&1
+ yum -q list installed "${deptocheck}" > /dev/null 2>&1
depstatus=$?
fi
@@ -77,7 +77,7 @@ fn_found_missing_deps(){
sleep 0.5
fn_print_error_nl "Checking dependencies: missing: ${red}${array_deps_missing[@]}${default}"
fn_script_log_error "Checking dependencies: missing: ${array_deps_missing[@]}"
- sleep 1
+ sleep 0.5
sudo -v > /dev/null 2>&1
if [ $? -eq 0 ]; then
fn_print_information_nl "Automatically installing missing dependencies."
@@ -90,11 +90,11 @@ fn_found_missing_deps(){
sleep 1
echo -en " \r"
if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
- cmd="sudo dpkg --add-architecture i386; sudo apt-get update; sudo apt-get -y install ${array_deps_missing[@]}"
- eval ${cmd}
+ cmd="sudo dpkg --add-architecture i386; sudo apt update; sudo apt -y install ${array_deps_missing[@]}"
+ eval "${cmd}"
elif [ -n "$(command -v yum 2>/dev/null)" ]; then
cmd="sudo yum -y install ${array_deps_missing[@]}"
- eval ${cmd}
+ eval "${cmd}"
fi
if [ $? != 0 ]; then
fn_print_failure_nl "Unable to install dependencies"
@@ -108,7 +108,7 @@ fn_found_missing_deps(){
fn_print_warning_nl "$(whoami) does not have sudo access. Manually install dependencies."
fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies."
if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
- echo " sudo dpkg --add-architecture i386; sudo apt-get update; sudo apt-get install ${array_deps_missing[@]}"
+ echo " sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}"
elif [ -n "$(command -v yum 2>/dev/null)" ]; then
echo " sudo yum install ${array_deps_missing[@]}"
fi
@@ -139,7 +139,7 @@ if [ "${function_selfname}" == "command_install.sh" ]; then
echo "================================="
fi
-# Check will only run if using apt-get or yum
+# Check will only run if using apt or yum
if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
# Generate array of missing deps
array_deps_missing=()
@@ -193,7 +193,7 @@ if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
elif [ "${gamename}" == "Battlefield: 1942" ]; then
array_deps_required+=( libncurses5:i386 )
# Call of Duty
- elif [ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty 2" ]; then
+ elif [ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]; then
array_deps_required+=( libstdc++5:i386 )
# Factorio
elif [ "${gamename}" == "Factorio" ]; then
@@ -286,7 +286,7 @@ elif [ -n "$(command -v yum 2>/dev/null)" ]; then
elif [ "${gamename}" == "Battlefield: 1942" ]; then
array_deps_required+=( ncurses-libs.i686 )
# Call of Duty
- elif [ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty 2" ]; then
+ elif [ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]; then
array_deps_required+=( compat-libstdc++-33.i686 )
# Factorio
elif [ "${gamename}" == "Factorio" ]; then
diff --git a/lgsm/functions/check_ip.sh b/lgsm/functions/check_ip.sh
index 57971725a..507a1a51a 100644
--- a/lgsm/functions/check_ip.sh
+++ b/lgsm/functions/check_ip.sh
@@ -14,18 +14,19 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
else
ipcommand="ip"
fi
- getip=$(${ipcommand} -o -4 addr|awk '{print $4}'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -v 127.0.0)
- getipwc=$(${ipcommand} -o -4 addr|awk '{print $4}'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -vc 127.0.0)
+ getip=$(${ipcommand} -o -4 addr| awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}' | grep -v 127.0.0)
+ getipwc=$(${ipcommand} -o -4 addr| awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}' | grep -vc 127.0.0)
info_config.sh
+ info_parms.sh
# IP is not set to specific IP
if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
fn_print_dots "Check IP"
- sleep 1
+ sleep 0.5
# Multiple interfaces
if [ "${getipwc}" -ge "2" ]; then
fn_print_fail "Check IP: Multiple IP addresses found."
- sleep 1
+ sleep 0.5
echo -en "\n"
# IP is set within game config
if [ "${ipsetinconfig}" == "1" ]; then
@@ -57,7 +58,7 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
# Single interface
elif [ "${ipsetinconfig}" == "1" ]; then
fn_print_fail "Check IP: IP address not set in game config."
- sleep 1
+ sleep 0.5
echo -en "\n"
fn_print_information "Specify the IP you want to bind within ${servercfg}.\n"
echo -en " * location: ${servercfgfullpath}\n"
@@ -74,7 +75,7 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
else
fn_print_info_nl "Check IP: ${getip}"
fn_script_log_info "IP automatically set as: ${getip}"
- sleep 1
+ sleep 0.5
ip="${getip}"
fi
fi
diff --git a/lgsm/functions/check_permissions.sh b/lgsm/functions/check_permissions.sh
index 125b9904d..7498925e1 100644
--- a/lgsm/functions/check_permissions.sh
+++ b/lgsm/functions/check_permissions.sh
@@ -9,17 +9,17 @@ local commandname="CHECK"
fn_check_ownership(){
if [ -f "${rootdir}/${selfname}" ]; then
- if [ $(find "${rootdir}/${selfname}" -not -user $(whoami)|wc -l) -ne "0" ]; then
+ if [ "$(find "${rootdir}/${selfname}" -not -user $(whoami) | wc -l)" -ne "0" ]; then
selfownissue=1
fi
fi
if [ -d "${functionsdir}" ]; then
- if [ $(find "${functionsdir}" -not -user $(whoami)|wc -l) -ne "0" ]; then
+ if [ "$(find "${functionsdir}" -not -user $(whoami) | wc -l)" -ne "0" ]; then
funcownissue=1
fi
fi
if [ -d "${serverfiles}" ]; then
- if [ $(find "${serverfiles}" -not -user $(whoami)|wc -l) -ne "0" ]; then
+ if [ "$(find "${serverfiles}" -not -user $(whoami) | wc -l)" -ne "0" ]; then
filesownissue=1
fi
fi
@@ -31,13 +31,13 @@ fn_check_ownership(){
{
echo -e "User\tGroup\tFile\n"
if [ "${selfownissue}" == "1" ]; then
- find "${rootdir}/${selfname}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n"
+ find "${rootdir}/${selfname}" -not -user "$(whoami)" -printf "%u\t\t%g\t%p\n"
fi
if [ "${funcownissue}" == "1" ]; then
- find "${functionsdir}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n"
+ find "${functionsdir}" -not -user "$(whoami)" -printf "%u\t\t%g\t%p\n"
fi
if [ "${filesownissue}" == "1" ]; then
- find "${serverfiles}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n"
+ find "${serverfiles}" -not -user "$(whoami)" -printf "%u\t\t%g\t%p\n"
fi
} | column -s $'\t' -t | tee -a "${lgsmlog}"
@@ -54,7 +54,7 @@ fn_check_ownership(){
fn_check_permissions(){
if [ -d "${functionsdir}" ]; then
- if [ $(find "${functionsdir}" -type f -not -executable|wc -l) -ne "0" ]; then
+ if [ "$(find "${functionsdir}" -type f -not -executable | wc -l)" -ne "0" ]; then
fn_print_fail_nl "Permissions issues found"
fn_script_log_fatal "Permissions issues found"
fn_print_information_nl "The following files are not executable:"
@@ -102,9 +102,9 @@ fn_check_permissions(){
userexecperm="${execperm:0:1}"
groupexecperm="${execperm:1:1}"
# Check for invalid user permission
- if [ "${userexecperm}" == "0" ] || [ "${userexecperm}" == "2" ] || [ "${userexecperm}" == "4" ] || [ "${userexecperm}" == "6" ]; then
+ if [ "${userexecperm}" == "0" ]||[ "${userexecperm}" == "2" ]||[ "${userexecperm}" == "4" ]||[ "${userexecperm}" == "6" ]; then
# If user permission is invalid, then check for invalid group permissions
- if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ] || [ "${groupexecperm}" == "6" ]; then
+ if [ "${groupexecperm}" == "0" ]||[ "${groupexecperm}" == "2" ]||[ "${groupexecperm}" == "4" ]||[ "${groupexecperm}" == "6" ]; then
# If permission issues are found
fn_print_warn_nl "Permissions issue found"
fn_script_log_warn "Permissions issue found"
@@ -122,14 +122,14 @@ fn_check_permissions(){
# Grab the first and second digit for user and group permission
userexecperm="${execperm:0:1}"
groupexecperm="${execperm:1:1}"
- if [ "${userexecperm}" == "0" ] || [ "${userexecperm}" == "2" ] || [ "${userexecperm}" == "4" ] || [ "${userexecperm}" == "6" ]; then
- if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ] || [ "${groupexecperm}" == "6" ]; then
+ if [ "${userexecperm}" == "0" ]||[ "${userexecperm}" == "2" ]||[ "${userexecperm}" == "4" ]||[ "${userexecperm}" == "6" ]; then
+ if [ "${groupexecperm}" == "0" ]||[ "${groupexecperm}" == "2" ]||[ "${groupexecperm}" == "4" ]||[ "${groupexecperm}" == "6" ]; then
# If errors are still found
fn_print_fail_nl "The following file could not be set executable:"
ls -l "${executabledir}/${execname}"
fn_script_log_warn "The following file could not be set executable:"
fn_script_log_info "${executabledir}/${execname}"
- if [ "${monitorflag}" == 1 ]; then
+ if [ "${monitorflag}" == "1" ]; then
alert="permissions"
alert.sh
fi
@@ -171,7 +171,7 @@ fn_sys_perm_fix_manually_msg(){
fn_script_log_info "To fix this issue, run the following command as root:"
echo " chmod a+rx /sys /sys/class /sys/class/net"
fn_script_log "chmod a+rx /sys /sys/class /sys/class/net"
- sleep 1
+ sleep 0.5
if [ "${monitorflag}" == 1 ]; then
alert="permissions"
alert.sh
@@ -184,7 +184,7 @@ fn_sys_perm_errors_fix(){
sudo -v > /dev/null 2>&1
if [ $? -eq 0 ]; then
fn_print_dots "Automatically fixing /sys permissions"
- sleep 2
+ sleep 0.5
fn_script_log_info "Automatically fixing /sys permissions."
if [ "${sysdirpermerror}" == "1" ]; then
sudo chmod a+rx "/sys"
@@ -200,13 +200,13 @@ fn_sys_perm_errors_fix(){
if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then
fn_print_error "Could not fix /sys permissions"
fn_script_log_error "Could not fix /sys permissions."
- sleep 1
+ sleep 0.5
# Show the user how to fix
fn_sys_perm_fix_manually_msg
else
fn_print_ok_nl "Automatically fixing /sys permissions"
fn_script_log_pass "Permissions in /sys fixed"
- sleep 1
+ sleep 0.5
fi
else
# Show the user how to fix
@@ -221,7 +221,7 @@ fn_sys_perm_error_process(){
if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then
fn_print_error_nl "Permission error(s) found in /sys"
fn_script_log_error "Permission error(s) found in /sys"
- sleep 1
+ sleep 0.5
# Run the fix
fn_sys_perm_errors_fix
fi
diff --git a/lgsm/functions/check_status.sh b/lgsm/functions/check_status.sh
index 706b57f63..e297f24c2 100644
--- a/lgsm/functions/check_status.sh
+++ b/lgsm/functions/check_status.sh
@@ -12,7 +12,7 @@ if [ "${gamename}" == "TeamSpeak 3" ]; then
# 1: Server is running
# 0: Server seems to have died
# 0: No server running (ts3server.pid is missing)
- status=$(${executabledir}/ts3server_startscript.sh status servercfgfullpathfile=${servercfgfullpath})
+ status=$("${executabledir}/ts3server_startscript.sh" status servercfgfullpathfile=${servercfgfullpath})
if [ "${status}" == "Server is running" ]; then
status=1
else
@@ -25,7 +25,7 @@ elif [ "${gamename}" == "Mumble" ]; then
info_config.sh
# 1: Server is listening
# 0: Server is not listening, considered closed
- mumblepid=$(netstat -nap 2>/dev/null | grep udp | grep ${port} | grep murmur | awk '{ print $6 }' | awk -F'/' '{ print $1 }')
+ mumblepid=$(netstat -nap 2>/dev/null | grep udp | grep "${port}" | grep murmur | awk '{ print $6 }' | awk -F'/' '{ print $1 }')
if [ -z "${mumblepid}" ]; then
status=0
else
diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh
index 1c0b4b492..f47abf359 100644
--- a/lgsm/functions/check_steamcmd.sh
+++ b/lgsm/functions/check_steamcmd.sh
@@ -40,7 +40,6 @@ fn_check_steamcmd_user(){
fi
steamuser="anonymous"
steampass=''
- sleep 1
fi
}
@@ -53,7 +52,7 @@ fn_check_steamcmd_sh(){
else
fn_print_error_nl "SteamCMD is missing"
fn_script_log_error "SteamCMD is missing"
- sleep 1
+ sleep 0.5
fn_install_steamcmd
fi
elif [ "${function_selfname}" == "command_install.sh" ]; then
diff --git a/lgsm/functions/check_system_requirements.sh b/lgsm/functions/check_system_requirements.sh
index 16babcbac..e0a3dbd01 100644
--- a/lgsm/functions/check_system_requirements.sh
+++ b/lgsm/functions/check_system_requirements.sh
@@ -39,8 +39,8 @@ if [ -n "${ramrequirementmb}" ]; then
sleep 0.5
# Warn the user
fn_print_warn_nl "Check RAM: ${ramrequirementgb}G required, ${physmemtotal} available"
- sleep 1
+ sleep 0.5
echo " * ${gamename} server may fail to run or experience poor performance."
- sleep 1
+ sleep 0.5
fi
fi
diff --git a/lgsm/functions/command_backup.sh b/lgsm/functions/command_backup.sh
index a651f50fe..b2df4be6d 100644
--- a/lgsm/functions/command_backup.sh
+++ b/lgsm/functions/command_backup.sh
@@ -17,7 +17,7 @@ fn_backup_trap(){
echo -ne "backup ${backupname}.tar.gz..."
fn_print_canceled_eol_nl
fn_script_log_info "Backup ${backupname}.tar.gz: CANCELED"
- sleep 1
+ sleep 0.5
rm -f "${backupdir}/${backupname}.tar.gz" | tee -a "${lgsmlog}"
echo -ne "backup ${backupname}.tar.gz..."
fn_print_removed_eol_nl
@@ -44,9 +44,9 @@ fn_backup_init(){
info_distro.sh
fn_print_dots "Backup starting"
fn_script_log_info "Backup starting"
- sleep 1
+ sleep 0.5
fn_print_ok "Backup starting"
- sleep 1
+ sleep 0.5
echo -ne "\n"
if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
fn_print_info_nl "There are no previous backups"
@@ -59,11 +59,11 @@ fn_backup_init(){
daysago="${lastbackupdaysago} days ago"
fi
echo " * Previous backup was created ${daysago}, total size ${lastbackupsize}"
- sleep 1
+ sleep 0.5
fi
}
-# Check if server is started and wether to stop it
+# Check if server is started and whether to stop it
fn_backup_stop_server(){
check_status.sh
# Server is stopped
@@ -80,7 +80,7 @@ fn_backup_stop_server(){
else
fn_print_warn_nl "${servicename} will be stopped during the backup"
fn_script_log_warn "${servicename} will be stopped during the backup"
- sleep 4
+ sleep 5
serverstopped="yes"
exitbypass=1
command_stop.sh
@@ -131,7 +131,7 @@ fn_backup_compression(){
fn_script_log_fatal "Starting backup"
else
fn_print_ok_eol
- sleep 1
+ sleep 0.5
fn_print_ok_nl "Completed: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fi
@@ -153,18 +153,18 @@ fn_backup_prune(){
if [ "${backupquotadiff}" -gt "0" ]||[ "${backupsoudatedcount}" -gt "0" ]; then
fn_print_dots "Pruning"
fn_script_log_info "Backup pruning activated"
- sleep 1
+ sleep 0.5
fn_print_ok_nl "Pruning"
- sleep 1
+ sleep 0.5
# If maxbackups greater or equal to backupsoutdatedcount, then it is over maxbackupdays
if [ "${backupquotadiff}" -ge "${backupsoudatedcount}" ]; then
# Display how many backups will be cleared
echo " * Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit"
fn_script_log_info "Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit"
- sleep 1
+ sleep 0.5
fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_info "Pruning: Clearing ${backupquotadiff} backup(s)"
- sleep 1
+ sleep 0.5
# Clear backups over quota
find "${backupdir}"/ -type f -name "*.tar.gz" -printf '%T@ %p\n' | sort -rn | tail -${backupquotadiff} | cut -f2- -d" " | xargs rm
fn_print_ok_nl "Pruning: Clearing ${backupquotadiff} backup(s)"
@@ -174,16 +174,16 @@ fn_backup_prune(){
# Display how many backups will be cleared
echo " * Pruning: ${backupsoudatedcount} backup(s) are older than ${maxbackupdays} days."
fn_script_log_info "Pruning: ${backupsoudatedcount} backup(s) older than ${maxbackupdays} days."
- sleep 1
+ sleep 0.5
fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)."
fn_script_log_info "Pruning: Clearing ${backupquotadiff} backup(s)"
- sleep 1
+ sleep 0.5
# Clear backups over quota
find "${backupdir}"/ -type f -mtime +"${maxbackupdays}" -exec rm -f {} \;
fn_print_ok_nl "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_pass "Pruning: Cleared ${backupquotadiff} backup(s)"
fi
- sleep 1
+ sleep 0.5
fi
fi
}
diff --git a/lgsm/functions/command_console.sh b/lgsm/functions/command_console.sh
index a6fd07dc1..8feed5bb6 100644
--- a/lgsm/functions/command_console.sh
+++ b/lgsm/functions/command_console.sh
@@ -24,19 +24,19 @@ if ! fn_prompt_yn "Continue?" Y; then
echo Exiting; return
fi
fn_print_dots "Accessing console"
-sleep 1
+sleep 0.5
check_status.sh
if [ "${status}" != "0" ]; then
fn_print_ok_nl "Accessing console"
fn_script_log_pass "Console accessed"
- sleep 1
- tmux attach-session -t ${servicename}
+ sleep 0.5
+ tmux attach-session -t="${servicename}"
fn_print_ok_nl "Closing console"
fn_script_log_pass "Console closed"
else
fn_print_error_nl "Server not running"
fn_script_log_error "Failed to access: Server not running"
- sleep 1
+ sleep 0.5
if fn_prompt_yn "Do you want to start the server?" Y; then
exitbypass=1
command_start.sh
diff --git a/lgsm/functions/command_debug.sh b/lgsm/functions/command_debug.sh
index 07f7611c2..3f9b3b3f7 100644
--- a/lgsm/functions/command_debug.sh
+++ b/lgsm/functions/command_debug.sh
@@ -40,7 +40,7 @@ if [ -n "${glibcrequired}" ]; then
:
elif [ "${glibcrequired}" == "UNKNOWN" ]; then
echo -e "${blue}GLIBC required:\t${red}${glibcrequired}"
- elif [ "$(printf '%s\n'${glibcrequired}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibcrequired}" ]; then
+ elif [ "$(printf '%s\n'${glibcrequired}'\n' "${glibcversion}" | sort -V | head -n 1)" != "${glibcrequired}" ]; then
if [ "${glibcfix}" == "yes" ]; then
echo -e "${blue}GLIBC required:\t${red}${glibcrequired} ${default}(${green}Using GLIBC fix${default})"
else
@@ -80,12 +80,12 @@ fi
fn_print_info_nl "Stopping any running servers"
fn_script_log_info "Stopping any running servers"
-sleep 1
+sleep 0.5
exitbypass=1
command_stop.sh
fn_print_dots "Starting debug"
fn_script_log_info "Starting debug"
-sleep 1
+sleep 0.5
fn_print_ok_nl "Starting debug"
# Create lockfile
@@ -95,16 +95,16 @@ fn_script_log_info "${rootdir}/${lockselfname}"
# trap to remove lockfile on quit.
trap fn_lockfile_trap INT
-cd "${executabledir}"
+cd "${executabledir}" || exit
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
${executable} ${parms} -debug
elif [ "${engine}" == "realvirtuality" ]; then
# Arma3 requires semicolons in the module list, which need to
# be escaped for regular (tmux) loading, but need to be
# stripped when loading straight from the console.
- ${executable} ${parms//\\;/;}
+ "${executable}" "${parms//\\;/;}"
else
- ${executable} ${parms}
+ "${executable}" "${parms}"
fi
fn_print_dots "Stopping debug"
diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh
index 53d72a833..3474ae3ac 100644
--- a/lgsm/functions/command_details.sh
+++ b/lgsm/functions/command_details.sh
@@ -12,10 +12,11 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Run checks and gathers details to display.
check.sh
info_config.sh
+info_parms.sh
info_distro.sh
info_glibc.sh
-info_parms.sh
info_messages.sh
+query_gamedig.sh
fn_info_message_distro
fn_info_message_performance
fn_info_message_disk
diff --git a/lgsm/functions/command_dev_clear_functions.sh b/lgsm/functions/command_dev_clear_functions.sh
new file mode 100644
index 000000000..bf3026c53
--- /dev/null
+++ b/lgsm/functions/command_dev_clear_functions.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# command_dev_clear_functions.sh function
+# Author: Daniel Gibbs
+# Website: https://linuxgsm.com
+# Description: Deletes the contents of the functions dir.
+
+echo "================================="
+echo "Clear Functions"
+echo "================================="
+echo ""
+if fn_prompt_yn "Do you want to delete all functions?" Y; then
+ rm -rfv "${functionsdir}/*"
+fi
+core_exit.sh
\ No newline at end of file
diff --git a/lgsm/functions/command_dev_detect_deps.sh b/lgsm/functions/command_dev_detect_deps.sh
index 8999b2f93..edf4e394e 100644
--- a/lgsm/functions/command_dev_detect_deps.sh
+++ b/lgsm/functions/command_dev_detect_deps.sh
@@ -24,9 +24,9 @@ files=$(find "${serverfiles}" | wc -l)
find "${serverfiles}" -type f -print0 |
while IFS= read -r -d $'\0' line; do
if [ "${readelf}" == "eu-readelf" ]; then
- ${readelf} -d "${line}" 2>/dev/null|grep NEEDED|awk '{ print $4 }'|sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
+ ${readelf} -d "${line}" 2>/dev/null | grep NEEDED| awk '{ print $4 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
else
- ${readelf} -d "${line}" 2>/dev/null|grep NEEDED|awk '{ print $5 }'|sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
+ ${readelf} -d "${line}" 2>/dev/null | grep NEEDED | awk '{ print $5 }' | sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
fi
echo -n "${i} / ${files}" $'\r'
((i++))
@@ -114,7 +114,7 @@ fi
echo ""
echo "Required Librarys"
echo "================================="
-sort "${tmpdir}/.depdetect_readelf" |uniq
+sort "${tmpdir}/.depdetect_readelf" | uniq
echo -en "\n"
rm -f "${tmpdir}/.depdetect_centos_line"
rm -f "${tmpdir}/.depdetect_centos_list"
diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/functions/command_dev_detect_glibc.sh
index 38018ef27..de98065ed 100644
--- a/lgsm/functions/command_dev_detect_glibc.sh
+++ b/lgsm/functions/command_dev_detect_glibc.sh
@@ -31,18 +31,18 @@ echo ""
files=$(find "${serverfiles}" | wc -l)
find "${serverfiles}" -type f -print0 |
while IFS= read -r -d $'\0' line; do
- glibcversion=$(objdump -T "${line}" 2>/dev/null|grep -oP "GLIBC[^ ]+" |grep -v GLIBCXX|sort|uniq|sort -r --version-sort| head -n 1)
+ glibcversion=$(objdump -T "${line}" 2>/dev/null | grep -oP "GLIBC[^ ]+" | grep -v GLIBCXX | sort | uniq | sort -r --version-sort | head -n 1)
if [ "${glibcversion}" ]; then
echo "${glibcversion}: ${line}" >>"${tmpdir}/detect_glibc_files.tmp"
fi
- objdump -T "${line}" 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc.tmp"
+ objdump -T "${line}" 2>/dev/null | grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc.tmp"
echo -n "${i} / ${files}" $'\r'
((i++))
done
echo ""
cat "${tmpdir}/detect_glibc_files.tmp"
echo ""
-cat "${tmpdir}/detect_glibc.tmp"|sort|uniq|sort -r --version-sort
+cat "${tmpdir}/detect_glibc.tmp" | sort | uniq | sort -r --version-sort
rm "${tmpdir}/detect_glibc.tmp"
rm "${tmpdir}/detect_glibc_files.tmp"
diff --git a/lgsm/functions/command_dev_detect_ldd.sh b/lgsm/functions/command_dev_detect_ldd.sh
index b4758cdb8..2e3a859d1 100644
--- a/lgsm/functions/command_dev_detect_ldd.sh
+++ b/lgsm/functions/command_dev_detect_ldd.sh
@@ -25,14 +25,14 @@ echo ""
files=$(find "${serverfiles}" | wc -l)
find "${serverfiles}" -type f -print0 |
while IFS= read -r -d $'\0' line; do
- #ldd -v $line 2>/dev/null|grep "=>" >>"${tmpdir}/detect_ldd.tmp"
- if [ -n "$(ldd "${line}" 2>/dev/null |grep -v "not a dynamic executable")" ]; then
+ if ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable"
+ then
echo "${line}" >> "${tmpdir}/detect_ldd.tmp"
- ldd "${line}" 2>/dev/null |grep -v "not a dynamic executable" >> "${tmpdir}/detect_ldd.tmp"
-
- if [ -n "$(ldd "${line}" 2>/dev/null |grep -v "not a dynamic executable"|grep "not found")" ]; then
+ ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" >> "${tmpdir}/detect_ldd.tmp"
+ if ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" | grep "not found"
+ then
echo "${line}" >> "${tmpdir}/detect_ldd_not_found.tmp"
- ldd "${line}" 2>/dev/null |grep -v "not a dynamic executable"|grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp"
+ ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" | grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp"
fi
fi
echo -n "$i / $files" $'\r'
diff --git a/lgsm/functions/command_dev_query_raw.sh b/lgsm/functions/command_dev_query_raw.sh
new file mode 100644
index 000000000..320e24870
--- /dev/null
+++ b/lgsm/functions/command_dev_query_raw.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# command_dev_query_raw.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+# Description: Raw gamedig output of the server.
+
+echo "================================="
+echo "Gamedig Raw Output"
+echo "================================="
+echo""
+if [ ! "$(command -v gamedig 2>/dev/null)" ]; then
+ fn_print_failure_nl "gamedig not installed"
+fi
+if [ ! "$(command -v jq 2>/dev/null)" ]; then
+ fn_print_failure_nl "jq not installed"
+fi
+
+
+info_config.sh
+info_parms.sh
+if [ "${engine}" == "idtech3_ql" ]; then
+ local engine="quakelive"
+elif [ "${gamename}" == "Killing Floor 2" ]; then
+ local engine="unreal4"
+fi
+
+query_gamedig.sh
+echo "gamedig --type \"${gamedigengine}\" --host \"${ip}\" --port \"${port}\"|jq"
+echo""
+echo "${gamedigraw}" | jq
+echo""
+echo "================================="
+echo "gsquery Raw Output"
+echo "================================="
+echo""
+echo "./query_gsquery.py -a \"${ip}\" -p \"${port}\" -e \"${engine}\""
+if [ ! -f "${functionsdir}/query_gsquery.py" ]; then
+ fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
+fi
+"${functionsdir}"/query_gsquery.py -a "${ip}" -p "${port}" -e "${engine}"
\ No newline at end of file
diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh
index ca6d5cdea..630778e59 100644
--- a/lgsm/functions/command_fastdl.sh
+++ b/lgsm/functions/command_fastdl.sh
@@ -271,7 +271,7 @@ fn_fastdl_gmod(){
fi
# Clear addons directory in fastdl
echo -en "clearing addons dir from fastdl dir..."
- sleep 1
+ sleep 0.5
rm -R "${fastdldir:?}/addons"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
@@ -286,7 +286,7 @@ fn_fastdl_gmod(){
# Correct content that may be into a lua directory by mistake like some darkrpmodification addons
if [ -d "${fastdldir}/lua" ]; then
echo -en "correcting DarkRP files..."
- sleep 2
+ sleep 1
cp -Rf "${fastdldir}/lua/"* "${fastdldir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
@@ -302,7 +302,7 @@ fn_fastdl_gmod(){
totalfiles=$(wc -l < "${tmpdir}/fastdl_files_to_compress.txt")
# Calculates total file size
while read dufile; do
- filesize=$(du -b "${dufile}"| awk '{ print $1 }')
+ filesize=$(du -b "${dufile}" | awk '{ print $1 }')
filesizetotal=$(( ${filesizetotal} + ${filesize} ))
done <"${tmpdir}/fastdl_files_to_compress.txt"
fi
diff --git a/lgsm/functions/command_mods_install.sh b/lgsm/functions/command_mods_install.sh
index a02771687..b26bb9e06 100644
--- a/lgsm/functions/command_mods_install.sh
+++ b/lgsm/functions/command_mods_install.sh
@@ -16,7 +16,7 @@ fn_print_header
# Displays a list of installed mods
fn_mods_installed_list
-if [ ${installedmodscount} -gt 0 ]; then
+if [ "${installedmodscount}" -gt "0" ]; then
echo "Installed addons/mods"
echo "================================="
# Go through all available commands, get details and display them to the user
@@ -85,7 +85,7 @@ if [ -f "${modsinstalledlistfullpath}" ]; then
if [ -n "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
fn_print_warning_nl "${modprettyname} is already installed"
fn_script_log_warn "${modprettyname} is already installed"
- sleep 1
+ sleep 0.5
echo " * Any configs may be overwritten."
if ! fn_prompt_yn "Continue?" Y; then
echo Exiting; core_exit.sh
diff --git a/lgsm/functions/command_mods_remove.sh b/lgsm/functions/command_mods_remove.sh
index b2700b683..4ecdacfed 100644
--- a/lgsm/functions/command_mods_remove.sh
+++ b/lgsm/functions/command_mods_remove.sh
@@ -58,7 +58,7 @@ fn_script_log_info "Removing ${modsfilelistsize} files from ${modprettyname}"
echo -e "removing ${modprettyname}"
echo -e "* ${modsfilelistsize} files to be removed"
echo -e "* location: ${modinstalldir}"
-sleep 1
+sleep 0.5
# Go through every file and remove it
modfileline="1"
tput sc
diff --git a/lgsm/functions/command_mods_update.sh b/lgsm/functions/command_mods_update.sh
index a2274277d..b80e4416e 100644
--- a/lgsm/functions/command_mods_update.sh
+++ b/lgsm/functions/command_mods_update.sh
@@ -66,7 +66,7 @@ for ((ulindex=0; ulindex < ${#installedmodslist[@]}; ulindex++)); do
echo -e " * ${yellow}${modprettyname}${default} (retain common custom files)"
fi
done
-sleep 1
+sleep 0.5
## Update
# List all installed mods and apply update
diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh
index cf1cbdd5e..3eb111f92 100644
--- a/lgsm/functions/command_monitor.sh
+++ b/lgsm/functions/command_monitor.sh
@@ -4,12 +4,82 @@
# Contributor: UltimateByte
# Website: https://linuxgsm.com
# Description: Monitors server by checking for running processes.
-# then passes to monitor_gsquery.sh.
+# then passes to gamedig and gsquery.
local commandname="MONITOR"
local commandaction="Monitor"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_monitor_loop(){
+# 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.
+for queryattempt in {1..5}; do
+ fn_print_dots "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: "
+ fn_print_querying_eol
+ fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : QUERYING"
+ sleep 0.5
+ if [ "${querymethod}" == "gamedig" ]; then
+ query_gamedig.sh
+ elif [ "${querymethod}" == "gsquery" ]; then
+ if [ ! -f "${functionsdir}/query_gsquery.py" ]; then
+ fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
+ fi
+ "${functionsdir}"/query_gsquery.py -a "${ip}" -p "${queryport}" -e "${engine}" > /dev/null 2>&1
+ querystatus="$?"
+ elif [ "${querymethod}" == "telnet" ]; then
+ bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}''
+ querystatus="$?"
+ fi
+
+ if [ "${querystatus}" == "0" ]; then
+ # 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
+ 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
+ if [ "${querymethod}" == "gsquery" ]; then
+ if [ "${totalseconds}" -ge "59" ]; then
+ # 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
+ alert="restartquery"
+ alert.sh
+ command_restart.sh
+ core_exit.sh
+ fi
+ elif [ "${querymethod}" == "gamedig" ]; then
+ if [ "${totalseconds}" -ge "29" ]; then
+ break
+ fi
+ fi
+
+ # Seconds counter
+ for seconds in {1..15}; do
+ fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: WAIT"
+ totalseconds=$((totalseconds + 1))
+ sleep 1
+ if [ "${seconds}" == "15" ]; then
+ break
+ fi
+ done
+ fi
+done
+}
+
fn_monitor_check_lockfile(){
# Monitor does not run it lockfile is not found
if [ ! -f "${rootdir}/${lockselfname}" ]; then
@@ -22,102 +92,105 @@ fn_monitor_check_lockfile(){
fn_monitor_check_update(){
# Monitor will not check if update is running.
- if [ "$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l)" != "0" ]; then
+ if [ "$(ps -ef | grep "${selfname} update" | grep -v grep | wc -l)" != "0" ]; then
fn_print_error_nl "SteamCMD is currently checking for updates"
fn_script_log_error "SteamCMD is currently checking for updates"
- sleep 1
+ sleep 0.5
core_exit.sh
fi
}
-fn_monitor_msg_checking(){
+fn_monitor_check_session(){
fn_print_dots "Checking session: "
fn_print_checking_eol
fn_script_log_info "Checking session: CHECKING"
- sleep 1
-}
-
-fn_monitor_teamspeak3(){
+ sleep 0.5
if [ "${status}" != "0" ]; then
fn_print_ok "Checking session: "
fn_print_ok_eol_nl
fn_script_log_pass "Checking session: OK"
else
- fn_print_error "Checking session: ${ts3error}: "
+ if [ "${gamename}" == "TeamSpeak 3" ]; then
+ fn_print_error "Checking session: ${ts3error}: "
+ elif [ "${gamename}" == "Mumble" ]; then
+ fn_print_error "Checking session: Not listening to port ${queryport}"
+ else
+ fn_print_error "Checking session: "
+ fi
fn_print_fail_eol_nl
- fn_script_log_error "Checking session: ${ts3error}: FAIL"
- failurereason="${ts3error}"
+ fn_script_log_error "Checking session: FAIL"
alert="restart"
alert.sh
fn_script_log_info "Monitor is starting ${servername}"
- sleep 1
+ sleep 0.5
command_restart.sh
fi
+ sleep 0.5
}
-fn_monitor_mumble(){
- if [ "${status}" != "0" ]; then
- fn_print_ok "Checking session: "
- fn_print_ok_eol_nl
- fn_script_log_pass "Checking session: OK"
- else
- fn_print_error "Checking session: Not listening to port ${port}"
- fn_print_fail_eol_nl
- fn_script_log_error "Checking session: Not listening to port ${port}"
- failurereason="Checking session: Not listening to port ${port}"
- alert="restart"
- alert.sh
- fn_script_log_info "Monitor is starting ${servername}"
- sleep 1
- command_restart.sh
- fi
-}
-fn_monitor_tmux(){
- # checks that tmux session is running
- if [ "${status}" != "0" ]; then
- fn_print_ok "Checking session: "
- fn_print_ok_eol_nl
- fn_script_log_pass "Checking session: OK"
- # runs gsquery check on game with specific engines.
- local allowed_engines_array=( avalanche2.0 avalanche3.0 goldsource idtech2 idtech3 idtech3_ql iw2.0 iw3.0 madness quake refractor realvirtuality source spark starbound unity3d unreal unreal2 unreal4 )
- for allowed_engine in "${allowed_engines_array[@]}"
- do
- if [ "${allowed_engine}" == "starbound" ]; then
- info_config.sh
- if [ "${queryenabled}" == "true" ]; then
- monitor_gsquery.sh
- fi
- elif [ "${allowed_engine}" == "${engine}" ]; then
- monitor_gsquery.sh
+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 madness quake refractor realvirtuality source spark starbound unity3d unreal unreal2 unreal4 )
+ for allowed_engine in "${allowed_engines_array[@]}"
+ do
+ if [ "${allowed_engine}" == "${engine}" ]; then
+ if [ "${engine}" == "idtech3_ql" ]; then
+ local engine="quakelive"
+ elif [ "${gamename}" == "Killing Floor 2" ]; then
+ local engine="unreal4"
fi
- done
- else
- fn_print_error "Checking session: "
- fn_print_fail_eol_nl
- fn_script_log_error "Checking session: FAIL"
- alert="restart"
- alert.sh
- fn_script_log_info "Monitor is starting ${servername}"
- sleep 1
- command_restart.sh
- fi
+
+ # will first attempt to use gamedig then gsquery
+ totalseconds=0
+ local query_methods_array=( gamedig gsquery )
+ for query_method in "${query_methods_array[@]}"
+ do
+ if [ "${query_method}" == "gamedig" ]; then
+ # 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}"
+ fn_monitor_loop
+ fi
+ fi
+ else
+ if [ -z "${monitorpass}" ]; then
+ querymethod="${query_method}"
+ fn_monitor_loop
+ fi
+ fi
+ done
+ fi
+ done
+}
+
+fn_monitor_query_telnet(){
+ querymethod="telnet"
+ fn_monitor_loop
}
monitorflag=1
fn_print_dots "${servername}"
-sleep 1
+sleep 0.5
check.sh
logs.sh
info_config.sh
+info_parms.sh
fn_monitor_check_lockfile
fn_monitor_check_update
-fn_monitor_msg_checking
-if [ "${gamename}" == "TeamSpeak 3" ]; then
- fn_monitor_teamspeak3
-elif [ "${gamename}" == "Mumble" ]; then
- fn_monitor_mumble
+fn_monitor_check_session
+# Query has to be enabled in starbound config
+if [ "${gamename}" == "starbound" ]; then
+ if [ "${queryenabled}" == "true" ]; then
+ fn_monitor_query
+ fi
+elif [ "${gamename}" == "TeamSpeak 3" ]; then
+ fn_monitor_query_telnet
else
- fn_monitor_tmux
+ fn_monitor_query
fi
+
core_exit.sh
+
diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh
index 6e2cd94a4..9bd635086 100644
--- a/lgsm/functions/command_postdetails.sh
+++ b/lgsm/functions/command_postdetails.sh
@@ -74,7 +74,7 @@ fi
if [ "${posttarget}" == "http://pastebin.com" ] ; then
fn_print_dots "Posting details to pastbin.com for ${postexpire}"
- sleep 1
+ sleep 0.5
# grab the return from 'value' from an initial visit to pastebin.
csrftoken=$(${curlpath} -s "${posttarget}" |
sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p')
@@ -94,7 +94,7 @@ if [ "${posttarget}" == "http://pastebin.com" ] ; then
echo " Please share the following url for support: ${pdurl}"
elif [ "${posttarget}" == "https://hastebin.com" ] ; then
fn_print_dots "Posting details to hastebin.com"
- sleep 1
+ sleep 0.5
# hastebin is a bit simpler. If successful, the returned result
# should look like: {"something":"key"}, putting the reference that
# we need in "key". TODO - error handling. -CedarLUG
diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh
index 43ce5480e..e8b0179e7 100644
--- a/lgsm/functions/command_start.sh
+++ b/lgsm/functions/command_start.sh
@@ -15,16 +15,16 @@ fn_start_teamspeak3(){
fn_script_log_warn "${servercfgfullpath} is missing"
echo " * Creating blank ${servercfg}"
fn_script_log_info "Creating blank ${servercfg}"
- sleep 2
+ sleep 1
echo " * ${servercfg} can remain blank by default."
fn_script_log_info "${servercfgfullpath} can remain blank by default."
- sleep 2
+ sleep 1
echo " * ${servercfg} is located in ${servercfgfullpath}."
fn_script_log_info "${servercfg} is located in ${servercfgfullpath}."
sleep 5
touch "${servercfgfullpath}"
fi
- sleep 1
+ sleep 0.5
check_status.sh
if [ "${status}" != "0" ]; then
fn_print_info_nl "${servername} is already running"
@@ -52,7 +52,7 @@ fn_start_teamspeak3(){
else
./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
fi
- sleep 1
+ sleep 0.5
check_status.sh
if [ "${status}" == "0" ]; then
fn_print_fail_nl "Unable to start ${servername}"
@@ -112,9 +112,9 @@ fn_start_tmux(){
touch "${consolelog}"
# Get tmux version
- tmuxversion="$(tmux -V|sed "s/tmux //"|sed -n '1 p')"
+ tmuxversion="$(tmux -V | sed "s/tmux //" | sed -n '1 p')"
# Tmux compiled from source will return "master", therefore ignore it
- if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p')" == "master" ]; then
+ if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p')" == "master" ]; then
fn_script_log "Tmux version: master (user compiled)"
echo "Tmux version: master (user compiled)" >> "${consolelog}"
if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
@@ -122,7 +122,7 @@ fn_start_tmux(){
fi
elif [ -n "${tmuxversion}" ]; then
# Get the digit version of tmux
- tmuxversion="$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')"
+ tmuxversion="$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')"
# tmux pipe-pane not supported in tmux versions < 1.6
if [ "${tmuxversion}" -lt "16" ]; then
echo "Console logging disabled: Tmux => 1.6 required
@@ -148,14 +148,14 @@ if [ "${consolelogging}" == "off" ]; then
echo "Console logging disabled by user" >> "${consolelog}"
fn_script_log_info "Console logging disabled by user"
fi
-sleep 1
+sleep 0.5
# If the server fails to start
check_status.sh
if [ "${status}" == "0" ]; then
fn_print_fail_nl "Unable to start ${servername}"
fn_script_log_fatal "Unable to start ${servername}"
- sleep 1
+ sleep 0.5
if [ -s "${lgsmlogdir}/.${servicename}-tmux-error.tmp" ]; then
fn_print_fail_nl "Unable to start ${servername}: Tmux error:"
fn_script_log_fatal "Unable to start ${servername}: Tmux error:"
@@ -169,7 +169,8 @@ sleep 1
cat "${lgsmlogdir}/.${servicename}-tmux-error.tmp" | tee -a "${lgsmlog}"
# Detected error https://linuxgsm.com/support
- if [ $(grep -c "Operation not permitted" "${lgsmlogdir}/.${servicename}-tmux-error.tmp") ]; then
+ if grep -c "Operation not permitted" "${lgsmlogdir}/.${servicename}-tmux-error.tmp"
+ then
echo ""
echo "Fix"
echo "================================="
@@ -206,7 +207,7 @@ sleep 1
}
fn_print_dots "${servername}"
-sleep 1
+sleep 0.5
check.sh
fix.sh
info_config.sh
diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh
index 4740f2f92..d8d13f9dc 100644
--- a/lgsm/functions/command_stop.sh
+++ b/lgsm/functions/command_stop.sh
@@ -14,7 +14,7 @@ fn_stop_graceful_ctrlc(){
fn_print_dots "Graceful: CTRL+c"
fn_script_log_info "Graceful: CTRL+c"
# sends quit
- tmux send-keys C-c -t "${servicename}" > /dev/null 2>&1
+ tmux send-keys C-c -t="${servicename}" > /dev/null 2>&1
# waits up to 30 seconds giving the server time to shutdown gracefuly
for seconds in {1..30}; do
check_status.sh
@@ -33,7 +33,7 @@ fn_stop_graceful_ctrlc(){
fn_print_fail_eol_nl
fn_script_log_error "Graceful: CTRL+c: FAIL"
fi
- sleep 1
+ sleep 0.5
fn_stop_tmux
}
@@ -44,7 +44,7 @@ fn_stop_graceful_cmd(){
fn_print_dots "Graceful: sending \"${1}\""
fn_script_log_info "Graceful: sending \"${1}\""
# sends specific stop command
- tmux send -t "${servicename}" ${1} ENTER > /dev/null 2>&1
+ tmux send -t="${servicename}" "${1}" ENTER > /dev/null 2>&1
# waits up to given seconds giving the server time to shutdown gracefully
for ((seconds=1; seconds<=${2}; seconds++)); do
check_status.sh
@@ -63,7 +63,7 @@ fn_stop_graceful_cmd(){
fn_print_fail_eol_nl
fn_script_log_error "Graceful: sending \"${1}\": FAIL"
fi
- sleep 1
+ sleep 0.5
fn_stop_tmux
}
@@ -75,7 +75,7 @@ fn_stop_graceful_goldsource(){
fn_print_dots "Graceful: sending \"quit\""
fn_script_log_info "Graceful: sending \"quit\""
# sends quit
- tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
+ tmux send -t="${servicename}" quit ENTER > /dev/null 2>&1
# waits 3 seconds as goldsource servers restart with the quit command
for seconds in {1..3}; do
sleep 1
@@ -84,7 +84,7 @@ fn_stop_graceful_goldsource(){
fn_print_ok "Graceful: sending \"quit\": ${seconds}: "
fn_print_ok_eol_nl
fn_script_log_pass "Graceful: sending \"quit\": OK: ${seconds} seconds"
- sleep 1
+ sleep 0.5
fn_stop_tmux
}
@@ -115,7 +115,7 @@ fn_stop_telnet_sdtd(){
fn_stop_graceful_sdtd(){
fn_print_dots "Graceful: telnet"
fn_script_log_info "Graceful: telnet"
- sleep 1
+ sleep 0.5
if [ "${telnetenabled}" == "false" ]; then
fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}"
elif [ "$(command -v expect 2>/dev/null)" ]; then
@@ -123,10 +123,10 @@ fn_stop_graceful_sdtd(){
for telnetip in 127.0.0.1 ${ip}; do
fn_print_dots "Graceful: telnet: ${telnetip}"
fn_script_log_info "Graceful: telnet: ${telnetip}"
- sleep 1
+ sleep 0.5
fn_stop_telnet_sdtd
- completed=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Completed.")
- refused=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Timeout or EOF")
+ completed=$(echo -en "\n ${sdtd_telnet_shutdown}" | grep "Completed.")
+ refused=$(echo -en "\n ${sdtd_telnet_shutdown}" | grep "Timeout or EOF")
if [ -n "${refused}" ]; then
fn_print_error "Graceful: telnet: ${telnetip}: "
fn_print_fail_eol_nl
@@ -142,7 +142,7 @@ fn_stop_graceful_sdtd(){
if [ -n "${completed}" ]; then
for seconds in {1..30}; do
fn_stop_telnet_sdtd
- refused=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Timeout or EOF")
+ refused=$(echo -en "\n ${sdtd_telnet_shutdown}" | grep "Timeout or EOF")
if [ -n "${refused}" ]; then
fn_print_ok "Graceful: telnet: ${telnetip}: "
fn_print_ok_eol_nl
@@ -173,7 +173,7 @@ fn_stop_graceful_sdtd(){
fn_print_fail_eol_nl
fn_script_log_warn "Graceful: telnet: expect not installed: FAIL"
fi
- sleep 1
+ sleep 0.5
fn_stop_tmux
}
@@ -193,7 +193,7 @@ fn_stop_graceful_select(){
fn_stop_graceful_goldsource
elif [ "${engine}" == "avalanche2.0" ]||[ "${engine}" == "avalanche3.0" ]||[ "${gamename}" == "Factorio" ]||[ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal4" ]||[ "${engine}" == "unreal3" ]||[ "${engine}" == "unreal2" ]||[ "${engine}" == "unreal" ]||[ "${gamename}" == "Mumble" ]; then
fn_stop_graceful_ctrlc
- elif [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${engine}" == "Just Cause 2" ]||[ "${engine}" == "projectzomboid" ]; then
+ elif [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${engine}" == "Just Cause 2" ]||[ "${engine}" == "projectzomboid" ]||[ "${shortname}" == "rw" ]; then
fn_stop_graceful_cmd "quit" 30
else
fn_stop_tmux
@@ -218,7 +218,7 @@ fn_stop_ark(){
if [ "${#queryport}" -gt 0 ] ; then
for (( pidcheck=0 ; pidcheck < ${maxpiditer} ; pidcheck++ )) ; do
- pid=$(netstat -nap 2>/dev/null | grep ^udp[[:space:]] |\
+ pid=$(netstat -nap 2>/dev/null | grep "^udp[[:space:]]" |\
grep ":${queryport}[[:space:]]" | rev | awk '{print $1}' |\
rev | cut -d\/ -f1)
#
@@ -228,7 +228,7 @@ fn_stop_ark(){
# and a valid numeric pid remains unchanged.
if [ "${pid}" -gt 1 ]&&[ "${pid}" -le "$(cat "/proc/sys/kernel/pid_max")" ]; then
fn_print_dots "Process still bound. Awaiting graceful exit: ${pidcheck}"
- sleep 1
+ sleep 0.5
else
break # Our job is done here
fi # end if for pid range check
@@ -263,7 +263,7 @@ fn_stop_tmux(){
fn_script_log_info "tmux kill-session: ${servername}"
sleep 0.5
# Kill tmux session
- tmux kill-session -t "${servicename}" > /dev/null 2>&1
+ tmux kill-session -t="${servicename}" > /dev/null 2>&1
sleep 0.5
check_status.sh
if [ "${status}" == "0" ]; then
diff --git a/lgsm/functions/command_test_alert.sh b/lgsm/functions/command_test_alert.sh
index e973007b8..ff5084696 100644
--- a/lgsm/functions/command_test_alert.sh
+++ b/lgsm/functions/command_test_alert.sh
@@ -9,7 +9,7 @@ local commandaction="Alert"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_print_dots "${servername}"
-sleep 1
+sleep 0.5
check.sh
info_config.sh
alert="test"
diff --git a/lgsm/functions/command_ts3_server_pass.sh b/lgsm/functions/command_ts3_server_pass.sh
index 05acf0f6b..cbd3ad9ae 100644
--- a/lgsm/functions/command_ts3_server_pass.sh
+++ b/lgsm/functions/command_ts3_server_pass.sh
@@ -25,14 +25,14 @@ fn_serveradmin_password_prompt(){
fn_serveradmin_password_set(){
fn_print_info_nl "Starting server with new password..."
fn_script_log_info "Starting server with new password"
- sleep 1
+ sleep 0.5
# Start server in "new password mode"
ts3serverpass="1"
exitbypass="1"
command_start.sh
fn_print_ok_nl "Password applied"
fn_script_log_pass "New ServerAdmin password applied"
- sleep 1
+ sleep 0.5
}
# Running functions
diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/functions/command_update_linuxgsm.sh
index 0e7f65cf8..77e5ddc49 100644
--- a/lgsm/functions/command_update_linuxgsm.sh
+++ b/lgsm/functions/command_update_linuxgsm.sh
@@ -9,12 +9,12 @@ local commandaction="Update LinuxGSM"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_print_dots "Updating LinuxGSM"
-sleep 1
+sleep 0.5
check.sh
fn_script_log_info "Updating LinuxGSM"
echo -ne "\n"
-if [ -z "${legacymode}" ];then
+if [ -z "${legacymode}" ]; then
# Check and update _default.cfg
echo -ne " checking config _default.cfg...\c"
config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(${curlpath} -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
@@ -75,7 +75,7 @@ fi
# Check and update functions
if [ -n "${functionsdir}" ]; then
if [ -d "${functionsdir}" ]; then
- cd "${functionsdir}"
+ cd "${functionsdir}" || exit
for functionfile in *
do
echo -ne " checking function ${functionfile}...\c"
@@ -97,7 +97,7 @@ if [ -n "${functionsdir}" ]; then
elif [ "${function_file_diff}" != "" ]; then
fn_print_update_eol_nl
fn_script_log_info "checking function ${functionfile}: UPDATE"
- rm -rf "${functionsdir}/${functionfile}"
+ rm -rf "${functionsdir:?}/${functionfile}"
fn_update_function
else
fn_print_ok_eol_nl
diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh
index a9cfc2721..cef68ce7c 100644
--- a/lgsm/functions/command_validate.sh
+++ b/lgsm/functions/command_validate.sh
@@ -17,9 +17,9 @@ fn_validation(){
echo -en "\n"
fn_script_log_info "Validating files: SteamCMD"
- sleep 1
+ sleep 0.5
- cd "${steamcmddir}"
+ cd "${steamcmddir}" || exit
# Detects if unbuffer command is available for 32 bit distributions only.
info_distro.sh
if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then
@@ -27,9 +27,9 @@ fn_validation(){
fi
if [ "${engine}" == "goldsource" ]; then
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit| tee -a "${lgsmlog}"
+ ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit | tee -a "${lgsmlog}"
else
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit| tee -a "${lgsmlog}"
+ ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit | tee -a "${lgsmlog}"
fi
if [ $? != 0 ]; then
fn_print_fail_nl "Validating files: SteamCMD"
@@ -45,7 +45,7 @@ fn_validation(){
fn_print_dots "Validating files:"
sleep 0.5
fn_print_dots "Validating files: SteamCMD"
-sleep 1
+sleep 0.5
check.sh
check_status.sh
if [ "${status}" != "0" ]; then
diff --git a/lgsm/functions/command_wipe.sh b/lgsm/functions/command_wipe.sh
index 370879832..7e38cf1ab 100644
--- a/lgsm/functions/command_wipe.sh
+++ b/lgsm/functions/command_wipe.sh
@@ -48,7 +48,7 @@ fn_wipe_server_remove_files(){
if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then
currentaction="Removing procedural map save(s): ${serveridentitydir}/proceduralmap.*.sav"
echo -en "Removing map saves proceduralmap.*.sav file(s)..."
- sleep 1
+ sleep 0.5
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "proceduralmap.*.sav" -delete
fn_wipe_exit_code
@@ -62,7 +62,7 @@ fn_wipe_server_remove_files(){
if [ -n "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]; then
currentaction="Removing barren map save(s): ${serveridentitydir}/barren*.sav"
echo -en "Removing barren map saves barren*.sav file(s)..."
- sleep 1
+ sleep 0.5
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "barren*.sav" -delete
fn_wipe_exit_code
@@ -76,7 +76,7 @@ fn_wipe_server_remove_files(){
if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then
currentaction="Removing map file(s): ${serveridentitydir}/proceduralmap.*.map"
echo -en "Removing procedural map proceduralmap.*.map file(s)..."
- sleep 1
+ sleep 0.5
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "proceduralmap.*.map" -delete
fn_wipe_exit_code
@@ -90,7 +90,7 @@ fn_wipe_server_remove_files(){
if [ -n "$(find "${serveridentitydir}" -type f -name "barren*.map")" ]; then
currentaction="Removing map file(s): ${serveridentitydir}/barren*.map"
echo -en "Removing barren map barren*.map file(s)..."
- sleep 1
+ sleep 0.5
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "barren*.map" -delete
fn_wipe_exit_code
@@ -103,7 +103,7 @@ fn_wipe_server_remove_files(){
if [ -d "${serveridentitydir}/user" ]; then
currentaction="Removing user directory: ${serveridentitydir}/user"
echo -en "Removing user directory..."
- sleep 1
+ sleep 0.5
fn_script_log "${currentaction}"
rm -rf "${serveridentitydir:?}/user"
fn_wipe_exit_code
@@ -116,7 +116,7 @@ fn_wipe_server_remove_files(){
if [ -d "${serveridentitydir}/storage" ]; then
currentaction="Removing storage directory: ${serveridentitydir}/storage"
echo -en "Removing storage directory..."
- sleep 1
+ sleep 0.5
fn_script_log "${currentaction}"
rm -rf "${serveridentitydir:?}/storage"
fn_wipe_exit_code
@@ -129,7 +129,7 @@ fn_wipe_server_remove_files(){
if [ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
currentaction="Removing log files: ${serveridentitydir}/Log.*.txt"
echo -en "Removing Log files..."
- sleep 1
+ sleep 0.5
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "Log.*.txt" -delete
fn_wipe_exit_code
@@ -152,12 +152,12 @@ if [ "${gamename}" == "Rust" ]; then
echo Exiting; core_exit.sh
fi
fn_script_log_info "User selects to erase any user, storage, log and map data from ${serveridentitydir}"
- sleep 1
+ sleep 0.5
fn_wipe_server_process
else
fn_print_information_nl "No data to wipe was found"
fn_script_log_info "No data to wipe was found."
- sleep 1
+ sleep 0.5
core_exit.sh
fi
# You can add an "elif" here to add another game or engine
@@ -165,7 +165,7 @@ else
# Game not listed
fn_print_information_nl "Wipe is not available for this game"
fn_script_log_info "Wipe is not available for this game."
- sleep 1
+ sleep 0.5
core_exit.sh
fi
diff --git a/lgsm/functions/compress_ut99_maps.sh b/lgsm/functions/compress_ut99_maps.sh
index c75f674d1..0832ae997 100644
--- a/lgsm/functions/compress_ut99_maps.sh
+++ b/lgsm/functions/compress_ut99_maps.sh
@@ -22,7 +22,7 @@ if ! fn_prompt_yn "Start compression?" Y; then
fi
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
rm -rfv "${serverfiles}/Maps/"*.unr.uz
-cd "${systemdir}"
+cd "${systemdir}" || exit
for map in "${serverfiles}/Maps/"*; do
./ucc-bin compress "${map}" --nohomedir
done
diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh
index 359a4c8a6..ea23b8c7e 100644
--- a/lgsm/functions/core_dl.sh
+++ b/lgsm/functions/core_dl.sh
@@ -25,7 +25,7 @@ fn_dl_md5(){
# Runs MD5 Check if available
if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then
echo -ne "verifying ${local_filename} with MD5..."
- sleep 1
+ sleep 0.5
local md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}')
if [ "${md5sumcmd}" != "${md5}" ]; then
fn_print_fail_eol_nl
@@ -88,7 +88,7 @@ fn_fetch_trap(){
echo -ne "downloading ${local_filename}..."
fn_print_canceled_eol_nl
fn_script_log_info "Downloading ${local_filename}...CANCELED"
- sleep 1
+ sleep 0.5
rm -f "${local_filedir}/${local_filename}"
echo -ne "downloading ${local_filename}..."
fn_print_removed_eol_nl
diff --git a/lgsm/functions/core_exit.sh b/lgsm/functions/core_exit.sh
index 58860d857..bc6c2331d 100644
--- a/lgsm/functions/core_exit.sh
+++ b/lgsm/functions/core_exit.sh
@@ -8,6 +8,9 @@ fn_exit_dev_debug(){
if [ -f "${rootdir}/.dev-debug" ]; then
echo ""
echo "${function_selfname} exiting with code: ${exitcode}"
+ if [ -f "${rootdir}/dev-debug.log" ]; then
+ grep "functionfile=" "${rootdir}/dev-debug.log" | sed 's/functionfile=//g' > "${rootdir}/dev-debug-function-order.log"
+ fi
fi
}
diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh
index 0bea6c7a3..913929ea7 100644
--- a/lgsm/functions/core_functions.sh
+++ b/lgsm/functions/core_functions.sh
@@ -269,6 +269,11 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
+command_dev_query_raw.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
# Fix
fix.sh(){
@@ -306,37 +311,43 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
-fix_steamcmd.sh(){
+fix_glibc.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
-fix_glibc.sh(){
+
+fix_kf.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
-fix_ro.sh(){
+fix_kf2.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
-fix_kf.sh(){
+fix_mta.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
-fix_kf2.sh(){
+fix_ro.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
-fix_ut2k4.sh(){
+fix_rust.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
-fix_ut.sh(){
+fix_rw.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_ut3.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
@@ -346,7 +357,12 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
-fix_mta.sh(){
+fix_ut2k4.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_ut.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
@@ -363,6 +379,11 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
+info_gamedig.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
info_glibc.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
@@ -426,9 +447,9 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
-# Monitor
+# Query
-monitor_gsquery.sh(){
+query_gamedig.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh
index 9f9d87247..abe999b34 100644
--- a/lgsm/functions/core_getopt.sh
+++ b/lgsm/functions/core_getopt.sh
@@ -47,6 +47,8 @@ cmd_dev_debug=( "dev;developer" "command_dev_debug.sh" "Enable developer Mode."
cmd_dev_detect_deps=( "dd;detect-deps" "command_dev_detect_deps.sh" "Detect required dependencies." )
cmd_dev_detect_glibc=( "dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc." )
cmd_dev_detect_ldd=( "dl;detect-ldd" "command_dev_detect_ldd.sh" "Detect required dynamic dependencies." )
+cmd_dev_query_raw=( "qr;query-raw" "command_dev_query_raw.sh" "The raw output of gamedig and gsquery." )
+cmd_dev_clear_functions=( "cf;clear-functions" "command_dev_clear_functions.sh" "Delete the contents of the functions dir." )
### Set specific opt here ###
@@ -59,7 +61,7 @@ currentopt+=( "${cmd_update_linuxgsm[@]}" )
if [ "${gamename}" != "Battlefield: 1942" ]&&[ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]&&[ "${gamename}" != "San Andreas Multiplayer" ]; then
currentopt+=( "${cmd_update[@]}" )
# force update for SteamCMD only or MTA
- if [ -n "${appid}" ] || [ "${gamename}" == "Multi Theft Auto" ]; then
+ if [ -n "${appid}" ]||[ "${gamename}" == "Multi Theft Auto" ]; then
currentopt+=( "${cmd_force_update[@]}" )
fi
fi
@@ -130,16 +132,16 @@ currentopt+=( "${cmd_install[@]}" "${cmd_auto_install[@]}" )
## Developer commands
currentopt+=( "${cmd_dev_debug[@]}" )
if [ -f ".dev-debug" ]; then
- currentopt+=( "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" )
+ currentopt+=( "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" )
fi
### Build list of available commands
optcommands=()
index="0"
for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
- cmdamount="$(echo "${currentopt[index]}"| awk -F ';' '{ print NF }')"
+ cmdamount="$(echo "${currentopt[index]}" | awk -F ';' '{ print NF }')"
for ((cmdindex=1; cmdindex <= ${cmdamount}; cmdindex++)); do
- optcommands+=( "$(echo "${currentopt[index]}"| awk -F ';' -v x=${cmdindex} '{ print $x }')" )
+ optcommands+=( "$(echo "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')" )
done
done
@@ -174,11 +176,11 @@ for i in "${optcommands[@]}"; do
# Seek and run command
index="0"
for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
- currcmdamount="$(echo "${currentopt[index]}"| awk -F ';' '{ print NF }')"
+ currcmdamount="$(echo "${currentopt[index]}" | awk -F ';' '{ print NF }')"
for ((currcmdindex=1; currcmdindex <= ${currcmdamount}; currcmdindex++)); do
- if [ "$(echo "${currentopt[index]}"| awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
+ if [ "$(echo "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
# Run command
- eval ${currentopt[index+1]}
+ eval "${currentopt[index+1]}"
core_exit.sh
break
fi
diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh
index 1d89cc4ee..2872b806f 100644
--- a/lgsm/functions/fix.sh
+++ b/lgsm/functions/fix.sh
@@ -11,18 +11,18 @@ local commandaction="Fix"
# Messages that are displayed for some fixes
fn_fix_msg_start(){
fn_print_dots "Applying ${fixname} fix: ${gamename}"
- sleep 1
+ sleep 0.5
fn_print_info "Applying ${fixname} fix: ${gamename}"
fn_script_log_info "Applying ${fixname} fix: ${gamename}"
- sleep 1
+ sleep 0.5
}
fn_fix_msg_start_nl(){
fn_print_dots "Applying ${fixname} fix: ${gamename}"
- sleep 1
+ sleep 0.5
fn_print_info "Applying ${fixname} fix: ${gamename}"
fn_script_log_info "Applying ${fixname} fix: ${gamename}"
- sleep 1
+ sleep 0.5
}
fn_fix_msg_end(){
@@ -56,6 +56,8 @@ if [ "${function_selfname}" != "command_install.sh" ]; then
fix_ins.sh
elif [ "${gamename}" == "Rust" ]; then
fix_rust.sh
+ elif [ "${shortname}" == "rw" ]; then
+ fix_rw.sh
elif [ "${gamename}" == "Multi Theft Auto" ]; then
fix_mta.sh
fi
@@ -66,7 +68,7 @@ if [ "${function_selfname}" == "command_install.sh" ]; then
echo ""
echo "Applying ${gamename} Server Fixes"
echo "================================="
- sleep 1
+ sleep 0.5
if [ "${gamename}" == "Killing Floor" ]; then
fix_kf.sh
elif [ "${gamename}" == "Killing Floor 2" ]; then
@@ -77,5 +79,7 @@ if [ "${function_selfname}" == "command_install.sh" ]; then
fix_ut2k4.sh
elif [ "${gamename}" == "Unreal Tournament" ]; then
fix_ut.sh
+ elif [ "${gamename}" == "Unreal Tournament 3" ]; then
+ fix_ut3.sh
fi
fi
diff --git a/lgsm/functions/fix_kf.sh b/lgsm/functions/fix_kf.sh
index db8c07ba2..ad96678ef 100644
--- a/lgsm/functions/fix_kf.sh
+++ b/lgsm/functions/fix_kf.sh
@@ -12,15 +12,15 @@ echo "Applying WebAdmin ROOst.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
-sleep 1
+sleep 0.5
echo "Applying WebAdmin CharSet fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/UWeb.int"
-sleep 1
+sleep 0.5
echo "applying server name fix."
-sleep 1
+sleep 0.5
echo "forcing server restart..."
-sleep 1
+sleep 0.5
command_start.sh
sleep 5
command_stop.sh
diff --git a/lgsm/functions/fix_kf2.sh b/lgsm/functions/fix_kf2.sh
index 2a402e7d3..ad132bf72 100644
--- a/lgsm/functions/fix_kf2.sh
+++ b/lgsm/functions/fix_kf2.sh
@@ -12,7 +12,7 @@ fn_parms(){
parms="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\""
}
-fn_print_information "starting Killing Floor 2 server to generate configs."
+fn_print_information "starting ${gamename} server to generate configs."
sleep 1
exitbypass=1
command_start.sh
diff --git a/lgsm/functions/fix_mta.sh b/lgsm/functions/fix_mta.sh
index 333705d42..f16064a96 100644
--- a/lgsm/functions/fix_mta.sh
+++ b/lgsm/functions/fix_mta.sh
@@ -11,7 +11,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ ! -f "${lgsmdir}/lib/libmysqlclient.so.16" ]; then
fixname="libmysqlclient16"
fn_fix_msg_start_nl
- sleep 1
+ sleep 0.5
fn_fetch_file "https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16" "${lgsmdir}/lib" "libmysqlclient.so.16" "chmodx" "norun" "noforce" "6c188e0f8fb5d7a29f4bc413b9fed6c2"
fn_fix_msg_end
fi
diff --git a/lgsm/functions/fix_ro.sh b/lgsm/functions/fix_ro.sh
index 66ebfdc52..0b4f41f15 100644
--- a/lgsm/functions/fix_ro.sh
+++ b/lgsm/functions/fix_ro.sh
@@ -12,18 +12,18 @@ echo "Applying WebAdmin ROOst.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
-sleep 1
+sleep 0.5
echo "Applying WebAdmin CharSet fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/uweb.int"
-sleep 1
+sleep 0.5
echo "Applying Steam AppID fix."
sed -i 's/1210/1200/g' "${systemdir}/steam_appid.txt"
-sleep 1
+sleep 0.5
echo "applying server name fix."
-sleep 1
+sleep 0.5
echo "forcing server restart..."
-sleep 1
+sleep 0.5
command_start.sh
sleep 5
command_stop.sh
diff --git a/lgsm/functions/fix_rw.sh b/lgsm/functions/fix_rw.sh
new file mode 100644
index 000000000..3ce85a699
--- /dev/null
+++ b/lgsm/functions/fix_rw.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# LinuxGSM fix_rw.sh function
+# Author: Daniel Gibbs
+# Website: https://linuxgsm.com
+# Description: Resolves startup issue with Rising World
+
+local commandname="FIX"
+local commandaction="Fix"
+
+export LD_LIBRARY_PATH="${serverfiles}/linux64:${serverfiles}:$LD_LIBRARY_PATH"
\ No newline at end of file
diff --git a/lgsm/functions/fix_ut.sh b/lgsm/functions/fix_ut.sh
index c797c7acb..aaaad40cb 100644
--- a/lgsm/functions/fix_ut.sh
+++ b/lgsm/functions/fix_ut.sh
@@ -11,4 +11,4 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
#Set Binary Executable
echo "chmod +x ${executabledir}/${executable}"
chmod +x "${executabledir}/${executable}"
-sleep 1
\ No newline at end of file
+sleep 0.5
\ No newline at end of file
diff --git a/lgsm/functions/fix_ut2k4.sh b/lgsm/functions/fix_ut2k4.sh
index a2ce302ec..b29b312c3 100644
--- a/lgsm/functions/fix_ut2k4.sh
+++ b/lgsm/functions/fix_ut2k4.sh
@@ -12,15 +12,15 @@ echo "applying WebAdmin ut2003.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ut2003.css"
sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ut2003.css"
-sleep 1
+sleep 0.5
echo "applying WebAdmin CharSet fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/UWeb.int"
-sleep 1
+sleep 0.5
echo "applying server name fix."
-sleep 1
+sleep 0.5
echo "forcing server restart."
-sleep 1
+sleep 0.5
exitbypass=1
command_start.sh
sleep 5
diff --git a/lgsm/functions/fix_ut3.sh b/lgsm/functions/fix_ut3.sh
new file mode 100644
index 000000000..217140432
--- /dev/null
+++ b/lgsm/functions/fix_ut3.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# LinuxGSM fix_ut2.sh function
+# Author: Daniel Gibbs
+# Website: https://linuxgsm.com
+# Description: Resolves various issues with configs in Unreal Tournament 3.
+
+local commandname="FIX"
+local commandaction="Fix"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+fn_parms(){
+parms="server VCTF-Suspense?Game=UTGameContent.UTVehicleCTFGame_Content?bIsDedicated=true?bIsLanMatch=false?bUsesStats=false?bShouldAdvertise=false?PureServer=1?bAllowJoinInProgress=true?ConfigSubDir=${servicename} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}"
+}
+
+fn_print_information "starting ${gamename} server to generate configs."
+sleep 1
+exitbypass=1
+command_start.sh
+sleep 10
+command_stop.sh
\ No newline at end of file
diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh
index 5dd54a586..68592afe2 100644
--- a/lgsm/functions/info_config.sh
+++ b/lgsm/functions/info_config.sh
@@ -20,13 +20,14 @@ fn_info_config_justcause2(){
serverpassword="${unavailable}"
maxplayers="${zero}"
port="${zero}"
+ queryport="${zero}"
else
servername=$(grep "Name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/Name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
serverdescription=$(grep "Description" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/Description//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^ *//g' -e '/^--/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
maxplayers=$(grep "MaxPlayers" "${servercfgfullpath}" | grep -v "\--" | tr -cd '[:digit:]')
port=$(grep "BindPort" "${servercfgfullpath}" | grep -v "\--" | tr -cd '[:digit:]')
-
+ queryport="${port}"
ip=$(grep "BindIP" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/BindIP//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
ipsetinconfig=1
ipinconfigvar="BindIP"
@@ -36,6 +37,7 @@ fn_info_config_justcause2(){
serverpassword=${serverpassword:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
port=${port:-"0"}
+ queryport=${queryport:-"0"}
fi
}
@@ -364,7 +366,7 @@ fn_info_config_quakeworld(){
rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set rcon_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
servername=$(grep "hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set hostname//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
maxplayers=$(grep "maxclients" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
- port=
+
# Not Set
rconpassword=${rconpassword:-"NOT SET"}
servername=${servername:-"NOT SET"}
@@ -417,6 +419,7 @@ fn_info_config_quakelive(){
serverpassword="${unavailable}"
maxplayers="${zero}"
port="${zero}"
+ queryport="${zero}"
rconport="${zero}"
statsport="${zero}"
else
@@ -425,6 +428,7 @@ fn_info_config_quakelive(){
serverpassword=$(grep "g_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set g_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
maxplayers=$(grep "sv_maxClients" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
port=$(grep "net_port" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+ queryport="${port}"
rconport=$(grep "zmq_rcon_port" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
statsport=$(grep "zmq_stats_port" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
@@ -438,6 +442,7 @@ fn_info_config_quakelive(){
serverpassword=${serverpassword:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
port=${port:-"0"}
+ queryport=${queryport:-"0"}
rconport=${rconport:-"0"}
statsport=${statsport:-"0"}
fi
@@ -463,6 +468,40 @@ fn_info_config_realvirtuality(){
fi
}
+fn_info_config_risingworld(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ rconpassword="${unavailable}"
+ rconport="${zero}"
+ maxplayers="${zero}"
+ port="${zero}"
+ gamemode="${unavailable}"
+ gameworld="${unavailable}"
+ else
+ servername=$(grep "server_name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ serverpassword=$(grep "server_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/rcon_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ rconport=$(grep "rcon_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+ maxplayers=$(grep "settings_max_players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+ port=$(grep "server_port" "${servercfgfullpath}" | grep -v "database_mysql_server_port" | grep -v "#" | tr -cd '[:digit:]')
+ gamemode=$(grep "gamemode" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+ gameworld=$(grep "server_world_name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_world_name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ javaram=$(grep "server_memory" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_memory//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ ip=$(grep "server_ip" "${servercfgfullpath}" | grep -v "database_mysql_server_ip" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/server_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ ipsetinconfig=1
+ ipinconfigvar="server-ip"
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ rconpassword=${rconpassword:-"NOT SET"}
+ rconport=${rconport:-"NOT SET"}
+ maxplayers=${maxplayers:-"NOT SET"}
+ port=${port:-"NOT SET"}
+ gamemode=${gamemode:-"NOT SET"}
+ gameworld=${gameworld:-"NOT SET"}
+ fi
+}
+
fn_info_config_seriousengine35(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@@ -704,7 +743,6 @@ fn_info_config_unreal3(){
servername="${unavailable}"
serverpassword="${unavailable}"
adminpassword="${unavailable}"
- port="${unavailable}"
webadminenabled="${unavailable}"
webadminport="${zero}"
webadminuser="${unavailable}"
@@ -712,7 +750,6 @@ fn_info_config_unreal3(){
else
servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
adminpassword=$(grep "AdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
- port=$(grep "Port" "${servercfgdir}/UTEngine.ini" | sed -e 's/^[ \t]*//g' | grep "^Port" | grep -v "#" | tr -cd '[:digit:]')
webadminenabled=$(grep "bEnabled" "${servercfgdir}/UTWeb.ini" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bEnabled//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
webadminport=$(grep "ListenPort" "${servercfgdir}/UTWeb.ini" | grep -v "#" | tr -cd '[:digit:]')
webadminuser="Admin"
@@ -736,13 +773,13 @@ fn_info_config_kf2(){
serverpassword="${unavailable}"
adminpassword="${unavailable}"
port="${unavailable}"
+ queryport="${unavailable}"
webadminenabled="${unavailable}"
webadminport="${zero}"
webadminuser="${unavailable}"
webadminpass="${unavailable}"
else
servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
- # Not in UT3
serverpassword=$(grep "GamePassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/GamePassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
adminpassword=$(grep "AdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
port=$(grep "Port" "${servercfgdir}/LinuxServer-KFEngine.ini" | sed -e 's/^[ \t]*//g' | grep "^Port" | grep -v "#" | tr -cd '[:digit:]')
@@ -858,8 +895,10 @@ fn_info_config_wolfensteinenemyterritory(){
serverpassword="${unavailable}"
maxplayers="${zero}"
port="${zero}"
+ queryport="${zero}"
else
port=$(grep "set net_port" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+ queryport="${port}"
rconpassword=$(grep "set zmq_rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set zmq_rcon_password //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//g' -e '/^\//d' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
servername=$(grep "set sv_hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
serverpassword=$(grep "set g_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set g_password //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
@@ -875,24 +914,56 @@ fn_info_config_wolfensteinenemyterritory(){
serverpassword=${serverpassword:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
port=${port:-"27960"}
+ queryport=${queryport:-"27960"}
fi
}
+fn_info_config_etlegacy(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ rconpassword="${unavailable}"
+ servername="${unavailable}"
+ serverpassword="${unavailable}"
+ maxplayers="${zero}"
+ port="${zero}"
+ queryport="${zero}"
+ else
+ port=$(grep "set net_port" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+ queryport="${port}"
+ rconpassword=$(grep "set rconpassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set rconpassword //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//g' -e '/^\//d' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ servername=$(grep "set sv_hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ serverpassword=$(grep "set g_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set g_password //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ maxplayers=$(grep "set sv_maxclients" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
+
+ ip=$(grep "set net_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set net_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ ipsetinconfig=1
+ ipinconfigvar="set net_ip"
+
+ # Not Set
+ rconpassword=${rconpassword:-"NOT SET"}
+ servername=${servername:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ maxplayers=${maxplayers:-"0"}
+ port=${port:-"27960"}
+ queryport=${queryport:-"27960"}
+ fi
+}
+
+
fn_info_config_squad(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
maxplayers="${unavailable}"
else
- servername="$(cat ${servercfgfullpath} | grep "ServerName=" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')"
- maxplayers="$(cat ${servercfgfullpath} | grep "MaxPlayers=" | tr -cd '[:digit:]')"
+ servername="$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')"
+ maxplayers="$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')"
fi
if [ ! -f "${servercfgdir}/Rcon.cfg" ]; then
rconport=${unavailable}
rconpassword=${unavailable}
else
- rconport=$(cat ${servercfgdir}/Rcon.cfg | grep "Port=" | tr -cd '[:digit:]')
- rconpassword=$(cat ${servercfgdir}/Rcon.cfg | grep "Password=" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+ rconport=$(grep "Port=" "${servercfgdir}/Rcon.cfg" | tr -cd '[:digit:]')
+ rconpassword=$(grep "Password=" "${servercfgdir}/Rcon.cfg" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
fi
rconport=${rconport:-"0"}
@@ -987,6 +1058,9 @@ elif [ "${engine}" == "projectzomboid" ]; then
# ARMA 3
elif [ "${engine}" == "realvirtuality" ]; then
fn_info_config_realvirtuality
+# Rising World
+elif [ "${shortname}" == "rw" ]; then
+ fn_info_config_risingworld
# Serious Sam
elif [ "${engine}" == "seriousengine35" ]; then
fn_info_config_seriousengine35
@@ -1025,6 +1099,8 @@ elif [ "${gamename}" == "7 Days To Die" ]; then
fn_info_config_sdtd
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
fn_info_config_wolfensteinenemyterritory
+elif [ "${gamename}" == "ET: Legacy" ]; then
+ fn_info_config_etlegacy
elif [ "${gamename}" == "Multi Theft Auto" ]; then
fn_info_config_mta
elif [ "${gamename}" == "Squad" ]; then
diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh
index 5a4907e08..1b04f50c8 100644
--- a/lgsm/functions/info_distro.sh
+++ b/lgsm/functions/info_distro.sh
@@ -135,6 +135,13 @@ if [ -d "${backupdir}" ]; then
fi
# External IP address
-if [ -z "${extip}" ];then
- extip=$(${curlpath} -m 3 ifconfig.co 2>/dev/null)
+if [ -z "${extip}" ]; then
+ extip=$(${curlpath} -m 3 ifconfig.co > "${tmpdir}/extip.txt" 2>/dev/null)
+ if [ $? -ne 0 ]; then
+ if [ -f "${tmpdir}/extip.txt" ]; then
+ echo "${tmpdir}/extip.txt"
+ else
+ echo "x.x.x.x"
+ fi
+ fi
fi
\ No newline at end of file
diff --git a/lgsm/functions/info_glibc.sh b/lgsm/functions/info_glibc.sh
index 49d537b60..308138a25 100644
--- a/lgsm/functions/info_glibc.sh
+++ b/lgsm/functions/info_glibc.sh
@@ -26,6 +26,7 @@ elif [ "${gamename}" == "Blade Symphony" ]; then
glibcfix="yes"
elif [ "${gamename}" == "BrainBread 2" ]; then
glibcrequired="2.17"
+ glibcfix="no"
elif [ "${gamename}" == "Call of Duty" ]; then
glibcrequired="2.1"
glibcfix="no"
@@ -57,7 +58,7 @@ elif [ "${gamename}" == "Empires Mod" ]; then
glibcrequired="2.15"
glibcfix="yes"
elif [ "${gamename}" == "Factorio" ]; then
- glibcrequired="2.15"
+ glibcrequired="2.18"
glibcfix="yes"
elif [ "${gamename}" == "Fistful of Frags" ]; then
glibcrequired="2.15"
@@ -95,6 +96,9 @@ elif [ "${gamename}" == "Quake 3: Arena" ]; then
elif [ "${gamename}" == "Quake Live" ]; then
glibcrequired="2.15"
glibcfix="no"
+elif [ "${shortname}" == "rw" ]; then
+ glibcrequired="2.14"
+ glibcfix="no"
elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
glibcrequired="2.3"
glibcfix="no"
@@ -182,6 +186,9 @@ elif [ "${engine}" == "refractor" ]; then
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
glibcrequired="2.2.4"
glibcfix="no"
+elif [ "${gamename}" == "ET: Legacy" ]; then
+ glibcrequired="2.7"
+ glibcfix="no"
elif [ "${gamename}" == "Multi Theft Auto" ]; then
glibcrequired="2.7"
glibcfix="no"
diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh
index 50bd810aa..0151ad00c 100644
--- a/lgsm/functions/info_messages.sh
+++ b/lgsm/functions/info_messages.sh
@@ -2,7 +2,7 @@
# LinuxGSM info_messages.sh function
# Author: Daniel Gibbs
# Website: https://linuxgsm.com
-# Description: Defines server info messages for details, alerts.
+# Description: Defines server info messages for details and alerts.
# Standard Details
# This applies to all engines
@@ -122,7 +122,9 @@ fn_info_message_gameserver(){
fn_messages_separator
{
# Server name
- if [ -n "${servername}" ]; then
+ if [ -n "${gdname}" ]; then
+ echo -e "${blue}Server name:\t${default}${gdname}"
+ elif [ -n "${servername}" ]; then
echo -e "${blue}Server name:\t${default}${servername}"
fi
@@ -181,9 +183,43 @@ fn_info_message_gameserver(){
echo -e "${blue}Stats password:\t${default}${statspassword}"
fi
- # Maxplayers
- if [ -n "${maxplayers}" ]; then
- echo -e "${blue}Maxplayers:\t${default}${maxplayers}"
+ # Players
+
+ if [ "${querystatus}" != "0" ]; then
+ if [ -n "${maxplayers}" ]; then
+ echo -e "${blue}Maxplayers:\t${default}${maxplayers}"
+ fi
+ else
+ if [ -n "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
+ echo -e "${blue}Players:\t${default}${gdplayers}/${gdmaxplayers}"
+
+ elif [ -n "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then
+ echo -e "${blue}Players:\t${default}${gdplayers}/${maxplayers}"
+
+ elif [ -z "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
+ echo -e "${blue}Players:\t${default}0/${gdmaxplayers}"
+
+ elif [ -n "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then
+ echo -e "${blue}Players:\t${default}${gdplayers}|∞"
+
+ elif [ -z "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]&&[ -n "${maxplayers}" ]; then
+ echo -e "${blue}Maxplayers:\t${default}${maxplayers}"
+ fi
+ fi
+
+ # Bots
+ if [ -n "${gdbots}" ]; then
+ echo -e "${blue}Bots:\t${default}${gdbots}"
+ fi
+
+ # Current Map
+ if [ -n "${gdmap}" ]; then
+ echo -e "${blue}Current Map:\t${default}${gdmap}"
+ fi
+
+ # Default Map
+ if [ -n "${defaultmap}" ]; then
+ echo -e "${blue}Default Map:\t${default}${defaultmap}"
fi
# Game mode
@@ -406,19 +442,19 @@ fn_info_message_ports(){
for port_edit in "${ports_edit_array[@]}"
do
if [ "${shortname}" == "ut3" ]; then
- parmslocation="${servercfgdir}/UTEngine.ini\n${servercfgdir}/UTWeb.ini"
+ parmslocation="${servercfgdir}/UTWeb.ini"
elif [ "${shortname}" == "kf2" ]; then
parmslocation="${servercfgdir}/LinuxServer-KFEngine.ini\n${servercfgdir}/KFWeb.ini"
elif [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
parmslocation="${servercfgfullpath}"
fi
done
- # engines/games that require editing in the script file
+ # engines/games that require editing the parms
local ports_edit_array=( "goldsource" "Factorio" "Hurtworld" "iw3.0" "Rust" "spark" "source" "starbound" "unreal4" "realvirtuality")
for port_edit in "${ports_edit_array[@]}"
do
if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
- parmslocation="${selfname}"
+ parmslocation="${configdirserver}"
fi
done
echo -e "${parmslocation}"
@@ -443,7 +479,7 @@ fn_info_logs(){
if [ -n "${lgsmlog}" ]; then
echo -e "\nScript log\n==================="
- if [ ! "$(ls -A ${lgsmlogdir})" ]; then
+ if [ ! "$(ls -A "${lgsmlogdir}")" ]; then
echo "${lgsmlogdir} (NO LOG FILES)"
elif [ ! -s "${lgsmlog}" ]; then
echo "${lgsmlog} (LOG FILE IS EMPTY)"
@@ -456,7 +492,7 @@ fn_info_logs(){
if [ -n "${consolelog}" ]; then
echo -e "\nConsole log\n===================="
- if [ ! "$(ls -A ${consolelogdir})" ]; then
+ if [ ! "$(ls -A "${consolelogdir}")" ]; then
echo "${consolelogdir} (NO LOG FILES)"
elif [ ! -s "${consolelog}" ]; then
echo "${consolelog} (LOG FILE IS EMPTY)"
@@ -469,12 +505,12 @@ fn_info_logs(){
if [ -n "${gamelogdir}" ]; then
echo -e "\nServer log\n==================="
- if [ ! "$(ls -A ${gamelogdir})" ]; then
+ if [ ! "$(ls -A "${gamelogdir}")" ]; then
echo "${gamelogdir} (NO LOG FILES)"
else
echo "${gamelogdir}"
# dos2unix sed 's/\r//'
- tail "${gamelogdir}"/* 2>/dev/null | grep -v "==>" | sed '/^$/d' | sed 's/\r//'| tail -25
+ tail "${gamelogdir}"/* 2>/dev/null | grep -v "==>" | sed '/^$/d' | sed 's/\r//' | tail -25
fi
echo ""
fi
@@ -739,6 +775,17 @@ fn_info_message_refractor(){
} | column -s $'\t' -t
}
+fn_info_message_risingworld(){
+ echo -e "netstat -atunp | grep java"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
+ echo -e "> http query\tINBOUND\t${httpqueryport}\ttcp"
+ echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
+ } | column -s $'\t' -t
+}
+
fn_info_message_rust(){
echo -e "netstat -atunp | grep Rust"
echo -e ""
@@ -948,7 +995,8 @@ fn_info_message_unreal3(){
echo -e ""
{
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
+ echo -e "> Game\tINBOUND\t${port}\tudp"
+ echo -e "> Query\tINBOUND\t${queryport}\tudp"
echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
} | column -s $'\t' -t
echo -e ""
@@ -967,8 +1015,8 @@ fn_info_message_kf2(){
echo -e ""
{
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game\tINBOUND\t${port}\ttcp"
- echo -e "> Query\tINBOUND\t${queryport}\ttcp/udp"
+ echo -e "> Game\tINBOUND\t${port}\ttcp\tPort=${port}"
+ echo -e "> Query\tINBOUND\t${queryport}\tudp"
echo -e "> Steam\tINBOUND\t20560\tudp"
echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
} | column -s $'\t' -t
@@ -992,6 +1040,15 @@ fn_info_message_wolfensteinenemyterritory(){
} | column -s $'\t' -t
}
+fn_info_message_etlegacy(){
+ echo -e "netstat -atunp | grep etlded"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game/Query\tINBOUND\t${port}\tudp"
+ } | column -s $'\t' -t
+}
+
fn_info_message_mta(){
echo -e "netstat -atunp | grep mta-server64"
echo -e ""
@@ -1025,6 +1082,8 @@ fn_info_message_select_engine(){
fn_info_message_cod4
elif [ "${gamename}" == "Call of Duty: World at War" ]; then
fn_info_message_codwaw
+ elif [ "${gamename}" == "ET: Legacy" ]; then
+ fn_info_message_etlegacy
elif [ "${gamename}" == "Factorio" ]; then
fn_info_message_factorio
elif [ "${gamename}" == "Hurtworld" ]; then
@@ -1061,6 +1120,8 @@ fn_info_message_select_engine(){
fn_info_message_mumble
elif [ "${gamename}" == "Rust" ]; then
fn_info_message_rust
+ elif [ "${shortname}" == "rw" ]; then
+ fn_info_message_risingworld
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
fn_info_message_wolfensteinenemyterritory
elif [ "${engine}" == "refractor" ]; then
diff --git a/lgsm/functions/info_parms.sh b/lgsm/functions/info_parms.sh
index 9fc856a80..2a0a4222e 100644
--- a/lgsm/functions/info_parms.sh
+++ b/lgsm/functions/info_parms.sh
@@ -24,6 +24,7 @@ fn_info_parms_ark(){
fn_info_parms_realvirtuality(){
port=${port:-"0"}
+ queryport=$((port + 1))
}
fn_info_parms_cod(){
@@ -68,6 +69,14 @@ fn_info_parms_quake2(){
defaultmap=${defaultmap:-"NOT SET"}
}
+fn_info_parms_risingworld(){
+ servername=${servername:-"NOT SET"}
+ port=${port:-"0"}
+ queryport=${port}
+ httpqueryport=$((port - 1))
+
+}
+
fn_info_parms_rust(){
servername=${servername:-"NOT SET"}
port=${port:-"0"}
@@ -145,6 +154,9 @@ elif [ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]; then
# Rust
elif [ "${gamename}" == "Rust" ]; then
fn_info_parms_rust
+# Rising World
+elif [ "${shortname}" == "rw" ]; then
+ fn_info_parms_risingworld
# Serious Sam
elif [ "${engine}" == "seriousengine35" ]; then
fn_info_config_seriousengine35
@@ -158,7 +170,7 @@ elif [ "${gamename}" == "Tower Unite" ]; then
# Unreal/Unreal 2 engine
elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
fn_info_parms_unreal
-# Unreal/Unreal 2 engine
+# Unreal 3 engine
elif [ "${engine}" == "unreal3" ]; then
fn_info_parms_unreal3
fi
diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh
index afa08c66f..53df4a316 100644
--- a/lgsm/functions/install_config.sh
+++ b/lgsm/functions/install_config.sh
@@ -23,7 +23,7 @@ fn_fetch_default_config(){
echo "Downloading ${gamename} Configs"
echo "================================="
echo "default configs from https://github.com/GameServerManagers/Game-Server-Configs"
- sleep 1
+ sleep 0.5
mkdir -p "${lgsmdir}/config-default/config-game"
githuburl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master"
for config in "${array_configs[@]}"; do
@@ -38,16 +38,19 @@ fn_default_config_remote(){
echo "copying ${config} config file."
fn_script_log_info "copying ${servercfg} config file."
if [ "${config}" == "${servercfgdefault}" ]; then
+ mkdir -p "${servercfgdir}"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}"
elif [ "${gamename}" == "ARMA 3" ]&&[ "${config}" == "${networkcfgdefault}" ]; then
+ mkdir -p "${servercfgdir}"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}"
elif [ "${gamename}" == "Don't Starve Together" ]&&[ "${config}" == "${clustercfgdefault}" ]; then
cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}"
else
+ mkdir -p "${servercfgdir}"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}"
fi
done
- sleep 1
+ sleep 0.5
}
# Changes some variables within the default configs
@@ -60,7 +63,7 @@ fn_set_config_vars(){
rconpass="admin$random"
echo "changing hostname."
fn_script_log_info "changing hostname."
- sleep 1
+ sleep 0.5
if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2>/dev/null; then
sed -i "s/SERVERNAME=SERVERNAME/SERVERNAME=${servername}/g" "${servercfgfullpath}"
else
@@ -69,11 +72,11 @@ fn_set_config_vars(){
echo "changing rcon/admin password."
fn_script_log_info "changing rcon/admin password."
sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}"
- sleep 1
+ sleep 0.5
else
fn_script_log_warn "Config file not found, cannot alter it."
echo "Config file not found, cannot alter it."
- sleep 1
+ sleep 0.5
fi
}
@@ -84,16 +87,16 @@ fn_set_dst_config_vars(){
echo "changing server name."
fn_script_log_info "changing server name."
sed -i "s/SERVERNAME/LinuxGSM/g" "${clustercfgfullpath}"
- sleep 1
+ sleep 0.5
echo "changing shard mode."
fn_script_log_info "changing shard mode."
sed -i "s/USESHARDING/${sharding}/g" "${clustercfgfullpath}"
- sleep 1
+ sleep 0.5
echo "randomizing cluster key."
fn_script_log_info "randomizing cluster key."
randomkey=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs)
sed -i "s/CLUSTERKEY/${randomkey}/g" "${clustercfgfullpath}"
- sleep 1
+ sleep 0.5
else
echo "${clustercfg} is already configured."
fn_script_log_info "${clustercfg} is already configured."
@@ -111,11 +114,11 @@ fn_set_dst_config_vars(){
echo "changing shard name."
fn_script_log_info "changing shard name."
sed -i "s/SHARDNAME/${shard}/g" "${servercfgfullpath}"
- sleep 1
+ sleep 0.5
echo "changing master setting."
fn_script_log_info "changing master setting."
sed -i "s/ISMASTER/${master}/g" "${servercfgfullpath}"
- sleep 1
+ sleep 0.5
## worldgenoverride.lua
if [ "${cave}" == "true" ]; then
@@ -123,7 +126,7 @@ fn_set_dst_config_vars(){
fn_script_log_info "defining ${shard} as cave in ${servercfgdir}/worldgenoverride.lua."
echo 'return { override_enabled = true, preset = "DST_CAVE", }' > "${servercfgdir}/worldgenoverride.lua"
fi
- sleep 1
+ sleep 0.5
echo ""
}
@@ -293,6 +296,12 @@ elif [ "${gamename}" == "Double Action: Boogaloo" ]; then
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
+elif [ "${gamename}" == "ET: Legacy" ]; then
+ gamedirname="ETLegacy"
+ array_configs+=( server.cfg )
+ fn_fetch_default_config
+ fn_default_config_remote
+ fn_set_config_vars
elif [ "${gamename}" == "Factorio" ]; then
gamedirname="Factorio"
array_configs+=( server-settings.json )
diff --git a/lgsm/functions/install_dst_token.sh b/lgsm/functions/install_dst_token.sh
index c319088d1..11a4c3679 100644
--- a/lgsm/functions/install_dst_token.sh
+++ b/lgsm/functions/install_dst_token.sh
@@ -11,7 +11,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
echo ""
echo "Enter ${gamename} Cluster Token"
echo "================================="
-sleep 1
+sleep 0.5
echo "A cluster token is required to run this server!"
echo "Follow the instructions in this link to obtain this key:"
echo "https://linuxgsm.com/dst-auth-token"
diff --git a/lgsm/functions/install_factorio_save.sh b/lgsm/functions/install_factorio_save.sh
index b63004e6d..3b243c9d4 100644
--- a/lgsm/functions/install_factorio_save.sh
+++ b/lgsm/functions/install_factorio_save.sh
@@ -10,6 +10,6 @@ local commandaction="Install"
echo ""
echo "Creating initial Factorio savefile"
echo "================================="
-sleep 1
+sleep 0.5
check_glibc.sh
-"${executabledir}"/factorio --create ${serverfiles}/save1
+"${executabledir}"/factorio --create "${serverfiles}/save1"
diff --git a/lgsm/functions/install_gslt.sh b/lgsm/functions/install_gslt.sh
index 9ff176521..ab1ea7dca 100644
--- a/lgsm/functions/install_gslt.sh
+++ b/lgsm/functions/install_gslt.sh
@@ -11,7 +11,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
echo ""
echo "Game Server Login Token"
echo "================================="
-sleep 1
+sleep 0.5
if [ "${gamename}" == "Counter-Strike: Global Offensive" ]||[ "${gamename}" == "Counter-Strike: Source" ]||[ "${gamename}" == "No More Room in Hell" ]; then
echo "GSLT is required to run a public ${gamename} server"
fn_script_log_info "GSLT is required to run a public ${gamename} server"
@@ -37,7 +37,7 @@ if [ -z "${autoinstall}" ]; then
fi
fi
fi
-sleep 1
+sleep 0.5
if [ "${gamename}" == "Tower Unite" ]; then
echo "The GSLT can be changed by editing ${servercfgdir}/${servercfg}."
fn_script_log_info "The GSLT can be changed by editing ${servercfgdir}/${servercfg}."
diff --git a/lgsm/functions/install_logs.sh b/lgsm/functions/install_logs.sh
index b951436e7..acd6a6917 100644
--- a/lgsm/functions/install_logs.sh
+++ b/lgsm/functions/install_logs.sh
@@ -13,7 +13,7 @@ if [ "${checklogs}" != "1" ]; then
echo "Creating log directories"
echo "================================="
fi
-sleep 1
+sleep 0.5
# Create LinuxGSM logs
echo -ne "installing log dir: ${logdir}..."
mkdir -p "${logdir}"
@@ -77,7 +77,7 @@ fi
# e.g serverfiles/log is not within log/: symlink created
# log/server is in log/: symlink not created
if [ -n "${gamelogdir}" ]; then
- if [ "${gamelogdir:0:${#logdir}}" != "${logdir}" ];then
+ if [ "${gamelogdir:0:${#logdir}}" != "${logdir}" ]; then
echo -ne "creating symlink to game log dir: ${logdir}/server -> ${gamelogdir}..."
ln -nfs "${gamelogdir}" "${logdir}/server"
if [ $? -ne 0 ]; then
@@ -102,5 +102,5 @@ if [ -d "${rootdir}/Steam/logs" ]; then
fi
fi
fi
-sleep 1
+sleep 0.5
fn_script_log_info "Logs installed"
diff --git a/lgsm/functions/install_minecraft_eula.sh b/lgsm/functions/install_minecraft_eula.sh
index 2bf6e1c92..01999967f 100644
--- a/lgsm/functions/install_minecraft_eula.sh
+++ b/lgsm/functions/install_minecraft_eula.sh
@@ -7,7 +7,7 @@
echo ""
echo "Accept ${gamename} EULA"
echo "================================="
-sleep 1
+sleep 0.5
echo "You are required to accept the EULA:"
echo "https://account.mojang.com/documents/minecraft_eula"
diff --git a/lgsm/functions/install_server_dir.sh b/lgsm/functions/install_server_dir.sh
index 579f10497..abb8f6fb0 100644
--- a/lgsm/functions/install_server_dir.sh
+++ b/lgsm/functions/install_server_dir.sh
@@ -11,7 +11,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
echo ""
echo "Server Directory"
echo "================================="
-sleep 1
+sleep 0.5
if [ -d "${serverfiles}" ]; then
fn_print_warning_nl "A server is already installed here."
fi
@@ -24,5 +24,4 @@ if [ -z "${autoinstall}" ]; then
fi
if [ ! -d "${serverfiles}" ]; then
mkdir -v "${serverfiles}"
-fi
-sleep 1
+fi
\ No newline at end of file
diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh
index bec59e31b..63e2f48d1 100644
--- a/lgsm/functions/install_server_files.sh
+++ b/lgsm/functions/install_server_files.sh
@@ -21,6 +21,8 @@ fn_install_server_files(){
remote_fileurl="http://files.linuxgsm.com/CallOfDuty4/cod4x18_dedrun.tar.bz2"; local_filedir="${tmpdir}"; local_filename="cod4x18_dedrun.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="bebdfc1755626462bdaad49f6f926c08"
elif [ "${gamename}" == "Call of Duty: World at War" ]; then
remote_fileurl="http://files.linuxgsm.com/CallOfDutyWorldAtWar/codwaw-lnxded-1.7-full.tar.bz2"; local_filedir="${tmpdir}"; local_filename="codwaw-lnxded-1.7-full.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="0489697ff3bf678c109bfb377d1b7895"
+ elif [ "${shortname}" == "etl" ]; then
+ remote_fileurl="http://files.linuxgsm.com/WolfensteinEnemyTerritory/etlegacy-v2.75-i386-et-260b.tar.bz2"; local_filedir="${tmpdir}"; local_filename="etlegacy-v2.75-i386-et-260b.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="92d7d4c26e0a295daed78cef623eeabb"
elif [ "${gamename}" == "GoldenEye: Source" ]; then
remote_fileurl="http://files.linuxgsm.com/GoldenEyeSource/GoldenEye_Source_v5.0.6_full_server.tar.bz2"; local_filedir="${tmpdir}"; local_filename="GoldenEye_Source_v5.0.6_full_server.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="c45c16293096706e8b5e2cd64a6f2931"
elif [ "${gamename}" == "Quake 2" ]; then
@@ -65,7 +67,7 @@ fn_install_server_files_steamcmd(){
if [ "${counter}" -ge "7" ]; then
echo "Removing $(find ${serverfiles} -type d -print0 | grep -Ez '[^/]{30}$')"
- find ${serverfiles} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf
+ find "${serverfiles}" -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf
fi
if [ "${counter}" -ge "9" ]; then
rm -rf "${steamcmddir}"
@@ -74,7 +76,7 @@ fn_install_server_files_steamcmd(){
# Detects if unbuffer command is available for 32 bit distributions only.
info_distro.sh
- if [ $(command -v stdbuf 2>/dev/null) ]&&[ "${arch}" != "x86_64" ]; then
+ if [ "$(command -v stdbuf 2>/dev/null)" ]&&[ "${arch}" != "x86_64" ]; then
unbuffer="stdbuf -i0 -o0 -e0"
fi
@@ -85,11 +87,6 @@ fn_install_server_files_steamcmd(){
else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit
local exitcode=$?
-
- if [ "${gamename}" == "Classic Offensive" ]; then
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid_co}" ${branch} +quit
- local exitcode=$?
- fi
fi
elif [ "${counter}" -ge "5" ]; then
if [ "${engine}" == "goldsource" ]; then
@@ -98,11 +95,6 @@ fn_install_server_files_steamcmd(){
else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit
local exitcode=$?
-
- if [ "${gamename}" == "Classic Offensive" ]; then
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid_co}" ${branch} -validate +quit
- local exitcode=$?
- fi
fi
fi
elif [ "${counter}" -ge "11" ]; then
@@ -128,7 +120,7 @@ fn_install_server_files_steamcmd(){
echo ""
echo "Installing ${gamename} Server"
echo "================================="
-sleep 1
+sleep 0.5
if [ -n "${appid}" ]; then
fn_install_server_files_steamcmd
diff --git a/lgsm/functions/install_squad_license.sh b/lgsm/functions/install_squad_license.sh
index a5ca6345a..3b0711309 100644
--- a/lgsm/functions/install_squad_license.sh
+++ b/lgsm/functions/install_squad_license.sh
@@ -11,7 +11,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
echo ""
echo "Squad Server License"
echo "================================="
-sleep 1
+sleep 0.5
echo "Server license is an optional feature for ${gamename} server"
fn_script_log_info "Server license is an optional feature for ${gamename} server"
@@ -20,7 +20,7 @@ echo "http://forums.joinsquad.com/topic/16519-server-licensing-general-info/"
fn_script_log_info "Get more info and a server license here:"
fn_script_log_info "http://forums.joinsquad.com/topic/16519-server-licensing-general-info/"
echo ""
-sleep 1
+sleep 0.5
echo "The Squad server license can be changed by editing ${servercfgdir}/License.cfg."
fn_script_log_info "The Squad server license can be changed by editing ${selfname}."
echo ""
\ No newline at end of file
diff --git a/lgsm/functions/install_steamcmd.sh b/lgsm/functions/install_steamcmd.sh
index 7d3374ebd..10d095423 100644
--- a/lgsm/functions/install_steamcmd.sh
+++ b/lgsm/functions/install_steamcmd.sh
@@ -10,5 +10,5 @@ local commandaction="Install"
echo ""
echo "Installing SteamCMD"
echo "================================="
-sleep 1
+sleep 0.5
check_steamcmd.sh
diff --git a/lgsm/functions/install_ts3db.sh b/lgsm/functions/install_ts3db.sh
index 7cfc3205f..701b8c5ad 100644
--- a/lgsm/functions/install_ts3db.sh
+++ b/lgsm/functions/install_ts3db.sh
@@ -13,7 +13,7 @@ fn_install_ts3db_mariadb(){
echo ""
echo "checking if libmariadb2 is installed"
echo "================================="
- sleep 1
+ sleep 0.5
ldd "${serverfiles}/libts3db_mariadb.so" | grep "libmariadb.so.2 => not found"
if [ $? -eq 0 ]; then
echo "libmariadb2 not installed. Please install it first."
@@ -25,7 +25,7 @@ fn_install_ts3db_mariadb(){
echo ""
echo "Configuring ${gamename} Server for MariaDB/MySQL"
echo "================================="
- sleep 1
+ sleep 0.5
read -rp "Enter MariaDB hostname: " mariahostname
read -rp "Enter MariaDB port: " mariaport
read -rp "Enter MariaDB username: " mariausername
@@ -45,7 +45,7 @@ fn_install_ts3db_mariadb(){
sed -i "s/dbpluginparameter=/dbpluginparameter=ts3db_mariadb.ini/g" "${servercfgfullpath}"
sed -i "s/dbsqlcreatepath=create_sqlite\//dbsqlcreatepath=create_mariadb\//g" "${servercfgfullpath}"
echo "================================="
- sleep 1
+ sleep 0.5
}
if [ -z "${autoinstall}" ]; then
@@ -61,16 +61,16 @@ fi
fn_script_log "Accepting ts3server license: ${executabledir}/LICENSE"
fn_print_information_nl "Accepting TeamSpeak license:"
echo " * ${executabledir}/LICENSE"
-sleep 1
+sleep 0.5
touch "${executabledir}/.ts3server_license_accepted"
## Get privilege key
echo ""
echo "Getting privilege key"
echo "================================="
-sleep 1
+sleep 0.5
echo "IMPORANT! Save these details for later."
-sleep 1
+sleep 0.5
cd "${executabledir}" || exit
./ts3server_startscript.sh start inifile=ts3-server.ini
sleep 5
diff --git a/lgsm/functions/install_unreal_tournament_eula.sh b/lgsm/functions/install_unreal_tournament_eula.sh
index 8df4ad1e7..56fb8fbe4 100644
--- a/lgsm/functions/install_unreal_tournament_eula.sh
+++ b/lgsm/functions/install_unreal_tournament_eula.sh
@@ -7,7 +7,7 @@
echo ""
echo "Accept ${gamename} EULA"
echo "================================="
-sleep 1
+sleep 0.5
echo "You are required to accept the EULA:"
echo "https://www.epicgames.com/unrealtournament/unreal-tournament-pre-alpha-test-development-build-eula/"
diff --git a/lgsm/functions/install_ut2k4_key.sh b/lgsm/functions/install_ut2k4_key.sh
index b9bdf1306..f1e840462 100644
--- a/lgsm/functions/install_ut2k4_key.sh
+++ b/lgsm/functions/install_ut2k4_key.sh
@@ -11,7 +11,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
echo ""
echo "Enter ${gamename} CD Key"
echo "================================="
-sleep 1
+sleep 0.5
echo "To get your server listed on the Master Server list"
echo "you must get a free CD key. Get a key here:"
echo "https://forums.unrealtournament.com/utserver/cdkey.php?2004"
@@ -19,7 +19,7 @@ echo ""
if [ -z "${autoinstall}" ]; then
echo "Once you have the key enter it below"
echo -n "KEY: "
- read CODE
+ read -r CODE
echo ""\""CDKey"\""="\""${CODE}"\""" > "${systemdir}/cdkey"
if [ -f "${systemdir}/cdkey" ]; then
fn_script_log_info "UT2K4 Server CD Key created"
diff --git a/lgsm/functions/logs.sh b/lgsm/functions/logs.sh
index 7abe2ea2b..4f8aaf015 100644
--- a/lgsm/functions/logs.sh
+++ b/lgsm/functions/logs.sh
@@ -22,13 +22,13 @@ if [ "${status}" != "0" ] && [ "${function_selfname}" == "command_start.sh" ] &&
fn_print_info "Moving game logs to ${gamelogdir}"
fn_script_log_info "Moving game logs to ${gamelogdir}"
echo -en "\n"
- sleep 1
+ sleep 0.5
mv "${systemdir}"/gamelog*.log "${gamelogdir}"
fi
fi
# Log manager will start the cleanup if it finds logs older than "${logdays}"
-if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
+if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l) -ne "0" ]; then
fn_print_dots "Starting"
# Set common logs directories
commonlogs="${systemdir}/logs"
@@ -40,58 +40,58 @@ if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
legacyserverlogdir="${logdir}/server"
# Setting up counting variables
scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0"
- sleep 1
+ sleep 0.5
fn_print_ok_nl "Starting"
fn_print_info_nl "Removing logs older than ${logdays} days"
fn_script_log_info "Removing logs older than ${logdays} days"
# Logging logfiles to be removed according to "${logdays}", counting and removing them
# Script logfiles
- find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
- scriptcount=$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+ find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
+ scriptcount=$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${lgsmlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
# SRCDS and unreal logfiles
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
- find "${gamelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
- gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+ find "${gamelogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
+ gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Console logfiles
if [ -n "${consolelog}" ]; then
- find "${consolelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
- consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+ find "${consolelogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
+ consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Common logfiles
if [ -d "${commonlogs}" ]; then
- find "${commonlogs}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
- smcount=$(find "${commonlogs}"/ -type f -mtime +"${logdays}"|wc -l)
+ find "${commonlogs}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
+ smcount=$(find "${commonlogs}"/ -type f -mtime +"${logdays}" | wc -l)
find "${commonlogs}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
if [ -d "${commonsourcelogs}" ]; then
- find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
- smcount=$(find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"|wc -l)
+ find "${commonsourcelogs}"/* -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
+ smcount=$(find "${commonsourcelogs}"/* -type f -mtime +"${logdays}" | wc -l)
find "${commonsourcelogs}"/* -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Source addons logfiles
if [ "${engine}" == "source" ]; then
# SourceMod logfiles
if [ -d "${sourcemodlogdir}" ]; then
- find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
- smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+ find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
+ smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Garry's Mod logfiles
if [ "${gamename}" == "Garry's Mod" ]; then
# ULX logfiles
if [ -d "${ulxlogdir}" ]; then
- find "${ulxlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
- ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+ find "${ulxlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
+ ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${ulxlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# DarkRP logfiles
if [ -d "${darkrplogdir}" ]; then
- find "${darkrplogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
- darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+ find "${darkrplogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
+ darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${darkrplogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
fi
diff --git a/lgsm/functions/monitor_gsquery.sh b/lgsm/functions/monitor_gsquery.sh
deleted file mode 100644
index 7ffca8c7c..000000000
--- a/lgsm/functions/monitor_gsquery.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/bash
-# LinuxGSM monitor_gsquery.sh function
-# Author: Daniel Gibbs
-# Website: https://linuxgsm.com
-# Description: Uses gsquery.py to query the server port.
-# Detects if the server has frozen with the process still running.
-
-local commandname="MONITOR"
-local commandaction="Monitor"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-
-# Downloads gsquery.py if missing
-if [ ! -f "${functionsdir}/gsquery.py" ]; then
- fn_fetch_file_github "lgsm/functions" "gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
-fi
-
-info_config.sh
-
-if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
- port=$((port + 1))
-elif [ "${engine}" == "realvirtuality" ]; then
- port=$((port + 1))
-elif [ "${engine}" == "spark" ]; then
- port=$((port + 1))
-elif [ "${engine}" == "idtech3_ql" ]; then
- engine="quakelive"
-fi
-
-if [ -n "${queryport}" ]; then
- port="${queryport}"
-fi
-
-fn_print_info "Querying port: gsquery.py enabled"
-fn_script_log_info "Querying port: gsquery.py enabled"
-sleep 1
-
-# Will query up to 4 times every 15 seconds.
-# Servers changing map can return a failure.
-# Will Wait up to 60 seconds to confirm server is down giving server time to change map.
-totalseconds=0
-for queryattempt in {1..5}; do
- fn_print_dots "Querying port: ${ip}:${port} : ${totalseconds}/${queryattempt} : "
- fn_print_querying_eol
- fn_script_log_info "Querying port: ${ip}:${port} : ${queryattempt} : QUERYING"
-
- gsquerycmd=$("${functionsdir}"/gsquery.py -a "${ip}" -p "${port}" -e "${engine}" 2>&1)
- exitcode=$?
-
- sleep 1
- if [ "${exitcode}" == "0" ]; then
- # Server OK
- fn_print_ok "Querying port: ${ip}:${port} : ${queryattempt} : "
- fn_print_ok_eol_nl
- fn_script_log_pass "Querying port: ${ip}:${port} : ${queryattempt} : OK"
- exitcode=0
- break
- else
- # Server failed query
- fn_script_log_info "Querying port: ${ip}:${port} : ${queryattempt} : ${gsquerycmd}"
-
- if [ "${queryattempt}" == "5" ]; then
- # Server failed query 4 times confirmed failure
- fn_print_fail "Querying port: ${ip}:${port} : ${totalseconds}/${queryattempt} : "
- fn_print_fail_eol_nl
- fn_script_log_error "Querying port: ${ip}:${port} : ${queryattempt} : FAIL"
- sleep 1
-
- # Send alert if enabled
- alert="restartquery"
- alert.sh
- command_restart.sh
- break
- fi
-
- # Seconds counter
- for seconds in {1..15}; do
- fn_print_fail "Querying port: ${ip}:${port} : ${totalseconds}/${queryattempt} : ${red}${gsquerycmd}${default}"
- totalseconds=$((totalseconds + 1))
- sleep 1
- if [ "${seconds}" == "15" ]; then
- break
- fi
- done
- fi
-done
-core_exit.sh
\ No newline at end of file
diff --git a/lgsm/functions/query_gamedig.sh b/lgsm/functions/query_gamedig.sh
new file mode 100644
index 000000000..4249f8a76
--- /dev/null
+++ b/lgsm/functions/query_gamedig.sh
@@ -0,0 +1,96 @@
+#!/bin/bash
+# query_gamedig.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+# Description: Querys a gameserver using node-gamedig.
+# https://github.com/sonicsnes/node-gamedig
+
+#Check if gamedig and jq are installed
+if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then
+
+ if [ "${engine}" == "idtech3_ql" ]; then
+ local engine="quakelive"
+ elif [ "${gamename}" == "Killing Floor 2" ]; then
+ local engine="unreal4"
+ fi
+
+ local engine_query_array=( avalanche3.0 madness quakelive realvirtuality refractor source goldsource spark starbound unity3d unreal4 )
+ for engine_query in "${engine_query_array[@]}"
+ do
+ if [ "${engine_query}" == "${engine}" ]; then
+ gamedigengine="protocol-valve"
+ fi
+ done
+
+ local engine_query_array=( avalanche2.0 )
+ for engine_query in "${engine_query_array[@]}"
+ do
+ if [ "${engine_query}" == "${engine}" ]; then
+ gamedigengine="jc2mp"
+ fi
+ done
+
+ local engine_query_array=( idtech2 iw2.0 )
+ for engine_query in "${engine_query_array[@]}"
+ do
+ if [ "${engine_query}" == "${engine}" ]; then
+ gamedigengine="protocol-quake2"
+ fi
+ done
+
+ local engine_query_array=( idtech3 quake iw3.0 )
+ for engine_query in "${engine_query_array[@]}"
+ do
+ if [ "${engine_query}" == "${engine}" ]; then
+ gamedigengine="protocol-quake3"
+ fi
+ done
+
+ local shortname_query_array=( ts3 )
+ for shortname_query in "${shortname_query_array[@]}"
+ do
+ if [ "${shortname_query}" == "${shortname}" ]; then
+ gamedigengine="teamspeak3"
+ fi
+ done
+
+
+ # will bypass query if server offline
+ check_status.sh
+ if [ "${status}" != "0" ]; then
+ # checks if query is working 0 = pass
+ querystatus=$(gamedig --type "${gamedigengine}" --host "${ip}" --port "${queryport}" | jq '.error|length')
+ # raw output
+ gamedigraw=$(gamedig --type "${gamedigengine}" --host "${ip}" --port "${queryport}")
+
+ # server name
+ gdname=$(echo "${gamedigraw}" | jq -re '.name')
+ if [ "${gdname}" == "null" ]; then
+ gdname=
+ fi
+
+ # numplayers
+ gdplayers=$(echo "${gamedigraw}" | jq -re '.players|length')
+ if [ "${gdplayers}" == "null" ]; then
+ gdplayers=
+ fi
+
+ # maxplayers
+ gdmaxplayers=$(echo "${gamedigraw}" | jq -re '.maxplayers|length')
+ if [ "${gdmaxplayers}" == "null" ]; then
+ maxplayers=
+ fi
+
+ # current map
+ gdmap=$(echo "${gamedigraw}" | jq -re '.map')
+ if [ "${gdmap}" == "null" ]; then
+ gdmap=
+ fi
+
+ # numbots
+ gdbots=$(echo "${gamedigraw}" | jq -re '.raw.numbots')
+ if [ "${gdbots}" == "null" ]; then
+ gdbots=
+ fi
+ fi
+fi
\ No newline at end of file
diff --git a/lgsm/functions/gsquery.py b/lgsm/functions/query_gsquery.py
similarity index 98%
rename from lgsm/functions/gsquery.py
rename to lgsm/functions/query_gsquery.py
index 18123bfe8..d672870b9 100644
--- a/lgsm/functions/gsquery.py
+++ b/lgsm/functions/query_gsquery.py
@@ -1,6 +1,6 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
-# PythonGSQ
+# query_gsquery.py
# Author: Anonymous & Daniel Gibbs
# Website: https://linuxgsm.com
# Description: Allows querying of various game servers.
@@ -9,7 +9,7 @@ import optparse
import socket
import sys
-class PythonGSQ:
+class gsquery:
def __init__(self, options, arguments):
self.option = options
self.argument = arguments
@@ -118,5 +118,5 @@ if __name__ == '__main__':
)
options, arguments = parser.parse_args()
#
- server = PythonGSQ(options, arguments)
+ server = gsquery(options, arguments)
server.responding()
diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh
index f6cccac77..ca70396e8 100644
--- a/lgsm/functions/update_factorio.sh
+++ b/lgsm/functions/update_factorio.sh
@@ -28,18 +28,18 @@ fn_update_factorio_currentbuild(){
# Checks if current build info is available. If it fails, then a server restart will be forced to generate logs.
if [ ! -f "${serverfiles}/factorio-current.log" ]; then
fn_print_error "Checking for update: factorio.com"
- sleep 1
+ sleep 0.5
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"
- sleep 1
+ 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"
- sleep 1
+ sleep 0.5
exitbypass=1
command_stop.sh
exitbypass=1
command_start.sh
- sleep 1
+ sleep 0.5
# Check again and exit on failure.
if [ ! -f "${serverfiles}/factorio-current.log" ]; then
fn_print_fail_nl "Checking for update: factorio.com: Still No logs with server version found"
@@ -49,18 +49,18 @@ fn_update_factorio_currentbuild(){
fi
# Get current build from logs
- currentbuild=$(grep "Loading mod base" "${serverfiles}/factorio-current.log" 2> /dev/null|awk '{print $5}'|tail -1)
+ currentbuild=$(grep "Loading mod base" "${serverfiles}/factorio-current.log" 2> /dev/null | awk '{print $5}' | tail -1)
if [ -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"
- sleep 1
+ 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"
exitbypass=1
command_stop.sh
exitbypass=1
command_start.sh
- currentbuild=$(grep "Loading mod base" "${serverfiles}/factorio-current.log" 2> /dev/null|awk '{print $5}'|tail -1)
+ currentbuild=$(grep "Loading mod base" "${serverfiles}/factorio-current.log" 2> /dev/null | awk '{print $5}' | tail -1)
if [ -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"
@@ -81,12 +81,12 @@ fn_update_factorio_availablebuild(){
else
availablebuild=$(${curlpath} -s https://www.factorio.com/download-headless | grep 'headless/linux64' | head -n 2 | tail -n 1 | grep -oP '(?<=get-download/).*?(?=/)')
fi
- sleep 1
+ sleep 0.5
# Checks if availablebuild variable has been set
if [ -z "${availablebuild}" ]; then
fn_print_fail "Checking for update: factorio.com"
- sleep 1
+ 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
@@ -95,23 +95,23 @@ fn_update_factorio_availablebuild(){
else
fn_print_ok "Checking for update: factorio.com"
fn_script_log_pass "Checking for update: factorio.com"
- sleep 1
+ sleep 0.5
fi
}
fn_update_factorio_compare(){
# Removes dots so if can compare version numbers
- currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]')
- availablebuilddigit=$(echo "${availablebuild}"|tr -cd '[:digit:]')
+ currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]')
+ availablebuilddigit=$(echo "${availablebuild}" | tr -cd '[:digit:]')
if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then
echo -e "\n"
echo -e "Update available:"
- sleep 1
+ sleep 0.5
echo -e " Current build: ${red}${currentbuild} ${factorioarch} ${branch} ${default}"
echo -e " Available build: ${green}${availablebuild} ${factorioarch} ${branch}${default}"
echo -e ""
- sleep 1
+ sleep 0.5
echo ""
echo -en "Applying update.\r"
sleep 1
@@ -163,7 +163,7 @@ 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"
- sleep 1
+ sleep 0.5
fn_update_factorio_currentbuild
fn_update_factorio_availablebuild
fn_update_factorio_compare
diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh
index bbb5163e8..88ee6cebc 100644
--- a/lgsm/functions/update_minecraft.sh
+++ b/lgsm/functions/update_minecraft.sh
@@ -26,18 +26,18 @@ fn_update_currentbuild(){
# 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"
- sleep 1
+ 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"
- sleep 1
+ 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"
- sleep 1
+ sleep 0.5
exitbypass=1
command_stop.sh
exitbypass=1
command_start.sh
- sleep 1
+ 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"
@@ -51,7 +51,7 @@ fn_update_currentbuild(){
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 1
+ 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
@@ -88,17 +88,17 @@ fn_update_availablebuild(){
fn_update_compare(){
# Removes dots so if can compare version numbers
- currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]')
- availablebuilddigit=$(echo "${availablebuild}"|tr -cd '[:digit:]')
+ currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]')
+ availablebuilddigit=$(echo "${availablebuild}" | tr -cd '[:digit:]')
if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then
echo -e "\n"
echo -e "Update available:"
- sleep 1
+ sleep 0.5
echo -e " Current build: ${red}${currentbuild}${default}"
echo -e " Available build: ${green}${availablebuild}${default}"
echo -e ""
- sleep 1
+ sleep 0.5
echo ""
echo -en "Applying update.\r"
sleep 1
@@ -149,7 +149,7 @@ 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"
- sleep 1
+ sleep 0.5
fn_update_currentbuild
fn_update_availablebuild
fn_update_compare
diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh
index 8ae9f8b53..1a4bb4419 100644
--- a/lgsm/functions/update_mta.sh
+++ b/lgsm/functions/update_mta.sh
@@ -28,18 +28,18 @@ fn_update_mta_currentbuild(){
# 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"
- sleep 1
+ 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"
- sleep 1
+ 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"
- sleep 1
+ sleep 0.5
exitbypass=1
command_stop.sh
exitbypass=1
command_start.sh
- sleep 1
+ 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"
@@ -49,18 +49,18 @@ fn_update_mta_currentbuild(){
fi
# Get current build from logs
- currentbuild=$(cat "${gamelogdir}"/server.log | grep "= Multi Theft Auto: San Andreas v" | awk '{ print $7 }'| sed -r 's/^.{1}//' | tail -1)
+ 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 1
+ 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=$(cat "${gamelogdir}"/server.log | grep "= Multi Theft Auto: San Andreas v" | awk '{ print $7 }'| sed -r 's/^.{1}//' | tail -1)
+ 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"
@@ -71,9 +71,9 @@ fn_update_mta_currentbuild(){
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="$(cat ${tmpdir}/version.h | grep "#define MTASA_VERSION_MAJOR" | awk '{ print $3 }' | sed 's/\r//g')"
- local minorversion="$(cat ${tmpdir}/version.h | grep "#define MTASA_VERSION_MINOR" | awk '{ print $3 }' | sed 's/\r//g')"
- local maintenanceversion="$(cat ${tmpdir}/version.h | grep "#define MTASA_VERSION_MAINTENANCE" | awk '{ print $3 }' | sed 's/\r//g')"
+ 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"
@@ -81,7 +81,7 @@ fn_mta_get_availablebuild(){
fn_update_mta_compare(){
# Removes dots so if can compare version numbers
- currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]')
+ currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]')
if [ "${currentbuilddigit}" -ne "${numversion}" ]||[ "${forceupdate}" == "1" ]; then
if [ "${forceupdate}" == "1" ]; then
# forceupdate bypasses checks, useful for small build changes
@@ -91,11 +91,11 @@ fn_update_mta_compare(){
fi
echo -e "\n"
echo -e "Update ${mta_update_string}:"
- sleep 1
+ sleep 0.5
echo -e " Current build: ${red}${currentbuild} ${default}"
echo -e " Available build: ${green}${fullversion} ${default}"
echo -e ""
- sleep 1
+ sleep 0.5
echo ""
echo -en "Applying update.\r"
sleep 1
@@ -147,7 +147,7 @@ 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"
- sleep 1
+ sleep 0.5
fn_update_mta_currentbuild
fn_mta_get_availablebuild
fn_update_mta_compare
diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh
index f104451b3..3ad1c1a47 100644
--- a/lgsm/functions/update_mumble.sh
+++ b/lgsm/functions/update_mumble.sh
@@ -28,18 +28,18 @@ fn_update_mumble_currentbuild(){
# 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 1
+ 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 1
+ 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 1
+ sleep 0.5
exitbypass=1
command_stop.sh
exitbypass=1
command_start.sh
- sleep 1
+ 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"
@@ -53,7 +53,7 @@ fn_update_mumble_currentbuild(){
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"
- sleep 1
+ 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
@@ -77,12 +77,12 @@ fn_update_mumble_arch(){
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 1
+ sleep 0.5
# Checks if availablebuild variable has been set
if [ -z "${availablebuild}" ]; then
fn_print_fail "Checking for update: GitHub"
- sleep 1
+ 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
@@ -91,23 +91,23 @@ fn_update_mumble_availablebuild(){
else
fn_print_ok "Checking for update: GitHub"
fn_script_log_pass "Checking for update: GitHub"
- sleep 1
+ sleep 0.5
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:]')
+ currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]')
+ availablebuilddigit=$(echo "${availablebuild}" | tr -cd '[:digit:]')
if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then
echo -e "\n"
echo -e "Update available:"
- sleep 1
+ sleep 0.5
echo -e " Current build: ${red}${currentbuild} ${mumblearch}${default}"
echo -e " Available build: ${green}${availablebuild} ${mumblearch}${default}"
echo -e ""
- sleep 1
+ sleep 0.5
echo ""
echo -en "Applying update.\r"
sleep 1
@@ -159,7 +159,7 @@ 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"
- sleep 1
+ sleep 0.5
fn_update_mumble_currentbuild
fn_update_mumble_availablebuild
fn_update_mumble_compare
diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh
index 1b0663df0..3a068be18 100644
--- a/lgsm/functions/update_steamcmd.sh
+++ b/lgsm/functions/update_steamcmd.sh
@@ -13,7 +13,7 @@ check.sh
fn_update_steamcmd_dl(){
info_config.sh
fn_print_dots "SteamCMD"
- sleep 1
+ sleep 0.5
fn_print_ok_nl "SteamCMD"
fn_script_log_info "Starting SteamCMD"
@@ -21,13 +21,13 @@ fn_update_steamcmd_dl(){
# Detects if unbuffer command is available for 32 bit distributions only.
info_distro.sh
- if [ $(command -v stdbuf) ]&&[ "${arch}" != "x86_64" ]; then
+ if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then
unbuffer="stdbuf -i0 -o0 -e0"
fi
- cd "${steamcmddir}"
+ cd "${steamcmddir}" || exit
if [ "${engine}" == "goldsource" ]; then
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +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
@@ -40,7 +40,7 @@ fn_update_steamcmd_dl(){
fn_appmanifest_info(){
appmanifestfile=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf")
- appmanifestfilewc=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf"|wc -l)
+ appmanifestfilewc=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf" | wc -l)
}
fn_appmanifest_check(){
@@ -48,22 +48,22 @@ fn_appmanifest_check(){
# Multiple or no matching appmanifest files may sometimes be present.
# This error is corrected if required.
if [ "${appmanifestfilewc}" -ge "2" ]; then
- sleep 1
+ sleep 0.5
fn_print_error "Multiple appmanifest_${appid}.acf files found"
fn_script_log_error "Multiple appmanifest_${appid}.acf files found"
sleep 2
fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files"
- sleep 1
+ sleep 0.5
for appfile in ${appmanifestfile}; do
rm "${appfile}"
done
- sleep 1
+ sleep 0.5
appmanifestfilewc1="${appmanifestfilewc}"
fn_appmanifest_info
if [ "${appmanifestfilewc}" -ge "2" ]; then
fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
fn_script_log_fatal "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
- sleep 1
+ sleep 0.5
echo " * Check user permissions"
for appfile in ${appmanifestfile}; do
echo " ${appfile}"
@@ -72,25 +72,25 @@ fn_appmanifest_check(){
else
fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
fn_script_log_pass "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
- sleep 1
+ sleep 0.5
fn_print_info_nl "Forcing update to correct issue"
fn_script_log_info "Forcing update to correct issue"
- sleep 1
+ sleep 0.5
fn_update_steamcmd_dl
fn_update_request_log
fi
elif [ "${appmanifestfilewc}" -eq "0" ]; then
- fn_print_error "No appmanifest_${appid}.acf found"
+ fn_print_error_nl "No appmanifest_${appid}.acf found"
fn_script_log_error "No appmanifest_${appid}.acf found"
- sleep 1
+ sleep 0.5
fn_print_info_nl "Forcing update to correct issue"
fn_script_log_info "Forcing update to correct issue"
- sleep 1
+ sleep 0.5
fn_update_steamcmd_dl
fn_update_request_log
fn_appmanifest_info
if [ "${appmanifestfilewc}" -eq "0" ]; then
- fn_print_fatal "Still no appmanifest_${appid}.acf found"
+ fn_print_fail_nl "Still no appmanifest_${appid}.acf found"
fn_script_log_fatal "Still no appmanifest_${appid}.acf found"
core_exit.sh
fi
@@ -101,7 +101,7 @@ 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 1
+ sleep 0.5
if [ -f "${consolelog}" ]; then
requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}")
else
@@ -110,7 +110,7 @@ fn_update_request_log(){
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 1
+ sleep 0.5
echo ""
echo -en "Applying update.\r"
sleep 1
@@ -135,7 +135,7 @@ fn_update_request_log(){
alert.sh
else
fn_print_ok "Checking for update: Server logs: No update requested"
- sleep 1
+ sleep 0.5
fi
}
@@ -145,7 +145,7 @@ fn_update_steamcmd_check(){
# Checks for server update from SteamCMD
fn_print_dots "Checking for update: SteamCMD"
fn_script_log_info "Checking for update: SteamCMD"
- sleep 1
+ sleep 0.5
# Gets currentbuild
currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
@@ -157,7 +157,7 @@ fn_update_steamcmd_check(){
fi
# Set branch for updateinfo
- IFS=' ' read -ra branchsplits <<< "${branch}"
+ IFS=' ' read -ra branchsplits <<< ${branch}
if [ "${#branchsplits[@]}" -gt 1 ]; then
branchname="${branchsplits[1]}"
else
@@ -169,14 +169,14 @@ fn_update_steamcmd_check(){
availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | sed -n '/branch/,$p' | grep -m 1 buildid | tr -cd '[:digit:]')
if [ -z "${availablebuild}" ]; then
fn_print_fail "Checking for update: SteamCMD"
- sleep 1
+ 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 1
+ sleep 0.5
fi
if [ "${currentbuild}" != "${availablebuild}" ]; then
@@ -184,11 +184,11 @@ fn_update_steamcmd_check(){
fn_script_log_pass "Checking for update: SteamCMD: Update available"
echo -e "\n"
echo -e "Update available:"
- sleep 1
+ 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 1
+ sleep 0.5
echo ""
echo -en "Applying update.\r"
sleep 1
diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh
index c30b15bd1..596979348 100644
--- a/lgsm/functions/update_ts3.sh
+++ b/lgsm/functions/update_ts3.sh
@@ -27,18 +27,18 @@ fn_update_ts3_currentbuild(){
# 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"
- sleep 1
+ 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"
- sleep 1
+ 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"
- sleep 1
+ sleep 0.5
exitbypass=1
command_stop.sh
exitbypass=1
command_start.sh
- sleep 1
+ 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"
@@ -52,7 +52,7 @@ fn_update_ts3_currentbuild(){
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 1
+ 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
@@ -112,7 +112,7 @@ 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"
+ 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"
@@ -134,7 +134,7 @@ fn_update_ts3_availablebuild_legacy(){
# Checks availablebuild info is available
if [ -z "${availablebuild}" ]; then
fn_print_fail "Checking for update: teamspeak.com"
- sleep 1
+ 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
@@ -143,23 +143,23 @@ fn_update_ts3_availablebuild_legacy(){
else
fn_print_ok "Checking for update: teamspeak.com"
fn_script_log_pass "Checking for update: teamspeak.com"
- sleep 1
+ sleep 0.5
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:]')
+ currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]')
+ availablebuilddigit=$(echo "${availablebuild}" | tr -cd '[:digit:]')
if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then
echo -e "\n"
echo -e "Update available:"
- sleep 1
+ sleep 0.5
echo -e " Current build: ${red}${currentbuild} ${ts3arch}${default}"
echo -e " Available build: ${green}${availablebuild} ${ts3arch}${default}"
echo -e ""
- sleep 1
+ sleep 0.5
echo ""
echo -en "Applying update.\r"
sleep 1
@@ -216,7 +216,7 @@ 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"
- sleep 1
+ sleep 0.5
fn_update_ts3_currentbuild
if [ "$(command -v jq >/dev/null 2>&1)" ]; then
fn_update_ts3_availablebuild
diff --git a/linuxgsm.sh b/linuxgsm.sh
index 39329e911..9e59cfd9a 100755
--- a/linuxgsm.sh
+++ b/linuxgsm.sh
@@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
-version="180318"
+version="180409"
shortname="core"
gameservername="core"
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
@@ -73,7 +73,7 @@ fn_bootstrap_fetch_file(){
curlpath=$(command -v curl 2>/dev/null)
# If curl exists download file
- if [ "$(basename ${curlpath})" == "curl" ]; then
+ if [ "$(basename "${curlpath}")" == "curl" ]; then
# trap to remove part downloaded files
echo -ne " fetching ${local_filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
@@ -142,14 +142,14 @@ fn_install_menu_bash() {
caption=$3
options=$4
fn_print_horizontal
- fn_print_center $title
- fn_print_center $caption
+ fn_print_center "${title}"
+ fn_print_center "${caption}"
fn_print_horizontal
menu_options=()
while read -r line || [[ -n "${line}" ]]; do
var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
menu_options+=( "${var}" )
- done < $options
+ done < ${options}
menu_options+=( "Cancel" )
select option in "${menu_options[@]}"; do
if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then
@@ -175,8 +175,8 @@ fn_install_menu_whiptail() {
key=$(echo "${line}" | awk -F "," '{print $3}')
val=$(echo "${line}" | awk -F "," '{print $2}')
menu_options+=( ${val//\"} "${key//\"}" )
- done < $options
- OPTION=$(${menucmd} --title "${title}" --menu "${caption}" ${height} ${width} ${menuheight} "${menu_options[@]}" 3>&1 1>&2 2>&3)
+ done < "${options}"
+ OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3)
if [ $? == 0 ]; then
eval "$resultvar=\"${OPTION}\""
else
@@ -193,12 +193,12 @@ fn_install_menu() {
options=$4
# Get menu command
for menucmd in whiptail dialog bash; do
- if [ -x $(command -v ${menucmd}) ]; then
- menucmd=$(command -v ${menucmd})
+ if [ -x "$(command -v "${menucmd}")" ]; then
+ menucmd=$(command -v "${menucmd}")
break
fi
done
- case "$(basename ${menucmd})" in
+ case "$(basename "${menucmd}")" in
whiptail|dialog)
fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;;
*)
diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh
new file mode 100644
index 000000000..31d9205d0
--- /dev/null
+++ b/tests/tests_fctrserver.sh
@@ -0,0 +1,910 @@
+#!/bin/bash
+# Project: Game Server Managers - LinuxGSM
+# Author: Daniel Gibbs
+# License: MIT License, Copyright (c) 2017 Daniel Gibbs
+# Purpose: Travis CI Tests: Factorio | Linux Game Server Management Script
+# Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
+# Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
+# Website: https://linuxgsm.com
+
+travistest="1"
+version="180409"
+shortname="fctr"
+gameservername="fctrserver"
+rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
+selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+servicename="${selfname}"
+lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+logdir="${rootdir}/log"
+lgsmlogdir="${logdir}/lgsm"
+steamcmddir="${rootdir}/steamcmd"
+serverfiles="${rootdir}/serverfiles"
+functionsdir="${lgsmdir}/functions"
+libdir="${lgsmdir}/lib"
+tmpdir="${lgsmdir}/tmp"
+configdir="${lgsmdir}/config-lgsm"
+configdirserver="${configdir}/${gameservername}"
+configdirdefault="${lgsmdir}/config-default"
+
+# Allows for testing not on Travis CI
+if [ ! -v TRAVIS ]; then
+ TRAVIS_BRANCH="develop"
+ TRAVIS_BUILD_DIR="${rootdir}"
+fi
+
+## GitHub Branch Select
+# Allows for the use of different function files
+# from a different repo and/or branch.
+githubuser="GameServerManagers"
+githubrepo="LinuxGSM"
+githubbranch="${TRAVIS_BRANCH}"
+
+# Core Function that is required first
+core_functions.sh(){
+ functionfile="${FUNCNAME}"
+ fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
+}
+
+# Bootstrap
+# Fetches the core functions required before passed off to core_dl.sh
+
+# Fetches core functions
+fn_bootstrap_fetch_file(){
+ remote_fileurl="${1}"
+ local_filedir="${2}"
+ local_filename="${3}"
+ chmodx="${4:-0}"
+ run="${5:-0}"
+ forcedl="${6:-0}"
+ md5="${7:-0}"
+ # 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
+ # Defines curl path
+ curlpath=$(command -v curl 2>/dev/null)
+
+ # If curl exists download file
+ if [ "$(basename "${curlpath}")" == "curl" ]; then
+ # trap to remove part downloaded files
+ echo -ne " fetching ${local_filename}...\c"
+ curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
+ local exitcode=$?
+ if [ ${exitcode} -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ if [ -f "${lgsmlog}" ]; then
+ echo -e "${remote_fileurl}" | tee -a "${lgsmlog}"
+ echo "${curlcmd}" | tee -a "${lgsmlog}"
+ fi
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
+ echo "[ FAIL ] Curl is not installed"
+ exit 1
+ fi
+ # make file chmodx if chmodx is set
+ if [ "${chmodx}" == "chmodx" ]; then
+ chmod +x "${local_filedir}/${local_filename}"
+ fi
+ fi
+
+ if [ -f "${local_filedir}/${local_filename}" ]; then
+ # run file if run is set
+ if [ "${run}" == "run" ]; then
+ source "${local_filedir}/${local_filename}"
+ fi
+ fi
+}
+
+fn_bootstrap_fetch_file_github(){
+ github_file_url_dir="${1}"
+ github_file_url_name="${2}"
+ githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+
+ remote_fileurl="${githuburl}"
+ local_filedir="${3}"
+ local_filename="${github_file_url_name}"
+ chmodx="${4:-0}"
+ run="${5:-0}"
+ forcedl="${6:-0}"
+ md5="${7:-0}"
+ # Passes vars to the file download function
+ fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
+}
+
+# Installer menu
+
+fn_print_center() {
+ columns="$(tput cols)"
+ line="$@"
+ printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}"
+}
+
+fn_print_horizontal(){
+ char="${1:-=}"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
+}
+
+# Bash Menu
+fn_install_menu_bash() {
+ local resultvar=$1
+ title=$2
+ caption=$3
+ options=$4
+ fn_print_horizontal
+ fn_print_center "${title}"
+ fn_print_center "${caption}"
+ fn_print_horizontal
+ menu_options=()
+ while read -r line || [[ -n "${line}" ]]; do
+ var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
+ menu_options+=( "${var}" )
+ done < ${options}
+ menu_options+=( "Cancel" )
+ select option in "${menu_options[@]}"; do
+ if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then
+ eval "$resultvar=\"${option/%\ */}\""
+ fi
+ break
+ done
+}
+
+# Whiptail/Dialog Menu
+fn_install_menu_whiptail() {
+ local menucmd=$1
+ local resultvar=$2
+ title=$3
+ caption=$4
+ options=$5
+ height=${6:-40}
+ width=${7:-80}
+ menuheight=${8:-30}
+ IFS=","
+ menu_options=()
+ while read -r line; do
+ key=$(echo "${line}" | awk -F "," '{print $3}')
+ val=$(echo "${line}" | awk -F "," '{print $2}')
+ menu_options+=( ${val//\"} "${key//\"}" )
+ done < "${options}"
+ OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3)
+ if [ $? == 0 ]; then
+ eval "$resultvar=\"${OPTION}\""
+ else
+ eval "$resultvar="
+ fi
+}
+
+# Menu selector
+fn_install_menu() {
+ local resultvar=$1
+ local selection=""
+ title=$2
+ caption=$3
+ options=$4
+ # Get menu command
+ for menucmd in whiptail dialog bash; do
+ if [ -x "$(command -v "${menucmd}")" ]; then
+ menucmd=$(command -v "${menucmd}")
+ break
+ fi
+ done
+ case "$(basename "${menucmd}")" in
+ whiptail|dialog)
+ fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;;
+ *)
+ fn_install_menu_bash selection "${title}" "${caption}" "${options}";;
+ esac
+ eval "$resultvar=\"${selection}\""
+}
+
+# Gets server info from serverlist.csv and puts in to array
+fn_server_info(){
+ IFS=","
+ server_info_array=($(grep -aw "${userinput}" "${serverlist}"))
+ shortname="${server_info_array[0]}" # csgo
+ gameservername="${server_info_array[1]}" # csgoserver
+ gamename="${server_info_array[2]}" # Counter Strike: Global Offensive
+}
+
+fn_install_getopt(){
+ userinput="empty"
+ echo "Usage: $0 [option]"
+ echo -e ""
+ echo "Installer - Linux Game Server Managers - Version ${version}"
+ echo "https://linuxgsm.com"
+ echo -e ""
+ echo -e "Commands"
+ echo -e "install\t\t| Select server to install."
+ echo -e "servername\t| e.g $0 csgoserver. Enter name of server/game to install."
+ echo -e "list\t\t| List all servers available for install."
+ exit
+}
+
+fn_install_file(){
+ local_filename="${gameservername}"
+ if [ -e "${local_filename}" ]; then
+ i=2
+ while [ -e "${local_filename}-${i}" ] ; do
+ let i++
+ done
+ local_filename="${local_filename}-${i}"
+ fi
+ cp -R "${selfname}" "${local_filename}"
+ sed -i -e "s/shortname=\"core\"/shortname=\"${shortname}\"/g" "${local_filename}"
+ sed -i -e "s/gameservername=\"core\"/gameservername=\"${gameservername}\"/g" "${local_filename}"
+ echo "Installed ${gamename} server as ${local_filename}"
+ echo ""
+ if [ ! -d "${serverfiles}" ]; then
+ echo "./${local_filename} install"
+ else
+ echo "Remember to check server ports"
+ echo "./${local_filename} details"
+ fi
+ echo ""
+ exit
+}
+
+# Prevent from running this script as root.
+if [ "$(whoami)" == "root" ]; then
+ if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
+ echo "[ FAIL ] Do NOT run this script as root!"
+ exit 1
+ else
+ core_functions.sh
+ check_root.sh
+ fi
+fi
+
+# LinuxGSM installer mode
+if [ "${shortname}" == "core" ]; then
+ userinput=$1
+ datadir="${tmpdir}/data"
+ serverlist="${datadir}/serverlist.csv"
+
+ # Download the latest serverlist. This is the complete list of all supported servers.
+ fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
+ if [ ! -f "${serverlist}" ]; then
+ echo "[ FAIL ] serverlist.csv could not be loaded."
+ exit 1
+ fi
+
+ if [ "${userinput}" == "list" ]; then
+ {
+ awk -F "," '{print $2 "\t" $3}' "${serverlist}"
+ } | column -s $'\t' -t | more
+ exit
+ elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then
+ fn_install_menu result "LinuxGSM" "Select game to install" "${serverlist}"
+ userinput="${result}"
+ fn_server_info
+ if [ "${result}" == "${gameservername}" ]; then
+ fn_install_file
+ elif [ "${result}" == "" ]; then
+ echo "Install canceled"
+ else
+ echo "[ FAIL ] menu result does not match gameservername"
+ echo "result: ${result}"
+ echo "gameservername: ${gameservername}"
+ fi
+ elif [ -n "${userinput}" ]; then
+ fn_server_info
+ if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then
+ fn_install_file
+ else
+ echo "[ FAIL ] unknown game server"
+ fi
+ else
+ fn_install_getopt
+ fi
+
+# LinuxGSM Server Mode
+else
+ core_functions.sh
+
+ # Load LinuxGSM configs
+ # These are required to get all the default variables for the specific server.
+ # Load the default config. If missing download it. If changed reload it.
+ if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
+ mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
+ fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+ fi
+ if [ ! -f "${configdirserver}/_default.cfg" ]; then
+ mkdir -p "${configdirserver}"
+ echo -ne " copying _default.cfg...\c"
+ cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
+ exitcode=$?
+ if [ ${exitcode} -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
+ function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
+ if [ "${function_file_diff}" != "" ]; then
+ fn_print_warn_nl "_default.cfg has been altered. reloading config."
+ echo -ne " copying _default.cfg...\c"
+ cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
+ exitcode=$?
+ if [ ${exitcode} -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ fi
+ fi
+ source "${configdirserver}/_default.cfg"
+ # Load the common.cfg config. If missing download it
+ if [ ! -f "${configdirserver}/common.cfg" ]; then
+ fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+ source "${configdirserver}/common.cfg"
+ else
+ source "${configdirserver}/common.cfg"
+ fi
+ # Load the instance.cfg config. If missing download it
+ if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
+ fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+ source "${configdirserver}/${servicename}.cfg"
+ else
+ source "${configdirserver}/${servicename}.cfg"
+ fi
+ # Load the linuxgsm.sh in to tmpdir. If missing download it
+ if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
+ fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
+ fi
+
+ # Prevents running of core_exit.sh for Travis.
+ if [ -z "${travistest}" ]; then
+ getopt=$1
+ core_getopt.sh
+ fi
+fi
+
+fn_currentstatus_tmux(){
+ check_status.sh
+ if [ "${status}" != "0" ]; then
+ currentstatus="ONLINE"
+ else
+ currentstatus="OFFLINE"
+ fi
+}
+
+fn_currentstatus_ts3(){
+ check_status.sh
+ if [ "${status}" != "0" ]; then
+ currentstatus="ONLINE"
+ else
+ currentstatus="OFFLINE"
+ fi
+}
+
+fn_setstatus(){
+ fn_currentstatus_tmux
+ echo""
+ echo "Required status: ${requiredstatus}"
+ counter=0
+ echo "Current status: ${currentstatus}"
+ while [ "${requiredstatus}" != "${currentstatus}" ]; do
+ counter=$((counter+1))
+ fn_currentstatus_tmux
+ echo -ne "New status: ${currentstatus}\\r"
+
+ if [ "${requiredstatus}" == "ONLINE" ]; then
+ (command_start.sh > /dev/null 2>&1)
+ else
+ (command_stop.sh > /dev/null 2>&1)
+ fi
+ if [ "${counter}" -gt "5" ]; then
+ currentstatus="FAIL"
+ echo "Current status: ${currentstatus}"
+ echo ""
+ echo "Unable to start or stop server."
+ exit 1
+ fi
+ done
+ echo -ne "New status: ${currentstatus}\\r"
+ echo -e "\n"
+ echo "Test starting:"
+ echo ""
+ sleep 0.5
+}
+
+# End of every test will expect the result to either pass or fail
+# If the script does not do as intended the whole test will fail
+# if expecting a pass
+fn_test_result_pass(){
+ if [ $? != 0 ]; then
+ echo "================================="
+ echo "Expected result: PASS"
+ echo "Actual result: FAIL"
+ fn_print_fail_nl "TEST FAILED"
+ exitcode=1
+ core_exit.sh
+ else
+ echo "================================="
+ echo "Expected result: PASS"
+ echo "Actual result: PASS"
+ fn_print_ok_nl "TEST PASSED"
+ echo ""
+ fi
+}
+
+# if expecting a fail
+fn_test_result_fail(){
+ if [ $? == 0 ]; then
+ echo "================================="
+ echo "Expected result: FAIL"
+ echo "Actual result: PASS"
+ fn_print_fail_nl "TEST FAILED"
+ exitcode=1
+ core_exit.sh
+ else
+ echo "================================="
+ echo "Expected result: FAIL"
+ echo "Actual result: FAIL"
+ fn_print_ok_nl "TEST PASSED"
+ echo ""
+ fi
+}
+
+echo "================================="
+echo "Travis CI Tests"
+echo "Linux Game Server Manager"
+echo "by Daniel Gibbs"
+echo "Contributors: http://goo.gl/qLmitD"
+echo "https://linuxgsm.com"
+echo "================================="
+echo ""
+echo "================================="
+echo "Server Tests"
+echo "Using: ${gamename}"
+echo "Testing Branch: $TRAVIS_BRANCH"
+echo "================================="
+
+echo ""
+echo "0.1 - Create log dir's"
+echo "================================="
+echo "Description:"
+echo "Create log dir's"
+echo ""
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ install_logs.sh
+)
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "0.2 - Enable dev-debug"
+echo "================================="
+echo "Description:"
+echo "Enable dev-debug"
+echo ""
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_dev_debug.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "1.0 - start - no files"
+echo "================================="
+echo "Description:"
+echo "test script reaction to missing server files."
+echo "Command: ./fctrserver start"
+echo ""
+# Allows for testing not on Travis CI
+if [ ! -v TRAVIS ]; then
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_start.sh
+)
+fn_test_result_fail
+else
+ echo "Test bypassed"
+fi
+
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "1.1 - getopt"
+echo "================================="
+echo "Description:"
+echo "displaying options messages."
+echo "Command: ./fctrserver"
+echo ""
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ core_getopt.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "1.2 - getopt with incorrect args"
+echo "================================="
+echo "Description:"
+echo "displaying options messages."
+echo "Command: ./fctrserver abc123"
+echo ""
+getopt="abc123"
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ core_getopt.sh
+)
+fn_test_result_fail
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "2.0 - install"
+echo "================================="
+echo "Description:"
+echo "install ${gamename} server."
+echo "Command: ./fctrserver auto-install"
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ fn_autoinstall
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "3.1 - start"
+echo "================================="
+echo "Description:"
+echo "start ${gamename} server."
+echo "Command: ./fctrserver start"
+requiredstatus="OFFLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_start.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "3.2 - start - online"
+echo "================================="
+echo "Description:"
+echo "start ${gamename} server while already running."
+echo "Command: ./fctrserver start"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_start.sh
+)
+fn_test_result_fail
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "3.3 - start - updateonstart"
+echo "================================="
+echo "Description:"
+echo "will update server on start."
+echo "Command: ./fctrserver start"
+requiredstatus="OFFLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ updateonstart="on";command_start.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "3.4 - stop"
+echo "================================="
+echo "Description:"
+echo "stop ${gamename} server."
+echo "Command: ./fctrserver stop"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_stop.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "3.5 - stop - offline"
+echo "================================="
+echo "Description:"
+echo "stop ${gamename} server while already stopped."
+echo "Command: ./fctrserver stop"
+requiredstatus="OFFLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_stop.sh
+)
+fn_test_result_fail
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "3.6 - restart"
+echo "================================="
+echo "Description:"
+echo "restart ${gamename}."
+echo "Command: ./fctrserver restart"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_restart.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "3.7 - restart - offline"
+echo "================================="
+echo "Description:"
+echo "restart ${gamename} while already stopped."
+echo "Command: ./fctrserver restart"
+requiredstatus="OFFLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_restart.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "4.1 - update"
+echo "================================="
+echo "Description:"
+echo "check for updates."
+echo "Command: ./fctrserver update"
+requiredstatus="OFFLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_update.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "5.1 - monitor - online"
+echo "================================="
+echo "Description:"
+echo "run monitor server while already running."
+echo "Command: ./fctrserver monitor"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_monitor.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "5.2 - monitor - offline - with lockfile"
+echo "================================="
+echo "Description:"
+echo "run monitor while server is offline with lockfile."
+echo "Command: ./fctrserver monitor"
+requiredstatus="OFFLINE"
+fn_setstatus
+fn_print_info_nl "creating lockfile."
+date > "${rootdir}/${lockselfname}"
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_monitor.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "5.3 - monitor - offline - no lockfile"
+echo "================================="
+echo "Description:"
+echo "run monitor while server is offline with no lockfile."
+echo "Command: ./fctrserver monitor"
+requiredstatus="OFFLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_monitor.sh
+)
+fn_test_result_fail
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "6.0 - details"
+echo "================================="
+echo "Description:"
+echo "display details."
+echo "Command: ./fctrserver details"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_details.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "6.1 - post details"
+echo "================================="
+echo "Description:"
+echo "post details."
+echo "Command: ./fctrserver postdetails"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_postdetails.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "7.0 - backup"
+echo "================================="
+echo "Description:"
+echo "run a backup."
+echo "Command: ./fctrserver backup"
+requiredstatus="ONLINE"
+fn_setstatus
+echo "test de-activated until issue #1839 fixed"
+#(command_backup.sh)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "8.0 - dev - detect glibc"
+echo "================================="
+echo "Description:"
+echo "detect glibc."
+echo "Command: ./fctrserver detect-glibc"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_dev_detect_glibc.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "8.1 - dev - detect ldd"
+echo "================================="
+echo "Description:"
+echo "detect ldd."
+echo "Command: ./fctrserver detect-ldd"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_dev_detect_ldd.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "8.2 - dev - detect deps"
+echo "================================="
+echo "Description:"
+echo "detect dependencies."
+echo "Command: ./fctrserver detect-deps"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_dev_detect_deps.sh
+)
+fn_test_result_pass
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "================================="
+echo "Server Tests - Complete!"
+echo "Using: ${gamename}"
+echo "================================="
+requiredstatus="OFFLINE"
+fn_setstatus
+fn_print_info "Tidying up directories."
+rm -rfv "${serverfiles}"
+core_exit.sh
\ No newline at end of file
diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh
index 738da502c..ead84d404 100644
--- a/tests/tests_jc2server.sh
+++ b/tests/tests_jc2server.sh
@@ -8,16 +8,16 @@
# Website: https://linuxgsm.com
travistest="1"
-
-version="171014"
+version="180409"
shortname="jc2"
gameservername="jc2server"
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
-selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
servicename="${selfname}"
lockselfname=".${servicename}.lock"
lgsmdir="${rootdir}/lgsm"
logdir="${rootdir}/log"
+lgsmlogdir="${logdir}/lgsm"
steamcmddir="${rootdir}/steamcmd"
serverfiles="${rootdir}/serverfiles"
functionsdir="${lgsmdir}/functions"
@@ -27,12 +27,18 @@ configdir="${lgsmdir}/config-lgsm"
configdirserver="${configdir}/${gameservername}"
configdirdefault="${lgsmdir}/config-default"
+# Allows for testing not on Travis CI
+if [ ! -v TRAVIS ]; then
+ TRAVIS_BRANCH="develop"
+ TRAVIS_BUILD_DIR="${rootdir}"
+fi
+
## GitHub Branch Select
# Allows for the use of different function files
# from a different repo and/or branch.
githubuser="GameServerManagers"
githubrepo="LinuxGSM"
-githubbranch="$TRAVIS_BRANCH"
+githubbranch="${TRAVIS_BRANCH}"
# Core Function that is required first
core_functions.sh(){
@@ -52,8 +58,8 @@ fn_bootstrap_fetch_file(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
- # If the file is missing, then download
- if [ ! -f "${local_filedir}/${local_filename}" ]; then
+ # 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
@@ -61,7 +67,7 @@ fn_bootstrap_fetch_file(){
curlpath=$(command -v curl 2>/dev/null)
# If curl exists download file
- if [ "$(basename ${curlpath})" == "curl" ]; then
+ if [ "$(basename "${curlpath}")" == "curl" ]; then
# trap to remove part downloaded files
echo -ne " fetching ${local_filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
@@ -99,15 +105,15 @@ fn_bootstrap_fetch_file_github(){
github_file_url_name="${2}"
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
- remote_remote_fileurl="${githuburl}"
- local_local_filedir="${3}"
- local_local_filename="${github_file_url_name}"
+ remote_fileurl="${githuburl}"
+ local_filedir="${3}"
+ local_filename="${github_file_url_name}"
chmodx="${4:-0}"
run="${5:-0}"
- forcedldl="${6:-0}"
+ forcedl="${6:-0}"
md5="${7:-0}"
# Passes vars to the file download function
- fn_bootstrap_fetch_file "${remote_remote_fileurl}" "${local_local_filedir}" "${local_local_filename}" "${chmodx}" "${run}" "${forcedldl}" "${md5}"
+ fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
}
# Installer menu
@@ -130,14 +136,14 @@ fn_install_menu_bash() {
caption=$3
options=$4
fn_print_horizontal
- fn_print_center $title
- fn_print_center $caption
+ fn_print_center "${title}"
+ fn_print_center "${caption}"
fn_print_horizontal
menu_options=()
while read -r line || [[ -n "${line}" ]]; do
var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
menu_options+=( "${var}" )
- done < $options
+ done < ${options}
menu_options+=( "Cancel" )
select option in "${menu_options[@]}"; do
if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then
@@ -163,8 +169,8 @@ fn_install_menu_whiptail() {
key=$(echo "${line}" | awk -F "," '{print $3}')
val=$(echo "${line}" | awk -F "," '{print $2}')
menu_options+=( ${val//\"} "${key//\"}" )
- done < $options
- OPTION=$(${menucmd} --title "${title}" --menu "${caption}" ${height} ${width} ${menuheight} "${menu_options[@]}" 3>&1 1>&2 2>&3)
+ done < "${options}"
+ OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3)
if [ $? == 0 ]; then
eval "$resultvar=\"${OPTION}\""
else
@@ -181,12 +187,12 @@ fn_install_menu() {
options=$4
# Get menu command
for menucmd in whiptail dialog bash; do
- if [ -x $(command -v ${menucmd}) ]; then
- menucmd=$(command -v ${menucmd})
+ if [ -x "$(command -v "${menucmd}")" ]; then
+ menucmd=$(command -v "${menucmd}")
break
fi
done
- case "$(basename ${menucmd})" in
+ case "$(basename "${menucmd}")" in
whiptail|dialog)
fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;;
*)
@@ -212,9 +218,9 @@ fn_install_getopt(){
echo "https://linuxgsm.com"
echo -e ""
echo -e "Commands"
- echo -e "install |Select server to install."
- echo -e "servername |e.g $0 csgoserver. Enter the required servername will install it."
- echo -e "list |List all servers available for install."
+ echo -e "install\t\t| Select server to install."
+ echo -e "servername\t| e.g $0 csgoserver. Enter name of server/game to install."
+ echo -e "list\t\t| List all servers available for install."
exit
}
@@ -259,12 +265,8 @@ if [ "${shortname}" == "core" ]; then
datadir="${tmpdir}/data"
serverlist="${datadir}/serverlist.csv"
- # Download the serverlist. This is the complete list of all supported servers.
-
- if [ -f "${serverlist}" ]; then
- rm "${serverlist}"
- fi
- fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "serverlist.csv" "nochmodx" "norun" "noforcedl" "nomd5"
+ # Download the latest serverlist. This is the complete list of all supported servers.
+ fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
@@ -290,8 +292,10 @@ if [ "${shortname}" == "core" ]; then
fi
elif [ -n "${userinput}" ]; then
fn_server_info
- if [ "${userinput}" == "${gameservername}" ]; then
+ if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then
fn_install_file
+ else
+ echo "[ FAIL ] unknown game server"
fi
else
fn_install_getopt
@@ -320,7 +324,7 @@ else
echo -e "\e[0;32mOK\e[0m"
fi
else
- function_file_diff=$(diff -q ${configdirdefault}/config-lgsm/${gameservername}/_default.cfg ${configdirserver}/_default.cfg)
+ function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
echo -ne " copying _default.cfg...\c"
@@ -353,6 +357,7 @@ else
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
+
# Prevents running of core_exit.sh for Travis.
if [ "${travistest}" != "1" ]; then
getopt=$1
@@ -460,8 +465,8 @@ echo "Server Tests"
echo "Using: ${gamename}"
echo "Testing Branch: $TRAVIS_BRANCH"
echo "================================="
-echo ""
+echo ""
echo "0.1 - Create log dir's"
echo "================================="
echo "Description:"
@@ -475,8 +480,9 @@ echo ""
)
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+echo ""
echo "0.2 - Enable dev-debug"
echo "================================="
echo "Description:"
@@ -491,7 +497,7 @@ echo ""
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "1.0 - start - no files"
@@ -500,6 +506,8 @@ echo "Description:"
echo "test script reaction to missing server files."
echo "Command: ./jc2server start"
echo ""
+# Allows for testing not on Travis CI
+if [ ! -v TRAVIS ]; then
(
exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
BASH_XTRACEFD="5"
@@ -507,9 +515,13 @@ echo ""
command_start.sh
)
fn_test_result_fail
+else
+ echo "Test bypassed"
+fi
+
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "1.1 - getopt"
@@ -527,7 +539,7 @@ echo ""
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "1.2 - getopt with incorrect args"
@@ -546,7 +558,7 @@ getopt="abc123"
fn_test_result_fail
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "2.0 - install"
@@ -563,7 +575,7 @@ echo "Command: ./jc2server auto-install"
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.1 - start"
@@ -582,7 +594,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.2 - start - online"
@@ -601,7 +613,7 @@ fn_setstatus
fn_test_result_fail
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.3 - start - updateonstart"
@@ -620,7 +632,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.4 - stop"
@@ -639,7 +651,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.5 - stop - offline"
@@ -658,7 +670,7 @@ fn_setstatus
fn_test_result_fail
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.6 - restart"
@@ -677,7 +689,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.7 - restart - offline"
@@ -696,8 +708,9 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+echo ""
echo "4.1 - update"
echo "================================="
echo "Description:"
@@ -714,7 +727,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "4.2 - update - change buildid"
@@ -735,7 +748,7 @@ sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf"
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "4.3 - update - change buildid - online"
@@ -756,7 +769,7 @@ sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf"
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "4.4 - update - remove appmanifest file"
@@ -777,7 +790,7 @@ rm --verbose "${serverfiles}/steamapps/appmanifest_${appid}.acf"
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "4.5 - force-update"
@@ -796,7 +809,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "4.6 - force-update - online"
@@ -815,7 +828,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "4.7 - validate"
@@ -834,7 +847,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "4.8 - validate - online"
@@ -854,7 +867,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "Inserting IP address"
@@ -883,7 +896,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "5.2 - monitor - offline - with lockfile"
@@ -904,7 +917,7 @@ date > "${rootdir}/${lockselfname}"
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "5.3 - monitor - offline - no lockfile"
@@ -923,13 +936,13 @@ fn_setstatus
fn_test_result_fail
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
-echo "5.4 - monitor - gsquery.py failure"
+echo "5.4 - monitor - query_gsquery.py failure"
echo "================================="
echo "Description:"
-echo "gsquery.py will fail to query port."
+echo "query_gsquery.py will fail to query port."
echo "Command: ./jc2server monitor"
requiredstatus="ONLINE"
fn_setstatus
@@ -944,7 +957,7 @@ sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
fn_test_result_fail
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
fn_print_info_nl "Re-generating ${servercfg}."
@@ -968,7 +981,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "6.1 - post details"
@@ -987,7 +1000,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "7.0 - backup"
@@ -1002,7 +1015,7 @@ echo "test de-activated until issue #1839 fixed"
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "8.0 - dev - detect glibc"
@@ -1021,7 +1034,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "8.1 - dev - detect ldd"
@@ -1040,7 +1053,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "8.2 - dev - detect deps"
@@ -1059,7 +1072,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "================================="
diff --git a/tests/tests_shellcheck.sh b/tests/tests_shellcheck.sh
index 0a9230226..d3d26c0c4 100644
--- a/tests/tests_shellcheck.sh
+++ b/tests/tests_shellcheck.sh
@@ -21,8 +21,10 @@ echo "Using: Shellcheck"
echo "Testing Branch: $TRAVIS_BRANCH"
echo "================================="
echo ""
-find . -type f -name "*.sh" -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \;
-find . -type f -name "*.cfg" -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \;
+scissues=$(find . -type f \( -name "*.sh" -o -name "*.cfg" \) -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \; | grep -F "^--" | wc -l)
+echo "Found issues: ${scissues}"
+echo "================================="
+find . -type f \( -name "*.sh" -o -name "*.cfg" \) -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \;
echo ""
echo "================================="
echo "Bash Analysis Tests - Complete!"
diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh
index b6ee25f95..f8594c134 100644
--- a/tests/tests_ts3server.sh
+++ b/tests/tests_ts3server.sh
@@ -8,16 +8,16 @@
# Website: https://linuxgsm.com
travistest="1"
-
-version="171014"
+version="180409"
shortname="ts3"
gameservername="ts3server"
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
-selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
servicename="${selfname}"
lockselfname=".${servicename}.lock"
lgsmdir="${rootdir}/lgsm"
logdir="${rootdir}/log"
+lgsmlogdir="${logdir}/lgsm"
steamcmddir="${rootdir}/steamcmd"
serverfiles="${rootdir}/serverfiles"
functionsdir="${lgsmdir}/functions"
@@ -27,12 +27,18 @@ configdir="${lgsmdir}/config-lgsm"
configdirserver="${configdir}/${gameservername}"
configdirdefault="${lgsmdir}/config-default"
+# Allows for testing not on Travis CI
+if [ ! -v TRAVIS ]; then
+ TRAVIS_BRANCH="develop"
+ TRAVIS_BUILD_DIR="${rootdir}"
+fi
+
## GitHub Branch Select
# Allows for the use of different function files
# from a different repo and/or branch.
githubuser="GameServerManagers"
githubrepo="LinuxGSM"
-githubbranch="$TRAVIS_BRANCH"
+githubbranch="${TRAVIS_BRANCH}"
# Core Function that is required first
core_functions.sh(){
@@ -52,8 +58,8 @@ fn_bootstrap_fetch_file(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
- # If the file is missing, then download
- if [ ! -f "${local_filedir}/${local_filename}" ]; then
+ # 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
@@ -61,7 +67,7 @@ fn_bootstrap_fetch_file(){
curlpath=$(command -v curl 2>/dev/null)
# If curl exists download file
- if [ "$(basename ${curlpath})" == "curl" ]; then
+ if [ "$(basename "${curlpath}")" == "curl" ]; then
# trap to remove part downloaded files
echo -ne " fetching ${local_filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
@@ -99,15 +105,15 @@ fn_bootstrap_fetch_file_github(){
github_file_url_name="${2}"
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
- remote_remote_fileurl="${githuburl}"
- local_local_filedir="${3}"
- local_local_filename="${github_file_url_name}"
+ remote_fileurl="${githuburl}"
+ local_filedir="${3}"
+ local_filename="${github_file_url_name}"
chmodx="${4:-0}"
run="${5:-0}"
- forcedldl="${6:-0}"
+ forcedl="${6:-0}"
md5="${7:-0}"
# Passes vars to the file download function
- fn_bootstrap_fetch_file "${remote_remote_fileurl}" "${local_local_filedir}" "${local_local_filename}" "${chmodx}" "${run}" "${forcedldl}" "${md5}"
+ fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
}
# Installer menu
@@ -130,14 +136,14 @@ fn_install_menu_bash() {
caption=$3
options=$4
fn_print_horizontal
- fn_print_center $title
- fn_print_center $caption
+ fn_print_center "${title}"
+ fn_print_center "${caption}"
fn_print_horizontal
menu_options=()
while read -r line || [[ -n "${line}" ]]; do
var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
menu_options+=( "${var}" )
- done < $options
+ done < ${options}
menu_options+=( "Cancel" )
select option in "${menu_options[@]}"; do
if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then
@@ -163,8 +169,8 @@ fn_install_menu_whiptail() {
key=$(echo "${line}" | awk -F "," '{print $3}')
val=$(echo "${line}" | awk -F "," '{print $2}')
menu_options+=( ${val//\"} "${key//\"}" )
- done < $options
- OPTION=$(${menucmd} --title "${title}" --menu "${caption}" ${height} ${width} ${menuheight} "${menu_options[@]}" 3>&1 1>&2 2>&3)
+ done < "${options}"
+ OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3)
if [ $? == 0 ]; then
eval "$resultvar=\"${OPTION}\""
else
@@ -181,12 +187,12 @@ fn_install_menu() {
options=$4
# Get menu command
for menucmd in whiptail dialog bash; do
- if [ -x $(command -v ${menucmd}) ]; then
- menucmd=$(command -v ${menucmd})
+ if [ -x "$(command -v "${menucmd}")" ]; then
+ menucmd=$(command -v "${menucmd}")
break
fi
done
- case "$(basename ${menucmd})" in
+ case "$(basename "${menucmd}")" in
whiptail|dialog)
fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;;
*)
@@ -212,9 +218,9 @@ fn_install_getopt(){
echo "https://linuxgsm.com"
echo -e ""
echo -e "Commands"
- echo -e "install |Select server to install."
- echo -e "servername |e.g $0 csgoserver. Enter the required servername will install it."
- echo -e "list |List all servers available for install."
+ echo -e "install\t\t| Select server to install."
+ echo -e "servername\t| e.g $0 csgoserver. Enter name of server/game to install."
+ echo -e "list\t\t| List all servers available for install."
exit
}
@@ -259,12 +265,8 @@ if [ "${shortname}" == "core" ]; then
datadir="${tmpdir}/data"
serverlist="${datadir}/serverlist.csv"
- # Download the serverlist. This is the complete list of all supported servers.
-
- if [ -f "${serverlist}" ]; then
- rm "${serverlist}"
- fi
- fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "serverlist.csv" "nochmodx" "norun" "noforcedl" "nomd5"
+ # Download the latest serverlist. This is the complete list of all supported servers.
+ fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
@@ -290,8 +292,10 @@ if [ "${shortname}" == "core" ]; then
fi
elif [ -n "${userinput}" ]; then
fn_server_info
- if [ "${userinput}" == "${gameservername}" ]; then
+ if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then
fn_install_file
+ else
+ echo "[ FAIL ] unknown game server"
fi
else
fn_install_getopt
@@ -320,7 +324,7 @@ else
echo -e "\e[0;32mOK\e[0m"
fi
else
- function_file_diff=$(diff -q ${configdirdefault}/config-lgsm/${gameservername}/_default.cfg ${configdirserver}/_default.cfg)
+ function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
echo -ne " copying _default.cfg...\c"
@@ -353,6 +357,7 @@ else
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
+
# Prevents running of core_exit.sh for Travis.
if [ "${travistest}" != "1" ]; then
getopt=$1
@@ -475,27 +480,34 @@ echo ""
)
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
-echo""
+echo ""
echo "0.2 - Enable dev-debug"
echo "================================="
echo "Description:"
echo "Enable dev-debug"
echo ""
-(command_dev_debug.sh)
+(
+ exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+ BASH_XTRACEFD="5"
+ set -x
+ command_dev_debug.sh
+)
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
-echo""
+echo ""
echo "1.0 - start - no files"
echo "================================="
echo "Description:"
echo "test script reaction to missing server files."
echo "Command: ./ts3server start"
echo ""
+# Allows for testing not on Travis CI
+if [ ! -v TRAVIS ]; then
(
exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
BASH_XTRACEFD="5"
@@ -503,9 +515,13 @@ echo ""
command_start.sh
)
fn_test_result_fail
+else
+ echo "Test bypassed"
+fi
+
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "1.1 - getopt"
@@ -523,7 +539,7 @@ echo ""
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "1.2 - getopt with incorrect args"
@@ -542,7 +558,7 @@ getopt="abc123"
fn_test_result_fail
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "2.0 - install"
@@ -559,7 +575,7 @@ echo "Command: ./ts3server auto-install"
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.1 - start"
@@ -578,7 +594,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.2 - start - online"
@@ -595,6 +611,9 @@ fn_setstatus
command_start.sh
)
fn_test_result_fail
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.3 - start - updateonstart"
@@ -613,7 +632,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.4 - stop"
@@ -632,7 +651,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.5 - stop - offline"
@@ -651,7 +670,7 @@ fn_setstatus
fn_test_result_fail
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.6 - restart"
@@ -670,7 +689,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "3.7 - restart - offline"
@@ -689,8 +708,9 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+echo ""
echo "4.1 - update"
echo "================================="
echo "Description:"
@@ -707,7 +727,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "5.1 - monitor - online"
@@ -726,7 +746,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "5.2 - monitor - offline - with lockfile"
@@ -747,7 +767,7 @@ date > "${rootdir}/${lockselfname}"
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "5.3 - monitor - offline - no lockfile"
@@ -766,7 +786,7 @@ fn_setstatus
fn_test_result_fail
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "6.0 - details"
@@ -785,14 +805,14 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "6.1 - post details"
echo "================================="
echo "Description:"
echo "post details."
-echo "Command: ./jc2server postdetails"
+echo "Command: ./ts3server postdetails"
requiredstatus="ONLINE"
fn_setstatus
(
@@ -804,7 +824,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "7.0 - backup"
@@ -819,7 +839,7 @@ echo "test de-activated until issue #1839 fixed"
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "8.0 - dev - detect glibc"
@@ -838,7 +858,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "8.1 - dev - detect ldd"
@@ -857,7 +877,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "8.2 - dev - detect deps"
@@ -876,7 +896,7 @@ fn_setstatus
fn_test_result_pass
echo "run order"
echo "================="
-grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log"| sed 's/functionfile=//g'
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
echo ""
echo "================================="