[arch-general] [PATCH 09/48] If $CONSOLEFONT is not declared, then just return out of set_consolefont.

Victor Lowther victor.lowther at gmail.com
Wed Jun 30 17:47:42 EDT 2010


We do this early so that the entire body of the function is not in an if block.
---
 functions |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/functions b/functions
index d9f55fa..f954737 100644
--- a/functions
+++ b/functions
@@ -257,27 +257,26 @@ declare -r add_hook run_hook
 
 # Function for setting console font if required
 set_consolefont() {
-    if [ -n "$CONSOLEFONT" ]; then
-	stat_busy "Loading Console Font: $CONSOLEFONT"
-	#CONSOLEMAP in UTF-8 shouldn't be used
-	if [ -n "$CONSOLEMAP" ] && echo "$LOCALE" | /bin/grep -qi utf ; then
-		CONSOLEMAP=""
-	fi
-	for i in /dev/tty[0-9]*; do
-		if [ -n "$CONSOLEMAP" ]; then
-			/usr/bin/setfont -m $CONSOLEMAP $CONSOLEFONT -C ${i} >/dev/null 2>&1
-		else
-			/usr/bin/setfont $CONSOLEFONT -C ${i} >/dev/null 2>&1
-		fi
-	done
-	if [ $? -ne 0 ]; then
-		stat_fail
+    [[ $CONSOLEFONT ]] || return 0
+    stat_busy "Loading Console Font: $CONSOLEFONT"
+    #CONSOLEMAP in UTF-8 shouldn't be used
+    if [ -n "$CONSOLEMAP" ] && echo "$LOCALE" | /bin/grep -qi utf ; then
+	CONSOLEMAP=""
+    fi
+    for i in /dev/tty[0-9]*; do
+	if [ -n "$CONSOLEMAP" ]; then
+	    /usr/bin/setfont -m $CONSOLEMAP $CONSOLEFONT -C ${i} >/dev/null 2>&1
 	else
-		if [ -n "$CONSOLEMAP" ]; then
-			echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033(K"; fi' >>/etc/profile.d/locale.sh
-		fi
-		stat_done
+	    /usr/bin/setfont $CONSOLEFONT -C ${i} >/dev/null 2>&1
+	fi
+    done
+    if [ $? -ne 0 ]; then
+	stat_fail
+    else
+	if [ -n "$CONSOLEMAP" ]; then
+	    echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033(K"; fi' >>/etc/profile.d/locale.sh
 	fi
+	stat_done
     fi
 }
 
-- 
1.7.1



More information about the arch-general mailing list