Skip to content

Commit 9984f95

Browse files
authored
feat(ts3): add check-update function (#3967)
1 parent 28101a7 commit 9984f95

File tree

3 files changed

+37
-29
lines changed

3 files changed

+37
-29
lines changed

lgsm/functions/command_check_update.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ fn_print_dots ""
1414
check.sh
1515
core_logs.sh
1616

17-
core_steamcmd.sh
17+
if [ "${appid}" ]; then
18+
core_steamcmd.sh
1819

19-
check_steamcmd.sh
20+
check_steamcmd.sh
2021

21-
fn_update_steamcmd_localbuild
22-
fn_update_steamcmd_remotebuild
23-
fn_update_steamcmd_compare
22+
fn_update_steamcmd_localbuild
23+
fn_update_steamcmd_remotebuild
24+
fn_update_steamcmd_compare
25+
elif [ "${shortname}" == "ts3" ]; then
26+
update_ts3.sh
27+
fi
2428

2529
core_exit.sh

lgsm/functions/core_getopt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if [ "${shortname}" == "jk2" ] || [ "${engine}" != "idtech3" ]; then
7575
fi
7676

7777
# Validate and check-update command.
78-
if [ "${appid}" ]; then
78+
if [ "${appid}" ]||[ "${shortname}" == "ts3" ]; then
7979
currentopt+=("${cmd_validate[@]}" "${cmd_check_update[@]}")
8080
fi
8181

lgsm/functions/update_ts3.sh

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -150,35 +150,39 @@ fn_update_ts3_compare() {
150150
fn_script_log_info "Remote build: ${remotebuild}"
151151
fn_script_log_info "${localbuild} > ${remotebuild}"
152152

153-
unset updateonstart
154-
check_status.sh
155-
# If server stopped.
156-
if [ "${status}" == "0" ]; then
157-
exitbypass=1
158-
fn_update_ts3_dl
159-
if [ "${requirerestart}" == "1" ]; then
153+
if [ "${commandname}" == "UPDATE" ]; then
154+
unset updateonstart
155+
check_status.sh
156+
# If server stopped.
157+
if [ "${status}" == "0" ]; then
160158
exitbypass=1
161-
command_start.sh
162-
fn_firstcommand_reset
159+
fn_update_ts3_dl
160+
if [ "${requirerestart}" == "1" ]; then
161+
exitbypass=1
162+
command_start.sh
163+
fn_firstcommand_reset
164+
exitbypass=1
165+
command_stop.sh
166+
fn_firstcommand_reset
167+
fi
168+
# If server started.
169+
else
170+
fn_print_restart_warning
163171
exitbypass=1
164172
command_stop.sh
165173
fn_firstcommand_reset
174+
exitbypass=1
175+
fn_update_ts3_dl
176+
exitbypass=1
177+
command_start.sh
178+
fn_firstcommand_reset
166179
fi
167-
# If server started.
168-
else
169-
fn_print_restart_warning
170-
exitbypass=1
171-
command_stop.sh
172-
fn_firstcommand_reset
173-
exitbypass=1
174-
fn_update_ts3_dl
175-
exitbypass=1
176-
command_start.sh
177-
fn_firstcommand_reset
180+
unset exitbypass
181+
date +%s > "${lockdir}/lastupdate.lock"
182+
alert="update"
183+
elif [ "${commandname}" == "CHECK-UPDATE" ]; then
184+
alert="check-update"
178185
fi
179-
unset exitbypass
180-
date +%s > "${lockdir}/lastupdate.lock"
181-
alert="update"
182186
alert.sh
183187
else
184188
fn_print_ok_nl "Checking for update: ${remotelocation}"

0 commit comments

Comments
 (0)