[arch-projects] [initscripts] [PATCH 09/13] functions: Refactor set_consolefont()

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Tue Jul 12 04:58:34 EDT 2011


Simplify conditionals a bit to make this more readable.

Make this a bit more readable and uniform.
---
 functions |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/functions b/functions
index 2bd6893..77387cb 100644
--- a/functions
+++ b/functions
@@ -506,22 +506,20 @@ set_consolefont() {
 	[[ $CONSOLEFONT ]] || return 0
 	stat_busy "Loading Console Font: $CONSOLEFONT"
 		#CONSOLEMAP in UTF-8 shouldn't be used
-		[[ $CONSOLEMAP && ${LOCALE,,} =~ utf ]] && CONSOLEMAP=""
+		[[ ${LOCALE,,} =~ utf ]] && CONSOLEMAP=""
 		local i
 		for i in /dev/tty[0-9]*; do
 			setfont ${CONSOLEMAP:+-m ${CONSOLEMAP}} \
 				$CONSOLEFONT -C ${i} &>/dev/null
 		done
 	if (( $? )); then
-		stat_fail
+		false
 	elif [[ $CONSOLEMAP ]]; then
 		cat <<"EOF" >>/etc/profile.d/locale.sh
 if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033(K"; fi
 EOF
-		stat_done
-	else
-		stat_done
 	fi
+	(( $? == 0 )) && stat_done || stat_fail
 }
 
 # Source additional functions at the end to allow overrides
-- 
1.7.1



More information about the arch-projects mailing list