]> git.pld-linux.org Git - projects/rc-scripts.git/blobdiff - setsysfont
rc.sysinit: move /proc/cmdline parsing to single function
[projects/rc-scripts.git] / setsysfont
index 2d6860358cdb424b425be497221da11490d68d73..7d3a1bd7be3f231e5cfbd8c76b3b5756ef66479f 100755 (executable)
@@ -8,13 +8,20 @@
 
 [ -n "$SYSFONT" ] && CONSOLEFONT="$SYSFONT"
 
-case "$LANG" in
-  *.utf8|*.UTF-8)
-       if [ -x /bin/unicode_start ] && /sbin/consoletype fg ; then
+
+charmap=
+# /usr might not be mounted
+if [ -x /usr/bin/locale ]; then
+       charmap=$(LANG="$LANG" locale charmap)
+fi
+
+if [ "$charmap" = "UTF-8" ]; then
+       if [ -x /bin/unicode_start ] && /sbin/consoletype fg; then
                exec unicode_start $CONSOLEFONT $CONSOLEMAP
        fi
-       ;;
-esac
+elif [ -x /bin/unicode_stop ] && /sbin/consoletype fg; then
+       unicode_stop
+fi
 
 # console-tools, obsolete part
 if [ -x /usr/bin/consolechars -o -x /bin/consolechars ]; then
@@ -31,7 +38,7 @@ elif [ -x /usr/bin/setfont -o -x /bin/setfont ]; then
        fi
        if [ -n "$CONSOLEMAP" ]; then
                if [ ! -f /lib/kbd/consoletrans/${CONSOLEMAP}_to_uni.trans ]; then
-                       CONSOLEMAP=$(echo "$CONSOLEMAP" | sed "s|iso0|8859-|g;s|iso|8859-|g")
+                       CONSOLEMAP=$(echo "$CONSOLEMAP" | awk '{ gsub(/iso[0]?/,"8859-"); print $0; }')
                fi
                ARGS="$ARGS -m $CONSOLEMAP"
        fi
@@ -43,6 +50,3 @@ elif [ -x /usr/bin/setfont -o -x /bin/setfont ]; then
 fi
 
 exit 0
-
-# This must be last line !
-# vi:syntax=sh
This page took 0.029327 seconds and 4 git commands to generate.