committed by
GitHub
38 changed files with 529 additions and 8 deletions
@ -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" |
||||
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 4.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
After Width: | Height: | Size: 146 B |
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 47.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
@ -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…
Reference in new issue