mirror of
https://github.com/GameServerManagers/LinuxGSM.git
synced 2025-01-08 12:07:37 +08:00
codacy
This commit is contained in:
parent
bfdd04e864
commit
167cf43e5b
@ -22,9 +22,9 @@ maxplayers="28"
|
||||
fn_parms(){
|
||||
# Allows serverpassword to work with parameters
|
||||
if [ "${serverpassword}" != "NOT SET" ]; then
|
||||
parms="${defaultmap}?Scenario=${defaultscenario}?MaxPlayers=${maxplayers}?Port=${port}?QueryPort=${queryport}?password="${serverpassword}" -hostname='${servername}' -log"
|
||||
parms="${defaultmap}?Scenario=${defaultscenario}?MaxPlayers=${maxplayers}?Port=${port}?QueryPort=${queryport}?password="${serverpassword}" -hostname="${servername}" -log"
|
||||
else
|
||||
parms="${defaultmap}?Scenario=${defaultscenario}?MaxPlayers=${maxplayers}?Port=${port}?QueryPort=${queryport} -hostname='${servername}' -log"
|
||||
parms="${defaultmap}?Scenario=${defaultscenario}?MaxPlayers=${maxplayers}?Port=${port}?QueryPort=${queryport} -hostname="${servername}" -log"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ maxplayers="32"
|
||||
|
||||
## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
|
||||
fn_parms(){
|
||||
parms="-port=${port} -beaconport=${beaconport} -MULTIHOME="${ip}" -maxplayers=${maxplayers}"
|
||||
parms="-port="${port}" -beaconport="${beaconport}" -MULTIHOME="${ip}" -maxplayers=${maxplayers}"
|
||||
}
|
||||
|
||||
#### LinuxGSM Settings ####
|
||||
|
@ -139,6 +139,7 @@ executabledir="${systemdir}"
|
||||
executable="./mta-server64"
|
||||
servercfgdir="${systemdir}/mods/deathmatch"
|
||||
servercfg="mtaserver.conf"
|
||||
servercfgdefault="mtaserver.conf"
|
||||
servercfgfullpath="${servercfgdir}/${servercfg}"
|
||||
|
||||
## Backup Directory
|
||||
|
@ -142,6 +142,7 @@ executabledir="${systemdir}/Engine/Binaries/Linux"
|
||||
executable="./UE4Server-Linux-Shipping"
|
||||
servercfgdir="${systemdir}/UnrealTournament/Saved/Config/LinuxServer"
|
||||
servercfg="Game.ini"
|
||||
servercfgdefault"Game.ini"
|
||||
servercfgfullpath="${servercfgdir}/${servercfg}"
|
||||
|
||||
## Backup Directory
|
||||
|
@ -383,7 +383,7 @@ fn_deps_build_debian(){
|
||||
# Battlefield: Vietnam
|
||||
elif [ "${shortname}" == "bfv" ]; then
|
||||
array_deps_required+=( libncurses5:i386 libstdc++5:i386 )
|
||||
# Battlefield 1942, Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source
|
||||
# Battlefield 1942, Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source
|
||||
elif [ "${shortname}" == "bf1942" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "zmr" ]||[ "${shortname}" == "zps" ]; then
|
||||
if [ "${arch}" == "x86_64" ]; then
|
||||
array_deps_required+=( libtinfo5:i386 )
|
||||
@ -447,6 +447,7 @@ fn_deps_build_debian(){
|
||||
# Wurm: Unlimited
|
||||
elif [ "${shortname}" == "wurm" ]; then
|
||||
array_deps_required+=( xvfb )
|
||||
# Post Scriptum
|
||||
elif [ "${shortname}" == "pstbs" ]; then
|
||||
array_deps_required+=( libgconf-2-4 )
|
||||
fi
|
||||
@ -495,7 +496,7 @@ fn_deps_build_redhat(){
|
||||
# Battlefield: Vietnam
|
||||
elif [ "${shortname}" == "bfv" ]; then
|
||||
array_deps_required+=( compat-libstdc++-33.i686 glibc.i686 )
|
||||
# Battlefield 1942, Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source
|
||||
# Battlefield 1942, Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source
|
||||
elif [ "${shortname}" == "bf1942" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "zmr" ]||[ "${shortname}" == "zps" ]; then
|
||||
array_deps_required+=( ncurses-libs.i686 )
|
||||
# Brainbread 2, Don't Starve Together & Team Fortress 2
|
||||
@ -555,6 +556,7 @@ fn_deps_build_redhat(){
|
||||
# Wurm: Unlimited
|
||||
elif [ "${shortname}" == "wurm" ]; then
|
||||
array_deps_required+=( xorg-x11-server-Xvfb )
|
||||
# Post Scriptum
|
||||
elif [ "${shortname}" == "pstbs" ]; then
|
||||
array_deps_required+=( GConf2 )
|
||||
fi
|
||||
|
@ -7,7 +7,7 @@
|
||||
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
|
||||
fn_install_steamcmd(){
|
||||
if [ ${shortname} == "ark" ]&&[ "${installsteamcmd}" == "1" ]; then
|
||||
if [ "${shortname}" == "ark" ]&&[ "${installsteamcmd}" == "1" ]; then
|
||||
steamcmddir="${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux"
|
||||
fi
|
||||
if [ ! -d "${steamcmddir}" ]; then
|
||||
|
@ -4,7 +4,6 @@
|
||||
# Website: https://linuxgsm.com
|
||||
# Description: Gives access to the server tmux console.
|
||||
|
||||
|
||||
commandname="CONSOLE"
|
||||
commandaction="Access console"
|
||||
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
|
@ -78,7 +78,7 @@ if [ "${script_diff}" != "" ]; then
|
||||
mkdir -p "${backupdir}/script"
|
||||
fi
|
||||
cp "${rootdir}/${selfname}" "${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? != 0 ]; then
|
||||
fn_print_fail_eol_nl
|
||||
fn_script_log_fatal "Backup ${selfname}"
|
||||
core_exit.sh
|
||||
@ -160,7 +160,7 @@ if [ -n "${functionsdir}" ]; then
|
||||
else
|
||||
curl -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}" 1>/dev/null
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? != 0 ]; then
|
||||
fn_print_error_eol_nl
|
||||
fn_script_log_error "Checking ${remotereponame} module ${functionfile}"
|
||||
echo -en "removing module ${functionfile}...\c"
|
||||
|
@ -135,13 +135,13 @@ fn_wipe_server_files(){
|
||||
fn_script_log_pass "No blueprint file to remove"
|
||||
fi
|
||||
elif [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
|
||||
echo -e "keeping blueprints"
|
||||
fn_sleep_time
|
||||
fn_script_log_info "Keeping blueprints"
|
||||
echo -e "keeping blueprints"
|
||||
fn_sleep_time
|
||||
fn_script_log_info "Keeping blueprints"
|
||||
else
|
||||
echo -e "no blueprints found"
|
||||
fn_sleep_time
|
||||
fn_script_log_pass "No blueprints found"
|
||||
echo -e "no blueprints found"
|
||||
fn_sleep_time
|
||||
fn_script_log_pass "No blueprints found"
|
||||
fi
|
||||
# Wipe some logs that might be there.
|
||||
if [ "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
|
||||
|
@ -21,7 +21,7 @@ fn_fix_msg_start_nl(){
|
||||
}
|
||||
|
||||
fn_fix_msg_end(){
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? != 0 ]; then
|
||||
fn_print_error_nl "Applying ${fixname} fix: ${gamename}"
|
||||
fn_script_log_error "Applying ${fixname} fix: ${gamename}"
|
||||
else
|
||||
|
@ -7,18 +7,18 @@
|
||||
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# removes mulitple appworkshop_346110.acf if found.
|
||||
steamappsfilewc=$(find ${HOME} -name appworkshop_346110.acf | wc -l)
|
||||
steamappsfilewc="$(find "${HOME}" -name appworkshop_346110.acf | wc -l)"
|
||||
if [ "${steamappsfilewc}" -gt "1" ]; then
|
||||
fixname="multiple appworkshop acf files"
|
||||
fn_fix_msg_start
|
||||
find ${HOME} -name appworkshop_346110.acf -exec rm -f {} \;
|
||||
find "${HOME}" -name appworkshop_346110.acf -exec rm -f {} \;
|
||||
fn_fix_msg_end
|
||||
elif [ "${steamappsfilewc}" -eq "1" ]; then
|
||||
# Steam mods directory selecter
|
||||
# This allows LinxuGSM to select either ~/.steam or ~/Steam. depending on what is being used
|
||||
steamappsfile=$(find ${HOME} -name appworkshop_346110.acf)
|
||||
steamappsfile=$(find "${HOME}" -name appworkshop_346110.acf)
|
||||
steamappsdir=$(dirname "${steamappsfile}")
|
||||
steamappspath=$(cd "${steamappsdir}"|| return; cd ../;pwd)
|
||||
steamappspath=$(cd "${steamappsdir}" || return; cd ../;pwd)
|
||||
|
||||
# removes the symlink if exists.
|
||||
# fixes issue with older versions of LinuxGSM linking to /home/arkserver/steamcmd
|
||||
@ -40,7 +40,7 @@ elif [ "${steamappsfilewc}" -eq "1" ]; then
|
||||
fi
|
||||
|
||||
# if the steamapps symlink is incorrect unlink it.
|
||||
if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]&&[ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]&&[ "$(readlink ${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps)" != "${steamappspath}" ]; then
|
||||
if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]&&[ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]&&[ "$(readlink "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps")" != "${steamappspath}" ]; then
|
||||
fixname="incorrect steamapps symlink"
|
||||
fn_fix_msg_start
|
||||
unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps"
|
||||
|
@ -232,8 +232,8 @@ fn_info_config_chivalry(){
|
||||
serverpassword="${unavailable}"
|
||||
adminpassword="${unavailable}"
|
||||
else
|
||||
servername=$(egrep "^ServerName" "${servercfgfullpath}" | sed 's/^ServerName=//')
|
||||
adminpassword=$(egrep "^AdminPassword" "${servercfgfullpath}" | sed 's/^AdminPassword=//')
|
||||
servername=$(grep -E "^ServerName" "${servercfgfullpath}" | sed 's/^ServerName=//')
|
||||
adminpassword=$(grep -E "^AdminPassword" "${servercfgfullpath}" | sed 's/^AdminPassword=//')
|
||||
|
||||
# Not Set
|
||||
servername=${servername:-"NOT SET"}
|
||||
|
@ -263,9 +263,9 @@ fi
|
||||
if [ "$(command -v jq 2>/dev/null)" ]; then
|
||||
if [ "${ip}" ]&&[ "${port}" ]; then
|
||||
if [ "${steammaster}" == "true" ]; then
|
||||
masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]?|.addr' | wc -l 2>/dev/null)
|
||||
masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l 2>/dev/null)
|
||||
if [ "${masterserver}" == "0" ]; then
|
||||
masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]?|.addr' | wc -l 2>/dev/null)
|
||||
masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l 2>/dev/null)
|
||||
fi
|
||||
if [ "${masterserver}" == "0" ]; then
|
||||
displaymasterserver="false"
|
||||
|
@ -15,7 +15,7 @@ fn_sleep_time
|
||||
# Create LinuxGSM logs.
|
||||
echo -en "installing log dir: ${logdir}..."
|
||||
mkdir -p "${logdir}"
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? != 0 ]; then
|
||||
fn_print_fail_eol_nl
|
||||
core_exit.sh
|
||||
else
|
||||
@ -24,7 +24,7 @@ fi
|
||||
|
||||
echo -en "installing LinuxGSM log dir: ${lgsmlogdir}..."
|
||||
mkdir -p "${lgsmlogdir}"
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? != 0 ]; then
|
||||
fn_print_fail_eol_nl
|
||||
core_exit.sh
|
||||
else
|
||||
@ -32,7 +32,7 @@ else
|
||||
fi
|
||||
echo -en "creating LinuxGSM log: ${lgsmlog}..."
|
||||
touch "${lgsmlog}"
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? != 0 ]; then
|
||||
fn_print_fail_eol_nl
|
||||
core_exit.sh
|
||||
else
|
||||
@ -42,7 +42,7 @@ fi
|
||||
if [ "${consolelogdir}" ]; then
|
||||
echo -en "installing console log dir: ${consolelogdir}..."
|
||||
mkdir -p "${consolelogdir}"
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? != 0 ]; then
|
||||
fn_print_fail_eol_nl
|
||||
core_exit.sh
|
||||
else
|
||||
|
@ -381,7 +381,7 @@ else
|
||||
mkdir -p "${configdirserver}"
|
||||
echo -en "copying _default.cfg...\c"
|
||||
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "FAIL"
|
||||
exit 1
|
||||
else
|
||||
@ -393,7 +393,7 @@ else
|
||||
fn_print_warn_nl "_default.cfg has altered. reloading config."
|
||||
echo -en "copying _default.cfg...\c"
|
||||
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "FAIL"
|
||||
exit 1
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user