Daniel Gibbs před 2 roky
rodič
revize
06b570b3e0

+ 3 - 3
lgsm/modules/core_dl.sh

@@ -150,7 +150,7 @@ fn_dl_steamcmd() {
 
 # Emptys contents of the LinuxGSM tmpdir.
 fn_clear_tmp() {
-	echo -en "clearing tmp directory [ ${tmpdir} ]"
+	echo -en "clearing tmp directory [ ${italic}${tmpdir}${default} ]"
 	if [ -d "${tmpdir}" ]; then
 		rm -rf "${tmpdir:?}/"*
 		local exitcode=$?
@@ -397,11 +397,11 @@ fn_fetch_file() {
 			local exitcode=""
 			large_files=("bz2" "gz" "zip" "jar" "xz")
 			if grep -qE "(^|\s)${local_filename##*.}(\s|$)" <<< "${large_files[@]}"; then
-				echo -e "downloading file [ ${local_filename} ]"
+				echo -e "downloading file [ ${italic}${local_filename}${default} ]"
 				fn_sleep_time
 				"${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1
 				exitcode="$?"
-				echo -en "downloading file [ ${local_filename} ]"
+				echo -en "downloading file [ ${italic}${local_filename}${default} ]"
 			else
 				echo -en "fetching ${fileurl_name} [ ${italic}${local_filename}${default} ]\c"
 				"${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1

+ 1 - 1
lgsm/modules/install_complete.sh

@@ -20,7 +20,7 @@ elif [ "${exitcode}" == "3" ]; then
 	echo -e "${lightyellow}Install Completed with Warnings!${default}}"
 	fn_script_log_warn "Install Completed with Warnings!"
 elif [ -z "${exitcode}" ] || [ "${exitcode}" == "0" ]; then
-	echo -e "${green}Install Complete!${default}}"
+	echo -e "${green}Install Complete!${default}"
 	fn_script_log_pass "Install Complete!"
 fi
 

+ 42 - 41
lgsm/modules/install_config.sh

@@ -9,24 +9,26 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Checks if server cfg dir exists, creates it if it doesn't.
 fn_check_cfgdir() {
-
+	changes=""
 	if [ "${shortname}" == "dst" ]; then
-		echo -en "creating ${clustercfgfullpath} config directory"
-		mkdir -p "${clustercfgfullpath}"
+		echo -en "creating config directory [ ${italic}${clustercfgfullpath}${default} ]"
+		changes+=$(mkdir -pv "${clustercfgfullpath}")
 	elif [ "${shortname}" == "arma3" ]; then
-		echo -en "creating ${networkcfgfullpath} config directory"
-		mkdir -p "${networkcfgfullpath}"
+		echo -en "creating config directory [ ${italic}${networkcfgfullpath}${default} ]"
+		changes+=$(mkdir -pv "${networkcfgfullpath}")
 	else
-		echo -en "creating ${servercfgdir} config directory"
-		mkdir -p "${servercfgdir}"
+		echo -en "creating config directory [ ${italic}${servercfgdir}${default} ]"
+		changes+=$(mkdir -pv "${servercfgdir}")
 	fi
 	if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
-		fn_print_fail_eol
+		fn_print_fail_eol_nl
 		fn_script_log_fatal "creating ${servercfgdir} config directory"
 		core_exit.sh
-	else
-		fn_print_ok_eol
+	elif [ "${changes}" != "" ]; then
+		fn_print_ok_eol_nl
 		fn_script_log_pass "creating ${servercfgdir} config directory"
+	else
+		fn_print_skip_eol_nl
 	fi
 }
 
@@ -45,34 +47,33 @@ fn_default_config_remote() {
 	for config in "${array_configs[@]}"; do
 		if [ ! -f "${lgsmdir}/config-default/config-game/${config}" ]; then
 			fn_fetch_file "${githuburl}/${shortname}/${config}" "${remote_fileurl_backup}" "GitHub" "Bitbucket" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "forcedl" "nohash"
+		fi
+		fn_check_cfgdir
 
-			fn_check_cfgdir
-
-			changes=""
-			if [ "${config}" == "${servercfgdefault}" ]; then
-				echo -en "copying config file [ ${italic}${servercfgfullpath}${default} ]"
-				changes+=$(cp -n "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}")
-			elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then
-				echo -en "copying config file [ ${italic}${networkcfgfullpath}${default} ]"
-				changes+=$(cp -n "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}")
-			elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then
-				echo -en "copying config file [ ${italic}${clustercfgdefault}${default} ]"
-				changes+=$(cp -n "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}")
-			else
-				echo -en "copying config file [ ${italic}${servercfgdir}/${config}${default} ]"
-				changes+=$(cp -n "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}")
-			fi
-			if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
-				fn_print_failure_eol_nl
-				fn_script_log_fatal "copying config file ${servercfgfullpath}"
-			elif [ "${changes}" != "" ]; then
-				fn_print_ok_eol_nl
-				fn_script_log_pass "copying config file ${servercfgfullpath}"
-			else
-				fn_print_skip_eol_nl
-			fi
-
+		changes=""
+		if [ "${config}" == "${servercfgdefault}" ]; then
+			echo -en "copying config file [ ${italic}${servercfgfullpath}${default} ]"
+			changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}")
+		elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then
+			echo -en "copying config file [ ${italic}${networkcfgfullpath}${default} ]"
+			changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}")
+		elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then
+			echo -en "copying config file [ ${italic}${clustercfgdefault}${default} ]"
+			changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}")
+		else
+			echo -en "copying config file [ ${italic}${servercfgdir}/${config}${default} ]"
+			changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}")
+		fi
+		if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
+			fn_print_failure_eol_nl
+			fn_script_log_fatal "copying config file ${servercfgfullpath}"
+		elif [ "${changes}" != "" ]; then
+			fn_print_ok_eol_nl
+			fn_script_log_pass "copying config file ${servercfgfullpath}"
+		else
+			fn_print_skip_eol_nl
 		fi
+		unset changes
 	done
 }
 
@@ -118,13 +119,13 @@ fn_set_config_vars() {
 		unset changes
 
 		randomstring=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2> /dev/null | head -c 8 | xargs)
-		rconpass="admin${randomstring}"
+		adminpass="admin${randomstring}"
 		echo -en "generating rcon/admin password"
 		changes=""
 		if [ "${shortname}" == "squad" ]; then
-			changes+=$(sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgdir}/Rcon.cfg")
+			changes+=$(sed -i "s/ADMINPASSWORD/${adminpass}/g w /dev/stdout" "${servercfgdir}/Rcon.cfg")
 		else
-			changes+=$(sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}")
+			changes+=$(sed -i "s/ADMINPASSWORD/${adminpass}/g w /dev/stdout" "${servercfgfullpath}")
 		fi
 		if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
 			fn_print_fail_eol
@@ -144,7 +145,7 @@ fn_set_dst_config_vars() {
 	servername="LinuxGSM"
 	echo -en "changing cluster name"
 	changes=""
-	changes+=$(sed -i "s/SERVERNAME/${servername}/g" "${clustercfgfullpath}")
+	changes+=$(sed -i "s/SERVERNAME/${servername}/g w /dev/stdout" "${clustercfgfullpath}")
 	if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
 		fn_print_fail_eol
 		fn_script_log_fatal "changing cluster name"
@@ -159,7 +160,7 @@ fn_set_dst_config_vars() {
 	randomstring=$(tr -dc A-Za-z0-9 < /dev/urandom 2> /dev/null | head -c 16 | xargs)
 	echo -en "generating cluster key"
 	changes=""
-	changes+=$(sed -i "s/CLUSTERKEY/${randomstring}/g" "${clustercfgfullpath}")
+	changes+=$(sed -i "s/CLUSTERKEY/${randomstring}/g w /dev/stdout" "${clustercfgfullpath}")
 	if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
 		fn_print_fail_eol
 		fn_script_log_fatal "generating cluster key"