Browse Source

feat(hytserver): add Hytale server support

pull/4928/head
Andrew dos Santos 2 weeks ago
parent
commit
11c14fcd36
  1. 188
      lgsm/config-default/config-lgsm/hytserver/_default.cfg
  2. 1
      lgsm/data/almalinux-8.csv
  3. 1
      lgsm/data/almalinux-9.csv
  4. 1
      lgsm/data/centos-7.csv
  5. 1
      lgsm/data/centos-8.csv
  6. 1
      lgsm/data/centos-9.csv
  7. 1
      lgsm/data/debian-10.csv
  8. 1
      lgsm/data/debian-11.csv
  9. 1
      lgsm/data/debian-12.csv
  10. 1
      lgsm/data/debian-13.csv
  11. 1
      lgsm/data/debian-9.csv
  12. BIN
      lgsm/data/gameicons/hyt-icon.png
  13. 1
      lgsm/data/rhel-7.csv
  14. 1
      lgsm/data/rhel-8.csv
  15. 1
      lgsm/data/rhel-9.csv
  16. 1
      lgsm/data/rocky-8.csv
  17. 1
      lgsm/data/rocky-9.csv
  18. 1
      lgsm/data/serverlist.csv
  19. 1
      lgsm/data/ubuntu-16.04.csv
  20. 1
      lgsm/data/ubuntu-18.04.csv
  21. 1
      lgsm/data/ubuntu-20.04.csv
  22. 1
      lgsm/data/ubuntu-22.04.csv
  23. 1
      lgsm/data/ubuntu-23.04.csv
  24. 1
      lgsm/data/ubuntu-23.10.csv
  25. 1
      lgsm/data/ubuntu-24.04.csv
  26. 1
      lgsm/data/ubuntu-26.04.csv
  27. 11
      lgsm/modules/check_deps.sh
  28. 2
      lgsm/modules/check_system_requirements.sh
  29. 2
      lgsm/modules/command_check_update.sh
  30. 2
      lgsm/modules/command_update.sh
  31. 4
      lgsm/modules/core_getopt.sh
  32. 5
      lgsm/modules/core_modules.sh
  33. 15
      lgsm/modules/info_game.sh
  34. 13
      lgsm/modules/info_messages.sh
  35. 3
      lgsm/modules/install_config.sh
  36. 2
      lgsm/modules/install_server_files.sh
  37. 264
      lgsm/modules/update_hyt.sh

188
lgsm/config-default/config-lgsm/hytserver/_default.cfg

@ -0,0 +1,188 @@
##################################
######## 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 ####
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
ip="0.0.0.0"
port="5520"
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
startparameters="--bind ${ip}:${port}"
## Release Settings
# Patchline (release|pre-release)
hytalepatchline="release"
#### 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"
# Alert on Start/Stop/Restart
statusalert="off"
# 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=""
# Gotify Alerts | https://docs.linuxgsm.com/alerts/gotify
gotifyalert="off"
gotifytoken="token"
gotifywebhook="webhook"
# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
iftttalert="off"
ifttttoken="accesstoken"
iftttevent="linuxgsm_alert"
# ntfy Alerts | https://docs.linuxgsm.com/alerts/ntfy
ntfyalert="off"
ntfytopic="LinuxGSM"
ntfyserver="https://ntfy.sh"
ntfytoken=""
ntfyusername=""
ntfypassword=""
ntfypriority=""
ntfytags=""
# 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"
pushoveruserkey="userkey"
# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat
rocketchatalert="off"
rocketchatwebhook="webhook"
# 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) in "curlcustomstring".
# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help all".
telegramapi="api.telegram.org"
telegramalert="off"
telegramtoken="accesstoken"
telegramchatid=""
telegramthreadid=""
telegramsilentnotification="false"
curlcustomstring=""
## Updating | https://docs.linuxgsm.com/commands/update
updateonstart="off"
## Backup | https://docs.linuxgsm.com/commands/backup
maxbackups="4"
maxbackupdays="30"
stoponbackup="on"
## Logging | https://docs.linuxgsm.com/features/logging
consolelogging="on"
logdays="7"
## Monitor | https://docs.linuxgsm.com/commands/monitor
# Query delay time
querydelay="1"
## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
ansi="on"
#### Advanced Settings ####
## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
sleeptime="0.5"
## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
# 1: tmux kill
# 2: CTRL+c
# 3: quit
# 4: quit 120s
# 5: stop
# 6: q
# 7: exit
# 8: 7 Days to Die
# 9: GoldSrc
# 10: Avorion
# 11: end
stopmode="5"
## Query mode
# 1: session only
# 2: gamedig (gsquery fallback)
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="1"
querytype=""
## Console type
consoleverbose="yes"
consoleinteract="yes"
## Game Server Details
# Do not edit
gamename="Hytale"
engine="hytale"
glibc="null"
#### Directories ####
# Edit with care
## Game Server Directories
systemdir="${serverfiles}/Server"
executabledir="${serverfiles}"
executable="./start.sh"
servercfgdir="${systemdir}"
servercfg="config.json"
servercfgdefault="config.json"
servercfgfullpath="${servercfgdir}/${servercfg}"
## Backup Directory
backupdir="${lgsmdir}/backup"
## Logging Directories
[ -n "${LGSM_LOGDIR}" ] && logdir="${LGSM_LOGDIR}" || logdir="${rootdir}/log"
gamelogdir="${systemdir}/logs"
lgsmlogdir="${logdir}/script"
consolelogdir="${logdir}/console"
lgsmlog="${lgsmlogdir}/${selfname}-script.log"
consolelog="${consolelogdir}/${selfname}-console.log"
alertlog="${lgsmlogdir}/${selfname}-alert.log"
postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
## Logs Naming
lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
## Log Parameters
logtimestamp="off"
logtimestampformat="%Y-%m-%d %H:%M:%S"

1
lgsm/data/almalinux-8.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/almalinux-9.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/centos-7.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/centos-8.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/centos-9.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-10.csv

@ -53,6 +53,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 4.

1
lgsm/data/debian-11.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-12.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-13.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-9.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

BIN
lgsm/data/gameicons/hyt-icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

1
lgsm/data/rhel-7.csv

@ -55,6 +55,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rhel-8.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rhel-9.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rocky-8.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rocky-9.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,zlib-devel
hyt,java-25-openjdk
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/serverlist.csv

@ -53,6 +53,7 @@ hl2dm,hl2dmserver,Half-Life 2: Deathmatch,ubuntu-24.04
hldm,hldmserver,Half-Life: Deathmatch,ubuntu-24.04
hldms,hldmsserver,Half-Life Deathmatch: Source,ubuntu-24.04
hw,hwserver,Hurtworld,ubuntu-24.04
hyt,hytserver,Hytale,ubuntu-24.04
hz,hzserver,Humanitz,ubuntu-24.04
ins,insserver,Insurgency,ubuntu-24.04
inss,inssserver,Insurgency: Sandstorm,ubuntu-24.04

Can't render this file because it has a wrong number of fields in line 47.

1
lgsm/data/ubuntu-16.04.csv

@ -55,6 +55,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-18.04.csv

@ -55,6 +55,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-20.04.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-22.04.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-23.04.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-23.10.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-24.04.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-26.04.csv

@ -54,6 +54,7 @@ hl2dm
hldm
hldms
hw,lib32z1
hyt,openjdk-25-jre
hz
ins
inss

Can't render this file because it has a wrong number of fields in line 2.

11
lgsm/modules/check_deps.sh

@ -277,9 +277,14 @@ fn_deps_detector() {
elif [[ ${deptocheck} == "openjdk"* ]] || [[ ${deptocheck} == "java"* ]]; then
# Is java already installed?
if [ -n "${javaversion}" ]; then
# Added for users using Oracle JRE to bypass check.
depstatus=0
deptocheck="${javaversion}"
javamajorversion="$(echo "${javaversion}" | grep -Eo 'version "[0-9]+' | grep -Eo '[0-9]+' | head -1)"
if [ "${shortname}" == "hyt" ] && { [ -z "${javamajorversion}" ] || [ "${javamajorversion}" -lt "25" ]; }; then
depstatus=1
else
# Added for users using Oracle JRE to bypass check.
depstatus=0
deptocheck="${javaversion}"
fi
else
depstatus=1
fi

2
lgsm/modules/check_system_requirements.sh

@ -31,6 +31,8 @@ elif [ "${shortname}" == "dodr" ]; then
ramrequirementgb="2"
elif [ "${shortname}" == "hw" ]; then
ramrequirementgb="3"
elif [ "${shortname}" == "hyt" ]; then
ramrequirementgb="4"
elif [ "${shortname}" == "mc" ]; then
ramrequirementgb="1"
elif [ "${shortname}" == "pmc" ]; then

2
lgsm/modules/command_check_update.sh

@ -24,6 +24,8 @@ elif [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortna
update_pmc.sh
elif [ "${shortname}" == "fctr" ]; then
update_fctr.sh
elif [ "${shortname}" == "hyt" ]; then
update_hyt.sh
elif [ "${shortname}" == "mta" ]; then
update_mta.sh
elif [ "${shortname}" == "jk2" ]; then

2
lgsm/modules/command_update.sh

@ -25,6 +25,8 @@ elif [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortna
update_pmc.sh
elif [ "${shortname}" == "fctr" ]; then
update_fctr.sh
elif [ "${shortname}" == "hyt" ]; then
update_hyt.sh
elif [ "${shortname}" == "mta" ]; then
update_mta.sh
elif [ "${shortname}" == "jk2" ]; then

4
lgsm/modules/core_getopt.sh

@ -69,8 +69,8 @@ currentopt+=("${cmd_update_linuxgsm[@]}")
if [ "${shortname}" == "jk2" ] || [ "${shortname}" == "etl" ] || [ "${engine}" != "idtech3" ]; then
if [ "${shortname}" != "bf1942" ] && [ "${shortname}" != "bfv" ] && [ "${engine}" != "idtech2" ] && [ "${engine}" != "iw2.0" ] && [ "${engine}" != "iw3.0" ] && [ "${engine}" != "quake" ] && [ "${shortname}" != "samp" ] && [ "${shortname}" != "ut2k4" ]; then
currentopt+=("${cmd_update[@]}" "${cmd_check_update[@]}")
# force update for SteamCMD or Multi Theft Auto only.
if [ "${appid}" ] || [ "${shortname}" == "mta" ]; then
# force update for SteamCMD, Multi Theft Auto or Hytale only.
if [ "${appid}" ] || [ "${shortname}" == "mta" ] || [ "${shortname}" == "hyt" ]; then
currentopt+=("${cmd_force_update[@]}")
fi
fi

5
lgsm/modules/core_modules.sh

@ -670,6 +670,11 @@ update_fctr.sh() {
fn_fetch_module
}
update_hyt.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
}
update_jk2.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module

15
lgsm/modules/info_game.sh

@ -1350,6 +1350,19 @@ fn_info_game_hz() {
servername="${servername:-"NOT SET"}"
}
# Config Type: json
# Parameters: true
# Comment:
# Example: "ServerName": "SERVERNAME"
# Filetype: json
fn_info_game_hyt() {
configtype="json"
configip="${ip:-"0.0.0.0"}"
port="${port:-"5520"}"
queryport="${port}"
servername="${servername:-"NOT SET"}"
}
# Config Type: parameters
# Parameters: true
# Comment:
@ -2375,6 +2388,8 @@ elif [ "${shortname}" == "hw" ]; then
fn_info_game_hw
elif [ "${shortname}" == "hz" ]; then
fn_info_game_hz
elif [ "${shortname}" == "hyt" ]; then
fn_info_game_hyt
elif [ "${shortname}" == "inss" ]; then
fn_info_game_inss
elif [ "${shortname}" == "jc2" ]; then

13
lgsm/modules/info_messages.sh

@ -730,7 +730,7 @@ fn_info_messages_ports_edit() {
fi
done
# engines/games that require editing the start parameters.
local ports_edit_array=("av" "ck" "col" "cs2" "fctr" "goldsrc" "hcu" "hw" "iw3.0" "ioquake3" "pw" "qfusion" "rust" "scpsl" "scpslsm" "sf" "sol" "spark" "source" "unreal4" "arma3" "dayz" "unt" "vh")
local ports_edit_array=("av" "ck" "col" "cs2" "fctr" "goldsrc" "hcu" "hw" "hyt" "iw3.0" "ioquake3" "pw" "qfusion" "rust" "scpsl" "scpslsm" "sf" "sol" "spark" "source" "unreal4" "arma3" "dayz" "unt" "vh")
for port_edit in "${ports_edit_array[@]}"; do
if [ "${engine}" == "${port_edit}" ] || [ "${gamename}" == "${port_edit}" ] || [ "${shortname}" == "${port_edit}" ]; then
startparameterslocation="${configdirserver}"
@ -754,7 +754,7 @@ fn_info_messages_ports() {
portcommand="ss -tuplwn | grep enfMain"
elif [ "${shortname}" == "q4" ]; then
portcommand="ss -tuplwn | grep q4ded.x86"
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "nec" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then
elif [ "${shortname}" == "hyt" ] || [ "${shortname}" == "mc" ] || [ "${shortname}" == "nec" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then
portcommand="ss -tuplwn | grep java"
elif [ "${shortname}" == "terraria" ]; then
portcommand="ss -tuplwn | grep Main"
@ -1131,6 +1131,13 @@ fn_info_messages_hz() {
} | column -s $'\t' -t
}
fn_info_messages_hyt() {
{
fn_port "header"
fn_port "Game" port udp
} | column -s $'\t' -t
}
fn_info_messages_ins() {
{
fn_port "header"
@ -1860,6 +1867,8 @@ fn_info_messages_select_engine() {
fn_info_messages_hw
elif [ "${shortname}" == "hz" ]; then
fn_info_messages_hz
elif [ "${shortname}" == "hyt" ]; then
fn_info_messages_hyt
elif [ "${shortname}" == "ins" ]; then
fn_info_messages_ins
elif [ "${shortname}" == "inss" ]; then

3
lgsm/modules/install_config.sh

@ -520,6 +520,9 @@ elif [ "${shortname}" == "hl2dm" ]; then
elif [ "${shortname}" == "hz" ]; then
# Config is generated on first run
:
elif [ "${shortname}" == "hyt" ]; then
# Config is generated on first run
:
elif [ "${shortname}" == "ins" ]; then
array_configs+=(server.cfg)
fn_default_config_remote

2
lgsm/modules/install_server_files.sh

@ -256,6 +256,8 @@ elif [ "${shortname}" == "mta" ]; then
elif [ "${shortname}" == "fctr" ]; then
update_fctr.sh
install_factorio_save.sh
elif [ "${shortname}" == "hyt" ]; then
update_hyt.sh
elif [ "${shortname}" == "jk2" ]; then
update_jk2.sh
elif [ "${shortname}" == "vints" ]; then

264
lgsm/modules/update_hyt.sh

@ -0,0 +1,264 @@
#!/bin/bash
# LinuxGSM update_hyt.sh module
# Author: Andrew dos Santos
# Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Handles updating of Hytale servers.
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_update_hyt_downloader_arch() {
case "${arch}" in
x86_64 | amd64)
hytaledownloaderfile="hytale-downloader-linux-amd64"
;;
aarch64 | arm64)
fn_print_failure "Hytale supports arm64 servers, but the official downloader archive currently used by LinuxGSM does not include a Linux arm64 downloader."
fn_script_log_fail "Unsupported Hytale downloader architecture: ${arch}"
core_exit.sh
;;
*)
fn_print_failure "Unknown or unsupported hytale-downloader architecture: ${arch}"
fn_script_log_fail "Unknown or unsupported hytale-downloader architecture: ${arch}"
core_exit.sh
;;
esac
hytaledownloader="${serverfiles}/${hytaledownloaderfile}"
}
fn_update_downloader() {
fn_update_hyt_downloader_arch
if [ ! -f "${hytaledownloader}" ] || [ "${forceupdate}" == "1" ]; then
fn_fetch_file "https://downloader.hytale.com/hytale-downloader.zip" "" "" "" "${tmpdir}" "hytale-downloader.zip" "nochmodx" "norun" "forcedl" "nohash"
echo -en "extracting hytale-downloader..."
unzip -oq "${tmpdir}/hytale-downloader.zip" "${hytaledownloaderfile}" "QUICKSTART.md" -d "${serverfiles}"
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fail "Extracting hytale-downloader"
core_exit.sh
else
chmod +x "${hytaledownloader}"
fn_print_ok_eol_nl
fn_script_log_pass "Extracting hytale-downloader"
fi
fi
}
fn_update_hyt_patchline_args() {
hytalepatchline="${hytalepatchline:-release}"
hytalepatchlineargs=()
if [ "${hytalepatchline}" != "release" ]; then
hytalepatchlineargs=(-patchline "${hytalepatchline}")
fi
}
fn_update_extract() {
extractdir="${tmpdir}/hytale-game"
rm -rf "${extractdir:?}"
mkdir -p "${extractdir}"
echo -en "extracting ${remotebuildfilename}..."
unzip -oq "${tmpdir}/${remotebuildfilename}" -d "${extractdir}"
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fail "Extracting ${remotebuildfilename}"
core_exit.sh
fi
if [ -d "${extractdir}/game/Server" ]; then
extractedroot="${extractdir}/game"
else
extractedroot="${extractdir}"
fi
mkdir -p "${serverfiles}"
if [ "${firstcommandname}" == "INSTALL" ]; then
cp -a "${extractedroot}/." "${serverfiles}/"
else
for item in "${extractedroot}"/*; do
[ -e "${item}" ] || continue
itemname="$(basename "${item}")"
case "${itemname}" in
Server | .hytale-downloader-credentials.json)
continue
;;
jvm.options)
if [ -f "${serverfiles}/jvm.options" ]; then
continue
fi
;;
esac
cp -a "${item}" "${serverfiles}/"
done
mkdir -p "${serverfiles}/Server"
for item in "${extractedroot}/Server"/*; do
[ -e "${item}" ] || continue
itemname="$(basename "${item}")"
case "${itemname}" in
backups | bans.json | config.json | logs | mods | permissions.json | universe | whitelist.json)
continue
;;
esac
cp -a "${item}" "${serverfiles}/Server/"
done
fi
[ -f "${serverfiles}/start.sh" ] && chmod +x "${serverfiles}/start.sh"
fn_print_ok_eol_nl
fn_script_log_pass "Extracting ${remotebuildfilename}"
rm -rf "${extractdir:?}"
}
fn_update_dl() {
fn_update_downloader
fn_update_hyt_patchline_args
remotebuildfilename="hytale-server-${remotebuild:-latest}.zip"
echo -e "downloading file [ ${italic}${remotebuildfilename}${default} ]"
fn_sleep_time
cd "${serverfiles}" || exit
"${hytaledownloader}" -download-path "${tmpdir}/${remotebuildfilename}" "${hytalepatchlineargs[@]}" -skip-update-check
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_failure_nl "Downloading ${remotebuildfilename}"
fn_script_log_fail "Downloading ${remotebuildfilename}"
core_exit.sh
fi
fn_update_extract
if [ -n "${remotebuild}" ]; then
echo "${remotebuild}" > "${localbuildfile}"
fi
fn_clear_tmp
}
fn_update_hyt_check_localbuild_tracking() {
if [ -f "${localbuildfile}" ] && [ -f "${serverfiles}/Server/HytaleServer.jar" ] && [ "${serverfiles}/Server/HytaleServer.jar" -nt "${localbuildfile}" ]; then
fn_print_warn_nl "Hytale server files are newer than LinuxGSM build tracking"
echo -e "* Hytale may have updated itself outside LinuxGSM."
echo -e "* Run ./${selfname} update to refresh LinuxGSM version tracking."
fn_script_log_warn "Hytale server files are newer than LinuxGSM build tracking"
fi
}
fn_update_localbuild() {
fn_print_dots "Checking local build: ${remotelocation}"
if [ -f "${localbuildfile}" ]; then
localbuild="$(cat "${localbuildfile}")"
fi
if [ -z "${localbuild}" ]; then
fn_print_error "Checking local build: ${remotelocation}: missing local build info"
fn_script_log_error "Missing local build info"
fn_script_log_error "Set localbuild to 0"
localbuild="0"
else
fn_print_ok "Checking local build: ${remotelocation}"
fn_script_log_pass "Checking local build"
fn_update_hyt_check_localbuild_tracking
fi
}
fn_update_remotebuild() {
fn_update_downloader
fn_update_hyt_patchline_args
cd "${serverfiles}" || exit
remotebuildresponsefile="${tmpdir}/hytale-print-version-response.txt"
rm -f "${remotebuildresponsefile}"
"${hytaledownloader}" -print-version "${hytalepatchlineargs[@]}" -skip-update-check 2>&1 | tee "${remotebuildresponsefile}"
exitcode=${PIPESTATUS[0]}
remotebuildresponse="$(cat "${remotebuildresponsefile}")"
if [ -f "${lgsmlog}" ]; then
cat "${remotebuildresponsefile}" >> "${lgsmlog}"
fi
remotebuild=$(echo "${remotebuildresponse}" | grep -Eo "[0-9]{4}\.[0-9]{2}\.[0-9]{2}-[A-Za-z0-9]+" | tail -1)
if [ -z "${remotebuild}" ]; then
remotebuild=$(echo "${remotebuildresponse}" | tail -1)
fi
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
if [ "${exitcode}" -ne 0 ] || [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
else
fn_print_ok "Checking remote build: ${remotelocation}"
fn_script_log_pass "Checking remote build"
fi
else
if [ "${exitcode}" -ne 0 ] || [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
fi
fi
}
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
fn_print_nl "* Patchline: ${hytalepatchline}"
fn_print "\n"
fn_script_log_info "Update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuild}"
fn_script_log_info "Patchline: ${hytalepatchline}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
unset updateonstart
check_status.sh
if [ "${status}" == "0" ]; then
fn_update_dl
else
fn_print_restart_warning
exitbypass=1
command_stop.sh
fn_firstcommand_reset
exitbypass=1
fn_update_dl
exitbypass=1
command_start.sh
fn_firstcommand_reset
fi
unset exitbypass
alert="update"
elif [ "${commandname}" == "CHECK-UPDATE" ]; then
alert="check-update"
fi
alert.sh
else
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
fn_print_nl "* Patchline: ${hytalepatchline}"
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuild}"
fn_script_log_info "Patchline: ${hytalepatchline}"
fi
}
info_distro.sh
localbuildfile="${datadir}/${selfname}-hytale-version"
remotelocation="hytale.com"
if [ "${firstcommandname}" == "INSTALL" ]; then
fn_update_remotebuild
fn_update_dl
else
fn_print_dots "Checking for update"
fn_print_dots "Checking for update: ${remotelocation}"
fn_script_log_info "Checking for update: ${remotelocation}"
fn_update_localbuild
fn_update_remotebuild
fn_update_compare
fi
Loading…
Cancel
Save