Browse Source

Merge branch 'develop' into repo-sync/master

pull/4810/head
Daniel Gibbs 14 hours ago
committed by GitHub
parent
commit
c19ab3533e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 17
      .editorconfig
  2. 4
      .github/workflows/details-check.yml
  3. 4
      .github/workflows/update-check.yml
  4. 1
      .shellcheckrc
  5. 2
      lgsm/config-default/config-lgsm/hl2dmserver/_default.cfg
  6. 2
      lgsm/config-default/config-lgsm/tf2server/_default.cfg
  7. 7
      lgsm/modules/alert_discord.sh
  8. 2
      lgsm/modules/alert_email.sh
  9. 18
      lgsm/modules/check.sh
  10. 62
      lgsm/modules/command_backup.sh
  11. 2
      lgsm/modules/command_check_update.sh
  12. 35
      lgsm/modules/command_fastdl.sh
  13. 1
      lgsm/modules/command_mods_install.sh
  14. 1
      lgsm/modules/command_mods_remove.sh
  15. 8
      lgsm/modules/command_send.sh
  16. 35
      lgsm/modules/compress_unreal2_maps.sh
  17. 80
      lgsm/modules/compress_unreal_maps.sh
  18. 35
      lgsm/modules/compress_ut99_maps.sh
  19. 4
      lgsm/modules/core_exit.sh
  20. 11
      lgsm/modules/core_getopt.sh
  21. 5
      lgsm/modules/core_modules.sh
  22. 6
      lgsm/modules/info_distro.sh
  23. 8
      lgsm/modules/install_config.sh
  24. 1
      lgsm/modules/install_ut2k4_key.sh
  25. 4
      lgsm/modules/mods_list.sh
  26. 21
      lgsm/modules/update_xnt.sh
  27. 3
      linuxgsm.sh

17
.editorconfig

@ -1,28 +1,17 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs.
# 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.
# http://editorconfig.org/
root = true
[*]
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true
# YAML Files
[*.{yml,yaml}]
indent_size = 2
indent_style = space
# JSON Files
[*.{json,json5,webmanifest}]
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
# BASH Files
[*.{.sh}]
indent_style = tab
indent_size = 4
indent_style = tab

4
.github/workflows/details-check.yml

@ -68,6 +68,10 @@ jobs:
else
curl -f -o config "https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/main/${{ matrix.shortname }}/${{ steps.sets-servercfgname.outputs.servercfgname }}"
fi
- name: Pre-load LinuxGSM
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server details
- name: Display config
run: |
if [ "${{ steps.sets-servercfgname.outputs.servercfgname }}" == "" ]; then

4
.github/workflows/update-check.yml

@ -13,12 +13,12 @@ concurrency:
jobs:
update-check:
if: github.repository_owner == 'GameServerManagers'
continue-on-error: true
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shortname: [css, fctr, jk2, mc, mcb, mta, pmc, ts3, ut99, vints]
shortname: [css, fctr, jk2, mc, mcb, mta, pmc, ts3, ut99, vints, xnt]
steps:
- name: Download linuxgsm.sh

1
.shellcheckrc

@ -0,0 +1 @@
disable=SC2154

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

@ -9,6 +9,8 @@
#### Game Server Settings ####
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
# Note that for HL2DM, maxplayers > 33 must be specified like so:
# maxplayers="101 -unrestricted_maxplayers"
ip="0.0.0.0"
port="27015"
clientport="27005"

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

@ -9,6 +9,8 @@
#### Game Server Settings ####
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
# Note that for TF2, maxplayers > 33 must be specified like so:
# maxplayers="101 -unrestricted_maxplayers"
ip="0.0.0.0"
port="27015"
clientport="27005"

7
lgsm/modules/alert_discord.sh

@ -46,6 +46,11 @@ json=$(
"name": "Server Time",
"value": "$(date)",
"inline": true
},
{
"name": "More info",
"value": "${alerturl}",
"inline": true
}
EOF
)
@ -63,7 +68,7 @@ EOF
)
fi
if [ -n "{alerturl}" ]; then
if [ -n "${alerturl}" ]; then
json+=$(
cat << EOF
,

2
lgsm/modules/alert_email.sh

@ -15,7 +15,7 @@ else
mail -s "${alerttitle}" "${email}" < "${alertlog}"
fi
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
if [ "${exitcode}" -eq 0 ]; then
fn_print_ok_nl "Sending Email alert: ${email}"
fn_script_log_pass "Sending Email alert: ${email}"
else

18
lgsm/modules/check.sh

@ -31,7 +31,7 @@ if [ "${commandname}" != "INSTALL" ] && [ "${commandname}" != "UPDATE-LGSM" ] &&
check_system_dir.sh
fi
allowed_commands_array=(START DEBUG)
allowed_commands_array=(DEBUG RESTART START)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
check_executable.sh
@ -39,7 +39,7 @@ for allowed_command in "${allowed_commands_array[@]}"; do
done
if [ "$(whoami)" != "root" ]; then
allowed_commands_array=(DEBUG START INSTALL)
allowed_commands_array=(DEBUG RESTART START INSTALL)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
check_glibc.sh
@ -54,21 +54,21 @@ for allowed_command in "${allowed_commands_array[@]}"; do
fi
done
allowed_commands_array=(BACKUP DEBUG DETAILS START UPDATE)
allowed_commands_array=(BACKUP DEBUG DETAILS RESTART START UPDATE)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
check_deps.sh
fi
done
allowed_commands_array=(CONSOLE DEBUG MONITOR START STOP)
allowed_commands_array=(CONSOLE DEBUG MONITOR RESTART START STOP)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
check_config.sh
fi
done
allowed_commands_array=(DEBUG DETAILS DEV-QUERY-RAW MONITOR POST_DETAILS START STOP POST-DETAILS)
allowed_commands_array=(DEBUG DETAILS DEV-QUERY-RAW MONITOR POST_DETAILS RESTART START STOP POST-DETAILS)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
if [ -z "${installflag}" ]; then
@ -77,7 +77,7 @@ for allowed_command in "${allowed_commands_array[@]}"; do
fi
done
allowed_commands_array=(DEBUG START UPDATE VALIDATE CHECK-UPDATE)
allowed_commands_array=(DEBUG RESTART START UPDATE VALIDATE CHECK-UPDATE)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
if [ "${appid}" ]; then
@ -86,21 +86,21 @@ for allowed_command in "${allowed_commands_array[@]}"; do
fi
done
allowed_commands_array=(CHANGE-PASSWORD DETAILS MONITOR START STOP UPDATE VALIDATE POST-DETAILS)
allowed_commands_array=(CHANGE-PASSWORD DETAILS MONITOR RESTART START STOP UPDATE VALIDATE POST-DETAILS)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
check_status.sh
fi
done
allowed_commands_array=(DEBUG START INSTALL)
allowed_commands_array=(DEBUG RESTART START INSTALL)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
check_system_requirements.sh
fi
done
allowed_commands_array=(DETAILS MONITOR START STOP UPDATE VALIDATE POST-DETAILS)
allowed_commands_array=(DETAILS MONITOR RESTART START STOP UPDATE VALIDATE POST-DETAILS)
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
check_gamedig.sh

62
lgsm/modules/command_backup.sh

@ -13,13 +13,13 @@ fn_firstcommand_set
# Trap to remove lockfile on quit.
fn_backup_trap() {
echo -e ""
echo -en "backup ${backupname}.tar.gz..."
echo -en "backup ${backupname}.${compressext}..."
fn_print_canceled_eol_nl
fn_script_log_info "Backup ${backupname}.tar.gz: CANCELED"
rm -f "${backupdir:?}/${backupname}.tar.gz" | tee -a "${lgsmlog}"
echo -en "backup ${backupname}.tar.gz..."
fn_script_log_info "Backup ${backupname}.${compressext}: CANCELED"
rm -f "${backupdir:?}/${backupname}.${compressext}" | tee -a "${lgsmlog}"
echo -en "backup ${backupname}.${compressext}..."
fn_print_removed_eol_nl
fn_script_log_info "Backup ${backupname}.tar.gz: REMOVED"
fn_script_log_info "Backup ${backupname}.${compressext}: REMOVED"
# Remove backup lockfile.
rm -f "${lockdir:?}/backup.lock"
fn_backup_start_server
@ -110,23 +110,47 @@ fn_backup_create_lockfile() {
trap fn_backup_trap INT
}
fn_select_compression() {
if command -v zstd > /dev/null 2>&1; then
compressprog="zstd"
compressext="tar.zst"
compressflag="--zstd"
elif command -v pigz > /dev/null 2>&1; then
compressprog="pigz"
compressext="tar.gz"
compressflag="--use-compress-program=pigz"
elif command -v gzip > /dev/null 2>&1; then
compressprog="gzip"
compressext="tar.gz"
compressflag="--gzip"
else
compressprog=""
compressext="tar"
compressflag=""
fi
}
# Compressing files.
fn_backup_compression() {
# Tells how much will be compressed using rootdirduexbackup value from info_distro and prompt for continue.
fn_print_info "A total of ${rootdirduexbackup} will be compressed."
fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.tar.gz"
fn_print_dots "Backup (${rootdirduexbackup}) ${backupname}.tar.gz, in progress ..."
fn_script_log_info "Backup ${rootdirduexbackup} ${backupname}.tar.gz, in progress"
fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.${compressext}"
fn_print_dots "Backup (${rootdirduexbackup}) ${backupname}.${compressext}, in progress ..."
fn_script_log_info "Backup ${rootdirduexbackup} ${backupname}.${compressext}, in progress"
excludedir=$(fn_backup_relpath)
# Check that excludedir is a valid path.
if [ ! -d "${excludedir}" ]; then
fn_print_fail_nl "Problem identifying the previous backup directory for exclusion."
fn_script_log_fail "Problem identifying the previous backup directory for exclusion"
core_exit.sh
fi
tar --use-compress-program=pigz -cf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}" --exclude "${tmpdir}" ./.
if [ -n "${compressflag}" ]; then
tar ${compressflag} -hcf "${backupdir}/${backupname}.${compressext}" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}" --exclude "${tmpdir}" ./.
else
tar -hcf "${backupdir}/${backupname}.${compressext}" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}" --exclude "${tmpdir}" ./.
fi
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
fn_print_fail_eol
@ -136,8 +160,8 @@ fn_backup_compression() {
fn_script_log_fail "Starting backup"
else
fn_print_ok_eol
fn_print_ok_nl "Completed: ${italic}${backupname}.tar.gz${default}, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fn_print_ok "Completed: ${italic}${backupname}.${compressext}${default}, total size $(du -sh "${backupdir}/${backupname}.${compressext}" | awk '{print $1}')"
fn_script_log_pass "Backup created: ${backupname}.${compressext}, total size $(du -sh "${backupdir}/${backupname}.${compressext}" | awk '{print $1}')"
alert="backup"
alert.sh
fi
@ -152,7 +176,7 @@ fn_backup_prune() {
# How many backups exceed maxbackups.
backupquotadiff=$((backupcount - maxbackups))
# How many backups exceed maxbackupdays.
backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.gz" -mtime +"${maxbackupdays}" | wc -l)
backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.*" -mtime +"${maxbackupdays}" | wc -l)
# If anything can be cleared.
if [ "${backupquotadiff}" -gt "0" ] || [ "${backupsoudatedcount}" -gt "0" ]; then
fn_print_dots "Pruning"
@ -167,7 +191,7 @@ fn_backup_prune() {
fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_info "Pruning: Clearing ${backupquotadiff} backup(s)"
# Clear backups over quota.
find "${backupdir}"/ -type f -name "*.tar.gz" -printf '%T@ %p\n' | sort -rn | tail -${backupquotadiff} | cut -f2- -d" " | xargs rm
find "${backupdir}"/ -type f -name "*.tar.*" -printf '%T@ %p\n' | sort -rn | tail -${backupquotadiff} | cut -f2- -d" " | xargs rm
fn_print_ok_nl "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_pass "Pruning: Cleared ${backupquotadiff} backup(s)"
# If maxbackupdays is used over maxbackups.
@ -190,7 +214,7 @@ fn_backup_prune() {
fn_backup_relpath() {
# Written by CedarLUG as a "realpath --relative-to" alternative in bash.
# Populate an array of tokens initialized from the rootdir components.
declare -a rdirtoks=($(readlink -f "${rootdir}" | sed "s/\// /g"))
mapfile -t rdirtoks < <(readlink -f "${rootdir}" | sed "s/\//\n/g")
if [ ${#rdirtoks[@]} -eq 0 ]; then
fn_print_fail_nl "Problem assessing rootdir during relative path assessment"
fn_script_log_fail "Problem assessing rootdir during relative path assessment: ${rootdir}"
@ -198,7 +222,7 @@ fn_backup_relpath() {
fi
# Populate an array of tokens initialized from the backupdir components.
declare -a bdirtoks=($(readlink -f "${backupdir}" | sed "s/\// /g"))
mapfile -t bdirtoks < <(readlink -f "${backupdir}" | sed "s/\//\n/g")
if [ ${#bdirtoks[@]} -eq 0 ]; then
fn_print_fail_nl "Problem assessing backupdir during relative path assessment"
fn_script_log_fail "Problem assessing backupdir during relative path assessment: ${rootdir}"
@ -243,12 +267,12 @@ fn_backup_start_server() {
fn_print_dots ""
check.sh
core_logs.sh
fn_select_compression
fn_backup_check_lockfile
fn_backup_create_lockfile
fn_backup_init
fn_backup_stop_server
fn_backup_dir
fn_backup_create_lockfile
fn_backup_compression
fn_backup_prune
fn_backup_start_server

2
lgsm/modules/command_check_update.sh

@ -32,6 +32,8 @@ elif [ "${shortname}" == "vints" ]; then
update_vints.sh
elif [ "${shortname}" == "ut99" ]; then
update_ut99.sh
elif [ "${shortname}" == "xnt" ]; then
update_xnt.sh
else
update_steamcmd.sh
fi

35
lgsm/modules/command_fastdl.sh

@ -21,13 +21,6 @@ luasvautorundir="${systemdir}/lua/autorun/server"
luafastdlfile="lgsm_cl_force_fastdl.lua"
luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
# Check if bzip2 is installed.
if [ ! "$(command -v bzip2 2> /dev/null)" ]; then
fn_print_fail "bzip2 is not installed"
fn_script_log_fail "bzip2 is not installed"
core_exit.sh
fi
# Header
fn_print_header
fn_print_nl "More info: ${italic}https://docs.linuxgsm.com/commands/fastdl"
@ -112,13 +105,13 @@ fn_fastdl_dirs() {
# Using this gist https://gist.github.com/agunnerson-ibm/efca449565a3e7356906
fn_human_readable_file_size() {
local abbrevs=(
$((1 << 60)):ZB
$((1 << 50)):EB
$((1 << 40)):TB
$((1 << 30)):GB
$((1 << 20)):MB
$((1 << 10)):KB
$((1)):bytes
"1152921504606846976:ZB"
"1125899906842624:EB"
"1099511627776:TB"
"1073741824:GB"
"1048576:MB"
"1024:KB"
"1:bytes"
)
local bytes="${1}"
@ -225,11 +218,17 @@ fn_fastdl_preview() {
fn_script_log_fail "Generating file list."
core_exit.sh
fi
fn_print_nl "about to compress ${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
if [ "${engine}" == "source" ]; then
echo -e "about to compress ${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
elif [ "${engine}" == "goldsrc" ]; then
echo -e "about to copy ${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
fi
fn_script_log_info "${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
rm -f "${tmpdir:?}/fastdl_files_to_compress.txt"
if ! fn_prompt_yn "Continue?" Y; then
fn_script_log "User exited"
exitcode=0
core_exit.sh
fi
}
@ -431,7 +430,9 @@ fn_fastdl_preview
fn_clear_old_fastdl
fn_fastdl_dirs
fn_fastdl_build
fn_fastdl_bzip2
if [ "${engine}" == "source" ]; then
fn_fastdl_bzip2
fi
# Finished message.
fn_print_nl "Fastdl files are located in:"
fn_print_nl "${fastdldir}"

1
lgsm/modules/command_mods_install.sh

@ -88,6 +88,7 @@ if [ -f "${modsinstalledlistfullpath}" ]; then
fn_script_log_warn "${modprettyname} is already installed"
echo -e " * Any configs may be overwritten."
if ! fn_prompt_yn "Continue?" Y; then
exitcode=0
core_exit.sh
fi
fn_script_log_info "User selected to continue"

1
lgsm/modules/command_mods_remove.sh

@ -47,6 +47,7 @@ done
fn_print_warning_nl "You are about to remove ${cyan}${usermodselect}${default}."
echo -e " * Any custom files/configuration will be removed."
if ! fn_prompt_yn "Continue?" Y; then
exitcode=0
core_exit.sh
fi

8
lgsm/modules/command_send.sh

@ -30,12 +30,8 @@ if [ "${status}" != "0" ]; then
tmux -L "${socketname}" send-keys -t "${sessionname}" "${commandtosend}" ENTER
fn_script_log_pass "Command \"${commandtosend}\" sent to console"
else
fn_print_error_nl "Server not running"
fn_script_log_error "Failed to access: Server not running"
if fn_prompt_yn "Do you want to start the server?" Y; then
exitbypass=1
command_start.sh
fi
fn_print_error_nl "Unable to send command to console. Server not running"
fn_script_log_error "Unable to send command to console. Server not running"
fi
core_exit.sh

35
lgsm/modules/compress_unreal2_maps.sh

@ -1,35 +0,0 @@
#!/bin/bash
# LinuxGSM compress_unreal2_maps.sh module
# Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Compresses unreal maps.
commandname="MAP-COMPRESSOR"
commandaction="Compressing Maps"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set
check.sh
fn_print_header
echo -e "Will compress all maps in:"
echo -e ""
pwd
echo -e ""
echo -e "Compressed maps saved to:"
echo -e ""
echo -e "${compressedmapsdir}"
echo -e ""
if ! fn_prompt_yn "Start compression?" Y; then
exitcode=0
core_exit.sh
fi
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
rm -rfv "${serverfiles:?}/Maps/"*.ut2.uz2
cd "${systemdir}" || exit
for map in "${serverfiles}/Maps/"*; do
./ucc-bin compress "${map}" --nohomedir
done
mv -fv "${serverfiles}/Maps/"*.ut2.uz2 "${compressedmapsdir}"
core_exit.sh

80
lgsm/modules/compress_unreal_maps.sh

@ -0,0 +1,80 @@
#!/bin/bash
# LinuxGSM compress_unreal_maps.sh module
# Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Compresses unreal and unreal2 resources.
commandname="MAP-COMPRESSOR"
commandaction="Compressing Maps"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set
check.sh
fn_print_header
echo -e "Will compress all maps in:"
echo -e ""
pwd
echo -e ""
echo -e "Compressed maps saved to:"
echo -e ""
echo -e "${compressedmapsdir}"
echo -e ""
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "map compression starting in: ${totalseconds}"
totalseconds=$((totalseconds - 1))
fn_sleep_time_1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_nl
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
# List of extensions to compress
exts=(ut2 kfm rom u ucl upl int utx uax ukx usx unr umx umod uzx)
# Remove old compressed files using find
for ext in "${exts[@]}"; do
mapfile -t oldfiles < <(find "${serverfiles}" -name "*.${ext}.uz2" -type f)
if [ ${#oldfiles[@]} -gt 0 ]; then
echo -e "found ${#oldfiles[@]} old compressed file(s) to remove for extension: ${ext}"
fi
for file in "${oldfiles[@]}"; do
if rm -f "$file"; then
echo -en "removing file [ ${italic}$(basename "$file")${default} ]\c"
fn_print_ok_eol_nl
else
echo -en "removing file [ ${italic}$(basename "$file")${default} ]\c"
fn_print_fail_eol_nl
fi
done
done
cd "${systemdir}" || exit
# Find and compress files, then move .uz2 to compressedmapsdir
for ext in "${exts[@]}"; do
# Collect all files with the current extension into an array
mapfile -t files < <(find "${serverfiles}" -name "*.${ext}" -type f)
for file in "${files[@]}"; do
echo -en "compressing file [ ${italic}$(basename "$file") -> $(basename "$file").uz2${default} ]\c"
if ! ./ucc-bin compress "${file}" --nohomedir > /dev/null 2>&1; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
if ! mv -f "${file}.uz2" "${compressedmapsdir}" > /dev/null 2>&1; then
echo -en "moving compressed file [ ${italic}$(basename "$file").uz2 -> ${compressedmapsdir}/$(basename "$file").uz2${default} ]\c"
fn_print_fail_eol_nl
core_exit.sh
fi
done
done
fn_print_ok_nl "Compression complete: All compressed files moved to: ${compressedmapsdir}"
core_exit.sh

35
lgsm/modules/compress_ut99_maps.sh

@ -1,35 +0,0 @@
#!/bin/bash
# LinuxGSM compress_ut99_maps.sh module
# Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Compresses unreal maps.
commandname="MAP-COMPRESSOR"
commandaction="Compressing Maps"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set
check.sh
fn_print_header
echo -e "Will compress all maps in:"
echo -e ""
pwd
echo -e ""
echo -e "Compressed maps saved to:"
echo -e ""
echo -e "${compressedmapsdir}"
echo -e ""
if ! fn_prompt_yn "Start compression?" Y; then
exitcode=0
core_exit.sh
fi
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
rm -rfv "${serverfiles:?}/Maps/"*.unr.uz
cd "${systemdir}" || exit
for map in "${serverfiles}/Maps/"*; do
./ucc-bin compress "${map}" --nohomedir
done
mv -fv "${serverfiles}/Maps/"*.unr.uz "${compressedmapsdir}"
core_exit.sh

4
lgsm/modules/core_exit.sh

@ -13,8 +13,8 @@ fn_exit_dev_debug() {
echo -e "${moduleselfname} exiting with code: ${exitcode}"
if [ -f "${rootdir}/dev-debug.log" ]; then
grep -a "modulefile=" "${rootdir}/dev-debug.log" | sed 's/modulefile=//g' > "${rootdir}/dev-debug-module-order.log"
elif [ -f "${lgsmlogdir}/dev-debug.log" ]; then
grep -a "modulefile=" "${lgsmlogdir}/dev-debug.log" | sed 's/modulefile=//g' > "${rootdir}/dev-debug-module-order.log"
elif [ -f "${logdir}/dev-debug.log" ]; then
grep -a "modulefile=" "${logdir}/dev-debug.log" | sed 's/modulefile=//g' > "${logdir}/dev-debug-module-order.log"
fi
fi
}

11
lgsm/modules/core_getopt.sh

@ -42,8 +42,7 @@ cmd_change_password=("pw;change-password" "command_ts3_server_pass.sh" "Change T
cmd_install_default_resources=("ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources.")
cmd_fullwipe=("fw;full-wipe;wa;wipeall" "serverwipe=1; command_wipe.sh" "Reset the map and remove blueprint data.")
cmd_mapwipe=("mw;map-wipe;w;wipe;wi" "mapwipe=1; command_wipe.sh" "Reset the map and keep blueprint data.")
cmd_map_compressor_u99=("mc;map-compressor" "compress_ut99_maps.sh" "Compresses all ${gamename} server maps.")
cmd_map_compressor_u2=("mc;map-compressor" "compress_unreal2_maps.sh" "Compresses all ${gamename} server maps.")
cmd_map_compressor_unreal=("mc;map-compressor" "compress_unreal_maps.sh" "Compresses all ${gamename} server maps.")
cmd_install_cdkey=("cd;server-cd-key" "install_ut2k4_key.sh" "Add your server cd key.")
cmd_install_dst_token=("ct;cluster-token" "install_dst_token.sh" "Configure cluster token.")
cmd_install_squad_license=("li;license" "install_squad_license.sh" "Add your Squad server license.")
@ -96,7 +95,7 @@ fi
## Game server exclusive commands.
# FastDL command.
if [ "${engine}" == "source" ]; then
if [ "${engine}" == "source" ] || [ "${engine}" == "goldsrc" ]; then
currentopt+=("${cmd_fastdl[@]}")
fi
@ -113,13 +112,13 @@ fi
# Unreal exclusive.
if [ "${engine}" == "unreal2" ]; then
if [ "${shortname}" == "ut2k4" ]; then
currentopt+=("${cmd_install_cdkey[@]}" "${cmd_map_compressor_u2[@]}")
currentopt+=("${cmd_install_cdkey[@]}" "${cmd_map_compressor_unreal[@]}")
else
currentopt+=("${cmd_map_compressor_u2[@]}")
currentopt+=("${cmd_map_compressor_unreal[@]}")
fi
fi
if [ "${engine}" == "unreal" ]; then
currentopt+=("${cmd_map_compressor_u99[@]}")
currentopt+=("${cmd_map_compressor_unreal[@]}")
fi
# DST exclusive.

5
lgsm/modules/core_modules.sh

@ -275,11 +275,6 @@ compress_unreal2_maps.sh() {
fn_fetch_module
}
compress_ut99_maps.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
}
# Mods
mods_list.sh() {

6
lgsm/modules/info_distro.sh

@ -252,11 +252,11 @@ if [ -d "${backupdir}" ]; then
backupcount=0
# If there are backups in backup dir.
if [ "$(find "${backupdir}" -name "*.tar.gz" | wc -l)" -ne "0" ]; then
if [ "$(find "${backupdir}" -name "*.tar.*" | wc -l)" -ne "0" ]; then
# number of backups.
backupcount="$(find "${backupdir}"/*.tar.gz | wc -l)" # integer
backupcount="$(find "${backupdir}"/*.tar.* | wc -l)" # integer
# most recent backup.
lastbackup="$(ls -1t "${backupdir}"/*.tar.gz | head -1)" # string
lastbackup="$(ls -1t "${backupdir}"/*.tar.* | head -1)" # string
# date of most recent backup.
lastbackupdate="$(date -r "${lastbackup}")" # string
# no of days since last backup.

8
lgsm/modules/install_config.sh

@ -289,7 +289,6 @@ elif [ "${shortname}" == "bt" ]; then
elif [ "${shortname}" == "btl" ]; then
fn_check_cfgdir
array_configs+=(Game.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
@ -370,7 +369,6 @@ elif [ "${shortname}" == "cs" ]; then
fn_list_config_locations
elif [ "${shortname}" == "cs2" ]; then
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
@ -483,7 +481,6 @@ elif [ "${shortname}" == "hldms" ]; then
fn_list_config_locations
elif [ "${shortname}" == "ohd" ]; then
array_configs+=(Admins.cfg Engine.ini Game.ini MapCycle.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
@ -585,7 +582,6 @@ elif [ "${shortname}" == "pvkii" ]; then
fn_list_config_locations
elif [ "${shortname}" == "pw" ]; then
array_configs+=(PalWorldSettings.ini)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
@ -614,13 +610,11 @@ elif [ "${shortname}" == "q2" ]; then
fn_list_config_locations
elif [ "${shortname}" == "q3" ]; then
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "q4" ]; then
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
@ -783,8 +777,8 @@ elif [ "${shortname}" == "wmc" ]; then
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "xnt" ]; then
fix_xnt.sh
array_configs+=(server.cfg)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations

1
lgsm/modules/install_ut2k4_key.sh

@ -27,3 +27,4 @@ else
echo -e "./${selfname} server-cd-key"
fi
echo -e ""
core_exit.sh

4
lgsm/modules/mods_list.sh

@ -55,13 +55,13 @@ amxxtslatestfile="amxmodx-${amxxtsversion}-${amxxtsmod}-linux.tar.gz"
amxxtsdownloadurl="https://www.amxmodx.org/release/${amxxtslatestfile}"
amxxtsurl="${amxxtsdownloadurl}"
# Metamod:Source
metamodsourceversion="1.11"
metamodsourceversion="1.12"
metamodsourcescrapeurl="https://mms.alliedmods.net/mmsdrop/${metamodsourceversion}/mmsource-latest-linux"
metamodsourcelatestfile=$(wget "${metamodsourcescrapeurl}" -q -O -)
metamodsourcedownloadurl="https://www.metamodsource.net/latest.php?os=linux&version=${metamodsourceversion}"
metamodsourceurl="${metamodsourcedownloadurl}"
# Sourcemod
sourcemodversion="1.11"
sourcemodversion="1.13"
sourcemodscrapeurl="https://sm.alliedmods.net/smdrop/${sourcemodversion}/sourcemod-latest-linux"
sourcemodlatestfile=$(wget "${sourcemodscrapeurl}" -q -O -)
sourcemoddownloadurl="https://www.sourcemod.net/latest.php?os=linux&version=${sourcemodversion}"

21
lgsm/modules/update_xnt.sh

@ -1,9 +1,9 @@
#!/bin/bash
# LinuxGSM command_ut99.sh module
# LinuxGSM command_xnt.sh module
# Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Handles updating of Unreal Tournament 99 servers.
# Description: Handles updating of Xontic servers.
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
@ -17,10 +17,21 @@ fn_update_dl() {
fn_update_localbuild() {
# Gets local build info.
fn_print_dots "Checking local build: ${remotelocation}"
check_status.sh
# Send version command to Xonotic server.
tmux -L "${socketname}" send-keys -t "${sessionname}" "version\r" > /dev/null 2>&1
fn_sleep_time_1
if [ "${status}" != "0" ]; then
tmux -L "${socketname}" send-keys -t "${sessionname}" "version" C-m > /dev/null 2>&1
fn_sleep_time_1
else
exitbypass=1
command_start.sh
fn_firstcommand_reset
exitbypass=1
fn_sleep_time_5
tmux -L "${socketname}" send-keys -t "${sessionname}" "version" C-m > /dev/null 2>&1
command_stop.sh
fn_firstcommand_reset
fi
# Uses log file to get local build.
localbuild=$(grep "SVQC version: xonotic-v" "${consolelogdir}"/* 2> /dev/null | tail -1 | sed 's/.*SVQC version: \(xonotic-v[0-9.]*\).*/\1/' | tr -d '\000-\011\013-\037')

3
linuxgsm.sh

@ -32,7 +32,8 @@ rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
lgsmdir="${rootdir}/lgsm"
[ -n "${LGSM_LOGDIR}" ] && logdir="${LGSM_LOGDIR}" || logdir="${rootdir}/log"
lgsmlogdir="${logdir}/lgsm"
lgsmlogdir="${logdir}/script"
lgsmlog="${lgsmlogdir}/${selfname}-script.log"
steamcmddir="${HOME}/.steam/steamcmd"
[ -n "${LGSM_SERVERFILES}" ] && serverfiles="${LGSM_SERVERFILES}" || serverfiles="${rootdir}/serverfiles"
modulesdir="${lgsmdir}/modules"

Loading…
Cancel
Save