From ad8b2229ef48ecdb623476cbedf73d0ab22c0f16 Mon Sep 17 00:00:00 2001
From: Daniel Gibbs <me@danielgibbs.co.uk>
Date: Wed, 17 Oct 2018 23:45:40 +0100
Subject: [PATCH] Resolved Factorio Stable/Experimental downloads issue #1933
 (#2051)

* Updating factorio downloader

* added xz filw type to progress bar

* Change message to "Applying Post-Install Fixes"

* changed echo -ne to echo -en
---
 .../config-lgsm/fctrserver/_default.cfg        |  1 +
 lgsm/functions/command_backup.sh               |  6 +++---
 lgsm/functions/command_update_linuxgsm.sh      | 18 +++++++++---------
 lgsm/functions/core_dl.sh                      | 18 +++++++++---------
 lgsm/functions/fix.sh                          |  2 +-
 lgsm/functions/install_logs.sh                 | 16 ++++++++--------
 lgsm/functions/mods_core.sh                    | 16 ++++++++--------
 lgsm/functions/update_factorio.sh              | 16 +++++++++-------
 lgsm/functions/update_minecraft.sh             |  1 -
 lgsm/functions/update_mta.sh                   |  5 ++---
 lgsm/functions/update_mumble.sh                |  1 -
 lgsm/functions/update_steamcmd.sh              |  2 +-
 lgsm/functions/update_ts3.sh                   |  1 -
 linuxgsm.sh                                    |  6 +++---
 tests/tests_fctrserver.sh                      | 10 +++++-----
 tests/tests_jc2server.sh                       | 10 +++++-----
 tests/tests_ts3server.sh                       | 10 +++++-----
 17 files changed, 69 insertions(+), 70 deletions(-)

diff --git a/lgsm/config-default/config-lgsm/fctrserver/_default.cfg b/lgsm/config-default/config-lgsm/fctrserver/_default.cfg
index 2632e7717..91aec48b1 100644
--- a/lgsm/config-default/config-lgsm/fctrserver/_default.cfg
+++ b/lgsm/config-default/config-lgsm/fctrserver/_default.cfg
@@ -13,6 +13,7 @@ ip="0.0.0.0"
 port="34197"
 rconport="34198"
 rconpassword="CHANGE_ME"
+# (stable|experimental)
 branch="stable"
 
 ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
diff --git a/lgsm/functions/command_backup.sh b/lgsm/functions/command_backup.sh
index b2df4be6d..0f2b09b4d 100644
--- a/lgsm/functions/command_backup.sh
+++ b/lgsm/functions/command_backup.sh
@@ -14,12 +14,12 @@ check.sh
 # Trap to remove lockfile on quit.
 fn_backup_trap(){
 	echo ""
-	echo -ne "backup ${backupname}.tar.gz..."
+	echo -en "backup ${backupname}.tar.gz..."
 	fn_print_canceled_eol_nl
 	fn_script_log_info "Backup ${backupname}.tar.gz: CANCELED"
 	sleep 0.5
 	rm -f "${backupdir}/${backupname}.tar.gz" | tee -a "${lgsmlog}"
-	echo -ne "backup ${backupname}.tar.gz..."
+	echo -en "backup ${backupname}.tar.gz..."
 	fn_print_removed_eol_nl
 	fn_script_log_info "Backup ${backupname}.tar.gz: REMOVED"
 	# Remove lock file
@@ -47,7 +47,7 @@ fn_backup_init(){
 	sleep 0.5
 	fn_print_ok "Backup starting"
 	sleep 0.5
-	echo -ne "\n"
+	echo -en "\n"
 	if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
 		fn_print_info_nl "There are no previous backups"
 	else
diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/functions/command_update_linuxgsm.sh
index 56383f0ce..25b028ef7 100644
--- a/lgsm/functions/command_update_linuxgsm.sh
+++ b/lgsm/functions/command_update_linuxgsm.sh
@@ -12,11 +12,11 @@ fn_print_dots "Updating LinuxGSM"
 sleep 0.5
 check.sh
 fn_script_log_info "Updating LinuxGSM"
-echo -ne "\n"
+echo -en "\n"
 
 if [ -z "${legacymode}" ]; then
 	# Check and update _default.cfg
-	echo -ne "    checking config _default.cfg...\c"
+	echo -en "    checking config _default.cfg...\c"
 	config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(${curlpath} -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
 	if [ "${config_file_diff}" != "" ]; then
 		fn_print_update_eol_nl
@@ -30,7 +30,7 @@ if [ -z "${legacymode}" ]; then
 		fn_script_log_info "checking config _default.cfg: OK"
 	fi
 
-	echo -ne "    checking linuxgsm.sh...\c"
+	echo -en "    checking linuxgsm.sh...\c"
 	tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(${curlpath} -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh"))
 	if [ "${tmp_script_diff}" != "" ]; then
 		fn_print_update_eol_nl
@@ -42,11 +42,11 @@ if [ -z "${legacymode}" ]; then
 		fn_script_log_info "checking linuxgsm.sh: OK"
 		fn_print_ok_eol_nl
 	fi
-	echo -ne "    checking ${selfname}...\c"
+	echo -en "    checking ${selfname}...\c"
 	script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}"))
 	if [ "${script_diff}" != "" ]; then
 		fn_print_update_eol_nl
-		echo -ne "    backup ${selfname}...\c"
+		echo -en "    backup ${selfname}...\c"
 		mkdir -p "${backupdir}/script/"
 		cp "${rootdir}/${selfname}" "${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
 		if [ $? -ne 0 ]; then
@@ -56,7 +56,7 @@ if [ -z "${legacymode}" ]; then
 			fn_print_ok_eol_nl
 			echo -e "	Backup: ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
 		fi
-		echo -ne "    fetching ${selfname}...\c"
+		echo -en "    fetching ${selfname}...\c"
 		cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}"
 		sed -i "s/shortname=\"core\"/shortname=\"${shortname}\"/g" "${rootdir}/${selfname}"
 		sed -i "s/gameservername=\"core\"/gameservername=\"${gameservername}\"/g" "${rootdir}/${selfname}"
@@ -78,14 +78,14 @@ if [ -n "${functionsdir}" ]; then
 		cd "${functionsdir}" || exit
 		for functionfile in *
 		do
-			echo -ne "    checking function ${functionfile}...\c"
+			echo -en "    checking function ${functionfile}...\c"
 			github_file_url_dir="lgsm/functions"
 			get_function_file=$(${curlpath} --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}")
 			exitcode=$?
 			function_file_diff=$(diff "${functionsdir}/${functionfile}" <(${curlpath} --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}"))
 			if [ ${exitcode} -ne 0 ]; then
 				fn_print_fail_eol_nl
-				echo -ne "    removing unknown function ${functionfile}...\c"
+				echo -en "    removing unknown function ${functionfile}...\c"
 				fn_script_log_fatal "removing unknown function ${functionfile}"
 				rm -f "${functionfile}"
 				if [ $? -ne 0 ]; then
@@ -113,5 +113,5 @@ else
 	fn_print_ok "Updating functions"
 	fn_script_log_pass "Updating functions"
 fi
-echo -ne "\n"
+echo -en "\n"
 core_exit.sh
diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh
index ea23b8c7e..ad5de35ee 100644
--- a/lgsm/functions/core_dl.sh
+++ b/lgsm/functions/core_dl.sh
@@ -24,7 +24,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 fn_dl_md5(){
 	# Runs MD5 Check if available
 	if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then
-		echo -ne "verifying ${local_filename} with MD5..."
+		echo -en "verifying ${local_filename} with MD5..."
 		sleep 0.5
 		local md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}')
 		if [ "${md5sumcmd}" != "${md5}" ]; then
@@ -53,7 +53,7 @@ fn_dl_extract(){
 	local_filename="${2}"
 	extractdir="${3}"
 	# extracts archives
-	echo -ne "extracting ${local_filename}..."
+	echo -en "extracting ${local_filename}..."
 	mime=$(file -b --mime-type "${local_filedir}/${local_filename}")
 	if [ ! -d "${extractdir}" ]; then
 		mkdir "${extractdir}"
@@ -85,12 +85,12 @@ fn_dl_extract(){
 # Trap to remove file download if canceled before completed
 fn_fetch_trap(){
 	echo ""
-	echo -ne "downloading ${local_filename}..."
+	echo -en "downloading ${local_filename}..."
 	fn_print_canceled_eol_nl
 	fn_script_log_info "Downloading ${local_filename}...CANCELED"
 	sleep 0.5
 	rm -f "${local_filedir}/${local_filename}"
-	echo -ne "downloading ${local_filename}..."
+	echo -en "downloading ${local_filename}..."
 	fn_print_removed_eol_nl
 	fn_script_log_info "Downloading ${local_filename}...REMOVED"
 	core_exit.sh
@@ -112,14 +112,14 @@ fn_fetch_file(){
 		fi
 		# Trap will remove part downloaded files if canceled
 		trap fn_fetch_trap INT
-		# if larger file shows progress bar
-		if [ "${local_filename##*.}" == "bz2" ]||[ "${local_filename##*.}" == "gz" ]||[ "${local_filename##*.}" == "zip" ]||[ "${local_filename##*.}" == "jar" ]; then
-			echo -ne "downloading ${local_filename}..."
+		# larger files show a progress bar
+		if [ "${local_filename##*.}" == "bz2" ]||[ "${local_filename##*.}" == "gz" ]||[ "${local_filename##*.}" == "zip" ]||[ "${local_filename##*.}" == "jar" ]||[ "${local_filename##*.}" == "xz" ]; then
+			echo -en "downloading ${local_filename}..."
 			sleep 0.5
-			echo -ne "downloading ${local_filename}..."
+			echo -en "downloading ${local_filename}..."
 			curlcmd=$(${curlpath} --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}")
 		else
-			echo -ne "    fetching ${local_filename}...\c"
+			echo -en "    fetching ${local_filename}...\c"
 			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 		fi
 		local exitcode=$?
diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh
index f0de72fc0..232459e0a 100644
--- a/lgsm/functions/fix.sh
+++ b/lgsm/functions/fix.sh
@@ -70,7 +70,7 @@ fi
 # Fixes that are run on install only.
 if [ "${function_selfname}" == "command_install.sh" ]; then
 		echo ""
-		echo "Applying ${gamename} Server Fixes"
+		echo "Applying Post-Install Fixes"
 		echo "================================="
 		sleep 0.5
 		if [ "${gamename}" == "Killing Floor" ]; then
diff --git a/lgsm/functions/install_logs.sh b/lgsm/functions/install_logs.sh
index acd6a6917..bc8184839 100644
--- a/lgsm/functions/install_logs.sh
+++ b/lgsm/functions/install_logs.sh
@@ -15,7 +15,7 @@ if [ "${checklogs}" != "1" ]; then
 fi
 sleep 0.5
 # Create LinuxGSM logs
-echo -ne "installing log dir: ${logdir}..."
+echo -en "installing log dir: ${logdir}..."
 mkdir -p "${logdir}"
 if [ $? -ne 0 ]; then
 	fn_print_fail_eol_nl
@@ -24,7 +24,7 @@ else
 	fn_print_ok_eol_nl
 fi
 
-echo -ne "installing LinuxGSM log dir: ${lgsmlogdir}..."
+echo -en "installing LinuxGSM log dir: ${lgsmlogdir}..."
 mkdir -p "${lgsmlogdir}"
 if [ $? -ne 0 ]; then
 	fn_print_fail_eol_nl
@@ -32,7 +32,7 @@ if [ $? -ne 0 ]; then
 else
 	fn_print_ok_eol_nl
 fi
-echo -ne "creating LinuxGSM log: ${lgsmlog}..."
+echo -en "creating LinuxGSM log: ${lgsmlog}..."
 touch "${lgsmlog}"
 if [ $? -ne 0 ]; then
 	fn_print_fail_eol_nl
@@ -42,7 +42,7 @@ else
 fi
 # Create Console logs
 if [ -n "${consolelogdir}" ]; then
-	echo -ne "installing console log dir: ${consolelogdir}..."
+	echo -en "installing console log dir: ${consolelogdir}..."
 	mkdir -p "${consolelogdir}"
 	if [ $? -ne 0 ]; then
 		fn_print_fail_eol_nl
@@ -50,7 +50,7 @@ if [ -n "${consolelogdir}" ]; then
 	else
 		fn_print_ok_eol_nl
 	fi
-	echo -ne "creating console log: ${consolelog}..."
+	echo -en "creating console log: ${consolelog}..."
 	touch "${consolelog}"
 	if [ $? -ne 0 ]; then
 		fn_print_fail_eol_nl
@@ -62,7 +62,7 @@ fi
 
 # Create Game logs
 if [ -n "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then
-	echo -ne "installing game log dir: ${gamelogdir}..."
+	echo -en "installing game log dir: ${gamelogdir}..."
 	mkdir -p "${gamelogdir}"
 	if [ $? -ne 0 ]; then
 		fn_print_fail_eol_nl
@@ -78,7 +78,7 @@ fi
 # log/server is in log/: symlink not created
 if [ -n "${gamelogdir}" ]; then
 	if [ "${gamelogdir:0:${#logdir}}" != "${logdir}" ]; then
-		echo -ne "creating symlink to game log dir: ${logdir}/server -> ${gamelogdir}..."
+		echo -en "creating symlink to game log dir: ${logdir}/server -> ${gamelogdir}..."
 		ln -nfs "${gamelogdir}" "${logdir}/server"
 		if [ $? -ne 0 ]; then
 			fn_print_fail_eol_nl
@@ -92,7 +92,7 @@ fi
 # If server uses SteamCMD create a symbolic link to the Steam logs
 if [ -d "${rootdir}/Steam/logs" ]; then
 	if [ ! -L "${logdir}/steamcmd" ]; then
-		echo -ne "creating symlink to steam log dir: ${logdir}/steamcmd -> ${rootdir}/Steam/logs..."
+		echo -en "creating symlink to steam log dir: ${logdir}/steamcmd -> ${rootdir}/Steam/logs..."
 		ln -nfs "${rootdir}/Steam/logs" "${logdir}/steamcmd"
 		if [ $? -ne 0 ]; then
 			fn_print_fail_eol_nl
diff --git a/lgsm/functions/mods_core.sh b/lgsm/functions/mods_core.sh
index c53ad7c96..5fd39970f 100644
--- a/lgsm/functions/mods_core.sh
+++ b/lgsm/functions/mods_core.sh
@@ -37,7 +37,7 @@ fn_mod_install_files(){
 fn_mod_lowercase(){
 	if [ "${modlowercase}" == "LowercaseOn" ]; then
 
-		echo -ne "converting ${modprettyname} files to lowercase..."
+		echo -en "converting ${modprettyname} files to lowercase..."
 		sleep 0.5
 		fn_script_log_info "Converting ${modprettyname} files to lowercase"
 		fileswc=$(find "${extractdir}" -depth | wc -l)
@@ -50,10 +50,10 @@ fn_mod_lowercase(){
 				local exitcode=$?
 				((renamedwc++))
 			fi
-			echo -ne "${renamedwc} / ${totalfileswc} / ${fileswc} converting ${modprettyname} files to lowercase..." $'\r'
+			echo -en "${renamedwc} / ${totalfileswc} / ${fileswc} converting ${modprettyname} files to lowercase..." $'\r'
 			((totalfileswc++))
 		done < <(find "${extractdir}" -depth)
-		echo -ne "${renamedwc} / ${totalfileswc} / ${fileswc} converting ${modprettyname} files to lowercase..."
+		echo -en "${renamedwc} / ${totalfileswc} / ${fileswc} converting ${modprettyname} files to lowercase..."
 
 		if [ ${exitcode} -ne 0 ]; then
 			fn_print_fail_eol_nl
@@ -67,7 +67,7 @@ fn_mod_lowercase(){
 
 # Create ${modcommand}-files.txt containing the full extracted file/directory list
 fn_mod_create_filelist(){
-	echo -ne "building ${modcommand}-files.txt..."
+	echo -en "building ${modcommand}-files.txt..."
 	sleep 0.5
 	# ${modsdir}/${modcommand}-files.txt
 	find "${extractdir}" -mindepth 1 -printf '%P\n' > "${modsdir}/${modcommand}-files.txt"
@@ -89,7 +89,7 @@ fn_mod_create_filelist(){
 
 # Copy the mod into serverfiles
 fn_mod_copy_destination(){
-	echo -ne "copying ${modprettyname} to ${modinstalldir}..."
+	echo -en "copying ${modprettyname} to ${modinstalldir}..."
 	sleep 0.5
 	cp -Rf "${extractdir}/." "${modinstalldir}/"
 	local exitcode=$?
@@ -115,7 +115,7 @@ fn_mod_tidy_files_list(){
 	# Check file list validity
 	fn_check_mod_files_list
 	# Output to the user
-	echo -ne "tidy up ${modcommand}-files.txt..."
+	echo -en "tidy up ${modcommand}-files.txt..."
 	sleep 0.5
 	fn_script_log_info "Tidy up ${modcommand}-files.txt"
 	# Lines/files to remove from file list (end with ";" separator)
@@ -385,7 +385,7 @@ fn_mods_create_tmp_dir(){
 	if [ ! -d "${modstmpdir}" ]; then
 		mkdir -p "${modstmpdir}"
 		exitcode=$?
-		echo -ne "creating mod download directory ${modstmpdir}..."
+		echo -en "creating mod download directory ${modstmpdir}..."
 		if [ ${exitcode} -ne 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Creating mod download directory ${modstmpdir}"
@@ -400,7 +400,7 @@ fn_mods_create_tmp_dir(){
 # Remove the tmp mod download directory when finished
 fn_mods_clear_tmp_dir(){
 	if [ -d "${modstmpdir}" ]; then
-		echo -ne "clearing mod download directory ${modstmpdir}..."
+		echo -en "clearing mod download directory ${modstmpdir}..."
 		rm -r "${modstmpdir}"
 		exitcode=$?
 		if [ ${exitcode} -ne 0 ]; then
diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh
index ca70396e8..887bdd22b 100644
--- a/lgsm/functions/update_factorio.sh
+++ b/lgsm/functions/update_factorio.sh
@@ -10,8 +10,13 @@ local commandaction="Update"
 local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_update_factorio_dl(){
-	fn_fetch_file "https://www.factorio.com/get-download/${availablebuild}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.gz"
-	fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.gz" "${tmpdir}"
+	if [ "${branch}" == "stable" ]; then
+		downloadbranch="stable"
+	elif [ "${branch}" == "experimental" ]; then
+		downloadbranch="latest"
+	fi
+	fn_fetch_file "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.xz"
+	fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.xz" "${tmpdir}"
 	echo -e "copying to ${serverfiles}...\c"
 	fn_script_log "Copying to ${serverfiles}"
 	cp -R "${tmpdir}/factorio/"* "${serverfiles}"
@@ -77,12 +82,10 @@ fn_update_factorio_arch(){
 fn_update_factorio_availablebuild(){
 	# Gets latest build info.
 	if [ "${branch}" != "stable" ]; then
-		availablebuild=$(${curlpath} -s https://www.factorio.com/download-headless/"${branch}" | grep 'headless/linux64' | head -n 2 | tail -n 1 | grep -oP '(?<=get-download/).*?(?=/)')
+		availablebuild=$(${curlpath} -s https://factorio.com/get-download/stable/headless/linux64 | grep -o '[0-9]\.[0-9]\{2\}\.[0-9]\{2\}' | head -1)
 	else
-		availablebuild=$(${curlpath} -s https://www.factorio.com/download-headless | grep 'headless/linux64' | head -n 2 | tail -n 1 | grep -oP '(?<=get-download/).*?(?=/)')
+		availablebuild=$(${curlpath} -s https://factorio.com/get-download/latest/headless/linux64 | grep -o '[0-9]\.[0-9]\{2\}\.[0-9]\{2\}' | head -1)
 	fi
-	sleep 0.5
-
 	# Checks if availablebuild variable has been set
 	if [ -z "${availablebuild}" ]; then
 		fn_print_fail "Checking for update: factorio.com"
@@ -112,7 +115,6 @@ fn_update_factorio_compare(){
 		echo -e "	Available build: ${green}${availablebuild} ${factorioarch} ${branch}${default}"
 		echo -e ""
 		sleep 0.5
-		echo ""
 		echo -en "Applying update.\r"
 		sleep 1
 		echo -en "Applying update..\r"
diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh
index 947de934a..31c1f0a20 100644
--- a/lgsm/functions/update_minecraft.sh
+++ b/lgsm/functions/update_minecraft.sh
@@ -102,7 +102,6 @@ fn_update_compare(){
 		echo -e "	Available build: ${green}${availablebuild}${default}"
 		echo -e ""
 		sleep 0.5
-		echo ""
 		echo -en "Applying update.\r"
 		sleep 1
 		echo -en "Applying update..\r"
diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh
index 1a4bb4419..85c7b1053 100644
--- a/lgsm/functions/update_mta.sh
+++ b/lgsm/functions/update_mta.sh
@@ -92,11 +92,10 @@ fn_update_mta_compare(){
 		echo -e "\n"
 		echo -e "Update ${mta_update_string}:"
 		sleep 0.5
-		echo -e "       Current build: ${red}${currentbuild} ${default}"
-		echo -e "       Available build: ${green}${fullversion} ${default}"
+		echo -e "	Current build: ${red}${currentbuild} ${default}"
+		echo -e "	Available build: ${green}${fullversion} ${default}"
 		echo -e ""
 		sleep 0.5
-		echo ""
 		echo -en "Applying update.\r"
 		sleep 1
 		echo -en "Applying update..\r"
diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh
index 3ad1c1a47..6988fc317 100644
--- a/lgsm/functions/update_mumble.sh
+++ b/lgsm/functions/update_mumble.sh
@@ -108,7 +108,6 @@ fn_update_mumble_compare(){
 		echo -e "	Available build: ${green}${availablebuild} ${mumblearch}${default}"
 		echo -e ""
 		sleep 0.5
-		echo ""
 		echo -en "Applying update.\r"
 		sleep 1
 		echo -en "Applying update..\r"
diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh
index dbcf3736e..15fb0277f 100644
--- a/lgsm/functions/update_steamcmd.sh
+++ b/lgsm/functions/update_steamcmd.sh
@@ -111,7 +111,7 @@ fn_update_request_log(){
 		fn_print_ok_nl "Checking for update: Server logs: Update requested"
 		fn_script_log_pass "Checking for update: Server logs: Update requested"
 		sleep 0.5
-		echo ""
+		echo -e ""
 		echo -en "Applying update.\r"
 		sleep 1
 		echo -en "Applying update..\r"
diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh
index 596979348..ce41eef25 100644
--- a/lgsm/functions/update_ts3.sh
+++ b/lgsm/functions/update_ts3.sh
@@ -160,7 +160,6 @@ fn_update_ts3_compare(){
 		echo -e "	Available build: ${green}${availablebuild} ${ts3arch}${default}"
 		echo -e ""
 		sleep 0.5
-		echo ""
 		echo -en "Applying update.\r"
 		sleep 1
 		echo -en "Applying update..\r"
diff --git a/linuxgsm.sh b/linuxgsm.sh
index 178f00310..f0e896a49 100755
--- a/linuxgsm.sh
+++ b/linuxgsm.sh
@@ -76,7 +76,7 @@ fn_bootstrap_fetch_file(){
 		# If curl exists download file
 		if [ "$(basename "${curlpath}")" == "curl" ]; then
 			# trap to remove part downloaded files
-			echo -ne "    fetching ${local_filename}...\c"
+			echo -en "    fetching ${local_filename}...\c"
 			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 			local exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
@@ -325,7 +325,7 @@ else
 		fi
 		if [ ! -f "${configdirserver}/_default.cfg" ]; then
 			mkdir -p "${configdirserver}"
-			echo -ne "    copying _default.cfg...\c"
+			echo -en "    copying _default.cfg...\c"
 			cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 			exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
@@ -338,7 +338,7 @@ else
 			function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
 			if [ "${function_file_diff}" != "" ]; then
 				fn_print_warn_nl "_default.cfg has been altered. reloading config."
-				echo -ne "    copying _default.cfg...\c"
+				echo -en "    copying _default.cfg...\c"
 				cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 				exitcode=$?
 				if [ ${exitcode} -ne 0 ]; then
diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh
index 31d9205d0..8ed381f05 100644
--- a/tests/tests_fctrserver.sh
+++ b/tests/tests_fctrserver.sh
@@ -69,7 +69,7 @@ fn_bootstrap_fetch_file(){
 		# If curl exists download file
 		if [ "$(basename "${curlpath}")" == "curl" ]; then
 			# trap to remove part downloaded files
-			echo -ne "    fetching ${local_filename}...\c"
+			echo -en "    fetching ${local_filename}...\c"
 			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 			local exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
@@ -314,7 +314,7 @@ else
 	fi
 	if [ ! -f "${configdirserver}/_default.cfg" ]; then
 		mkdir -p "${configdirserver}"
-		echo -ne "    copying _default.cfg...\c"
+		echo -en "    copying _default.cfg...\c"
 		cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 		exitcode=$?
 		if [ ${exitcode} -ne 0 ]; then
@@ -327,7 +327,7 @@ else
 		function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
 		if [ "${function_file_diff}" != "" ]; then
 			fn_print_warn_nl "_default.cfg has been altered. reloading config."
-			echo -ne "    copying _default.cfg...\c"
+			echo -en "    copying _default.cfg...\c"
 			cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 			exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
@@ -392,7 +392,7 @@ fn_setstatus(){
 	while [  "${requiredstatus}" != "${currentstatus}" ]; do
 		counter=$((counter+1))
 		fn_currentstatus_tmux
-		echo -ne "New status:  ${currentstatus}\\r"
+		echo -en "New status:  ${currentstatus}\\r"
 
 		if [ "${requiredstatus}" == "ONLINE" ]; then
 			(command_start.sh > /dev/null 2>&1)
@@ -407,7 +407,7 @@ fn_setstatus(){
 			exit 1
 		fi
 	done
-	echo -ne "New status:  ${currentstatus}\\r"
+	echo -en "New status:  ${currentstatus}\\r"
 	echo -e "\n"
 	echo "Test starting:"
 	echo ""
diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh
index ead84d404..4a6c9265a 100644
--- a/tests/tests_jc2server.sh
+++ b/tests/tests_jc2server.sh
@@ -69,7 +69,7 @@ fn_bootstrap_fetch_file(){
 		# If curl exists download file
 		if [ "$(basename "${curlpath}")" == "curl" ]; then
 			# trap to remove part downloaded files
-			echo -ne "    fetching ${local_filename}...\c"
+			echo -en "    fetching ${local_filename}...\c"
 			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 			local exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
@@ -314,7 +314,7 @@ else
 	fi
 	if [ ! -f "${configdirserver}/_default.cfg" ]; then
 		mkdir -p "${configdirserver}"
-		echo -ne "    copying _default.cfg...\c"
+		echo -en "    copying _default.cfg...\c"
 		cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 		exitcode=$?
 		if [ ${exitcode} -ne 0 ]; then
@@ -327,7 +327,7 @@ else
 		function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
 		if [ "${function_file_diff}" != "" ]; then
 			fn_print_warn_nl "_default.cfg has been altered. reloading config."
-			echo -ne "    copying _default.cfg...\c"
+			echo -en "    copying _default.cfg...\c"
 			cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 			exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
@@ -392,7 +392,7 @@ fn_setstatus(){
 	while [  "${requiredstatus}" != "${currentstatus}" ]; do
 		counter=$((counter+1))
 		fn_currentstatus_tmux
-		echo -ne "New status:  ${currentstatus}\\r"
+		echo -en "New status:  ${currentstatus}\\r"
 
 		if [ "${requiredstatus}" == "ONLINE" ]; then
 			(command_start.sh > /dev/null 2>&1)
@@ -407,7 +407,7 @@ fn_setstatus(){
 			exit 1
 		fi
 	done
-	echo -ne "New status:  ${currentstatus}\\r"
+	echo -en "New status:  ${currentstatus}\\r"
 	echo -e "\n"
 	echo "Test starting:"
 	echo ""
diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh
index f8594c134..a2e091e28 100644
--- a/tests/tests_ts3server.sh
+++ b/tests/tests_ts3server.sh
@@ -69,7 +69,7 @@ fn_bootstrap_fetch_file(){
 		# If curl exists download file
 		if [ "$(basename "${curlpath}")" == "curl" ]; then
 			# trap to remove part downloaded files
-			echo -ne "    fetching ${local_filename}...\c"
+			echo -en "    fetching ${local_filename}...\c"
 			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 			local exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
@@ -314,7 +314,7 @@ else
 	fi
 	if [ ! -f "${configdirserver}/_default.cfg" ]; then
 		mkdir -p "${configdirserver}"
-		echo -ne "    copying _default.cfg...\c"
+		echo -en "    copying _default.cfg...\c"
 		cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 		exitcode=$?
 		if [ ${exitcode} -ne 0 ]; then
@@ -327,7 +327,7 @@ else
 		function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
 		if [ "${function_file_diff}" != "" ]; then
 			fn_print_warn_nl "_default.cfg has been altered. reloading config."
-			echo -ne "    copying _default.cfg...\c"
+			echo -en "    copying _default.cfg...\c"
 			cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 			exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
@@ -392,7 +392,7 @@ fn_setstatus(){
 	while [  "${requiredstatus}" != "${currentstatus}" ]; do
 		counter=$((counter+1))
 		fn_currentstatus_ts3
-		echo -ne "New status:  ${currentstatus}\\r"
+		echo -en "New status:  ${currentstatus}\\r"
 
 		if [ "${requiredstatus}" == "ONLINE" ]; then
 			(command_start.sh > /dev/null 2>&1)
@@ -407,7 +407,7 @@ fn_setstatus(){
 			exit 1
 		fi
 	done
-	echo -ne "New status:  ${currentstatus}\\r"
+	echo -en "New status:  ${currentstatus}\\r"
 	echo -e "\n"
 	echo "Test starting:"
 	echo ""