]> git.pld-linux.org Git - projects/rc-scripts.git/blobdiff - setsysfont
drop raidutils (raidstart, /etc/raidtab) support. our geninitrd doesn't support it...
[projects/rc-scripts.git] / setsysfont
index a0240022593f4340e4e29cb4bda55a9e4accefe8..7d3a1bd7be3f231e5cfbd8c76b3b5756ef66479f 100755 (executable)
@@ -1,18 +1,52 @@
-#!/bin/bash
+#!/bin/sh
+#
+#      $Id$
+#
 
-if [ -f /etc/sysconfig/i18n ]; then
-  . /etc/sysconfig/i18n
+[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
+[ -f /etc/sysconfig/console ] && . /etc/sysconfig/console
+
+[ -n "$SYSFONT" ] && CONSOLEFONT="$SYSFONT"
+
+
+charmap=
+# /usr might not be mounted
+if [ -x /usr/bin/locale ]; then
+       charmap=$(LANG="$LANG" locale charmap)
 fi
 
-if [ -x /usr/bin/consolechars ]; then
-  if [ -n "$SYSFONT" ]; then
-  /usr/bin/consolechars -f $SYSFONT
-  fi
-elif [ -x /usr/bin/setfont ]; then
-  if [ -n "$SYSFONT" ]; then
-    /usr/bin/setfont $SYSFONT
-  fi
-else
-  echo "can't set font"
-  exit 1
+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
+       if [ -n "$CONSOLEFONT" ]; then
+               consolechars --acm ${CONSOLEMAP:-trivial.trans} --font $CONSOLEFONT
+       fi
+       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
+               ARGS="-u $CONSOLESCREENFONTMAP"
+       fi
+       if [ -n "$CONSOLEMAP" ]; then
+               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
+       fi
+fi
+
+exit 0
This page took 0.06627 seconds and 4 git commands to generate.