feat(refactor): general refactor of if statements (#2492)

* Codacy recommendation fixes
This commit is contained in:
Daniel Gibbs 2019-08-30 09:56:15 +01:00 committed by GitHub
parent c3521ba749
commit 1d41bc66d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 189 additions and 203 deletions

2
.gitattributes vendored
View File

@ -19,4 +19,4 @@
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.RTF diff=astextplain

View File

@ -26,4 +26,4 @@ If yes Use SteamDB to get the appid. (https://steamdb.info).
We only support Linux servers and do not support Wine.
* [ ] Yes
* [ ] No
* [ ] No

View File

@ -10,4 +10,4 @@ referenceComment: >
Potential duplicates:
{{#issues}}
- [#{{ number }}] {{ title }} ({{ accuracy }}%)
{{/issues}}
{{/issues}}

View File

@ -3,7 +3,7 @@
# *Required* Comment to reply with
requestInfoReplyComment: >
![More Data required](https://i.imgur.com/yS9cecv.png)
More data is required to assist with this issue
More data is required to assist with this issue
or issue template was not used correctly.
https://linuxgsm.com/support/#guide
@ -14,4 +14,4 @@ requestInfoReplyComment: >
# - updates
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
requestInfoLabelToAdd: "needs more info"
requestInfoLabelToAdd: "needs more info"

View File

@ -1,4 +1,4 @@
# Configuration for top-issue-bot
labelName: ":thumbsup: Top Issue!"
labelColor: "f442c2"
numberOfIssuesToLabel: 5
numberOfIssuesToLabel: 5

2
.github/welcome.yml vendored
View File

@ -18,4 +18,4 @@ newPRWelcomeComment: >
firstPRMergeComment: >
Congratulations on merging your first pull request! Thank you for supporting LinuxGSM!
# It is recommend to include as many gifs and emojis as possible
# It is recommend to include as many gifs and emojis as possible

View File

@ -1,4 +1,4 @@
# .github/write-good.yml
writeGood: true
alex: true
spellchecker: true
spellchecker: true

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
*.db
.idea
.idea

View File

@ -33,4 +33,4 @@ This will help us in understanding your code and determining where problems may
Start reading our code and you'll get the hang of it. Explore how functions are organized and you'll see how we strive for readable code.
Please give the following document a read and adjust your code according to its specifications.
[Syntax & Coding Conventions](https://github.com/GameServerManagers/LinuxGSM/wiki/Syntax-and-Conventions)
[Syntax & Coding Conventions](https://github.com/GameServerManagers/LinuxGSM/wiki/Syntax-and-Conventions)

View File

@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because one or more lines are too long

View File

@ -23,4 +23,4 @@ if [ "${exitcode}" == "0" ]; then
else
fn_print_fail_nl "Sending Email alert: ${email}"
fn_script_log_fatal "Sending Email alert: ${email}"
fi
fi

View File

@ -120,7 +120,7 @@ fn_install_universe_repo(){
sleep 1
echo -en " \r"
cmd="sudo apt-add-repository universe"
eval ${cmd}
eval "${cmd}"
if [ $? -eq 0 ]; then
fn_print_complete_nl "Installing universe repository completed."
fn_script_log_pass "Installing universe repository completed."

View File

@ -9,17 +9,17 @@ local commandname="CHECK"
fn_check_ownership(){
if [ -f "${rootdir}/${selfname}" ]; then
if [ "$(find "${rootdir}/${selfname}" -not -user $(whoami) | wc -l)" -ne "0" ]; then
if [ "$(find "${rootdir}/${selfname}" -not -user "$(whoami)" | wc -l)" -ne "0" ]; then
selfownissue=1
fi
fi
if [ -d "${functionsdir}" ]; then
if [ "$(find "${functionsdir}" -not -user $(whoami) | wc -l)" -ne "0" ]; then
if [ "$(find "${functionsdir}" -not -user "$(whoami)" | wc -l)" -ne "0" ]; then
funcownissue=1
fi
fi
if [ -d "${serverfiles}" ]; then
if [ "$(find "${serverfiles}" -not -user $(whoami) | wc -l)" -ne "0" ]; then
if [ "$(find "${serverfiles}" -not -user "$(whoami)" | wc -l)" -ne "0" ]; then
filesownissue=1
fi
fi

View File

@ -20,4 +20,3 @@ if [ ! -d "${checkdir}" ]; then
fi
core_exit.sh
fi

View File

@ -12,4 +12,4 @@ if fn_prompt_yn "Do you want to delete all functions?" Y; then
rm -rfv "${functionsdir:?}/"*
rm -rfv "${configdirdefault:?}/"*
fi
core_exit.sh
core_exit.sh

View File

@ -15,4 +15,4 @@ echo -e "* ${blue}Patreon:${default} https://linuxgsm.com/patreon"
echo -e "* ${blue}PayPal:${default} https://linuxgsm.com/paypal"
echo -e "* ${blue}Flattr:${default} https://linuxgsm.com/flattr"
echo -e ""
echo -e "LinuxGSM has been going since 2012"
echo -e "LinuxGSM has been going since 2012"

View File

@ -196,7 +196,7 @@ fn_fastdl_preview(){
echo "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
done < <(find "${systemdir}/${directory}" -type f -iname ${allowed_extention})
tput rc; tput el
printf "gathering ${directory} ${allowed_extention} : ${fileswc}..."
echo "gathering ${directory} ${allowed_extention} : ${fileswc}..."
if [ ${fileswc} != 0 ]; then
fn_print_ok_eol_nl
else
@ -245,7 +245,7 @@ fn_fastdl_gmod(){
while read -r fastdlfile; do
((fileswc++))
tput rc; tput el
printf "copying ${allowed_extention} : ${fileswc}..."
echo "copying ${allowed_extention} : ${fileswc}..."
cp --parents "${fastdlfile}" "${fastdldir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
@ -255,7 +255,7 @@ fn_fastdl_gmod(){
else
fn_script_log_pass "Copying ${fastdlfile} > ${fastdldir}"
fi
done < <(find . -type f -iname ${allowed_extention})
done < <(find . -type f -iname "${allowed_extention}")
if [ ${fileswc} != 0 ]; then
fn_print_ok_eol_nl
fi

View File

@ -96,8 +96,8 @@ fn_monitor_check_lockfile(){
}
fn_monitor_check_update(){
# Monitor will not check if update is running.
if [ "$(ps -ef | grep "${selfname} update" | grep -v grep | wc -l)" != "0" ]; then
# Monitor will check if update is already running.
if [ "$(pgrep "${selfname} update" | wc -l)" != "0" ]; then
fn_print_error_nl "SteamCMD is currently checking for updates"
fn_script_log_error "SteamCMD is currently checking for updates"
core_exit.sh

View File

@ -11,4 +11,4 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
info_config.sh
exitbypass=1
command_stop.sh
command_start.sh
command_start.sh

View File

@ -35,7 +35,7 @@ fn_start_teamspeak3(){
if [ ! -f "${executabledir}/.ts3server_license_accepted" ]; then
install_eula.sh
fi
cd "${executabledir}"
cd "${executabledir}" || exit
if [ "${ts3serverpass}" == "1" ]; then
./ts3server_startscript.sh start serveradmin_password="${newpassword}" inifile="${servercfgfullpath}" > /dev/null 2>&1
else
@ -86,7 +86,7 @@ fn_start_tmux(){
# Create lockfile
date > "${rootdir}/${lockselfname}"
cd "${executabledir}"
cd "${executabledir}" || exit
tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${servicename}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${servicename}-tmux-error.tmp"
# Create logfile.
@ -154,7 +154,7 @@ fn_sleep_time
echo ""
echo "Fix"
echo "================================="
if [ ! $(grep "tty:" /etc/group|grep "$(whoami)") ]; then
if [ ! "$(grep "tty:" /etc/group|grep "$(whoami)")" ]; then
echo "$(whoami) is not part of the tty group."
fn_script_log_info "$(whoami) is not part of the tty group."
group=$(grep tty /etc/group)

View File

@ -10,4 +10,4 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
command_update_linuxgsm.sh
command_update_linuxgsm.sh

View File

@ -34,7 +34,7 @@ fn_clear_tmp(){
fn_print_error_eol_nl
fn_script_log_error "clearing LinuxGSM tmp directory"
fi
fi
fi
}
fn_dl_md5(){
@ -260,4 +260,4 @@ curlpath=$(command -v curl 2>/dev/null)
if [ "$(basename "${curlpath}")" != "curl" ]; then
echo "[ FAIL ] Curl is not installed"
exit 1
fi
fi

View File

@ -10,4 +10,4 @@ fn_exit_trap(){
}
# trap to give an exit code.
trap fn_exit_trap INT
trap fn_exit_trap INT

View File

@ -11,4 +11,4 @@ fi
if [ ! -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]; then
ln -s "$HOME/Steam/steamapps/" "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps"
fi
fi

View File

@ -14,4 +14,4 @@ if [ ! -d "${HOME}/.local/share/Arma 3" ]||[ ! -d "${HOME}/.local/share/Arma 3 -
fn_fix_msg_start
mkdir -p "${HOME}/.local/share/Arma 3 - Other Profiles"
fn_fix_msg_end
fi
fi

View File

@ -8,4 +8,4 @@ local commandname="FIX"
local commandaction="Fix"
# Fixes: MALLOC_CHECK_ needing to be set to 0.
export MALLOC_CHECK_=0
export MALLOC_CHECK_=0

View File

@ -30,4 +30,4 @@ exitbypass=1
command_start.sh
sleep 5
exitbypass=1
command_stop.sh
command_stop.sh

View File

@ -7,4 +7,4 @@
local commandname="FIX"
local commandaction="Fix"
export LD_LIBRARY_PATH="${serverfiles}/linux64:${serverfiles}:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="${serverfiles}/linux64:${serverfiles}:$LD_LIBRARY_PATH"

View File

@ -7,4 +7,4 @@
local commandname="FIX"
local commandaction="Fix"
export LD_LIBRARY_PATH="${serverfiles}"
export LD_LIBRARY_PATH="${serverfiles}"

View File

@ -11,4 +11,4 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
#Set Binary Executable
echo "chmod +x ${executabledir}/${executable}"
chmod +x "${executabledir}/${executable}"
fn_sleep_time
fn_sleep_time

View File

@ -30,4 +30,4 @@ exitbypass=1
command_start.sh
sleep 5
exitbypass=1
command_stop.sh
command_stop.sh

View File

@ -235,9 +235,9 @@ fi
if [ "$(command -v jq 2>/dev/null)" ]; then
if [ "${ip}" ]&&[ "${port}" ]; then
if [ "${steammaster}" == "true" ]; then
masterserver=$(${curlpath} -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l)
masterserver="$(${curlpath} -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l)"
if [ "${masterserver}" == "0" ]; then
masterserver=$(${curlpath} -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l)
masterserver="$(${curlpath} -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l)"
fi
if [ "${masterserver}" == "0" ]; then
displaymasterserver="false"

View File

@ -1228,85 +1228,87 @@ fn_info_message_soldat() {
fn_info_message_select_engine(){
# Display details depending on game or engine.
if [ "${gamename}" == "7 Days To Die" ]; then
if [ "${shortname}" == "sdtd" ]; then
fn_info_message_sdtd
elif [ "${gamename}" == "ARK: Survival Evolved" ]; then
elif [ "${shortname}" == "ark" ]; then
fn_info_message_ark
elif [ "${gamename}" == "Ballistic Overkill" ]; then
elif [ "${shortname}" == "bo" ]; then
fn_info_message_ballisticoverkill
elif [ "${gamename}" == "Barotrauma" ]; then
elif [ "${shortname}" == "bt" ]; then
fn_info_message_barotrauma
elif [ "${gamename}" == "Battalion 1944" ]; then
elif [ "${shortname}" == "bt1944" ]; then
fn_info_message_battalion1944
elif [ "${gamename}" == "Call of Duty" ]; then
elif [ "${shortname}" == "cod" ]; then
fn_info_message_cod
elif [ "${gamename}" == "Call of Duty: United Offensive" ]; then
elif [ "${shortname}" == "coduo" ]; then
fn_info_message_coduo
elif [ "${gamename}" == "Call of Duty 2" ]; then
elif [ "${shortname}" == "cod2" ]; then
fn_info_message_cod2
elif [ "${gamename}" == "Call of Duty 4" ]; then
elif [ "${shortname}" == "cod4" ]; then
fn_info_message_cod4
elif [ "${gamename}" == "Call of Duty: World at War" ]; then
elif [ "${shortname}" == "codwaw" ]; then
fn_info_message_codwaw
elif [ "${gamename}" == "Eco" ]; then
elif [ "${shortname}" == "eco" ]; then
fn_info_message_eco
elif [ "${gamename}" == "ET: Legacy" ]; then
elif [ "${shortname}" == "etl" ]; then
fn_info_message_etlegacy
elif [ "${gamename}" == "Factorio" ]; then
elif [ "${shortname}" == "fctr" ]; then
fn_info_message_factorio
elif [ "${gamename}" == "Hurtworld" ]; then
elif [ "${shortname}" == "hw" ]; then
fn_info_message_hurtworld
elif [ "${shortname}" == "inss" ]; then
fn_info_message_inss
elif [ "${gamename}" == "Just Cause 2" ]; then
elif [ "${shortname}" == "jc2" ]; then
fn_info_message_justcause2
elif [ "${gamename}" == "Just Cause 3" ]; then
elif [ "${shortname}" == "jc3" ]; then
fn_info_message_justcause3
elif [ "${shortname}" == "kf2" ]; then
fn_info_message_kf2
elif [ "${shortname}" == "pstbs" ]; then
fn_info_message_pstbs
elif [ "${gamename}" == "Project Cars" ]; then
elif [ "${shortname}" == "pc" ]; then
fn_info_message_projectcars
elif [ "${gamename}" == "QuakeWorld" ]; then
elif [ "${shortname}" == "qw" ]; then
fn_info_message_quake
elif [ "${gamename}" == "Quake 2" ]; then
elif [ "${shortname}" == "q2" ]; then
fn_info_message_quake2
elif [ "${gamename}" == "Quake 3: Arena" ]; then
elif [ "${shortname}" == "q3" ]; then
fn_info_message_quake3
elif [ "${gamename}" == "Quake Live" ]; then
elif [ "${shortname}" == "ql" ]; then
fn_info_message_quakelive
elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
elif [ "${shortname}" == "samp" ]; then
fn_info_message_samp
elif [ "${gamename}" == "Squad" ]; then
elif [ "${shortname}" == "squad" ]; then
fn_info_message_squad
elif [ "${gamename}" == "Stationeers" ]; then
elif [ "${shortname}" == "st" ]; then
fn_info_message_stationeers
elif [ "${shortname}" == "sof2" ]; then
fn_info_message_sof2
elif [ "${shortname}" == "sol" ]; then
fn_info_message_soldat
elif [ "${shortname}" == "sbots" ]; then
fn_info_message_sbots
elif [ "${gamename}" == "TeamSpeak 3" ]; then
elif [ "${shortname}" == "ts3" ]; then
fn_info_message_teamspeak3
elif [ "${gamename}" == "Tower Unite" ]; then
elif [ "${shortname}" == "tu" ]; then
fn_info_message_towerunite
elif [ "${shortname}" == "unt" ]; then
fn_info_message_unturned
elif [ "${shortname}" == "mh" ]; then
fn_info_message_mordhau
elif [ "${gamename}" == "Multi Theft Auto" ]; then
elif [ "${shortname}" == "mta" ]; then
fn_info_message_mta
elif [ "${gamename}" == "Mumble" ]; then
elif [ "${shortname}" == "mumble" ]; then
fn_info_message_mumble
elif [ "${gamename}" == "Return to Castle Wolfenstein" ]; then
elif [ "${shortname}" == "rtcw" ]; then
fn_info_message_rtcw
elif [ "${gamename}" == "Rust" ]; then
elif [ "${shortname}" == "rust" ]; then
fn_info_message_rust
elif [ "${gamename}" == "Wurm Unlimited" ]; then
elif [ "${shortname}" == "wurm" ]; then
fn_info_message_wurmunlimited
elif [ "${shortname}" == "rw" ]; then
fn_info_message_risingworld
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
elif [ "${shortname}" == "wet" ]; then
fn_info_message_wolfensteinenemyterritory
elif [ "${engine}" == "refractor" ]; then
fn_info_message_refractor
@ -1324,8 +1326,6 @@ fn_info_message_select_engine(){
fn_info_message_seriousengine35
elif [ "${engine}" == "source" ]; then
fn_info_message_source
elif [ "${gamename}" == "Soldier Of Fortune 2: Gold Edition" ]; then
fn_info_message_sof2
elif [ "${engine}" == "spark" ]; then
fn_info_message_spark
elif [ "${engine}" == "starbound" ]; then

View File

@ -40,10 +40,10 @@ fn_default_config_remote(){
if [ "${config}" == "${servercfgdefault}" ]; then
mkdir -p "${servercfgdir}"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}"
elif [ "${gamename}" == "ARMA 3" ]&&[ "${config}" == "${networkcfgdefault}" ]; then
elif [ "${shortname}" == "arma3" ]&&[ "${config}" == "${networkcfgdefault}" ]; then
mkdir -p "${servercfgdir}"
cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}"
elif [ "${gamename}" == "Don't Starve Together" ]&&[ "${config}" == "${clustercfgdefault}" ]; then
elif [ "${shortname}" == "dst" ]&&[ "${config}" == "${clustercfgdefault}" ]; then
cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}"
else
mkdir -p "${servercfgdir}"
@ -144,514 +144,502 @@ fn_set_dst_config_vars(){
echo ""
}
if [ "${gamename}" == "7 Days To Die" ]; then
if [ "${shortname}" == "sdtd" ]; then
gamedirname="7DaysToDie"
fn_default_config_local
elif [ "${gamename}" == "Action half-life" ]; then
elif [ "${shortname}" == "ahl" ]; then
gamedirname="ActionHalfLife"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "ARK: Survival Evolved" ]; then
elif [ "${shortname}" == "ark" ]; then
gamedirname="ARKSurvivalEvolved"
fn_check_cfgdir
array_configs+=( GameUserSettings.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "ARMA 3" ]; then
elif [ "${shortname}" == "arma3" ]; then
gamedirname="Arma3"
fn_check_cfgdir
array_configs+=( server.cfg network.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Ballistic Overkill" ]; then
elif [ "${shortname}" == "bo" ]; then
gamedirname="BallisticOverkill"
array_configs+=( config.txt )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Base Defense" ]; then
elif [ "${shortname}" == "bo" ]; then
gamedirname="BaseDefense"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Barotrauma" ]; then
elif [ "${shortname}" == "bt" ]; then
gamedirname="Barotrauma"
fn_check_cfgdir
array_configs+=( serversettings.xml )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Battalion 1944" ]; then
elif [ "${shortname}" == "Battalion 1944" ]; then
gamedirname="Battalion1944"
fn_check_cfgdir
array_configs+=( DefaultGame.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Battlefield: 1942" ]; then
elif [ "${shortname}" == "bt1942" ]; then
gamedirname="Battlefield1942"
array_configs+=( serversettings.con )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Blade Symphony" ]; then
elif [ "${shortname}" == "bs" ]; then
gamedirname="BladeSymphony"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "BrainBread" ]; then
elif [ "${shortname}" == "bb" ]; then
gamedirname="BrainBread"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "BrainBread 2" ]; then
elif [ "${shortname}" == "bb2" ]; then
gamedirname="BrainBread2"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Black Mesa: Deathmatch" ]; then
elif [ "${shortname}" == "bmdm" ]; then
gamedirname="BlackMesa"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Call of Duty" ]; then
elif [ "${shortname}" == "cod" ]; then
gamedirname="CallOfDuty"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Call of Duty: United Offensive" ]; then
elif [ "${shortname}" == "coduo" ]; then
gamedirname="CallOfDutyUnitedOffensive"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Call of Duty 2" ]; then
elif [ "${shortname}" == "cod2" ]; then
gamedirname="CallOfDuty2"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Call of Duty 4" ]; then
elif [ "${shortname}" == "cod4" ]; then
gamedirname="CallOfDuty4"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Call of Duty: World at War" ]; then
elif [ "${shortname}" == "codwaw" ]; then
gamedirname="CallOfDutyWorldAtWar"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Codename CURE" ]; then
elif [ "${shortname}" == "cc" ]; then
gamedirname="CodenameCURE"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Counter-Strike 1.6" ]; then
elif [ "${shortname}" == "cs" ]; then
gamedirname="CounterStrike"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Counter-Strike: Condition Zero" ]; then
elif [ "${shortname}" == "cscz" ]; then
gamedirname="CounterStrikeConditionZero"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Counter-Strike: Global Offensive" ]; then
elif [ "${shortname}" == "csgo" ]; then
gamedirname="CounterStrikeGlobalOffensive"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Classic Offensive" ]; then
gamedirname="ClassicOffensive"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Counter-Strike: Source" ]; then
elif [ "${shortname}" == "css" ]; then
gamedirname="CounterStrikeSource"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Day of Defeat" ]; then
elif [ "${shortname}" == "dod" ]; then
gamedirname="DayOfDefeat"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Day of Defeat: Source" ]; then
elif [ "${shortname}" == "dods" ]; then
gamedirname="DayOfDefeatSource"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Day of Infamy" ]; then
elif [ "${shortname}" == "doi" ]; then
gamedirname="DayOfInfamy"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Deathmatch Classic" ]; then
elif [ "${shortname}" == "dmc" ]; then
gamedirname="DeathmatchClassic"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Don't Starve Together" ]; then
elif [ "${shortname}" == "dst" ]; then
gamedirname="DontStarveTogether"
fn_check_cfgdir
array_configs+=( cluster.ini server.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_dst_config_vars
elif [ "${gamename}" == "Double Action: Boogaloo" ]; then
elif [ "${shortname}" == "dab" ]; then
gamedirname="DoubleActionBoogaloo"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Dystopia" ]; then
elif [ "${shortname}" == "dys" ]; then
gamedirname="Dystopia"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Eco" ]; then
elif [ "${shortname}" == "eco" ]; then
gamedirname="Eco"
array_configs+=( Network.eco )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "ET: Legacy" ]; then
elif [ "${shortname}" == "etl" ]; then
gamedirname="ETLegacy"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Factorio" ]; then
elif [ "${shortname}" == "fctr" ]; then
gamedirname="Factorio"
array_configs+=( server-settings.json )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Fistful of Frags" ]; then
elif [ "${shortname}" == "fof" ]; then
gamedirname="FistfulofFrags"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Garry's Mod" ]; then
elif [ "${shortname}" == "gmod" ]; then
gamedirname="GarrysMod"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "GoldenEye: Source" ]; then
elif [ "${shortname}" == "ges" ]; then
gamedirname="GoldenEyeSource"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Half Life: Deathmatch" ]; then
elif [ "${shortname}" == "hldm" ]; then
gamedirname="HalfLifeDeathmatch"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Half-Life Deathmatch: Source" ]; then
elif [ "${shortname}" == "hldms" ]; then
gamedirname="HalfLifeDeathmatchSource"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Half-Life: Opposing Force" ]; then
elif [ "${shortname}" == "opfor" ]; then
gamedirname="OpposingForce"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Half Life 2: Deathmatch" ]; then
elif [ "${shortname}" == "hl2dm" ]; then
gamedirname="HalfLife2Deathmatch"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Insurgency" ]; then
elif [ "${shortname}" == "ins" ]; then
gamedirname="Insurgency"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "IOSoccer" ]; then
elif [ "${shortname}" == "ios" ]; then
gamedirname="IOSoccer"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Just Cause 2" ]; then
elif [ "${shortname}" == "jc2" ]; then
gamedirname="JustCause2"
array_configs+=( config.lua )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Just Cause 3" ]; then
elif [ "${shortname}" == "jc3" ]; then
gamedirname="JustCause3"
array_configs+=( config.json )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Killing Floor" ]; then
elif [ "${shortname}" == "kf" ]; then
gamedirname="KillingFloor"
array_configs+=( Default.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Left 4 Dead" ]; then
elif [ "${shortname}" == "l4d" ]; then
gamedirname="Left4Dead"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Left 4 Dead" ]; then
gamedirname="Left4Dead"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Left 4 Dead 2" ]; then
elif [ "${shortname}" == "l4d2" ]; then
gamedirname="Left4Dead2"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Minecraft" ]; then
elif [ "${shortname}" == "mc" ]; then
gamedirname="Minecraft"
array_configs+=( server.properties )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "MORDHAU" ]; then
elif [ "${shortname}" == "mh" ]; then
gamedirname="Mordhau"
fn_check_cfgdir
array_configs+=( Game.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Natural Selection" ]; then
elif [ "${shortname}" == "ns" ]; then
gamedirname="NaturalSelection"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "No More Room in Hell" ]; then
elif [ "${shortname}" == "nmrih" ]; then
gamedirname="NoMoreRoominHell"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Nuclear Dawn" ]; then
elif [ "${shortname}" == "nd" ]; then
gamedirname="NuclearDawn"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Multi Theft Auto" ]; then
elif [ "${shortname}" == "mta" ]; then
gamedirname="MultiTheftAuto"
fn_check_cfgdir
array_configs+=( acl.xml mtaserver.conf vehiclecolors.conf )
fn_fetch_default_config
fn_default_config_remote
elif [ "${gamename}" == "Mumble" ]; then
elif [ "${shortname}" == "mumble" ]; then
gamedirname="Mumble"
array_configs+=( murmur.ini )
fn_fetch_default_config
fn_default_config_remote
elif [ "${gamename}" == "Pirates, Vikings, and Knights II" ]; then
elif [ "${shortname}" == "pvkii" ]; then
gamedirname="PiratesVikingandKnightsII"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Project Zomboid" ]; then
elif [ "${shortname}" == "pz" ]; then
gamedirname="ProjectZomboid"
fn_check_cfgdir
array_configs+=( server.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Project Cars" ]; then
elif [ "${shortname}" == "pc" ]; then
gamedirname="ProjectCars"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Quake 2" ]; then
elif [ "${shortname}" == "q2" ]; then
gamedirname="Quake2"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Quake 3: Arena" ]; then
elif [ "${shortname}" == "q3" ]; then
gamedirname="Quake3Arena"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Quake Live" ]; then
elif [ "${shortname}" == "ql" ]; then
gamedirname="QuakeLive"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "QuakeWorld" ]; then
elif [ "${shortname}" == "qw" ]; then
gamedirname="QuakeWorld"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Ricochet" ]; then
elif [ "${shortname}" == "ricochet" ]; then
gamedirname="Ricochet"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Return to Castle Wolfenstein" ]; then
elif [ "${shortname}" == "rtcw" ]; then
gamedirname="ReturnToCastleWolfenstein"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Rust" ]; then
elif [ "${shortname}" == "rust" ]; then
gamedirname="Rust"
fn_check_cfgdir
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
elif [ "${shortname}" == "samp" ]; then
gamedirname="SanAndreasMultiplayer"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
elif [ "${shortname}" == "ss3" ]; then
gamedirname="SeriousSam3BFE"
array_configs+=( server.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Soldat" ]; then
elif [ "${shortname}" == "sol" ]; then
gamedirname="Soldat"
array_configs+=( soldat.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Soldier Of Fortune 2: Gold Edition" ]; then
elif [ "${shortname}" == "sof2" ]; then
gamedirname="SoldierOfFortune2Gold"
array_configs+=( server.cfg mapcycle.txt)
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "SourceForts Classic" ]; then
elif [ "${shortname}" == "sfc" ]; then
gamedirname="SourceFortsClassic"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Squad" ]; then
elif [ "${shortname}" == "squad" ]; then
gamedirname="Squad"
array_configs+=( Admins.cfg Bans.cfg License.cfg Server.cfg Rcon.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Starbound" ]; then
elif [ "${shortname}" == "sb" ]; then
gamedirname="Starbound"
array_configs+=( starbound_server.config )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Stationeers" ]; then
elif [ "${shortname}" == "st" ]; then
gamedirname="Stationeers"
array_configs+=( default.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Sven Co-op" ]; then
elif [ "${shortname}" == "sven" ]; then
gamedirname="SvenCoop"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Team Fortress 2" ]; then
elif [ "${shortname}" == "tf2" ]; then
gamedirname="TeamFortress2"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Team Fortress Classic" ]; then
elif [ "${shortname}" == "tfc" ]; then
gamedirname="TeamFortressClassic"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "The Specialists" ]; then
elif [ "${shortname}" == "ts" ]; then
gamedirname="TheSpecialists"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "TeamSpeak 3" ]; then
elif [ "${shortname}" == "ts3" ]; then
gamedirname="TeamSpeak3"
array_configs+=( ts3server.ini )
fn_fetch_default_config
fn_default_config_remote
elif [ "${gamename}" == "Teeworlds" ]; then
elif [ "${shortname}" == "tw" ]; then
gamedirname="Teeworlds"
array_configs+=( server.cfg ctf.cfg dm.cfg duel.cfg tdm.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Terraria" ]; then
elif [ "${shortname}" == "terraria" ]; then
gamedirname="Terraria"
array_configs+=( serverconfig.txt )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Tower Unite" ]; then
elif [ "${shortname}" == "tu" ]; then
gamedirname="TowerUnite"
fn_check_cfgdir
array_configs+=( TowerServer.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Unreal Tournament" ]; then
elif [ "${shortname}" == "ut" ]; then
gamedirname="UnrealTournament"
array_configs+=( Game.ini Engine.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
elif [ "${shortname}" == "ut2k4" ]; then
gamedirname="UnrealTournament2004"
array_configs+=( UT2004.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Unreal Tournament 99" ]; then
elif [ "${shortname}" == "ut99" ]; then
gamedirname="UnrealTournament99"
array_configs+=( Default.ini )
fn_fetch_default_config
@ -663,31 +651,31 @@ elif [ "${shortname}" == "unt" ]; then
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Vampire Slayer" ]; then
elif [ "${shortname}" == "vs" ]; then
gamedirname="VampireSlayer"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
elif [ "${shortname}" == "wet" ]; then
gamedirname="WolfensteinEnemyTerritory"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Wurm Unlimited" ]; then
elif [ "${shortname}" == "wurm" ]; then
gamedirname="WurmUnlimited"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Zombie Master: Reborn" ]; then
elif [ "${shortname}" == "zmr" ]; then
gamedirname="ZombieMasterReborn"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Zombie Panic! Source" ]; then
elif [ "${shortname}" == "zps" ]; then
gamedirname="ZombiePanicSource"
array_configs+=( server.cfg )
fn_fetch_default_config

View File

@ -24,4 +24,4 @@ if [ -z "${autoinstall}" ]; then
fi
if [ ! -d "${serverfiles}" ]; then
mkdir -v "${serverfiles}"
fi
fi

View File

@ -72,7 +72,7 @@ fn_install_server_files_steamcmd(){
counter="0"
while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do
counter=$((counter+1))
cd "${steamcmddir}"
cd "${steamcmddir}" || exit
if [ "${counter}" -le "10" ]; then
# Attempt 1-4: Standard attempt.
# Attempt 5-6: Validate attempt.

View File

@ -23,4 +23,4 @@ echo ""
fn_sleep_time
echo "The Squad server license can be changed by editing ${servercfgdir}/License.cfg."
fn_script_log_info "The Squad server license can be changed by editing ${selfname}."
echo ""
echo ""

View File

@ -28,7 +28,7 @@ if [ "${status}" != "0" ]&&[ "${function_selfname}" == "command_start.sh" ]&&[ -
fi
# Log manager will start the cleanup if it finds logs older than "${logdays}".
if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l) -ne "0" ]; then
if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ]; then
fn_print_dots "Starting"
# Set common logs directories
commonlogs="${systemdir}/logs"
@ -81,7 +81,7 @@ if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l) -ne "0" ]; th
find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Garry's Mod logfiles.
if [ "${gamename}" == "Garry's Mod" ]; then
if [ "${shortname}" == "gmod" ]; then
# ULX logfiles.
if [ -d "${ulxlogdir}" ]; then
find "${ulxlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"

View File

@ -43,7 +43,7 @@ fn_mod_lowercase(){
fileswc=$(find "${extractdir}" -depth | wc -l)
echo -en "\r"
while read -r src; do
dst=$(dirname "${src}"$(/)basename "${src}" | tr 'A-Z' 'a-z')
dst="$(dirname "${src}$(/)basename" "${src}" | tr 'A-Z' 'a-z')"
if [ "${src}" != "${dst}" ]
then
[ ! -e "${dst}" ] && mv -T "${src}" "${dst}" || echo "${src} was not renamed"

View File

@ -10,7 +10,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
if [ "${engine}" == "idtech3_ql" ]; then
local engine="quakelive"
elif [ "${gamename}" == "Killing Floor 2" ]; then
elif [ "${shortname}" == "kf2" ]; then
local engine="unreal4"
fi

View File

@ -151,7 +151,7 @@ fn_install_menu_bash() {
while read -r line || [[ -n "${line}" ]]; do
var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
menu_options+=( "${var}" )
done < ${options}
done < "${options}"
menu_options+=( "Cancel" )
select option in "${menu_options[@]}"; do
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then

View File

@ -162,7 +162,7 @@ fn_install_menu_bash() {
while read -r line || [[ -n "${line}" ]]; do
var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
menu_options+=( "${var}" )
done < ${options}
done < "${options}"
menu_options+=( "Cancel" )
select option in "${menu_options[@]}"; do
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then

View File

@ -160,7 +160,7 @@ fn_install_menu_bash() {
while read -r line || [[ -n "${line}" ]]; do
var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
menu_options+=( "${var}" )
done < ${options}
done < "${options}"
menu_options+=( "Cancel" )
select option in "${menu_options[@]}"; do
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then

View File

@ -160,7 +160,7 @@ fn_install_menu_bash() {
while read -r line || [[ -n "${line}" ]]; do
var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
menu_options+=( "${var}" )
done < ${options}
done < "${options}"
menu_options+=( "Cancel" )
select option in "${menu_options[@]}"; do
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then

View File

@ -160,7 +160,7 @@ fn_install_menu_bash() {
while read -r line || [[ -n "${line}" ]]; do
var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
menu_options+=( "${var}" )
done < ${options}
done < "${options}"
menu_options+=( "Cancel" )
select option in "${menu_options[@]}"; do
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then