diff --git a/lgsm/config-default/config-lgsm/jk2server/_default.cfg b/lgsm/config-default/config-lgsm/jk2server/_default.cfg index f238c45fe4..44bde3a951 100644 --- a/lgsm/config-default/config-lgsm/jk2server/_default.cfg +++ b/lgsm/config-default/config-lgsm/jk2server/_default.cfg @@ -14,7 +14,7 @@ steampass='password' ## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters ip="0.0.0.0" -port="27960" +port="28070" defaultmap="ffa_bespin" ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters diff --git a/lgsm/config-default/config-lgsm/jk3server/_default.cfg b/lgsm/config-default/config-lgsm/jk3server/_default.cfg new file mode 100644 index 0000000000..746650f161 --- /dev/null +++ b/lgsm/config-default/config-lgsm/jk3server/_default.cfg @@ -0,0 +1,189 @@ +################################## +######## 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 #### + +## SteamCMD Login | https://docs.linuxgsm.com/steamcmd#steamcmd-login +steamuser="username" +steampass='password' + +## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters +ip="0.0.0.0" +port="29070" +defaultmap="mp/ffa3" + +## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +startparameters="+set sv_punkbuster 0 +set fs_basepath ${serverfiles} +set net_ip ${ip} +set net_port ${port} +exec ${servercfg} +map ${defaultmap}" + +#### 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@example.com" +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" + +# 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". +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" + +## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd +# Server appid +appid="6020" +steamcmdforcewindows="yes" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" +betapassword="" +# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server +steammaster="true" + +## 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="3" + +## Query mode +# 1: session only +# 2: gamedig (gsquery fallback) +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="2" +querytype="protocol-quake3" + +## Console type +consoleverbose="yes" +consoleinteract="yes" + +## Game Server Details +# Do not edit +gamename="Jedi Knight: Jedi Academy" +engine="idtech3" +glibc="2.15" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}/GameData" +executabledir="${systemdir}" +executable="./openjkded.x86_64" +servercfg="${selfname}.cfg" +servercfgdefault="server.cfg" +servercfgdir="${systemdir}" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backups" + +## 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" diff --git a/lgsm/data/almalinux-8.csv b/lgsm/data/almalinux-8.csv index 4d6c05ca5f..0843b9ec0c 100644 --- a/lgsm/data/almalinux-8.csv +++ b/lgsm/data/almalinux-8.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/almalinux-9.csv b/lgsm/data/almalinux-9.csv index 2cdd36575a..df84b93fb0 100644 --- a/lgsm/data/almalinux-9.csv +++ b/lgsm/data/almalinux-9.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/centos-7.csv b/lgsm/data/centos-7.csv index df7422526e..285dd39913 100644 --- a/lgsm/data/centos-7.csv +++ b/lgsm/data/centos-7.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/centos-8.csv b/lgsm/data/centos-8.csv index 831bc38e93..0bc58fdc8a 100644 --- a/lgsm/data/centos-8.csv +++ b/lgsm/data/centos-8.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/centos-9.csv b/lgsm/data/centos-9.csv index 4d49ee66ec..6aa507fa71 100644 --- a/lgsm/data/centos-9.csv +++ b/lgsm/data/centos-9.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/debian-10.csv b/lgsm/data/debian-10.csv index f5d63b0264..ff43d2111b 100644 --- a/lgsm/data/debian-10.csv +++ b/lgsm/data/debian-10.csv @@ -60,6 +60,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/debian-11.csv b/lgsm/data/debian-11.csv index 97f5b978df..d9382fddcd 100644 --- a/lgsm/data/debian-11.csv +++ b/lgsm/data/debian-11.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/debian-12.csv b/lgsm/data/debian-12.csv index e54d9b12bf..994a0b583f 100644 --- a/lgsm/data/debian-12.csv +++ b/lgsm/data/debian-12.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/gameicons/jk3-icon.png b/lgsm/data/gameicons/jk3-icon.png new file mode 100644 index 0000000000..8c480a205e Binary files /dev/null and b/lgsm/data/gameicons/jk3-icon.png differ diff --git a/lgsm/data/rhel-7.csv b/lgsm/data/rhel-7.csv index 3ecff6183b..741171e31b 100644 --- a/lgsm/data/rhel-7.csv +++ b/lgsm/data/rhel-7.csv @@ -62,6 +62,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/rhel-8.csv b/lgsm/data/rhel-8.csv index a378694b29..3e929767ae 100644 --- a/lgsm/data/rhel-8.csv +++ b/lgsm/data/rhel-8.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/rocky-9.csv b/lgsm/data/rocky-9.csv index 2cdd36575a..df84b93fb0 100644 --- a/lgsm/data/rocky-9.csv +++ b/lgsm/data/rocky-9.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index ae270f9650..a7f7b88713 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -60,6 +60,7 @@ ios,iosserver,IOSoccer,ubuntu-22.04 jc2,jc2server,Just Cause 2,ubuntu-22.04 jc3,jc3server,Just Cause 3,ubuntu-22.04 jk2,jk2server,Jedi Knight II: Jedi Outcast,ubuntu-22.04 +jk3,jk3server,Jedi Knight: Jedi Academy,ubuntu-22.04 kf,kfserver,Killing Floor,ubuntu-22.04 kf2,kf2server,Killing Floor 2,ubuntu-22.04 l4d,l4dserver,Left 4 Dead,ubuntu-22.04 diff --git a/lgsm/data/ubuntu-16.04.csv b/lgsm/data/ubuntu-16.04.csv index 41dbd0bc5c..9630a70cb5 100644 --- a/lgsm/data/ubuntu-16.04.csv +++ b/lgsm/data/ubuntu-16.04.csv @@ -62,6 +62,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/ubuntu-18.04.csv b/lgsm/data/ubuntu-18.04.csv index 469c667050..18f84f338c 100644 --- a/lgsm/data/ubuntu-18.04.csv +++ b/lgsm/data/ubuntu-18.04.csv @@ -62,6 +62,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/ubuntu-20.04.csv b/lgsm/data/ubuntu-20.04.csv index 8d4cc6e521..daba10ed90 100644 --- a/lgsm/data/ubuntu-20.04.csv +++ b/lgsm/data/ubuntu-20.04.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/ubuntu-22.04.csv b/lgsm/data/ubuntu-22.04.csv index 67d28b5e93..fd9f48a226 100644 --- a/lgsm/data/ubuntu-22.04.csv +++ b/lgsm/data/ubuntu-22.04.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/ubuntu-23.04.csv b/lgsm/data/ubuntu-23.04.csv index 1b50ed7efb..6dec7c461d 100644 --- a/lgsm/data/ubuntu-23.04.csv +++ b/lgsm/data/ubuntu-23.04.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/ubuntu-23.10.csv b/lgsm/data/ubuntu-23.10.csv index 1b50ed7efb..6dec7c461d 100644 --- a/lgsm/data/ubuntu-23.10.csv +++ b/lgsm/data/ubuntu-23.10.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/data/ubuntu-24.04.csv b/lgsm/data/ubuntu-24.04.csv index 1b50ed7efb..6dec7c461d 100644 --- a/lgsm/data/ubuntu-24.04.csv +++ b/lgsm/data/ubuntu-24.04.csv @@ -61,6 +61,7 @@ ios jc2 jc3 jk2 +jk3 kf kf2 l4d diff --git a/lgsm/modules/command_check_update.sh b/lgsm/modules/command_check_update.sh index 2e6855f7cb..d6c5810b45 100644 --- a/lgsm/modules/command_check_update.sh +++ b/lgsm/modules/command_check_update.sh @@ -28,6 +28,8 @@ elif [ "${shortname}" == "mta" ]; then update_mta.sh elif [ "${shortname}" == "jk2" ]; then update_jk2.sh +elif [ "${shortname}" == "jk3" ]; then + update_jk3.sh elif [ "${shortname}" == "vints" ]; then update_vints.sh elif [ "${shortname}" == "ut99" ]; then diff --git a/lgsm/modules/command_start.sh b/lgsm/modules/command_start.sh index f38125a5e1..81ded92a14 100644 --- a/lgsm/modules/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -18,6 +18,13 @@ fn_start_jk2() { tmux -L "${socketname}" end -t "${sessionname}" version ENTER > /dev/null 2>&1 } +# Like above but for Jedi Academy version to be printed in console on start. +# Used to allow update to detect OpenJK server version. +fn_start_jk3() { + fn_start_tmux + tmux -L "${socketname}" end -t "${sessionname}" version ENTER > /dev/null 2>&1 +} + fn_start_tmux() { # check for tmux size variables. if [[ "${servercfgtmuxwidth}" =~ ^[0-9]+$ ]]; then @@ -199,6 +206,8 @@ fi fn_print_dots "${servername}" if [ "${shortname}" == "jk2" ]; then fn_start_jk2 +elif [ "$shortname" == "jk3" ]; then + fn_start_jk3 else fn_start_tmux fi diff --git a/lgsm/modules/command_update.sh b/lgsm/modules/command_update.sh index e1fcec97fe..5f85a5b417 100644 --- a/lgsm/modules/command_update.sh +++ b/lgsm/modules/command_update.sh @@ -29,6 +29,8 @@ elif [ "${shortname}" == "mta" ]; then update_mta.sh elif [ "${shortname}" == "jk2" ]; then update_jk2.sh +elif [ "${shortname}" == "jk3" ]; then + update_jk3.sh elif [ "${shortname}" == "vints" ]; then update_vints.sh elif [ "${shortname}" == "ut99" ]; then diff --git a/lgsm/modules/core_getopt.sh b/lgsm/modules/core_getopt.sh index cd3e57cb57..05f8610975 100644 --- a/lgsm/modules/core_getopt.sh +++ b/lgsm/modules/core_getopt.sh @@ -66,7 +66,7 @@ currentopt=("${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monito currentopt+=("${cmd_update_linuxgsm[@]}") # Exclude noupdate games here. -if [ "${shortname}" == "jk2" ] || [ "${engine}" != "idtech3" ]; then +if [ "${shortname}" == "jk2" ] || [ "${shortname}" == "jk3" ] || [ "${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. diff --git a/lgsm/modules/info_game.sh b/lgsm/modules/info_game.sh index 497a65f22b..16c368fad7 100644 --- a/lgsm/modules/info_game.sh +++ b/lgsm/modules/info_game.sh @@ -1438,6 +1438,29 @@ fn_info_game_jk2() { serverversion="${serverversion:-"NOT SET"}" } +# Config Type: QuakeC +# Parameters: true +# Comment: // or /* */ +# Example: set sv_hostname "SERVERNAME" +# Filetype: cfg +fn_info_game_jk3() { + if [ -f "${servercfgfullpath}" ]; then + fn_info_game_quakec "maxplayers" "sv_maxclients" + fn_info_game_quakec "rconpassword" "rconpassword" + fn_info_game_quakec "servername" "sv_hostname" + fn_info_game_quakec "serverpassword" "g_password" + fn_info_game_quakec "serverversion" "mv_serverversion" + fi + defaultmap="${defaultmap:-"NOT SET"}" + maxplayers="${maxplayers:-"0"}" + port="${port:-"0"}" + queryport="${port}" + rconpassword="${rconpassword:-"NOT SET"}" + servername="${servername:-"NOT SET"}" + serverpassword="${serverpassword:-"NOT SET"}" + serverversion="${serverversion:-"NOT SET"}" +} + # Config Type: Java properties # Comment: # or ! # Example: motd=SERVERNAME @@ -2363,6 +2386,8 @@ elif [ "${shortname}" == "jc3" ]; then fn_info_game_jc3 elif [ "${shortname}" == "jk2" ]; then fn_info_game_jk2 +elif [ "${shortname}" == "jk3" ]; then + fn_info_game_jk3 elif [ "${shortname}" == "kf" ]; then fn_info_game_kf elif [ "${shortname}" == "kf2" ]; then diff --git a/lgsm/modules/info_messages.sh b/lgsm/modules/info_messages.sh index a1e8f52acf..0d4a71c7f7 100644 --- a/lgsm/modules/info_messages.sh +++ b/lgsm/modules/info_messages.sh @@ -1118,6 +1118,13 @@ fn_info_messages_jk2() { } | column -s $'\t' -t } +fn_info_message_jk3(){ + { + fn_port "header" + fn_port "Game" port udp + } | column -s $'\t' -t +} + fn_info_messages_kf() { { fn_port "header" @@ -1791,7 +1798,9 @@ fn_info_messages_select_engine() { elif [ "${shortname}" == "jc3" ]; then fn_info_messages_jc3 elif [ "${shortname}" == "jk2" ]; then - fn_info_messages_jk2 + fn_info_message_jk2 + elif [ "${shortname}" == "jk3" ]; then + fn_info_message_jk3 elif [ "${shortname}" == "kf" ]; then fn_info_messages_kf elif [ "${shortname}" == "kf2" ]; then diff --git a/lgsm/modules/install_config.sh b/lgsm/modules/install_config.sh index 9b31467703..295bb9cbc6 100644 --- a/lgsm/modules/install_config.sh +++ b/lgsm/modules/install_config.sh @@ -665,6 +665,11 @@ elif [ "${shortname}" == "jk2" ]; then fn_fetch_default_config fn_default_config_remote fn_set_config_vars +elif [ "${shortname}" == "jk3" ]; then + array_configs+=( server.cfg ) + fn_fetch_default_config + fn_default_config_remote + fn_set_config_vars elif [ "${shortname}" == "qw" ]; then array_configs+=(server.cfg) fn_fetch_default_config diff --git a/lgsm/modules/install_server_files.sh b/lgsm/modules/install_server_files.sh index c5fe822add..f31009ef6b 100644 --- a/lgsm/modules/install_server_files.sh +++ b/lgsm/modules/install_server_files.sh @@ -242,6 +242,8 @@ elif [ "${shortname}" == "fctr" ]; then install_factorio_save.sh elif [ "${shortname}" == "jk2" ]; then update_jk2.sh +elif [ "${shortname}" == "jk3" ]; then + update_jk3.sh elif [ "${shortname}" == "vints" ]; then update_vints.sh elif [ "${shortname}" == "ut99" ]; then diff --git a/lgsm/modules/update_jk3.sh b/lgsm/modules/update_jk3.sh new file mode 100755 index 0000000000..c4bb58635f --- /dev/null +++ b/lgsm/modules/update_jk3.sh @@ -0,0 +1,166 @@ +#!/bin/bash +# LinuxGSM update_jk3.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Handles updating of Jedi Academy servers. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +fn_update_dl() { + # Download and extract files to serverfiles. + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "nohash" + fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}/GameData" "*" + fn_clear_tmp +} + +fn_update_localbuild() { + # Gets local build info. + fn_print_dots "Checking local build: ${remotelocation}" + # Uses log file to get local build. + localbuild=$(grep "\"version\"" "${consolelogdir}"/* 2> /dev/null | sed 's/.*://' | awk '{print $1}' | head -n 1 | sed 's/v//') + 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" + fi +} + +fn_update_remotebuild() { + # Get remote build info. + apiurl="https://api.github.com/repos/JACoders/OpenJK/latest" + remotebuildresponse=$(curl -s "${apiurl}") + remotebuildfilename=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("OpenJK-linux")) | .name') + remotebuildurl=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("OpenJK-linux")) | .browser_download_url') + remotebuildversion=$(echo "${remotebuildresponse}" | jq -r '.tag_name') + + if [ "${firstcommandname}" != "INSTALL" ]; then + fn_print_dots "Checking remote build: ${remotelocation}" + # Checks if remotebuildversion variable has been set. + if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "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 + # Checks if remotebuild variable has been set. + if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "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}" + # Update has been found or force update. + if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then + # Create update lockfile. + date '+%s' > "${lockdir:?}/update.lock" + 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}${remotebuildversion}${default}" + if [ -n "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi + if [ -f "${rootdir}/.dev-debug" ]; then + echo -e "Remote build info" + echo -e "* apiurl: ${apiurl}" + echo -e "* remotebuildfilename: ${remotebuildfilename}" + echo -e "* remotebuildurl: ${remotebuildurl}" + echo -e "* remotebuildversion: ${remotebuildversion}" + fi + echo -en "\n" + fn_script_log_info "Update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuildversion}" + if [ -n "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi + fn_script_log_info "${localbuild} > ${remotebuildversion}" + + if [ "${commandname}" == "UPDATE" ]; then + unset updateonstart + check_status.sh + # If server stopped. + if [ "${status}" == "0" ]; then + fn_update_dl + if [ "${localbuild}" == "0" ]; then + exitbypass=1 + command_start.sh + fn_firstcommand_reset + exitbypass=1 + fn_sleep_time_5 + command_stop.sh + fn_firstcommand_reset + fi + # If server started. + 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 + date +%s > "${lockdir}/last-updated.lock" + alert="update" + elif [ "${commandname}" == "CHECK-UPDATE" ]; then + alert="check-update" + fi + 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}${remotebuildversion}${default}" + if [ -n "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi + echo -en "\n" + fn_script_log_info "No update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuildversion}" + if [ -n "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi + if [ -f "${rootdir}/.dev-debug" ]; then + echo -e "Remote build info" + echo -e "* apiurl: ${apiurl}" + echo -e "* remotebuildfilename: ${remotebuildfilename}" + echo -e "* remotebuildurl: ${remotebuildurl}" + echo -e "* remotebuildversion: ${remotebuildversion}" + fi + fi +} + +# The location where the builds are checked and downloaded. +remotelocation="github.com" + +if [ "${firstcommandname}" == "INSTALL" ]; then + fn_update_remotebuild + fn_update_dl +else + update_steamcmd.sh + 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