Skip to content

Commit 953758f

Browse files
authored
Merge branch 'develop' into fix/install-config-cp-portability
2 parents ad890c6 + cba689a commit 953758f

9 files changed

Lines changed: 191 additions & 14 deletions

File tree

lgsm/config-default/config-lgsm/etlserver/_default.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ consoleinteract="yes"
141141
# Do not edit
142142
gamename="ET: Legacy"
143143
engine="idtech3"
144-
glibc="2.7"
144+
glibc="2.17"
145145

146146
#### Directories ####
147147
# Edit with care
@@ -160,7 +160,7 @@ backupdir="${lgsmdir}/backup"
160160

161161
## Logging Directories
162162
[ -n "${LGSM_LOGDIR}" ] && logdir="${LGSM_LOGDIR}" || logdir="${rootdir}/log"
163-
gamelogdir="${serverfiles}/Logs"
163+
gamelogdir="${serverfiles}/legacy"
164164
lgsmlogdir="${logdir}/script"
165165
consolelogdir="${logdir}/console"
166166
lgsmlog="${lgsmlogdir}/${selfname}-script.log"

lgsm/modules/command_check_update.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ elif [ "${shortname}" == "ut99" ]; then
3434
update_ut99.sh
3535
elif [ "${shortname}" == "xnt" ]; then
3636
update_xnt.sh
37+
elif [ "${shortname}" == "etl" ]; then
38+
update_etl.sh
3739
else
3840
update_steamcmd.sh
3941
fi

lgsm/modules/command_update.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ elif [ "${shortname}" == "ut99" ]; then
3535
update_ut99.sh
3636
elif [ "${shortname}" == "xnt" ]; then
3737
update_xnt.sh
38+
elif [ "${shortname}" == "etl" ]; then
39+
update_etl.sh
3840
else
3941
update_steamcmd.sh
4042
fi

lgsm/modules/core_dl.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn_dl_hash() {
204204
fn_print_error_nl "hash length not known for hash type"
205205
core_exit.sh
206206
fi
207-
echo -en "verifying ${local_filename} with ${hashtype}..."
207+
echo -en "verifying ${local_filename} with ${hashtype}"
208208
fn_sleep_time
209209
hashsumcmd=$(${hashbin} "${local_filedir}/${local_filename}" | awk '{print $1}')
210210
if [ "${hashsumcmd}" != "${hash}" ]; then
@@ -267,9 +267,9 @@ fn_dl_extract() {
267267
fi
268268
elif [ "${mime}" == "application/zip" ]; then
269269
if [ -n "${extractsrc}" ]; then
270-
temp_extractdir="${tmpdir}/Xonotic"
270+
temp_extractdir="${tmpdir}/${extractsrc}"
271271
extractcmd=$(unzip -qo "${local_filedir}/${local_filename}" "${extractsrc}/*" -d "${temp_extractdir}")
272-
find "${temp_extractdir}/${extractsrc}" -mindepth 1 -maxdepth 1 -exec mv -t "${extractdest}" {} +
272+
cp -a "${temp_extractdir}/${extractsrc}/." "${extractdest}/"
273273
rm -rf "${temp_extractdir}"
274274
else
275275
extractcmd=$(unzip -qo -d "${extractdest}" "${local_filedir}/${local_filename}")

lgsm/modules/core_getopt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ currentopt=("${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monito
6666
currentopt+=("${cmd_update_linuxgsm[@]}")
6767

6868
# Exclude noupdate games here.
69-
if [ "${shortname}" == "jk2" ] || [ "${engine}" != "idtech3" ]; then
69+
if [ "${shortname}" == "jk2" ] || [ "${shortname}" == "etl" ] || [ "${engine}" != "idtech3" ]; then
7070
if [ "${shortname}" != "bf1942" ] && [ "${shortname}" != "bfv" ] && [ "${engine}" != "idtech2" ] && [ "${engine}" != "iw2.0" ] && [ "${engine}" != "iw3.0" ] && [ "${engine}" != "quake" ] && [ "${shortname}" != "samp" ] && [ "${shortname}" != "ut2k4" ]; then
7171
currentopt+=("${cmd_update[@]}" "${cmd_check_update[@]}")
7272
# force update for SteamCMD or Multi Theft Auto only.

lgsm/modules/core_modules.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,11 @@ fn_update_modules.sh() {
660660
fn_fetch_module
661661
}
662662

663+
update_etl.sh() {
664+
modulefile="${FUNCNAME[0]}"
665+
fn_fetch_module
666+
}
667+
663668
update_fctr.sh() {
664669
modulefile="${FUNCNAME[0]}"
665670
fn_fetch_module

lgsm/modules/install_server_files.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,6 @@ fn_install_server_files() {
8080
run="norun"
8181
force="noforce"
8282
md5="2c6be1bb66ea631b9b2e7ae6216c6680"
83-
elif [ "${shortname}" == "etl" ]; then
84-
remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/etlegacy-v2.78.1-i386-et-260b.tar.xz"
85-
local_filedir="${tmpdir}"
86-
local_filename="etlegacy-v2.78.1-i386-et-260b.tar.xz"
87-
chmodx="nochmodx"
88-
run="norun"
89-
force="noforce"
90-
md5="7c08b52cb09b30eadb98ea05ef780fc7"
9183
elif [ "${shortname}" == "mohaa" ]; then
9284
remote_fileurl="http://linuxgsm.download/MedalofHonorAlliedAssault/moh_revival_v1.12_RC3.5.1.tar.xz"
9385
local_filedir="${tmpdir}"
@@ -280,6 +272,8 @@ elif [ "${shortname}" == "ut99" ]; then
280272
update_ut99.sh
281273
elif [ "${shortname}" == "xnt" ]; then
282274
update_xnt.sh
275+
elif [ "${shortname}" == "etl" ]; then
276+
update_etl.sh
283277
elif [ -z "${appid}" ] || [ "${shortname}" == "ahl" ] || [ "${shortname}" == "bb" ] || [ "${shortname}" == "q4" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "sfc" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "vs" ] || [ "${shortname}" == "zmr" ]; then
284278
if [ "${shortname}" == "ut" ]; then
285279
install_eula.sh

lgsm/modules/update_etl.sh

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
#!/bin/bash
2+
# LinuxGSM update_etl.sh module
3+
# Author: Daniel Gibbs
4+
# Contributors: https://linuxgsm.com/contrib
5+
# Website: https://linuxgsm.com
6+
# Description: Handles updating of ET: Legacy servers.
7+
8+
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
9+
10+
fn_update_dl() {
11+
# Download and extract files to serverfiles.
12+
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildhash}"
13+
fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}"
14+
echo "${remotebuild}" > "${serverfiles}/build.txt"
15+
fn_clear_tmp
16+
}
17+
18+
fn_update_localbuild() {
19+
# Gets local build info.
20+
fn_print_dots "Checking local build: ${remotelocation}"
21+
# Try to get build version from etconsole.log.
22+
if [ -f "${gamelogdir}/etconsole.log" ]; then
23+
localbuild=$(grep "Initializing legacy game" "${gamelogdir}/etconsole.log" | sed -n 's/.*\^2\(v[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p' | tail -1)
24+
fi
25+
# Fall back to build.txt if log parse failed or log does not exist.
26+
if [ -z "${localbuild}" ]; then
27+
localbuild=$(head -n 1 "${serverfiles}/build.txt" 2> /dev/null)
28+
fi
29+
if [ -z "${localbuild}" ]; then
30+
fn_print_error "Checking local build: ${remotelocation}: missing local build info"
31+
fn_script_log_error "Missing local build info"
32+
fn_script_log_error "Set localbuild to 0"
33+
localbuild="0"
34+
else
35+
fn_print_ok "Checking local build: ${remotelocation}"
36+
fn_script_log_pass "Checking local build"
37+
fi
38+
}
39+
40+
fn_update_remotebuild() {
41+
# Gets remote build info.
42+
apiurl="https://api.github.com/repos/GameServerManagers/etlserver-build/releases/latest"
43+
remotebuildresponse=$(curl -s "${apiurl}")
44+
remotebuildfilename=$(echo "${remotebuildresponse}" | jq -r '.assets[] | select(.browser_download_url | contains("i386-et-260b")) | .name')
45+
remotebuildurl=$(echo "${remotebuildresponse}" | jq -r '.assets[] | select(.browser_download_url | contains("i386-et-260b")) | .browser_download_url')
46+
remotebuild=$(echo "${remotebuildresponse}" | jq -r '.tag_name')
47+
remotebuildhash=$(echo "${remotebuildresponse}" | jq -r '.body' | grep 'MD5' | grep -oE '[a-f0-9]{32}')
48+
49+
if [ "${firstcommandname}" != "INSTALL" ]; then
50+
fn_print_dots "Checking remote build: ${remotelocation}"
51+
# Checks if remotebuild variable has been set.
52+
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
53+
fn_print_fail "Checking remote build: ${remotelocation}"
54+
fn_script_log_fail "Checking remote build"
55+
core_exit.sh
56+
else
57+
fn_print_ok "Checking remote build: ${remotelocation}"
58+
fn_script_log_pass "Checking remote build"
59+
fi
60+
else
61+
# Checks if remotebuild variable has been set.
62+
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
63+
fn_print_failure "Unable to get remote build"
64+
fn_script_log_fail "Unable to get remote build"
65+
core_exit.sh
66+
fi
67+
fi
68+
}
69+
70+
fn_update_compare() {
71+
fn_print_dots "Checking for update: ${remotelocation}"
72+
# Update has been found or force update.
73+
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
74+
# Create update lockfile.
75+
date '+%s' > "${lockdir:?}/update.lock"
76+
fn_print_ok_nl "Checking for update: ${remotelocation}"
77+
fn_print "\n"
78+
fn_print_nl "${bold}${underline}Update${default} available"
79+
fn_print_nl "* Local build: ${red}${localbuild}${default}"
80+
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
81+
if [ -n "${branch}" ]; then
82+
fn_print_nl "* Branch: ${branch}"
83+
fi
84+
if [ -f "${rootdir}/.dev-debug" ]; then
85+
fn_print_nl "Remote build info"
86+
fn_print_nl "* apiurl: ${apiurl}"
87+
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
88+
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
89+
fn_print_nl "* remotebuild: ${remotebuild}"
90+
fi
91+
fn_print "\n"
92+
fn_script_log_info "Update available"
93+
fn_script_log_info "Local build: ${localbuild}"
94+
fn_script_log_info "Remote build: ${remotebuild}"
95+
if [ -n "${branch}" ]; then
96+
fn_script_log_info "Branch: ${branch}"
97+
fi
98+
fn_script_log_info "${localbuild} > ${remotebuild}"
99+
100+
if [ "${commandname}" == "UPDATE" ]; then
101+
date +%s > "${lockdir:?}/last-updated.lock"
102+
unset updateonstart
103+
check_status.sh
104+
# If server stopped.
105+
if [ "${status}" == "0" ]; then
106+
fn_update_dl
107+
if [ "${localbuild}" == "0" ]; then
108+
exitbypass=1
109+
command_start.sh
110+
fn_firstcommand_reset
111+
exitbypass=1
112+
fn_sleep_time_5
113+
command_stop.sh
114+
fn_firstcommand_reset
115+
fi
116+
# If server started.
117+
else
118+
fn_print_restart_warning
119+
exitbypass=1
120+
command_stop.sh
121+
fn_firstcommand_reset
122+
exitbypass=1
123+
fn_update_dl
124+
exitbypass=1
125+
command_start.sh
126+
fn_firstcommand_reset
127+
fi
128+
unset exitbypass
129+
alert="update"
130+
elif [ "${commandname}" == "CHECK-UPDATE" ]; then
131+
alert="check-update"
132+
fi
133+
alert.sh
134+
else
135+
fn_print_ok_nl "Checking for update: ${remotelocation}"
136+
fn_print "\n"
137+
fn_print_nl "${bold}${underline}No update${default} available"
138+
fn_print_nl "* Local build: ${green}${localbuild}${default}"
139+
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
140+
if [ -n "${branch}" ]; then
141+
fn_print_nl "* Branch: ${branch}"
142+
fi
143+
fn_print "\n"
144+
fn_script_log_info "No update available"
145+
fn_script_log_info "Local build: ${localbuild}"
146+
fn_script_log_info "Remote build: ${remotebuild}"
147+
if [ -n "${branch}" ]; then
148+
fn_script_log_info "Branch: ${branch}"
149+
fi
150+
if [ -f "${rootdir}/.dev-debug" ]; then
151+
fn_print_nl "Remote build info"
152+
fn_print_nl "* apiurl: ${apiurl}"
153+
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
154+
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
155+
fn_print_nl "* remotebuild: ${remotebuild}"
156+
fi
157+
fi
158+
}
159+
160+
# The location where the builds are checked and downloaded.
161+
remotelocation="github.com"
162+
163+
if [ "${firstcommandname}" == "INSTALL" ]; then
164+
fn_update_remotebuild
165+
fn_update_dl
166+
else
167+
fn_print_dots "Checking for update"
168+
fn_print_dots "Checking for update: ${remotelocation}"
169+
fn_script_log_info "Checking for update: ${remotelocation}"
170+
fn_update_localbuild
171+
fn_update_remotebuild
172+
fn_update_compare
173+
fi

lgsm/modules/update_xnt.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ fn_update_remotebuild() {
5555
remotebuildfilename="${remotebuildfilename}.zip"
5656
remotebuildurl="https://dl.xonotic.org/${remotebuildfilename}"
5757
remotebuild="${remotebuildtag}"
58+
remotebuildhash=$(curl -s "https://dl.xonotic.org/${remotebuildfilename%.zip}.sha512" | grep "${remotebuildfilename}$" | grep -oE '[a-f0-9]{128}')
5859

5960
if [ "${firstcommandname}" != "INSTALL" ]; then
6061
fn_print_dots "Checking remote build: ${remotelocation}"

0 commit comments

Comments
 (0)