Skip to content

Commit c19ab35

Browse files
authored
Merge branch 'develop' into repo-sync/master
2 parents f47d159 + 0374441 commit c19ab35

27 files changed

+209
-170
lines changed

.editorconfig

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs.
2-
# Atom: Please assure your Atom's config setting Tab Type is set to auto, otherwise Atom-EditorConfig may not work as expected. Also disable whitespace package.
32
# http://editorconfig.org/
43

54
root = true
65

76
[*]
87
charset = utf-8
9-
indent_style = tab
10-
indent_size = 4
11-
trim_trailing_whitespace = true
128
end_of_line = lf
13-
insert_final_newline = true
14-
15-
# YAML Files
16-
[*.{yml,yaml}]
17-
indent_size = 2
18-
indent_style = space
19-
20-
# JSON Files
21-
[*.{json,json5,webmanifest}]
229
indent_size = 2
2310
indent_style = space
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
2413

2514
# BASH Files
2615
[*.{.sh}]
27-
indent_style = tab
2816
indent_size = 4
17+
indent_style = tab

.github/workflows/details-check.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ jobs:
6868
else
6969
curl -f -o config "https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/main/${{ matrix.shortname }}/${{ steps.sets-servercfgname.outputs.servercfgname }}"
7070
fi
71+
72+
- name: Pre-load LinuxGSM
73+
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server details
74+
7175
- name: Display config
7276
run: |
7377
if [ "${{ steps.sets-servercfgname.outputs.servercfgname }}" == "" ]; then

.github/workflows/update-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ concurrency:
1313
jobs:
1414
update-check:
1515
if: github.repository_owner == 'GameServerManagers'
16-
continue-on-error: true
1716
runs-on: ubuntu-latest
1817

1918
strategy:
19+
fail-fast: false
2020
matrix:
21-
shortname: [css, fctr, jk2, mc, mcb, mta, pmc, ts3, ut99, vints]
21+
shortname: [css, fctr, jk2, mc, mcb, mta, pmc, ts3, ut99, vints, xnt]
2222

2323
steps:
2424
- name: Download linuxgsm.sh

.shellcheckrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
disable=SC2154

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#### Game Server Settings ####
1010

1111
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
12+
# Note that for HL2DM, maxplayers > 33 must be specified like so:
13+
# maxplayers="101 -unrestricted_maxplayers"
1214
ip="0.0.0.0"
1315
port="27015"
1416
clientport="27005"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#### Game Server Settings ####
1010

1111
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
12+
# Note that for TF2, maxplayers > 33 must be specified like so:
13+
# maxplayers="101 -unrestricted_maxplayers"
1214
ip="0.0.0.0"
1315
port="27015"
1416
clientport="27005"

lgsm/modules/alert_discord.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ json=$(
4646
"name": "Server Time",
4747
"value": "$(date)",
4848
"inline": true
49+
},
50+
{
51+
"name": "More info",
52+
"value": "${alerturl}",
53+
"inline": true
4954
}
5055
EOF
5156
)
@@ -63,7 +68,7 @@ EOF
6368
)
6469
fi
6570

66-
if [ -n "{alerturl}" ]; then
71+
if [ -n "${alerturl}" ]; then
6772
json+=$(
6873
cat << EOF
6974
,

lgsm/modules/alert_email.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ else
1515
mail -s "${alerttitle}" "${email}" < "${alertlog}"
1616
fi
1717
exitcode=$?
18-
if [ "${exitcode}" -ne 0 ]; then
18+
if [ "${exitcode}" -eq 0 ]; then
1919
fn_print_ok_nl "Sending Email alert: ${email}"
2020
fn_script_log_pass "Sending Email alert: ${email}"
2121
else

lgsm/modules/check.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ if [ "${commandname}" != "INSTALL" ] && [ "${commandname}" != "UPDATE-LGSM" ] &&
3131
check_system_dir.sh
3232
fi
3333

34-
allowed_commands_array=(START DEBUG)
34+
allowed_commands_array=(DEBUG RESTART START)
3535
for allowed_command in "${allowed_commands_array[@]}"; do
3636
if [ "${allowed_command}" == "${commandname}" ]; then
3737
check_executable.sh
3838
fi
3939
done
4040

4141
if [ "$(whoami)" != "root" ]; then
42-
allowed_commands_array=(DEBUG START INSTALL)
42+
allowed_commands_array=(DEBUG RESTART START INSTALL)
4343
for allowed_command in "${allowed_commands_array[@]}"; do
4444
if [ "${allowed_command}" == "${commandname}" ]; then
4545
check_glibc.sh
@@ -54,21 +54,21 @@ for allowed_command in "${allowed_commands_array[@]}"; do
5454
fi
5555
done
5656

57-
allowed_commands_array=(BACKUP DEBUG DETAILS START UPDATE)
57+
allowed_commands_array=(BACKUP DEBUG DETAILS RESTART START UPDATE)
5858
for allowed_command in "${allowed_commands_array[@]}"; do
5959
if [ "${allowed_command}" == "${commandname}" ]; then
6060
check_deps.sh
6161
fi
6262
done
6363

64-
allowed_commands_array=(CONSOLE DEBUG MONITOR START STOP)
64+
allowed_commands_array=(CONSOLE DEBUG MONITOR RESTART START STOP)
6565
for allowed_command in "${allowed_commands_array[@]}"; do
6666
if [ "${allowed_command}" == "${commandname}" ]; then
6767
check_config.sh
6868
fi
6969
done
7070

71-
allowed_commands_array=(DEBUG DETAILS DEV-QUERY-RAW MONITOR POST_DETAILS START STOP POST-DETAILS)
71+
allowed_commands_array=(DEBUG DETAILS DEV-QUERY-RAW MONITOR POST_DETAILS RESTART START STOP POST-DETAILS)
7272
for allowed_command in "${allowed_commands_array[@]}"; do
7373
if [ "${allowed_command}" == "${commandname}" ]; then
7474
if [ -z "${installflag}" ]; then
@@ -77,7 +77,7 @@ for allowed_command in "${allowed_commands_array[@]}"; do
7777
fi
7878
done
7979

80-
allowed_commands_array=(DEBUG START UPDATE VALIDATE CHECK-UPDATE)
80+
allowed_commands_array=(DEBUG RESTART START UPDATE VALIDATE CHECK-UPDATE)
8181
for allowed_command in "${allowed_commands_array[@]}"; do
8282
if [ "${allowed_command}" == "${commandname}" ]; then
8383
if [ "${appid}" ]; then
@@ -86,21 +86,21 @@ for allowed_command in "${allowed_commands_array[@]}"; do
8686
fi
8787
done
8888

89-
allowed_commands_array=(CHANGE-PASSWORD DETAILS MONITOR START STOP UPDATE VALIDATE POST-DETAILS)
89+
allowed_commands_array=(CHANGE-PASSWORD DETAILS MONITOR RESTART START STOP UPDATE VALIDATE POST-DETAILS)
9090
for allowed_command in "${allowed_commands_array[@]}"; do
9191
if [ "${allowed_command}" == "${commandname}" ]; then
9292
check_status.sh
9393
fi
9494
done
9595

96-
allowed_commands_array=(DEBUG START INSTALL)
96+
allowed_commands_array=(DEBUG RESTART START INSTALL)
9797
for allowed_command in "${allowed_commands_array[@]}"; do
9898
if [ "${allowed_command}" == "${commandname}" ]; then
9999
check_system_requirements.sh
100100
fi
101101
done
102102

103-
allowed_commands_array=(DETAILS MONITOR START STOP UPDATE VALIDATE POST-DETAILS)
103+
allowed_commands_array=(DETAILS MONITOR RESTART START STOP UPDATE VALIDATE POST-DETAILS)
104104
for allowed_command in "${allowed_commands_array[@]}"; do
105105
if [ "${allowed_command}" == "${commandname}" ]; then
106106
check_gamedig.sh

lgsm/modules/command_backup.sh

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ fn_firstcommand_set
1313
# Trap to remove lockfile on quit.
1414
fn_backup_trap() {
1515
echo -e ""
16-
echo -en "backup ${backupname}.tar.gz..."
16+
echo -en "backup ${backupname}.${compressext}..."
1717
fn_print_canceled_eol_nl
18-
fn_script_log_info "Backup ${backupname}.tar.gz: CANCELED"
19-
rm -f "${backupdir:?}/${backupname}.tar.gz" | tee -a "${lgsmlog}"
20-
echo -en "backup ${backupname}.tar.gz..."
18+
fn_script_log_info "Backup ${backupname}.${compressext}: CANCELED"
19+
rm -f "${backupdir:?}/${backupname}.${compressext}" | tee -a "${lgsmlog}"
20+
echo -en "backup ${backupname}.${compressext}..."
2121
fn_print_removed_eol_nl
22-
fn_script_log_info "Backup ${backupname}.tar.gz: REMOVED"
22+
fn_script_log_info "Backup ${backupname}.${compressext}: REMOVED"
2323
# Remove backup lockfile.
2424
rm -f "${lockdir:?}/backup.lock"
2525
fn_backup_start_server
@@ -110,23 +110,47 @@ fn_backup_create_lockfile() {
110110
trap fn_backup_trap INT
111111
}
112112

113+
fn_select_compression() {
114+
if command -v zstd > /dev/null 2>&1; then
115+
compressprog="zstd"
116+
compressext="tar.zst"
117+
compressflag="--zstd"
118+
elif command -v pigz > /dev/null 2>&1; then
119+
compressprog="pigz"
120+
compressext="tar.gz"
121+
compressflag="--use-compress-program=pigz"
122+
elif command -v gzip > /dev/null 2>&1; then
123+
compressprog="gzip"
124+
compressext="tar.gz"
125+
compressflag="--gzip"
126+
else
127+
compressprog=""
128+
compressext="tar"
129+
compressflag=""
130+
fi
131+
}
132+
113133
# Compressing files.
114134
fn_backup_compression() {
115-
# Tells how much will be compressed using rootdirduexbackup value from info_distro and prompt for continue.
135+
116136
fn_print_info "A total of ${rootdirduexbackup} will be compressed."
117-
fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.tar.gz"
118-
fn_print_dots "Backup (${rootdirduexbackup}) ${backupname}.tar.gz, in progress ..."
119-
fn_script_log_info "Backup ${rootdirduexbackup} ${backupname}.tar.gz, in progress"
137+
fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.${compressext}"
138+
fn_print_dots "Backup (${rootdirduexbackup}) ${backupname}.${compressext}, in progress ..."
139+
fn_script_log_info "Backup ${rootdirduexbackup} ${backupname}.${compressext}, in progress"
120140
excludedir=$(fn_backup_relpath)
121141

122-
# Check that excludedir is a valid path.
123142
if [ ! -d "${excludedir}" ]; then
124143
fn_print_fail_nl "Problem identifying the previous backup directory for exclusion."
125144
fn_script_log_fail "Problem identifying the previous backup directory for exclusion"
126145
core_exit.sh
127146
fi
128147

129-
tar --use-compress-program=pigz -cf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}" --exclude "${tmpdir}" ./.
148+
if [ -n "${compressflag}" ]; then
149+
tar ${compressflag} -hcf "${backupdir}/${backupname}.${compressext}" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}" --exclude "${tmpdir}" ./.
150+
else
151+
tar -hcf "${backupdir}/${backupname}.${compressext}" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}" --exclude "${tmpdir}" ./.
152+
fi
153+
130154
exitcode=$?
131155
if [ "${exitcode}" -ne 0 ]; then
132156
fn_print_fail_eol
@@ -136,8 +160,8 @@ fn_backup_compression() {
136160
fn_script_log_fail "Starting backup"
137161
else
138162
fn_print_ok_eol
139-
fn_print_ok_nl "Completed: ${italic}${backupname}.tar.gz${default}, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
140-
fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
163+
fn_print_ok "Completed: ${italic}${backupname}.${compressext}${default}, total size $(du -sh "${backupdir}/${backupname}.${compressext}" | awk '{print $1}')"
164+
fn_script_log_pass "Backup created: ${backupname}.${compressext}, total size $(du -sh "${backupdir}/${backupname}.${compressext}" | awk '{print $1}')"
141165
alert="backup"
142166
alert.sh
143167
fi
@@ -152,7 +176,7 @@ fn_backup_prune() {
152176
# How many backups exceed maxbackups.
153177
backupquotadiff=$((backupcount - maxbackups))
154178
# How many backups exceed maxbackupdays.
155-
backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.gz" -mtime +"${maxbackupdays}" | wc -l)
179+
backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.*" -mtime +"${maxbackupdays}" | wc -l)
156180
# If anything can be cleared.
157181
if [ "${backupquotadiff}" -gt "0" ] || [ "${backupsoudatedcount}" -gt "0" ]; then
158182
fn_print_dots "Pruning"
@@ -167,7 +191,7 @@ fn_backup_prune() {
167191
fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)"
168192
fn_script_log_info "Pruning: Clearing ${backupquotadiff} backup(s)"
169193
# Clear backups over quota.
170-
find "${backupdir}"/ -type f -name "*.tar.gz" -printf '%T@ %p\n' | sort -rn | tail -${backupquotadiff} | cut -f2- -d" " | xargs rm
194+
find "${backupdir}"/ -type f -name "*.tar.*" -printf '%T@ %p\n' | sort -rn | tail -${backupquotadiff} | cut -f2- -d" " | xargs rm
171195
fn_print_ok_nl "Pruning: Clearing ${backupquotadiff} backup(s)"
172196
fn_script_log_pass "Pruning: Cleared ${backupquotadiff} backup(s)"
173197
# If maxbackupdays is used over maxbackups.
@@ -190,15 +214,15 @@ fn_backup_prune() {
190214
fn_backup_relpath() {
191215
# Written by CedarLUG as a "realpath --relative-to" alternative in bash.
192216
# Populate an array of tokens initialized from the rootdir components.
193-
declare -a rdirtoks=($(readlink -f "${rootdir}" | sed "s/\// /g"))
217+
mapfile -t rdirtoks < <(readlink -f "${rootdir}" | sed "s/\//\n/g")
194218
if [ ${#rdirtoks[@]} -eq 0 ]; then
195219
fn_print_fail_nl "Problem assessing rootdir during relative path assessment"
196220
fn_script_log_fail "Problem assessing rootdir during relative path assessment: ${rootdir}"
197221
core_exit.sh
198222
fi
199223

200224
# Populate an array of tokens initialized from the backupdir components.
201-
declare -a bdirtoks=($(readlink -f "${backupdir}" | sed "s/\// /g"))
225+
mapfile -t bdirtoks < <(readlink -f "${backupdir}" | sed "s/\//\n/g")
202226
if [ ${#bdirtoks[@]} -eq 0 ]; then
203227
fn_print_fail_nl "Problem assessing backupdir during relative path assessment"
204228
fn_script_log_fail "Problem assessing backupdir during relative path assessment: ${rootdir}"
@@ -243,12 +267,12 @@ fn_backup_start_server() {
243267
fn_print_dots ""
244268
check.sh
245269
core_logs.sh
246-
270+
fn_select_compression
247271
fn_backup_check_lockfile
272+
fn_backup_create_lockfile
248273
fn_backup_init
249274
fn_backup_stop_server
250275
fn_backup_dir
251-
fn_backup_create_lockfile
252276
fn_backup_compression
253277
fn_backup_prune
254278
fn_backup_start_server

0 commit comments

Comments
 (0)