]> TLD Linux GIT Repositories - rc-scripts.git/blob - setsysfont
- never try to create luks volumes, it may lead to data loss, leave it to user
[rc-scripts.git] / setsysfont
1 #!/bin/sh
2 #
3 #
4
5 [ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
6 [ -f /etc/sysconfig/console ] && . /etc/sysconfig/console
7
8 [ -n "$SYSFONT" ] && CONSOLEFONT="$SYSFONT"
9
10
11 charmap=
12 # /usr might not be mounted
13 if [ -x /usr/bin/locale ]; then
14         charmap=$(LANG="$LANG" locale charmap)
15 fi
16
17 if [ "$charmap" = "UTF-8" ]; then
18         if [ -x /bin/unicode_start ] && /sbin/consoletype fg; then
19                 exec unicode_start $CONSOLEFONT $CONSOLEMAP
20         fi
21 elif [ -x /bin/unicode_stop ] && /sbin/consoletype fg; then
22         unicode_stop
23 fi
24
25 # console-tools, obsolete part
26 if [ -x /usr/bin/consolechars -o -x /bin/consolechars ]; then
27         if [ -n "$CONSOLEFONT" ]; then
28                 consolechars --acm ${CONSOLEMAP:-trivial.trans} --font $CONSOLEFONT
29         fi
30         if [ -n "$KEYTABLE" ]; then
31                 loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0
32         fi
33 # kbd, currently used
34 elif [ -x /usr/bin/setfont -o -x /bin/setfont ]; then
35         if [ -n "$CONSOLESCREENFONTMAP" ]; then
36                 ARGS="-u $CONSOLESCREENFONTMAP"
37         fi
38         if [ -n "$CONSOLEMAP" ]; then
39                 if [ ! -f /lib/kbd/consoletrans/${CONSOLEMAP}_to_uni.trans ]; then
40                         CONSOLEMAP=$(echo "$CONSOLEMAP" | awk '{ gsub(/iso[0]?/,"8859-"); print $0; }')
41                 fi
42                 ARGS="$ARGS -m $CONSOLEMAP"
43         fi
44         if [ -n "$CONSOLEFONT" ]; then
45                 setfont $CONSOLEFONT $ARGS
46         else
47                 echo -ne "\033(K" 2>/dev/null > /proc/$$/fd/0
48         fi
49 fi
50
51 exit 0