From 6f8a113f2f5175105cca484fca0d7842052bca56 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 10 Aug 2020 19:38:53 +0100 Subject: [PATCH] updated if --- lgsm/functions/command_install.sh | 1 - lgsm/functions/update_factorio.sh | 4 ++-- lgsm/functions/update_jediknight2.sh | 8 ++------ lgsm/functions/update_minecraft.sh | 4 ++-- lgsm/functions/update_minecraft_bedrock.sh | 6 +++--- lgsm/functions/update_mta.sh | 4 ++-- lgsm/functions/update_mumble.sh | 4 ++-- lgsm/functions/update_steamcmd.sh | 2 +- lgsm/functions/update_ts3.sh | 4 ++-- 9 files changed, 16 insertions(+), 21 deletions(-) diff --git a/lgsm/functions/command_install.sh b/lgsm/functions/command_install.sh index 2437116d3..3e5d27872 100644 --- a/lgsm/functions/command_install.sh +++ b/lgsm/functions/command_install.sh @@ -24,7 +24,6 @@ else install_server_files.sh install_ut2k4_key.sh elif [ -z "${appid}" ]; then - installer=1 install_server_files.sh elif [ "${appid}" ]; then install_steamcmd.sh diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh index ae4bdbaa5..ded4d8206 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/functions/update_factorio.sh @@ -43,7 +43,7 @@ fn_update_factorio_localbuild(){ fn_update_factorio_remotebuild(){ # Gets remote build info. remotebuild=$(curl -s "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" | grep -o '[0-9]\.[0-9]\{1,\}\.[0-9]\{1,\}' | head -1) - if [ "${installer}" != "1" ]; then + if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then @@ -148,7 +148,7 @@ else downloadbranch="${branch}" fi -if [ "${installer}" == "1" ]; then +if [ "${firstcommandname}" == "INSTALL" ]; then fn_update_factorio_remotebuild fn_update_factorio_dl else diff --git a/lgsm/functions/update_jediknight2.sh b/lgsm/functions/update_jediknight2.sh index 726013658..c2bdca1b6 100644 --- a/lgsm/functions/update_jediknight2.sh +++ b/lgsm/functions/update_jediknight2.sh @@ -28,10 +28,6 @@ fn_update_jk2_dl(){ fn_update_jk2_localbuild(){ # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" - # Set localbuild to 0 if running installer - if [ "${firstcommandname}" == "INSTALL" ]; then - localbuild=0 - fi # Uses log file to gather info. # Log is generated and cleared on startup but filled on shutdown. localbuild=$(grep "\"version\"" "${consolelogdir}"/* 2>/dev/null | sed 's/.*://' | awk '{print $1}' | head -n 1) @@ -78,7 +74,7 @@ fn_update_jk2_localbuild(){ fn_update_jk2_remotebuild(){ # Gets remote build info. remotebuild=$(curl -s "https://api.github.com/repos/mvdevs/jk2mv/releases/latest" | grep dedicated.zip | tail -1 | awk -F"/" '{ print $8 }') - if [ "${installer}" != "1" ]; then + if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then @@ -161,7 +157,7 @@ remotelocation="jk2mv.org" # Game server architecture. jk2arch="x64" -if [ "${installer}" == "1" ]; then +if [ "${firstcommandname}" == "INSTALL" ]; then fn_update_jk2_remotebuild fn_update_jk2_dl else diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index 1de609147..9915f39b3 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -83,7 +83,7 @@ fn_update_minecraft_remotebuild(){ remotebuild=$(curl -s "https://launchermeta.${remotelocation}/mc/game/version_manifest.json" | jq -r '.versions[0].id') fi - if [ "${installer}" != "1" ]; then + if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then @@ -170,7 +170,7 @@ fn_update_minecraft_compare(){ # The location where the builds are checked and downloaded. remotelocation="mojang.com" -if [ "${installer}" == "1" ]; then +if [ "${firstcommandname}" == "INSTALL" ]; then fn_update_minecraft_remotebuild fn_update_minecraft_dl else diff --git a/lgsm/functions/update_minecraft_bedrock.sh b/lgsm/functions/update_minecraft_bedrock.sh index 8c90d5efb..925e85635 100644 --- a/lgsm/functions/update_minecraft_bedrock.sh +++ b/lgsm/functions/update_minecraft_bedrock.sh @@ -10,7 +10,7 @@ fn_update_minecraft_dl(){ latestmcbuildurl=$(curl -s "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*zip') fn_fetch_file "${latestmcbuildurl}" "" "" "" "${tmpdir}" "bedrock_server.${remotebuild}.zip" echo -e "Extracting to ${serverfiles}...\c" - if [ "${installer}" == "1" ]; then + if [ "${firstcommandname}" == "INSTALL" ]; then unzip -oq "${tmpdir}/bedrock_server.${remotebuild}.zip" -x "server.properties" -d "${serverfiles}" else unzip -oq "${tmpdir}/bedrock_server.${remotebuild}.zip" -x "permissions.json" "server.properties" "whitelist.json" -d "${serverfiles}" @@ -78,7 +78,7 @@ fn_update_minecraft_localbuild(){ fn_update_minecraft_remotebuild(){ # Gets remote build info. remotebuild=$(curl -s "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*' | sed 's/.*\///' | grep -Eo "[.0-9]+[0-9]") - if [ "${installer}" != "1" ]; then + if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then @@ -158,7 +158,7 @@ fn_update_minecraft_compare(){ # The location where the builds are checked and downloaded. remotelocation="minecraft.net" -if [ "${installer}" == "1" ]; then +if [ "${firstcommandname}" == "INSTALL" ]; then fn_update_minecraft_remotebuild fn_update_minecraft_dl else diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh index d15d9457b..bb5f744ea 100644 --- a/lgsm/functions/update_mta.sh +++ b/lgsm/functions/update_mta.sh @@ -101,7 +101,7 @@ fn_update_mta_remotebuild(){ minorversion=$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MINOR" | awk '{ print $3 }' | sed 's/\r//g') maintenanceversion=$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MAINTENANCE" | awk '{ print $3 }' | sed 's/\r//g') remotebuild="${majorversion}.${minorversion}.${maintenanceversion}" - if [ "${installer}" != "1" ]; then + if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then @@ -187,7 +187,7 @@ fn_update_mta_compare(){ # The location where the builds are checked and downloaded. remotelocation="linux.mtasa.com" -if [ "${installer}" == "1" ]; then +if [ "${firstcommandname}" == "INSTALL" ]; then fn_update_mta_remotebuild fn_update_mta_dl else diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh index 6b3fd19d0..dfe8b317a 100644 --- a/lgsm/functions/update_mumble.sh +++ b/lgsm/functions/update_mumble.sh @@ -43,7 +43,7 @@ fn_update_mumble_localbuild(){ fn_update_mumble_remotebuild(){ # Gets remote build info. remotebuild=$(curl -s "https://api.github.com/repos/mumble-voip/mumble/releases/latest" | grep 'murmur-static_x86.*\.bz2"' | tail -1 | awk -F"/" '{ print $8 }') - if [ "${installer}" != "1" ]; then + if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then @@ -126,7 +126,7 @@ remotelocation="mumble.info" # Game server architecture. mumblearch="x86" -if [ "${installer}" == "1" ]; then +if [ "${firstcommandname}" == "INSTALL" ]; then fn_update_mumble_remotebuild fn_update_mumble_dl else diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index 348147b03..11ad0598c 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -48,7 +48,7 @@ fn_update_steamcmd_remotebuild(){ remotebuild=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed '1,/branches/d' | sed "1,/${branch}/d" | grep -m 1 buildid | tr -cd '[:digit:]') fi - if [ "${installer}" != "1" ]; then + if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index 290ddf4d0..b4fc5d692 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -106,7 +106,7 @@ fn_update_ts3_remotebuild(){ elif [ "${arch}" == "x86" ]; then remotebuild=$(curl -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86.version') fi - if [ "${installer}" != "1" ]; then + if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then @@ -197,7 +197,7 @@ fi # The location where the builds are checked and downloaded. remotelocation="teamspeak.com" -if [ "${installer}" == "1" ]; then +if [ "${firstcommandname}" == "INSTALL" ]; then fn_update_ts3_remotebuild fn_update_ts3_dl else