Explorar o código

fix(messages): fix some messages not using newline correctly (#2765)

Daniel Gibbs %!s(int64=6) %!d(string=hai) anos
pai
achega
c847ecb4b6

+ 11 - 11
lgsm/functions/alert.sh

@@ -104,10 +104,10 @@ elif [ "${postalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert
 	fn_print_warn_nl "More Info not enabled"
 	fn_script_log_warn "More Info alerts not enabled"
 elif [ -z "${posttarget}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "posttarget not set"
+	fn_print_error "posttarget not set"
 	fn_script_error "posttarget not set"
 elif [ -z "${postdays}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "postdays not set"
+	fn_print_error "postdays not set"
 	fn_script_error "postdays not set"
 fi
 
@@ -117,7 +117,7 @@ elif [ "${discordalert}" != "on" ]&&[ "${function_selfname}" == "command_test_al
 	fn_print_warn_nl "Discord alerts not enabled"
 	fn_script_log_warn "Discord alerts not enabled"
 elif [ -z "${discordtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "Discord token not set"
+	fn_print_error "Discord token not set"
 	echo -e "	* https://docs.linuxgsm.com/alerts/discord"
 	fn_script_error "Discord token not set"
 fi
@@ -128,7 +128,7 @@ elif [ "${emailalert}" != "on" ]&&[ "${function_selfname}" == "command_test_aler
 	fn_print_warn_nl "Email alerts not enabled"
 	fn_script_log_warn "Email alerts not enabled"
 elif [ -z "${email}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "Email not set"
+	fn_print_error "Email not set"
 	fn_script_log_error "Email not set"
 fi
 
@@ -138,7 +138,7 @@ elif [ "${iftttalert}" != "on" ]&&[ "${function_selfname}" == "command_test_aler
 	fn_print_warn_nl "IFTTT alerts not enabled"
 	fn_script_log_warn "IFTTT alerts not enabled"
 elif [ -z "${ifttttoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "IFTTT token not set"
+	fn_print_error "IFTTT token not set"
 	echo -e "	* https://docs.linuxgsm.com/alerts/ifttt"
 	fn_script_error "IFTTT token not set"
 fi
@@ -149,7 +149,7 @@ elif [ "${mailgunalert}" != "on" ]&&[ "${function_selfname}" == "command_test_al
 	fn_print_warn_nl "Mailgun alerts not enabled"
 	fn_script_log_warn "Mailgun alerts not enabled"
 elif [ -z "${mailguntoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "Mailgun token not set"
+	fn_print_error "Mailgun token not set"
 	echo -e "	* https://docs.linuxgsm.com/alerts/mailgun"
 	fn_script_error "Mailgun token not set"
 fi
@@ -160,7 +160,7 @@ elif [ "${pushbulletalert}" != "on" ]&&[ "${function_selfname}" == "command_test
 	fn_print_warn_nl "Pushbullet alerts not enabled"
 	fn_script_log_warn "Pushbullet alerts not enabled"
 elif [ -z "${pushbullettoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "Pushbullet token not set"
+	fn_print_error "Pushbullet token not set"
 	echo -e "	* https://docs.linuxgsm.com/alerts/pushbullet"
 	fn_script_error "Pushbullet token not set"
 fi
@@ -171,7 +171,7 @@ elif [ "${pushoveralert}" != "on" ]&&[ "${function_selfname}" == "command_test_a
 	fn_print_warn_nl "Pushover alerts not enabled"
 	fn_script_log_warn "Pushover alerts not enabled"
 elif [ -z "${pushovertoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "Pushover token not set"
+	fn_print_error "Pushover token not set"
 	echo -e "	* https://docs.linuxgsm.com/alerts/pushover"
 	fn_script_error "Pushover token not set"
 fi
@@ -182,11 +182,11 @@ elif [ "${telegramalert}" != "on" ]&&[ "${function_selfname}" == "command_test_a
 	fn_print_warn_nl "Telegram Messages not enabled"
 	fn_script_log_warn "Telegram Messages not enabled"
 elif [ -z "${telegramtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "Telegram token not set."
+	fn_print_error "Telegram token not set."
 	echo -e "	* https://docs.linuxgsm.com/alerts/telegram"
 	fn_script_error "Telegram token not set."
 elif [ -z "${telegramchatid}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "Telegram chat id not set."
+	fn_print_error "Telegram chat id not set."
 	echo -e "	* https://docs.linuxgsm.com/alerts/telegram"
 	fn_script_error "Telegram chat id not set."
 fi
@@ -197,7 +197,7 @@ elif [ "${slackalert}" != "on" ]&&[ "${function_selfname}" == "command_test_aler
 	fn_print_warn_nl "Slack alerts not enabled"
 	fn_script_log_warn "Slack alerts not enabled"
 elif [ -z "${slacktoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
-	fn_print_error_nl "Slack token not set"
+	fn_print_error "Slack token not set"
 	echo -e "	* https://docs.linuxgsm.com/alerts/slack"
 	fn_script_error "Slack token not set"
 fi

+ 4 - 4
lgsm/functions/check_deps.sh

@@ -273,11 +273,11 @@ fn_found_missing_deps(){
 				if [ "${steamcmdfail}" ]; then
 					echo -e ""
 					if [ "${function_selfname}" == "command_install.sh" ]; then
-						fn_print_failure_nl "Missing dependencies required to run SteamCMD."
+						fn_print_failure "Missing dependencies required to run SteamCMD."
 						fn_script_log_fatal "Missing dependencies required to run SteamCMD."
 						core_exit.sh
 					else
-						fn_print_error_nl "Missing dependencies required to run SteamCMD."
+						fn_print_error "Missing dependencies required to run SteamCMD."
 						fn_script_log_error "Missing dependencies required to run SteamCMD."
 					fi
 				fi
@@ -299,11 +299,11 @@ fn_found_missing_deps(){
 			if [ "${steamcmdfail}" ]; then
 				echo -e ""
 				if [ "${function_selfname}" == "command_install.sh" ]; then
-					fn_print_failure_nl "Missing dependencies required to run SteamCMD."
+					fn_print_failure "Missing dependencies required to run SteamCMD."
 					fn_script_log_fatal "Missing dependencies required to run SteamCMD."
 					core_exit.sh
 				else
-					fn_print_error_nl "Missing dependencies required to run SteamCMD."
+					fn_print_error "Missing dependencies required to run SteamCMD."
 					fn_script_log_error "Missing dependencies required to run SteamCMD."
 				fi
 			fi

+ 2 - 2
lgsm/functions/command_backup.sh

@@ -43,9 +43,9 @@ fn_backup_init(){
 	info_distro.sh
 	fn_print_dots "Backup starting"
 	fn_script_log_info "Backup starting"
-	fn_print_ok_nl "Backup starting"
+	fn_print_ok "Backup starting"
 	if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
-		fn_print_info_nl "There are no previous backups"
+		fn_print_info "There are no previous backups"
 	else
 		if [ "${lastbackupdaysago}" == "0" ]; then
 			daysago="less than 1 day ago"

+ 1 - 1
lgsm/functions/command_monitor.sh

@@ -21,7 +21,7 @@ fn_monitor_check_lockfile(){
 		fn_print_error_eol_nl
 		fn_script_log_error "Checking lockfile: No lockfile found: ERROR"
 		fn_sleep_time
-		echo -en "* Start ${selfname} to run monitor."
+		echo -e "* Start ${selfname} to run monitor."
 		core_exit.sh
 	fi
 

+ 10 - 10
lgsm/functions/core_messages.sh

@@ -149,9 +149,9 @@ fn_print_ok(){
 
 fn_print_ok_nl(){
 	if [ "${commandaction}" ]; then
-		echo -en "${creeol}[${green}  OK  ${default}] ${commandaction} ${selfname}: $*"
+		echo -e "${creeol}[${green}  OK  ${default}] ${commandaction} ${selfname}: $*"
 	else
-		echo -en "${creeol}[${green}  OK  ${default}] $*"
+		echo -e "${creeol}[${green}  OK  ${default}] $*"
 	fi
 	fn_sleep_time
 	echo -en "\n"
@@ -169,9 +169,9 @@ fn_print_fail(){
 
 fn_print_fail_nl(){
 	if [ "${commandaction}" ]; then
-		echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
+		echo -e "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
 	else
-		echo -en "${creeol}[${red} FAIL ${default}] $*"
+		echo -e "${creeol}[${red} FAIL ${default}] $*"
 	fi
 	fn_sleep_time
 	echo -en "\n"
@@ -189,9 +189,9 @@ fn_print_error(){
 
 fn_print_error_nl(){
 	if [ "${commandaction}" ]; then
-		echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${selfname}: $*"
+		echo -e "${creeol}[${red}ERROR ${default}] ${commandaction} ${selfname}: $*"
 	else
-		echo -en "${creeol}[${red}ERROR ${default}] $*"
+		echo -e "${creeol}[${red}ERROR ${default}] $*"
 	fi
 	fn_sleep_time
 	echo -en "\n"
@@ -209,9 +209,9 @@ fn_print_warn(){
 
 fn_print_warn_nl(){
 	if [ "${commandaction}" ]; then
-		echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
+		echo -e "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
 	else
-		echo -en "${creeol}[${lightyellow} WARN ${default}] $*"
+		echo -e "${creeol}[${lightyellow} WARN ${default}] $*"
 	fi
 	fn_sleep_time
 	echo -en "\n"
@@ -229,9 +229,9 @@ fn_print_info(){
 
 fn_print_info_nl(){
 	if [ "${commandaction}" ]; then
-		echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*"
+		echo -e "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*"
 	else
-		echo -en "${creeol}[${cyan} INFO ${default}] $*"
+		echo -e "${creeol}[${cyan} INFO ${default}] $*"
 	fi
 	fn_sleep_time
 	echo -en "\n"