Browse Source

prettier

pull/3997/head
Daniel Gibbs 3 years ago
parent
commit
979da01e4a
  1. 2
      lgsm/functions/check_permissions.sh
  2. 2
      lgsm/functions/core_getopt.sh
  3. 14
      lgsm/functions/info_game.sh
  4. 2
      lgsm/functions/info_messages.sh
  5. 2
      lgsm/functions/install_server_files.sh
  6. 10
      linuxgsm.sh

2
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

2
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

14
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"

2
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

2
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

10
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}\""
@ -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

Loading…
Cancel
Save