]> git.pld-linux.org Git - projects/rc-scripts.git/blobdiff - setsysfont
update comment for kernel.sysrq
[projects/rc-scripts.git] / setsysfont
index d059a3a60057685710a1ff9823d90fc9ecade75f..e4f96ab064f0b1485e3c3987e64a89f54ace0b3f 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh
 #
-#      $Id$
 #
 
 [ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
@@ -8,13 +7,20 @@
 
 [ -n "$SYSFONT" ] && CONSOLEFONT="$SYSFONT"
 
-case "$LANG" in
-    *.utf8|*.UTF-8)
-    if [ -x /bin/unicode_start ] && /sbin/consoletype fg ; then
-       exec unicode_start $CONSOLEFONT $CONSOLEMAP
-    fi
-    ;;
-esac
+
+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
+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
@@ -24,25 +30,22 @@ if [ -x /usr/bin/consolechars -o -x /bin/consolechars ]; then
        if [ -n "$KEYTABLE" ]; then
                loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0
        fi
-
-
 # kbd, currently used
 elif [ -x /usr/bin/setfont -o -x /bin/setfont ]; then
-       if [ -n "$CONSOLESCREENFONTMAP" ]; then
+       if [ -n "$CONSOLESCREENFONTMAP" ]; then
                ARGS="-u $CONSOLESCREENFONTMAP"
        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")
+               if [ ! -f /lib/kbd/consoletrans/${CONSOLEMAP}_to_uni.trans ]; then
+                       CONSOLEMAP=$(echo "$CONSOLEMAP" | awk '{ gsub(/iso[0]?/,"8859-"); print $0; }')
                fi
                ARGS="$ARGS -m $CONSOLEMAP"
        fi
        if [ -n "$CONSOLEFONT" ]; then
                setfont $CONSOLEFONT $ARGS
        else
-               echo -ne "\033(K" 2>/dev/null > /proc/$$/fd/0
+               echo -ne "\033(K" 2>/dev/null > /proc/$$/fd/0
        fi
-else
-       echo "can't set font"
-       exit 1
 fi
+
+exit 0
This page took 0.463321 seconds and 4 git commands to generate.