From 979da01e4a26cc1880165cc308512e6338f4352e Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 30 Oct 2022 22:22:25 +0000 Subject: [PATCH] prettier --- lgsm/functions/check_permissions.sh | 2 +- lgsm/functions/core_getopt.sh | 2 +- lgsm/functions/info_game.sh | 14 +++++++------- lgsm/functions/info_messages.sh | 2 +- lgsm/functions/install_server_files.sh | 2 +- linuxgsm.sh | 22 +++++++++++----------- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lgsm/functions/check_permissions.sh b/lgsm/functions/check_permissions.sh index 1091cbc6e..0094456ec 100755 --- a/lgsm/functions/check_permissions.sh +++ b/lgsm/functions/check_permissions.sh @@ -181,7 +181,7 @@ fn_sys_perm_fix_manually_msg() { # Attempt to fix /sys related permission errors if sudo is available, exits otherwise. fn_sys_perm_errors_fix() { - if sudo -n true >/dev/null 2>&1; then + if sudo -n true > /dev/null 2>&1; then fn_print_dots "Automatically fixing /sys permissions" fn_script_log_info "Automatically fixing /sys permissions." if [ "${sysdirpermerror}" == "1" ]; then diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index 3c44931b9..fdd66ab3f 100755 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -75,7 +75,7 @@ if [ "${shortname}" == "jk2" ] || [ "${engine}" != "idtech3" ]; then fi # Validate and check-update command. -if [ "${appid}" ]||[ "${shortname}" == "ts3" ]; then +if [ "${appid}" ] || [ "${shortname}" == "ts3" ]; then currentopt+=("${cmd_validate[@]}" "${cmd_check_update[@]}") fi diff --git a/lgsm/functions/info_game.sh b/lgsm/functions/info_game.sh index 11aaa652a..77169b3f3 100644 --- a/lgsm/functions/info_game.sh +++ b/lgsm/functions/info_game.sh @@ -1007,7 +1007,7 @@ fn_info_game_mom() { if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" serverpassword="${unavailable}" - maxplayer="${zero}" + maxplayers="${zero}" defaultmap="${unavailable}" else servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') @@ -1018,7 +1018,7 @@ fn_info_game_mom() { # Not set servername=${servername:-"NOT SET"} serverpassword=${serverpassword:-"NOT SET"} - maxplayer=${maxplayers:-"0"} + maxplayers=${maxplayers:-"0"} defaultmap=${defaultmap:-"NOT SET"} fi @@ -2523,12 +2523,12 @@ fi # External IP address if [ -z "${extip}" ]; then - extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2>/dev/null)" + extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2> /dev/null)" exitcode=$? # Should ifconfig.co return an error will use last known IP. if [ ${exitcode} -eq 0 ]; then if [[ "${extip}" != *"DOCTYPE"* ]]; then - echo -e "${extip}" >"${tmpdir}/extip.txt" + echo -e "${extip}" > "${tmpdir}/extip.txt" else if [ -f "${tmpdir}/extip.txt" ]; then extip="$(cat "${tmpdir}/extip.txt")" @@ -2557,16 +2557,16 @@ fi # Steam Master Server - checks if detected by master server. # Checked after config init, as the queryport is needed if [ -z "${displaymasterserver}" ]; then - if [ "$(command -v jq 2>/dev/null)" ]; then + if [ "$(command -v jq 2> /dev/null)" ]; then if [ "${ip}" ] && [ "${port}" ]; then if [ "${steammaster}" == "true" ] || [ "${commandname}" == "DEV-QUERY-RAW" ]; then # Will query server IP addresses first. for queryip in "${queryips[@]}"; do - masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${queryip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2>/dev/null)" + masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${queryip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2> /dev/null)" done # Should that not work it will try the external IP. if [ "${masterserver}" == "0" ]; then - masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${extip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2>/dev/null)" + masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${extip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" '.response.servers[] | select((.gameport == ($port|tonumber) or (.gameport == ($queryport|tonumber)))) | .addr' | wc -l 2> /dev/null)" fi if [ "${masterserver}" == "0" ]; then displaymasterserver="false" diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index 88e4edae9..f4f67b120 100755 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -750,7 +750,7 @@ fn_info_logs() { else echo -e "${gamelogdir}" # dos2unix sed 's/\r//' - tail "${gamelogdir}"/* 2>/dev/null | grep -v "==>" | sed '/^$/d' | sed 's/\r//' | tail -25 + tail "${gamelogdir}"/* 2> /dev/null | grep -v "==>" | sed '/^$/d' | sed 's/\r//' | tail -25 fi echo -e "" fi diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index c9faf643a..61c6b131c 100755 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -222,7 +222,7 @@ elif [ "${shortname}" == "mcb" ]; then elif [ "${shortname}" == "pmc" ]; then install_eula.sh update_papermc.sh -elif [ "${shortname}" == "wmc" ]||[ "${shortname}" == "vpmc" ]; then +elif [ "${shortname}" == "wmc" ] || [ "${shortname}" == "vpmc" ]; then update_papermc.sh elif [ "${shortname}" == "mumble" ]; then update_mumble.sh diff --git a/linuxgsm.sh b/linuxgsm.sh index 7d9f21d0b..3849ae68b 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -15,7 +15,7 @@ # Debugging if [ -f ".dev-debug" ]; then - exec 5>dev-debug.log + exec 5> dev-debug.log BASH_XTRACEFD="5" set -x fi @@ -52,7 +52,7 @@ userinput2="${2}" [ -n "${LGSM_GITHUBBRANCH}" ] && githubbranch="${LGSM_GITHUBBRANCH}" || githubbranch="master" # Check that curl is installed before doing anything -if [ ! "$(command -v curl 2>/dev/null)" ]; then +if [ ! "$(command -v curl 2> /dev/null)" ]; then echo -e "[ FAIL ] Curl is not installed" exit 1 fi @@ -213,7 +213,7 @@ fn_install_menu_bash() { while read -r line || [[ -n "${line}" ]]; do var=$(echo -e "${line}" | awk -F "," '{print $2 " - " $3}') menu_options+=("${var}") - done <"${options}" + done < "${options}" menu_options+=("Cancel") select option in "${menu_options[@]}"; do if [ "${option}" ] && [ "${option}" != "Cancel" ]; then @@ -239,7 +239,7 @@ fn_install_menu_whiptail() { key=$(echo -e "${line}" | awk -F "," '{print $3}') val=$(echo -e "${line}" | awk -F "," '{print $2}') menu_options+=("${val//\"/}" "${key//\"/}") - done <"${options}" + done < "${options}" OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3) if [ $? == 0 ]; then eval "$resultvar=\"${OPTION}\"" @@ -263,12 +263,12 @@ fn_install_menu() { fi done case "$(basename "${menucmd}")" in - whiptail | dialog) - fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30 - ;; - *) - fn_install_menu_bash selection "${title}" "${caption}" "${options}" - ;; + whiptail | dialog) + fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30 + ;; + *) + fn_install_menu_bash selection "${title}" "${caption}" "${options}" + ;; esac eval "$resultvar=\"${selection}\"" } @@ -351,7 +351,7 @@ if [ "${shortname}" == "core" ]; then } | column -s $'\t' -t | more exit elif [ "${userinput}" == "install" ] || [ "${userinput}" == "i" ]; then - tail -n +1 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' >"${serverlistmenu}" + tail -n +1 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}" fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}" userinput="${result}" fn_server_info