Browse Source

Merge df9abefa37 into 579d54bc40

pull/3891/merge
Alex 2 months ago
committed by GitHub
parent
commit
c2fd7e8387
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      lgsm/config-default/config-lgsm/jk2server/_default.cfg
  2. 189
      lgsm/config-default/config-lgsm/jk3server/_default.cfg
  3. 1
      lgsm/data/almalinux-8.csv
  4. 1
      lgsm/data/almalinux-9.csv
  5. 1
      lgsm/data/centos-7.csv
  6. 1
      lgsm/data/centos-8.csv
  7. 1
      lgsm/data/centos-9.csv
  8. 1
      lgsm/data/debian-10.csv
  9. 1
      lgsm/data/debian-11.csv
  10. 1
      lgsm/data/debian-12.csv
  11. BIN
      lgsm/data/gameicons/jk3-icon.png
  12. 1
      lgsm/data/rhel-7.csv
  13. 1
      lgsm/data/rhel-8.csv
  14. 1
      lgsm/data/rocky-9.csv
  15. 1
      lgsm/data/serverlist.csv
  16. 1
      lgsm/data/ubuntu-16.04.csv
  17. 1
      lgsm/data/ubuntu-18.04.csv
  18. 1
      lgsm/data/ubuntu-20.04.csv
  19. 1
      lgsm/data/ubuntu-22.04.csv
  20. 1
      lgsm/data/ubuntu-23.04.csv
  21. 1
      lgsm/data/ubuntu-23.10.csv
  22. 1
      lgsm/data/ubuntu-24.04.csv
  23. 2
      lgsm/modules/command_check_update.sh
  24. 9
      lgsm/modules/command_start.sh
  25. 2
      lgsm/modules/command_update.sh
  26. 2
      lgsm/modules/core_getopt.sh
  27. 25
      lgsm/modules/info_game.sh
  28. 11
      lgsm/modules/info_messages.sh
  29. 5
      lgsm/modules/install_config.sh
  30. 2
      lgsm/modules/install_server_files.sh
  31. 166
      lgsm/modules/update_jk3.sh

2
lgsm/config-default/config-lgsm/jk2server/_default.cfg

@ -14,7 +14,7 @@ steampass='password'
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters ## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
ip="0.0.0.0" ip="0.0.0.0"
port="27960" port="28070"
defaultmap="ffa_bespin" defaultmap="ffa_bespin"
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters

189
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 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"
# 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"

1
lgsm/data/almalinux-8.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/almalinux-9.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/centos-7.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/centos-8.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/centos-9.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/debian-10.csv

@ -60,6 +60,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/debian-11.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/debian-12.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

1
lgsm/data/rhel-7.csv

@ -62,6 +62,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/rhel-8.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/rocky-9.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/serverlist.csv

@ -60,6 +60,7 @@ ios,iosserver,IOSoccer,ubuntu-22.04
jc2,jc2server,Just Cause 2,ubuntu-22.04 jc2,jc2server,Just Cause 2,ubuntu-22.04
jc3,jc3server,Just Cause 3,ubuntu-22.04 jc3,jc3server,Just Cause 3,ubuntu-22.04
jk2,jk2server,Jedi Knight II: Jedi Outcast,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 kf,kfserver,Killing Floor,ubuntu-22.04
kf2,kf2server,Killing Floor 2,ubuntu-22.04 kf2,kf2server,Killing Floor 2,ubuntu-22.04
l4d,l4dserver,Left 4 Dead,ubuntu-22.04 l4d,l4dserver,Left 4 Dead,ubuntu-22.04

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

1
lgsm/data/ubuntu-16.04.csv

@ -62,6 +62,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/ubuntu-18.04.csv

@ -62,6 +62,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/ubuntu-20.04.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/ubuntu-22.04.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/ubuntu-23.04.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/ubuntu-23.10.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

1
lgsm/data/ubuntu-24.04.csv

@ -61,6 +61,7 @@ ios
jc2 jc2
jc3 jc3
jk2 jk2
jk3
kf kf
kf2 kf2
l4d l4d

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

2
lgsm/modules/command_check_update.sh

@ -28,6 +28,8 @@ elif [ "${shortname}" == "mta" ]; then
update_mta.sh update_mta.sh
elif [ "${shortname}" == "jk2" ]; then elif [ "${shortname}" == "jk2" ]; then
update_jk2.sh update_jk2.sh
elif [ "${shortname}" == "jk3" ]; then
update_jk3.sh
elif [ "${shortname}" == "vints" ]; then elif [ "${shortname}" == "vints" ]; then
update_vints.sh update_vints.sh
elif [ "${shortname}" == "ut99" ]; then elif [ "${shortname}" == "ut99" ]; then

9
lgsm/modules/command_start.sh

@ -18,6 +18,13 @@ fn_start_jk2() {
tmux -L "${socketname}" end -t "${sessionname}" version ENTER > /dev/null 2>&1 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() { fn_start_tmux() {
# check for tmux size variables. # check for tmux size variables.
if [[ "${servercfgtmuxwidth}" =~ ^[0-9]+$ ]]; then if [[ "${servercfgtmuxwidth}" =~ ^[0-9]+$ ]]; then
@ -200,6 +207,8 @@ fi
fn_print_dots "${servername}" fn_print_dots "${servername}"
if [ "${shortname}" == "jk2" ]; then if [ "${shortname}" == "jk2" ]; then
fn_start_jk2 fn_start_jk2
elif [ "$shortname" == "jk3" ]; then
fn_start_jk3
else else
fn_start_tmux fn_start_tmux
fi fi

2
lgsm/modules/command_update.sh

@ -29,6 +29,8 @@ elif [ "${shortname}" == "mta" ]; then
update_mta.sh update_mta.sh
elif [ "${shortname}" == "jk2" ]; then elif [ "${shortname}" == "jk2" ]; then
update_jk2.sh update_jk2.sh
elif [ "${shortname}" == "jk3" ]; then
update_jk3.sh
elif [ "${shortname}" == "vints" ]; then elif [ "${shortname}" == "vints" ]; then
update_vints.sh update_vints.sh
elif [ "${shortname}" == "ut99" ]; then elif [ "${shortname}" == "ut99" ]; then

2
lgsm/modules/core_getopt.sh

@ -66,7 +66,7 @@ currentopt=("${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monito
currentopt+=("${cmd_update_linuxgsm[@]}") currentopt+=("${cmd_update_linuxgsm[@]}")
# Exclude noupdate games here. # 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 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[@]}") currentopt+=("${cmd_update[@]}" "${cmd_check_update[@]}")
# force update for SteamCMD or Multi Theft Auto only. # force update for SteamCMD or Multi Theft Auto only.

25
lgsm/modules/info_game.sh

@ -1438,6 +1438,29 @@ fn_info_game_jk2() {
serverversion="${serverversion:-"NOT SET"}" 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 # Config Type: Java properties
# Comment: # or ! # Comment: # or !
# Example: motd=SERVERNAME # Example: motd=SERVERNAME
@ -2378,6 +2401,8 @@ elif [ "${shortname}" == "jc3" ]; then
fn_info_game_jc3 fn_info_game_jc3
elif [ "${shortname}" == "jk2" ]; then elif [ "${shortname}" == "jk2" ]; then
fn_info_game_jk2 fn_info_game_jk2
elif [ "${shortname}" == "jk3" ]; then
fn_info_game_jk3
elif [ "${shortname}" == "kf" ]; then elif [ "${shortname}" == "kf" ]; then
fn_info_game_kf fn_info_game_kf
elif [ "${shortname}" == "kf2" ]; then elif [ "${shortname}" == "kf2" ]; then

11
lgsm/modules/info_messages.sh

@ -1125,6 +1125,13 @@ fn_info_messages_jk2() {
} | column -s $'\t' -t } | 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_info_messages_kf() {
{ {
fn_port "header" fn_port "header"
@ -1816,7 +1823,9 @@ fn_info_messages_select_engine() {
elif [ "${shortname}" == "jc3" ]; then elif [ "${shortname}" == "jc3" ]; then
fn_info_messages_jc3 fn_info_messages_jc3
elif [ "${shortname}" == "jk2" ]; then elif [ "${shortname}" == "jk2" ]; then
fn_info_messages_jk2 fn_info_message_jk2
elif [ "${shortname}" == "jk3" ]; then
fn_info_message_jk3
elif [ "${shortname}" == "kf" ]; then elif [ "${shortname}" == "kf" ]; then
fn_info_messages_kf fn_info_messages_kf
elif [ "${shortname}" == "kf2" ]; then elif [ "${shortname}" == "kf2" ]; then

5
lgsm/modules/install_config.sh

@ -666,6 +666,11 @@ elif [ "${shortname}" == "jk2" ]; then
fn_fetch_default_config fn_fetch_default_config
fn_default_config_remote fn_default_config_remote
fn_set_config_vars 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 elif [ "${shortname}" == "qw" ]; then
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_fetch_default_config fn_fetch_default_config

2
lgsm/modules/install_server_files.sh

@ -271,6 +271,8 @@ elif [ "${shortname}" == "fctr" ]; then
install_factorio_save.sh install_factorio_save.sh
elif [ "${shortname}" == "jk2" ]; then elif [ "${shortname}" == "jk2" ]; then
update_jk2.sh update_jk2.sh
elif [ "${shortname}" == "jk3" ]; then
update_jk3.sh
elif [ "${shortname}" == "vints" ]; then elif [ "${shortname}" == "vints" ]; then
update_vints.sh update_vints.sh
elif [ "${shortname}" == "ut99" ]; then elif [ "${shortname}" == "ut99" ]; then

166
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
Loading…
Cancel
Save