Browse Source

Merge branch 'develop' into feature/1202-jediknight2

pull/3002/head
Frisasky 6 years ago
committed by GitHub
parent
commit
a8f687f6ac
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/pull_request_template.md
  2. 57
      .travis.yml
  3. 2
      README.md
  4. 157
      lgsm/config-default/config-lgsm/mcbserver/_default.cfg
  5. 1
      lgsm/config-default/config-lgsm/mcserver/_default.cfg
  6. 1
      lgsm/data/serverlist.csv
  7. 2
      lgsm/functions/alert.sh
  8. 4
      lgsm/functions/command_fastdl.sh
  9. 2
      lgsm/functions/command_monitor.sh
  10. 2
      lgsm/functions/command_update.sh
  11. 4
      lgsm/functions/command_validate.sh
  12. 2
      lgsm/functions/core_dl.sh
  13. 10
      lgsm/functions/core_functions.sh
  14. 24
      lgsm/functions/core_messages.sh
  15. 2
      lgsm/functions/fix.sh
  16. 11
      lgsm/functions/fix_mcb.sh
  17. 32
      lgsm/functions/info_config.sh
  18. 14
      lgsm/functions/info_messages.sh
  19. 3
      lgsm/functions/info_stats.sh
  20. 6
      lgsm/functions/install_config.sh
  21. 12
      lgsm/functions/install_server_files.sh
  22. 9
      lgsm/functions/query_gsquery.py
  23. 2
      lgsm/functions/update_minecraft.sh
  24. 172
      lgsm/functions/update_minecraft_bedrock.sh
  25. 4
      lgsm/functions/update_steamcmd.sh
  26. 10
      linuxgsm.sh
  27. 26
      tests/tests_fctrserver.sh
  28. 8
      tests/tests_jc2server.sh
  29. 14
      tests/tests_kcov.sh
  30. 8
      tests/tests_mcserver.sh
  31. 8
      tests/tests_ts3server.sh

2
.github/pull_request_template.md

@ -18,7 +18,7 @@ PR will not be merged until all steps are complete.
* [ ] This pull request links to an issue.
* [ ] This pull request uses the `develop` branch as its base.
* [ ] This pull request Subject follows the Conventinal Commits standard.
* [ ] This pull request Subject follows the Conventional Commits standard.
* [ ] This code follows the style guidelines of this project.
* [ ] I have performed a self-review of my own code.
* [ ] I have checked that this code is commented where required.

57
.travis.yml

@ -1,49 +1,44 @@
language: node_js
dist: bionic
node_js:
- 10
- "stable"
env:
global:
secure: VsS98cwJ5X/Ev3HEm7KEOPftYay+7jNTHepTS7d+gQNHcDR1UYKTmqlQNSIoUC52Ejs1cHq43jOfle4330zDPOYI0v5BMri6/iZKpmMxAw6KWNiUgSkziTP2kHC4NRLwEoU2WQTI3JZQjrBEfsPmD81+yR/eWXV3rph+YcSOxao=
before_script:
- curl -L "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shunit2/shunit2-2.1.6.tgz" | tar zx
- curl -L "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shunit2/shunit2-2.1.6.tgz" | tar zx
install:
npm install gamedig
- npm install gamedig
addons:
apt:
packages:
- mailutils
- postfix
- curl
- wget
- file
- bzip2
- gzip
- unzip
- bsdmainutils
- python3
- util-linux
- ca-certificates
- binutils
- bc
- jq
- tmux
- lib32gcc1
- libstdc++6
- libstdc++6:i386
- net-tools
- iproute2
- shellcheck
- libcurl4-openssl-dev
- libdw-dev
- cmake
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_mcserver.sh
- # stage name not required
script: bash tests/tests_ts3server.sh
- # stage name not required
script: bash tests/tests_defaultcfg/tests_defaultcfg.sh
- # retired as codacy does this check.
# script: bash tests/tests_shellcheck.sh
- stage: "Jobs"
name: "code coverage"
script: bash tests/tests_kcov.sh; kcov --bash-method=DEBUG coverage tests/tests_mcserver.sh
- script: bash tests/tests_mcserver.sh
name: "Minecraft"
- script: bash tests/tests_jc2server.sh
name: "Just Cause 2"
- script: bash tests/tests_fctrserver.sh
name: "Factorio"
- script: bash tests/tests_ts3server.sh
name: "Teamspeak 3"
- script: bash tests/tests_defaultcfg/tests_defaultcfg.sh
name: "_default.cfg checks"
after_success:
- bash <(curl -Ls https://coverage.codacy.com/get.sh)

2
README.md

File diff suppressed because one or more lines are too long

157
lgsm/config-default/config-lgsm/mcbserver/_default.cfg

@ -0,0 +1,157 @@
##################################
######## Default Settings ########
##################################
# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
# Copy settings from here and use them in either:
# common.cfg - applies settings to every instance.
# [instance].cfg - applies settings to a specific instance.
#### Game Server Settings ####
## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
fn_parms(){
parms=""
}
#### LinuxGSM Settings ####
## LinuxGSM Stats
# Send useful stats to LinuxGSM developers.
# https://docs.linuxgsm.com/configuration/linuxgsm-stats
# (on|off)
stats="off"
## Notification Alerts
# (on|off)
# Display IP | https://docs.linuxgsm.com/alerts#display-ip
displayip=""
# More info | https://docs.linuxgsm.com/alerts#more-info
postalert="off"
postdays="7"
posttarget="https://hastebin.com"
# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
discordalert="off"
discordwebhook="webhook"
# Email Alerts | https://docs.linuxgsm.com/alerts/email
emailalert="off"
email="[email protected]"
emailfrom=""
# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
iftttalert="off"
ifttttoken="accesstoken"
iftttevent="linuxgsm_alert"
# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun
mailgunalert="off"
mailguntoken="accesstoken"
mailgundomain="example.com"
mailgunemailfrom="[email protected]"
mailgunemail="[email protected]"
# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
pushbulletalert="off"
pushbullettoken="accesstoken"
channeltag=""
# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
pushoveralert="off"
pushovertoken="accesstoken"
# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
slackalert="off"
slackwebhook="webhook"
# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring".
# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need
# any custom string in curl - simple ignore this parameter.
telegramalert="off"
telegramtoken="accesstoken"
telegramchatid=""
curlcustomstring=""
## Updating | https://docs.linuxgsm.com/commands/update
updateonstart="off"
## Backup | https://docs.linuxgsm.com/commands/backup
maxbackups="4"
maxbackupdays="30"
stoponbackup="on"
## Logging | https://docs.linuxgsm.com/features/logging
consolelogging="on"
logdays="7"
## Monitor | https://docs.linuxgsm.com/commands/monitor
# Query delay time
querydelay="1"
## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
ansi="on"
#### Advanced Settings ####
## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
sleeptime="0.5"
## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
# 1: tmux kill
# 2: CTRL+c
# 3: quit
# 4: quit 120s
# 5: stop
# 6: q
# 7: exit
# 8: 7 Days to Die
# 9: Gold Source
# 10: Teamspeak 3
stopmode="5"
## Query mode
# 1: session only
# 2: gamedig + gsquery
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="4"
querytype="minecraftbe"
## Game Server Details
# Do not edit
gamename="Minecraft Bedrock"
engine="bedrock"
glibc="2.27"
#### Directories ####
# Edit with care
## Game Server Directories
systemdir="${serverfiles}"
executabledir="${serverfiles}"
executable="${serverfiles}/bedrock_server"
servercfg="server.properties"
servercfgdefault="server.properties"
servercfgdir="${serverfiles}"
servercfgfullpath="${servercfgdir}/${servercfg}"
## Backup Directory
backupdir="${lgsmdir}/backup"
## Logging Directories
logdir="${rootdir}/log"
gamelogdir="${systemdir}"
lgsmlogdir="${logdir}/script"
consolelogdir="${logdir}/console"
lgsmlog="${lgsmlogdir}/${selfname}-script.log"
consolelog="${consolelogdir}/${selfname}-console.log"
alertlog="${lgsmlogdir}/${selfname}-alert.log"
postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
## Logs Naming
lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

1
lgsm/config-default/config-lgsm/mcserver/_default.cfg

@ -15,6 +15,7 @@ javaram="1024" # -Xmx$1024M
fn_parms(){
parms="nogui"
}
#### LinuxGSM Settings ####
## LinuxGSM Stats

1
lgsm/data/serverlist.csv

@ -50,6 +50,7 @@ kf2,kf2server,Killing Floor 2
l4d,l4dserver,Left 4 Dead
l4d2,l4d2server,Left 4 Dead 2
mc,mcserver,Minecraft
mcb,mcbserver,Minecraft Bedrock
mh,mhserver,MORDHAU
mohaa,mohaaserver,Medal of Honor: Allied Assault
mta,mtaserver,Multi Theft Auto

1 ahl ahlserver Action half-life
50 l4d l4dserver Left 4 Dead
51 l4d2 l4d2server Left 4 Dead 2
52 mc mcserver Minecraft
53 mcb mcbserver Minecraft Bedrock
54 mh mhserver MORDHAU
55 mohaa mohaaserver Medal of Honor: Allied Assault
56 mta mtaserver Multi Theft Auto

2
lgsm/functions/alert.sh

@ -76,7 +76,7 @@ fn_alert_config(){
alertemoji="🎮"
alertsound="1"
alerturl="not enabled"
alertbody="${servicename} has received a new _default.cfg. Check file for changes."
alertbody="${selfname} has received a new _default.cfg. Check file for changes."
}
if [ "${alert}" == "permissions" ]; then

4
lgsm/functions/command_fastdl.sh

@ -194,7 +194,7 @@ fn_fastdl_preview(){
tput rc; tput el
echo -e "gathering ${directory} ${allowed_extention} : ${fileswc}..."
echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
done < <(find "${systemdir}/${directory}" -type f -iname ${allowed_extention})
done < <(find "${systemdir}/${directory}" -type f -iname "${allowed_extention}")
tput rc; tput el
echo -e "gathering ${directory} ${allowed_extention} : ${fileswc}..."
if [ ${fileswc} != 0 ]; then
@ -213,7 +213,7 @@ fn_fastdl_preview(){
# Calculates total file size.
while read -r dufile; do
filesize=$(stat -c %s "${dufile}")
filesizetotal=$(( ${filesizetotal} + ${filesize} ))
filesizetotal=$(( filesizetotal+filesize ))
exitcode=$?
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl

2
lgsm/functions/command_monitor.sh

@ -17,7 +17,7 @@ fn_monitor_check_lockfile(){
fn_print_checking_eol
fn_script_log_info "Checking lockfile: CHECKING"
fn_sleep_time
fn_print_error_nl "Checking lockfile: No lockfile found: "
fn_print_error "Checking lockfile: No lockfile found: "
fn_print_error_eol
fn_script_log_error "Checking lockfile: No lockfile found: ERROR"
fn_sleep_time

2
lgsm/functions/command_update.sh

@ -16,6 +16,8 @@ if [ "${shortname}" == "ts3" ]; then
update_ts3.sh
elif [ "${shortname}" == "mc" ]; then
update_minecraft.sh
elif [ "${shortname}" == "mcb" ]; then
update_minecraft_bedrock.sh
elif [ "${shortname}" == "mumble" ]; then
update_mumble.sh
elif [ "${shortname}" == "fctr" ]; then

4
lgsm/functions/command_validate.sh

@ -23,11 +23,11 @@ fn_validation(){
fi
if [ "${appid}" == "90" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +app_update "${appid}" -beta ${branch} validate +quit | tee -a "${lgsmlog}"
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then
${unbuffer} ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -beta "${branch}" validate +quit| tee -a "${scriptlog}"
else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta ${branch} validate +quit | tee -a "${lgsmlog}"
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
fi
if [ $? != 0 ]; then
fn_print_fail_nl "Validating files: SteamCMD"

2
lgsm/functions/core_dl.sh

@ -81,7 +81,7 @@ fn_dl_extract(){
elif [ "${mime}" == "application/x-xz" ]; then
tarcmd=$(tar -xf "${local_filedir}/${local_filename}" -C "${extractdir}")
elif [ "${mime}" == "application/zip" ]; then
extractcmd=$(unzip -d "${extractdir}" "${local_filedir}/${local_filename}")
extractcmd=$(unzip -dq "${extractdir}" "${local_filedir}/${local_filename}")
fi
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then

10
lgsm/functions/core_functions.sh

@ -331,6 +331,11 @@ functionfile="${FUNCNAME[0]}"
fn_fetch_function
}
fix_mcb.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}
fix_mta.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
@ -545,6 +550,11 @@ functionfile="${FUNCNAME[0]}"
fn_fetch_function
}
update_minecraft_bedrock.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}
update_mumble.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function

24
lgsm/functions/core_messages.sh

@ -119,7 +119,7 @@ fn_script_log_info(){
# [ .... ]
fn_print_dots(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[ .... ] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[ .... ] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[ .... ] $*"
fi
@ -128,7 +128,7 @@ fn_print_dots(){
fn_print_dots_nl(){
if [ -n "${commandaction}" ]; then
echo -e "${creeol}[ .... ] ${commandaction} ${servicename}: $*"
echo -e "${creeol}[ .... ] ${commandaction} ${selfname}: $*"
else
echo -e "${creeol}[ .... ] $*"
fi
@ -139,7 +139,7 @@ fn_print_dots_nl(){
# [ OK ]
fn_print_ok(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${green} OK ${default}] $*"
fi
@ -148,7 +148,7 @@ fn_print_ok(){
fn_print_ok_nl(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${green} OK ${default}] $*"
fi
@ -159,7 +159,7 @@ fn_print_ok_nl(){
# [ FAIL ]
fn_print_fail(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${red} FAIL ${default}] $*"
fi
@ -168,7 +168,7 @@ fn_print_fail(){
fn_print_fail_nl(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${red} FAIL ${default}] $*"
fi
@ -179,7 +179,7 @@ fn_print_fail_nl(){
# [ ERROR ]
fn_print_error(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${red}ERROR ${default}] $*"
fi
@ -188,7 +188,7 @@ fn_print_error(){
fn_print_error_nl(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${red}ERROR ${default}] $*"
fi
@ -199,7 +199,7 @@ fn_print_error_nl(){
# [ WARN ]
fn_print_warn(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${lightyellow} WARN ${default}] $*"
fi
@ -208,7 +208,7 @@ fn_print_warn(){
fn_print_warn_nl(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${lightyellow} WARN ${default}] $*"
fi
@ -219,7 +219,7 @@ fn_print_warn_nl(){
# [ INFO ]
fn_print_info(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${cyan} INFO ${default}] $*"
fi
@ -228,7 +228,7 @@ fn_print_info(){
fn_print_info_nl(){
if [ -n "${commandaction}" ]; then
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${servicename}: $*"
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*"
else
echo -en "${creeol}[${cyan} INFO ${default}] $*"
fi

2
lgsm/functions/fix.sh

@ -67,6 +67,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th
fix_terraria.sh
elif [ "${shortname}" == "ts3" ]; then
fix_ts3.sh
elif [ "${shortname}" == "mcb" ]; then
fix_mcb.sh
elif [ "${shortname}" == "mta" ]; then
fix_mta.sh
elif [ "${shortname}" == "unt" ]; then

11
lgsm/functions/fix_mcb.sh

@ -0,0 +1,11 @@
#!/bin/bash
# LinuxGSM fix_mcb.sh function
# Author: Daniel Gibbs
# Website: https://linuxgsm.com
# Description: Resolves possible startup issue with Minecraft Bedrock
local commandname="FIX"
local commandaction="Fix"
# official docs state that the server should be started with: LD_LIBRARY_PATH=. ./bedrock_server
export LD_LIBRARY_PATH="${serverfiles}:$LD_LIBRARY_PATH"

32
lgsm/functions/info_config.sh

@ -386,6 +386,35 @@ fn_info_config_minecraft(){
fi
}
fn_info_config_minecraft_bedrock(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
maxplayers="${zero}"
port="${zero}"
port6="${zero}"
queryport="${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]*$//')
maxplayers=$(grep "max-players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
port=$(grep "server-port\b" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
port6=$(grep "server-portv6\b" "${servercfgfullpath}" | sed 's/v6//g' | grep -v "#" | tr -cd '[:digit:]')
queryport=${port}
gamemode=$(grep "gamemode" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/gamemode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
gameworld=$(grep "level-name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/level-name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
# Not Set
servername=${servername:-"NOT SET"}
maxplayers=${maxplayers:-"NOT SET"}
port=${port:-"NOT SET"}
port6=${port6:-"NOT SET"}
queryport=${queryport:-"NOT SET"}
gamemode=${gamemode:-"NOT SET"}
gameworld=${gameworld:-"NOT SET"}
fi
}
fn_info_config_mohaa(){
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@ -1388,6 +1417,9 @@ elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then
# Minecraft
elif [ "${shortname}" == "mc" ]; then
fn_info_config_minecraft
# Minecraft Bedrock
elif [ "${shortname}" == "mcb" ]; then
fn_info_config_minecraft_bedrock
# Post Scriptum: The Bloody Seventh
elif [ "${shortname}" == "pstbs" ]; then
fn_info_config_pstbs

14
lgsm/functions/info_messages.sh

@ -546,7 +546,7 @@ fn_info_message_ports(){
parmslocation="${red}UNKNOWN${default}"
# engines/games that require editing in the config file
local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "wurm")
local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Minecraft Bedrock" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "wurm")
for port_edit in "${ports_edit_array[@]}"
do
if [ "${shortname}" == "ut3" ]; then
@ -825,6 +825,16 @@ fn_info_message_minecraft(){
} | column -s $'\t' -t
}
fn_info_message_minecraft_bedrock(){
echo -e "netstat -atunp | grep bedrock_serv"
echo -e ""
{
echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
echo -e "> Game\tINBOUND\t${port}\tudp"
echo -e "> Game\tINBOUND\t${port6}\tudp6"
} | column -s $'\t' -t
}
fn_info_message_mohaa(){
echo -e "netstat -atunp | grep mohaa_lnxded"
echo -e ""
@ -1384,6 +1394,8 @@ fn_info_message_select_engine(){
fn_info_message_justcause3
elif [ "${shortname}" == "kf2" ]; then
fn_info_message_kf2
elif [ "${shortname}" == "mcb" ]; then
fn_info_message_minecraft_bedrock
elif [ "${shortname}" == "pz" ]; then
fn_info_message_projectzomboid
elif [ "${shortname}" == "pstbs" ]; then

3
lgsm/functions/info_stats.sh

@ -23,9 +23,6 @@ uuid=$(cat "${datadir}/uuid.txt")
cpuusedmhzroundup=$(((cpuusedmhz + 99) / 100 * 100))
# nearest 100MB
memusedroundup=$(((memused + 99) / 100 * 100))
# nearest 100MB
serverfilesduroundup=$(((serverfilesdu + 99) / 100 * 100))
# https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
# Level 1 Stats
## Distro

6
lgsm/functions/install_config.sh

@ -440,6 +440,12 @@ elif [ "${shortname}" == "mc" ]; then
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${shortname}" == "mcb" ]; then
gamedirname="MinecraftBedrock"
array_configs+=( server.properties )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${shortname}" == "mohaa" ]; then
gamedirname="MedalOfHonorAlliedAssault"
array_configs+=( server.cfg )

12
lgsm/functions/install_server_files.sh

@ -104,21 +104,21 @@ fn_install_server_files_steamcmd(){
if [ "${counter}" -le "4" ]; then
if [ "${appid}" == "90" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta ${branch} +quit
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit
local exitcode=$?
else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta ${branch} +quit
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit
local exitcode=$?
fi
elif [ "${counter}" -ge "5" ]; then
if [ "${engine}" == "goldsource" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta ${branch} validate +quit
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" validate +quit
local exitcode=$?
elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then
${unbuffer} ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -beta "${branch}" -validate +quit
local exitcode=$?
else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta ${branch} validate +quit
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit
local exitcode=$?
fi
fi
@ -136,7 +136,7 @@ fn_install_server_files_steamcmd(){
counter="0"
while [ "${counter}" -le "4" ]; do
counter=$((counter+1))
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} validate +quit
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" validate +quit
local exitcode=$?
done
fi
@ -156,6 +156,8 @@ if [ "${shortname}" == "ts3" ]; then
elif [ "${shortname}" == "mc" ]; then
install_eula.sh
update_minecraft.sh
elif [ "${shortname}" == "mcb" ]; then
update_minecraft_bedrock.sh
elif [ "${shortname}" == "mumble" ]; then
update_mumble.sh
elif [ "${shortname}" == "mta" ]; then

9
lgsm/functions/query_gsquery.py

@ -21,6 +21,7 @@ class gsquery:
idtech2query=['protocol-quake3','idtech2','quake','iw2.0']
idtech3query=['protocol-quake3','iw3.0','ioquake3','qfusion']
minecraftquery=['minecraft','lwjgl2']
minecraftbequery=['minecraftbe']
jc2mpquery=['jc2mp']
mumblequery=['mumbleping']
twquery=['teeworlds']
@ -32,10 +33,12 @@ class gsquery:
self.query_prompt_string = b'\xff\xff\xff\xffstatus\x00'
elif self.option.engine in idtech3query:
self.query_prompt_string = b'\xff\xff\xff\xffgetstatus'
elif self.option.engine in minecraftquery:
self.query_prompt_string = b'\xFE\xFD\x09\x3d\x54\x1f\x93'
elif self.option.engine in jc2mpquery:
self.query_prompt_string = b'\xFE\xFD\x09\x10\x20\x30\x40'
elif self.option.engine in minecraftquery:
self.query_prompt_string = b'\xFE\xFD\x09\x3d\x54\x1f\x93'
elif self.option.engine in minecraftbequery:
self.query_prompt_string = b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78\x00\x00\x00\x00\x00\x00\x00\x00'
elif self.option.engine in mumblequery:
self.query_prompt_string = b'\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08'
elif self.option.engine in unrealquery:
@ -113,7 +116,7 @@ if __name__ == '__main__':
action='store',
dest='engine',
default=False,
help='Engine type: protocol-valve protocol-quake3 protocol-quake3 protocol-gamespy1 protocol-unreal2 minecraft jc2mp mumbleping teeworlds'
help='Engine type: protocol-valve protocol-quake3 protocol-quake3 protocol-gamespy1 protocol-unreal2 minecraft minecraftbe jc2mp mumbleping teeworlds'
)
parser.add_option(
'-v', '--verbose',

2
lgsm/functions/update_minecraft.sh

@ -64,7 +64,7 @@ fn_update_minecraft_localbuild(){
fi
if [ -z "${localbuild}" ]; then
localbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
localbuild=$(grep version "${serverfiles}/logs/latest.log" | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
fi
if [ -z "${localbuild}" ]; then

172
lgsm/functions/update_minecraft_bedrock.sh

@ -0,0 +1,172 @@
#!/bin/bash
# LinuxGSM update_minecraft_bedrock.sh function
# Author: Daniel Gibbs
# Website: https://linuxgsm.com
# Description: Handles updating of Minecraft Bedrock servers.
local commandname="UPDATE"
local commandaction="Update"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_update_minecraft_dl(){
latestmcbuildurl=$(curl -s "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*zip')
fn_fetch_file "${latestmcbuildurl}" "${tmpdir}" "bedrock_server.${remotebuild}.zip"
echo -e "Extracting to ${serverfiles}...\c"
if [ "${installer}" == "1" ]; then
unzip -oq "${tmpdir}/bedrock_server.${remotebuild}.zip" -x "server.properties" -d "${serverfiles}"
else
unzip -oq "${tmpdir}/bedrock_server.${remotebuild}.zip" -x "permissions.json" "server.properties" "whitelist.json" -d "${serverfiles}"
fi
local exitcode=$?
if [ "${exitcode}" == "0" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "Extracting to ${serverfiles}"
chmod u+x "${serverfiles}/bedrock_server"
fn_clear_tmp
else
fn_print_fail_eol_nl
fn_script_log_fatal "Extracting to ${serverfiles}"
core_exit.sh
fi
}
fn_update_minecraft_localbuild(){
# Gets local build info.
fn_print_dots "Checking for update: ${remotelocation}: checking local build"
# Uses log file to gather info.
# Log is generated and cleared on startup but filled on shutdown.
localbuild=$(grep Version $(ls -tr "${consolelogdir}"/* 2>/dev/null) | tail -1 | sed 's/.*Version //')
if [ -z "${localbuild}" ]; then
fn_print_error "Checking for update: ${remotelocation}: checking local build"
fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no log files containing version info"
fn_script_log_error "No log files containing version info"
fn_print_info_nl "Checking for update: ${remotelocation}: checking local build: forcing server restart"
fn_script_log_info "Forcing server restart"
check_status.sh
if [ "${status}" != "0" ]; then
exitbypass=1
command_stop.sh
else
exitbypass=1
command_start.sh
sleep 3
exitbypass=1
command_stop.sh
fi
fi
if [ -z "${localbuild}" ]; then
localbuild=$(grep Version $(ls -tr "${consolelogdir}"/* 2>/dev/null) | tail -1 | sed 's/.*Version //')
fi
if [ -z "${localbuild}" ]; then
localbuild="0"
fn_print_error "Checking for update: ${remotelocation}: waiting for local build: missing local build info"
fn_script_log_error "Missing local build info"
fn_script_log_error "Set localbuild to 0"
else
fn_print_ok "Checking for update: ${remotelocation}: checking local build"
fn_script_log_pass "Checking local build"
fi
}
fn_update_minecraft_remotebuild(){
# Gets remote build info.
remotebuild=$(curl -s "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*' | sed 's/.*\///' | grep -Eo "[.0-9]+[0-9]")
if [ "${installer}" != "1" ]; then
fn_print_dots "Checking for update: ${remotelocation}: checking remote build"
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking for update: ${remotelocation}: checking remote build"
fn_script_log_fatal "Checking remote build"
core_exit.sh
else
fn_print_ok "Checking for update: ${remotelocation}: checking remote build"
fn_script_log_pass "Checking remote build"
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fatal "Unable to get remote build"
core_exit.sh
fi
fi
}
fn_update_minecraft_compare(){
# Removes dots so if statement can compare version numbers.
fn_print_dots "Checking for update: ${remotelocation}"
localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]')
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "Update available"
echo -e "* Local build: ${red}${localbuild}${default}"
echo -e "* Remote build: ${green}${remotebuild}${default}"
fn_script_log_info "Update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuild}"
fn_script_log_info "${localbuild} > ${remotebuild}"
fn_sleep_time
echo -en "\n"
echo -en "applying update.\r"
sleep 1
echo -en "applying update..\r"
sleep 1
echo -en "applying update...\r"
sleep 1
echo -en "\n"
unset updateonstart
check_status.sh
# If server stopped.
if [ "${status}" == "0" ]; then
exitbypass=1
fn_update_minecraft_dl
exitbypass=1
command_start.sh
exitbypass=1
command_stop.sh
# If server started.
else
exitbypass=1
command_stop.sh
exitbypass=1
fn_update_minecraft_dl
exitbypass=1
command_start.sh
fi
alert="update"
alert.sh
else
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "No update available"
echo -e "* Local build: ${green}${localbuild}${default}"
echo -e "* Remote build: ${green}${remotebuild}${default}"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuild}"
fi
}
# The location where the builds are checked and downloaded.
remotelocation="minecraft.net"
if [ "${installer}" == "1" ]; then
fn_update_minecraft_remotebuild
fn_update_minecraft_dl
else
check_status.sh
fn_print_dots "Checking for update: ${remotelocation}"
fn_script_log_info "Checking for update: ${remotelocation}"
fn_update_minecraft_localbuild
fn_update_minecraft_remotebuild
fn_update_minecraft_compare
fi

4
lgsm/functions/update_steamcmd.sh

@ -19,11 +19,11 @@ fn_update_steamcmd_dl(){
cd "${steamcmddir}" || exit
if [ "${appid}" == "90" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta ${branch} +quit | tee -a "${lgsmlog}"
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}"
elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then
${unbuffer} ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${scriptlog}"
else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta ${branch} +quit | tee -a "${lgsmlog}"
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}"
fi
fix.sh
}

10
linuxgsm.sh

@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="v19.11.0"
version="v19.12.2"
shortname="core"
gameservername="core"
rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
@ -357,13 +357,13 @@ 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"
if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
# shellcheck source=/dev/null
source "${configdirserver}/${servicename}.cfg"
source "${configdirserver}/${selfname}.cfg"
else
# shellcheck source=/dev/null
source "${configdirserver}/${servicename}.cfg"
source "${configdirserver}/${selfname}.cfg"
fi
# Load the linuxgsm.sh in to tmpdir. If missing download it.

26
tests/tests_fctrserver.sh

@ -66,8 +66,6 @@ core_functions.sh(){
# 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}"
@ -280,15 +278,15 @@ if [ "$(whoami)" == "root" ]; then
fi
fi
# 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 -e "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
# LinuxGSM installer mode.
if [ "${shortname}" == "core" ]; then
# 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 -e "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then
{
tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}'
@ -380,7 +378,7 @@ else
# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
fn_ansi_loader
# Prevents running of core_exit.sh for Travis-CI.
if [ -z "${travistest}" ]; then
if [ -z "${travistest}" ]; then
getopt=$1
core_getopt.sh
fi
@ -480,6 +478,8 @@ fn_test_result_na(){
fn_print_fail_nl "TEST N/A"
}
sleeptime="0"
echo -e "================================="
echo -e "Travis CI Tests"
echo -e "Linux Game Server Manager"
@ -1011,6 +1011,8 @@ echo -e "Using: ${gamename}"
echo -e "================================="
requiredstatus="OFFLINE"
fn_setstatus
fn_print_info "Tidying up directories."
rm -rfv "${serverfiles}"
if [ ! -v TRAVIS ]; then
fn_print_info "Tidying up directories."
rm -rfv "${serverfiles}"
fi
core_exit.sh

8
tests/tests_jc2server.sh

@ -478,6 +478,8 @@ fn_test_result_na(){
fn_print_fail_nl "TEST N/A"
}
sleeptime="0"
echo -e "================================="
echo -e "Travis CI Tests"
echo -e "Linux Game Server Manager"
@ -1170,6 +1172,8 @@ echo -e "Using: ${gamename}"
echo -e "================================="
requiredstatus="OFFLINE"
fn_setstatus
fn_print_info "Tidying up directories."
rm -rfv "${serverfiles}"
if [ ! -v TRAVIS ]; then
fn_print_info "Tidying up directories."
rm -rfv "${serverfiles}"
fi
core_exit.sh

14
tests/tests_kcov.sh

@ -0,0 +1,14 @@
#!/bin/bash
echo -e "Installing kcov"
curl -L "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shunit2/shunit2-2.1.6.tgz" | tar zx
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
tar xzf master.tar.gz
cd kcov-master || exit
mkdir build
cd build || exit
cmake ..
make
sudo make install
cd ../..
rm -rf kcov-master
mkdir -p coverage

8
tests/tests_mcserver.sh

@ -478,6 +478,8 @@ fn_test_result_na(){
fn_print_fail_nl "TEST N/A"
}
sleeptime="0"
echo -e "================================="
echo -e "Travis CI Tests"
echo -e "Linux Game Server Manager"
@ -1056,6 +1058,8 @@ echo -e "Using: ${gamename}"
echo -e "================================="
requiredstatus="OFFLINE"
fn_setstatus
fn_print_info "Tidying up directories."
rm -rfv "${serverfiles}"
if [ ! -v TRAVIS ]; then
fn_print_info "Tidying up directories."
rm -rfv "${serverfiles}"
fi
core_exit.sh

8
tests/tests_ts3server.sh

@ -478,6 +478,8 @@ fn_test_result_na(){
fn_print_fail_nl "TEST N/A"
}
sleeptime="0"
echo -e "================================="
echo -e "Travis CI Tests"
echo -e "Linux Game Server Manager"
@ -1009,6 +1011,8 @@ echo -e "Using: ${gamename}"
echo -e "================================="
requiredstatus="OFFLINE"
fn_setstatus
fn_print_info "Tidying up directories."
rm -rfv "${serverfiles}"
if [ ! -v TRAVIS ]; then
fn_print_info "Tidying up directories."
rm -rfv "${serverfiles}"
fi
core_exit.sh

Loading…
Cancel
Save