Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(monitor): prepare for gamedig 5 #4510

Merged
merged 24 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lgsm/config-default/config-lgsm/ecoserver/_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ stopmode="2"
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="1"
querytype=""
querymode="3"
querytype="eco"

## Console type
consoleverbose="yes"
Expand Down
2 changes: 1 addition & 1 deletion lgsm/config-default/config-lgsm/jc2server/_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ stopmode="2"
# 4: gsquery
# 5: tcp
querymode="2"
querytype="jc2mp"
querytype="jc2m"

## Console type
consoleverbose="yes"
Expand Down
2 changes: 1 addition & 1 deletion lgsm/config-default/config-lgsm/mcbserver/_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ stopmode="5"
# 4: gsquery
# 5: tcp
querymode="2"
querytype="minecraftbe"
querytype="mbe"

## Console type
consoleverbose="yes"
Expand Down
4 changes: 2 additions & 2 deletions lgsm/config-default/config-lgsm/pwserver/_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ stopmode="2"
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="1"
querytype="1"
querymode="3"
querytype="palworld"

## Console type
consoleverbose="yes"
Expand Down
2 changes: 1 addition & 1 deletion lgsm/config-default/config-lgsm/sampserver/_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ stopmode="2"
# 4: gsquery
# 5: tcp
querymode="3"
querytype="samp"
querytype="gtasam"

## Console type
consoleverbose="no"
Expand Down
2 changes: 1 addition & 1 deletion lgsm/config-default/config-lgsm/sdtdserver/_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ stopmode="8"
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="5"
querymode="2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit regressed #3764. Enabling monitor on 7 Days to Die continually restarts the server

querytype="protocol-valve"

## Console type
Expand Down
4 changes: 2 additions & 2 deletions lgsm/config-default/config-lgsm/squadserver/_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ stopmode="2"
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="2"
querytype="protocol-valve"
querymode="1"
querytype=""

## Console type
consoleverbose="yes"
Expand Down
2 changes: 1 addition & 1 deletion lgsm/config-default/config-lgsm/tiserver/_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
ip="0.0.0.0"
port="7777"
defaultmap="/Game/TheIsle/Maps/Game/Isla_Spiro/Isla_Spiro"
defaultmap="/Game/TheIsle/Maps/Game/Gateway/Gateway"

## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
## Game Server Docs | https://isle.fandom.com/wiki/The_Isle_Server_Settings_and_Configuration
Expand Down
7 changes: 7 additions & 0 deletions lgsm/modules/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,10 @@ for allowed_command in "${allowed_commands_array[@]}"; do
check_system_requirements.sh
fi
done

allowed_commands_array=(DETAILS MONITOR START STOP UPDATE VALIDATE POST-DETAILS)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
check_gamedig.sh
fi
done
15 changes: 15 additions & 0 deletions lgsm/modules/check_gamedig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# LinuxGSM check_gamedig.sh module
# Author: Daniel Gibbs
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Installs nodejs and gamedig

if [ "$(command -v node)" ] && [ "$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1)" -ge 16 ] && [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then
echo -e ""
echo -e "${bold}${lightyellow}Installing Gamedig${default}"
fn_script_log_info "Installing Gamedig"
cd "${lgsmdir}" || exit
wget -N --no-check-certificate "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${githubbranch}/package.json"
npm install
fi
8 changes: 4 additions & 4 deletions lgsm/modules/check_ip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@ function fn_is_valid_ip() {

# If the IP variable has been set by user.
if fn_is_valid_ip "${ip}"; then
queryips=("${ip}")
queryips=("${ip}" "${publicip}")
httpip=("${ip}")
telnetip=("${ip}")
# If the game config has an IP set.
elif fn_is_valid_ip "${configip}"; then
queryips=("${configip}")
queryips=("${configip}" "${publicip}")
ip="${configip}"
httpip=("${configip}")
telnetip=("${configip}")
# If there is only 1 server IP address.
# Some IP details can automatically use the one IP.
elif [ "${#current_ips[@]}" == "1" ]; then
queryips=("127.0.0.1" "${current_ips[@]}")
queryips=("127.0.0.1" "${current_ips[@]}" "${publicip}")
ip="0.0.0.0"
httpip=("${current_ips[@]}")
telnetip=("${current_ips[@]}")
# If no ip is set by the user and server has more than one IP.
else
queryips=("127.0.0.1" "${current_ips[@]}")
queryips=("127.0.0.1" "${current_ips[@]}" "${publicip}")
ip="0.0.0.0"
httpip=("${ip}")
telnetip=("${ip}")
Expand Down
2 changes: 1 addition & 1 deletion lgsm/modules/command_dev_query_raw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ echo -e ""
echo -e "${lightgreen}Gamedig Raw Output${default}"
fn_messages_separator
echo -e ""
if [ ! "$(command -v gamedig 2> /dev/null)" ]; then
if [ ! "$(command -v gamedig 2> /dev/null)" ] || [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then
fn_print_failure_nl "gamedig not installed"
fi
if [ ! "$(command -v jq 2> /dev/null)" ]; then
Expand Down
3 changes: 3 additions & 0 deletions lgsm/modules/command_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ else
install_server_files.sh
fi

# Install gamedig
check_gamedig.sh

# Configuration.
install_config.sh
if [ -v gslt ]; then
Expand Down
2 changes: 1 addition & 1 deletion lgsm/modules/command_monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ fn_monitor_loop() {
for querymethod in "${query_methods_array[@]}"; do
# Will check if gamedig is installed and bypass if not.
if [ "${querymethod}" == "gamedig" ]; then
if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then
if [ "$(command -v gamedig 2> /dev/null)" ] || [ -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ] && [ "$(command -v jq 2> /dev/null)" ]; then
if [ -z "${monitorpass}" ]; then
fn_monitor_query
fi
Expand Down
1 change: 1 addition & 0 deletions lgsm/modules/command_update_linuxgsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fn_firstcommand_set
fn_print_dots ""
check.sh
info_distro.sh
info_game.sh

fn_script_log_info "Updating LinuxGSM"

Expand Down
5 changes: 5 additions & 0 deletions lgsm/modules/core_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,11 @@ install_factorio_save.sh() {
fn_fetch_module
}

check_gamedig.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
}

install_dst_token.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
Expand Down
2 changes: 1 addition & 1 deletion lgsm/modules/fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn_apply_fix() {
fi
}

apply_pre_start_fix=(arma3 armar ark av bt bo csgo cmw dst hw ins kf nmrih onset pvr rust rw samp sdtd sfc sof2 squad st tf2 terraria ts3 mcb mta unt vh wurm zmr)
apply_pre_start_fix=(arma3 armar ark av bt bo csgo cmw dst hw ins kf nmrih onset pvr ro rust rw samp sdtd sfc sof2 squad st tf2 terraria ts3 mcb mta unt vh wurm zmr)
apply_post_install_fix=(av kf kf2 ro ut2k4 ut ut3)

# validate registered fixes for safe development
Expand Down
134 changes: 106 additions & 28 deletions lgsm/modules/fix_ro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,115 @@
# Author: Daniel Gibbs
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Resolves issues with Red Orchestra.
# Description: Resolves issues with Red Orchestra: Ostfront 41-45.

moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

echo -e "applying webinterface ROOst.css fix."
echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
# echo -e "applying WebAdmin ROOst.css fix."
# echo -e "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"
fn_sleep_time
echo -e "applying webinterface CharSet fix."
echo -e "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
# echo -e "applying WebAdmin CharSet fix."
# echo -e "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/uweb.int"
fn_sleep_time
echo -e "applying Steam AppID fix."
sed -i 's/1210/1200/g' "${systemdir}/steam_appid.txt"
fn_sleep_time
echo -e "applying server name fix."
fn_sleep_time
echo -e "forcing server restart..."
fn_sleep_time
exitbypass=1
command_start.sh
fn_firstcommand_reset
fn_sleep_time_5
exitbypass=1
command_stop.sh
fn_firstcommand_reset
exitbypass=1
command_start.sh
fn_firstcommand_reset
fn_sleep_time_5
exitbypass=1
command_stop.sh
fn_firstcommand_reset

# get md5sum of steamclient.so
if [ -f "${serverfiles}/system/steamclient.so" ]; then
steamclientmd5=$(md5sum "${serverfiles}/system/steamclient.so" | awk '{print $1;}')
fi
#get md5sum of libtier0_s.so
if [ -f "${serverfiles}/system/libtier0_s.so" ]; then
libtier0_smd5=$(md5sum "${serverfiles}/system/libtier0_s.so" | awk '{print $1;}')
fi
#get md5sum of libvstdlib_s.so
if [ -f "${serverfiles}/system/libvstdlib_s.so" ]; then
libvstdlib_smd5=$(md5sum "${serverfiles}/system/libvstdlib_s.so" | awk '{print $1;}')
fi

# get md5sum of steamclient.so from steamcmd
if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
steamcmdsteamclientmd5=$(md5sum "${HOME}/.steam/steamcmd/linux32/steamclient.so" | awk '{print $1;}')
elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
steamcmdsteamclientmd5=$(md5sum "${steamcmddir}/linux32/steamclient.so" | awk '{print $1;}')
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" ]; then
steamcmdsteamclientmd5=$(md5sum "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" | awk '{print $1;}')
fi

# get md5sum of libtier0_s.so from steamcmd
if [ -f "${HOME}/.steam/steamcmd/linux32/libtier0_s.so" ]; then
steamcmdlibtier0_smd5=$(md5sum "${HOME}/.steam/steamcmd/linux32/libtier0_s.so" | awk '{print $1;}')
elif [ -f "${steamcmddir}/linux32/libtier0_s.so" ]; then
steamcmdlibtier0_smd5=$(md5sum "${steamcmddir}/linux32/libtier0_s.so" | awk '{print $1;}')
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/libtier0_s.so" ]; then
steamcmdlibtier0_smd5=$(md5sum "${HOME}/.local/share/Steam/steamcmd/linux32/libtier0_s.so" | awk '{print $1;}')
fi

# get md5sum of libvstdlib_s.so from steamcmd
if [ -f "${HOME}/.steam/steamcmd/linux32/libvstdlib_s.so" ]; then
steamcmdlibvstdlib_smd5=$(md5sum "${HOME}/.steam/steamcmd/linux32/libvstdlib_s.so" | awk '{print $1;}')
elif [ -f "${steamcmddir}/linux32/libvstdlib_s.so" ]; then
steamcmdlibvstdlib_smd5=$(md5sum "${steamcmddir}/linux32/libvstdlib_s.so" | awk '{print $1;}')
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/libvstdlib_s.so" ]; then
steamcmdlibvstdlib_smd5=$(md5sum "${HOME}/.local/share/Steam/steamcmd/linux32/libvstdlib_s.so" | awk '{print $1;}')
fi

if [ ! -f "${serverfiles}/system/steamclient.so" ] || [ "${steamcmdsteamclientmd5}" != "${steamclientmd5}" ]; then
fixname="steamclient.so x86"
fn_fix_msg_start
if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/system/steamclient.so"
elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
cp "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/system/steamclient.so"
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" ]; then
cp "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" "${serverfiles}/system/steamclient.so"
fi
fn_fix_msg_end
fi

if [ ! -f "${serverfiles}/system/libtier0_s.so" ] || [ "${steamcmdlibtier0_smd5}" != "${libtier0_smd5}" ]; then
fixname="libtier0_s.so"
fn_fix_msg_start
if [ -f "${HOME}/.steam/steamcmd/linux32/libtier0_s.so" ]; then
cp "${HOME}/.steam/steamcmd/linux32/libtier0_s.so" "${serverfiles}/system/libtier0_s.so"
elif [ -f "${steamcmddir}/linux32/libtier0_s.so" ]; then
cp "${steamcmddir}/linux32/libtier0_s.so" "${serverfiles}/system/libtier0_s.so"
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/libtier0_s.so" ]; then
cp "${HOME}/.local/share/Steam/steamcmd/linux32/libtier0_s.so" "${serverfiles}/system/libtier0_s.so"
fi
fn_fix_msg_end
fi

if [ ! -f "${serverfiles}/system/libvstdlib_s.so" ] || [ "${steamcmdlibvstdlib_smd5}" != "${libvstdlib_smd5}" ]; then
fixname="libvstdlib_s.so"
fn_fix_msg_start
if [ -f "${HOME}/.steam/steamcmd/linux32/libvstdlib_s.so" ]; then
cp "${HOME}/.steam/steamcmd/linux32/libvstdlib_s.so" "${serverfiles}/system/libvstdlib_s.so"
elif [ -f "${steamcmddir}/linux32/libvstdlib_s.so" ]; then
cp "${steamcmddir}/linux32/libvstdlib_s.so" "${serverfiles}/system/libvstdlib_s.so"
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/libvstdlib_s.so" ]; then
cp "${HOME}/.local/share/Steam/steamcmd/linux32/libvstdlib_s.so" "${serverfiles}/system/libvstdlib_s.so"
fi
fn_fix_msg_end
fi

# if running install command
if [ "${commandname}" == "INSTALL" ]; then
echo -e "applying server name fix."
fn_sleep_time
echo -e "forcing server restart..."
fn_sleep_time
exitbypass=1
command_start.sh
fn_firstcommand_reset
fn_sleep_time_5
exitbypass=1
command_stop.sh
fn_firstcommand_reset
exitbypass=1
command_start.sh
fn_firstcommand_reset
fn_sleep_time_5
exitbypass=1
command_stop.sh
fn_firstcommand_reset
fi
4 changes: 4 additions & 0 deletions lgsm/modules/info_game.sh
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ fn_info_game_pvr() {
fn_info_game_pw() {
servername="${servername:-"NOT SET"}"
port="${port:-"0"}"
queryport="${port:-"0"}"
steamport="${steamport:-"0"}"
unknownport="1985"
}
Expand Down Expand Up @@ -1242,6 +1243,7 @@ fn_info_game_eco() {
fn_info_game_json "httpport" ".WebServerPort"
fn_info_game_json "maxplayers" ".MaxConnections"
fn_info_game_json "port" ".GameServerPort"
fn_info_game_json "rconport" ".RconServerPort"
fn_info_game_json "servername" ".Description"
fn_info_game_json "serverpassword" ".Password"
fn_info_game_json "tickrate" ".Rate"
Expand All @@ -1250,6 +1252,8 @@ fn_info_game_eco() {
httpport="${httpport:-"0"}"
maxplayers="${maxplayers:-"0"}"
port="${port:-"0"}"
queryport="${port:-"0"}"
rconport="${rconport:-"0"}"
servername="${servername:-"NOT SET"}"
serverpassword="${serverpassword:-"NOT SET"}"
tickrate="${tickrate:-"0"}"
Expand Down
4 changes: 4 additions & 0 deletions lgsm/modules/info_messages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ fn_info_messages_ports() {
portcommand="ss -tuplwn | grep AvorionServer"
elif [ "${shortname}" == "bf1942" ]; then
portcommand="ss -tuplwn | grep bf1942_lnxded"
elif [ "${shortname}" == "bfv" ]; then
portcommand="ss -tuplwn | grep bfv_linded"
elif [ "${shortname}" == "dayz" ]; then
portcommand="ss -tuplwn | grep enfMain"
elif [ "${shortname}" == "q4" ]; then
Expand Down Expand Up @@ -1015,7 +1017,9 @@ fn_info_messages_eco() {
{
fn_port "header"
fn_port "Game" port udp
fn_port "Query" queryport udp
fn_port "Web Interface" httpport tcp
fn_port "RCON" rconport tcp
} | column -s $'\t' -t
}

Expand Down
Loading