]> git.pld-linux.org Git - packages/kbd.git/blob - kbd.init
922892c7c28537c682d017f0899d2c6fb29b2440
[packages/kbd.git] / kbd.init
1 #!/bin/sh
2
3 # console       Loads console font and keyboard table
4 #
5 # chkconfig:    345 70 30
6 #
7 # description:  Loads the console font, the application-charset map \
8 #               and the keyboard table.
9
10 # This must be executed *after* /usr is mounted.
11 # This means, if /usr is NFS-mounted it needs to
12 # be run after networking and NFS mounts are up.
13
14 [ -f /etc/sysconfig/console ] || exit 0
15
16 [ -f /bin/loadkeys ] || exit 0
17 [ -f /usr/bin/setfont ] || exit 0
18
19 # Source function library
20 . /etc/rc.d/init.d/functions
21
22 FB=
23
24 case "$1" in
25         start|restart)
26                 . /etc/sysconfig/console
27
28                 # Checking if we have framebuffer enabled
29                 if [ -f /proc/fb ]; then
30                         # /proc shows as files with size=0, this is workaround
31                         if cat /proc/fb | grep -q "."; then FB=yes; fi
32                 fi
33                         
34                 if [ -n "$SVGATEXTMODE" ]
35                 then
36                         run_cmd "Setting Text Mode $SVGATEXTMODE" SVGATextMode $SVGATEXTMODE
37                 fi
38                 if [ -n "$CONSOLEFONT" ]
39                 then
40                         CMD="/usr/bin/setfont -m ${CONSOLEMAP:-trivial} $CONSOLEFONT"
41                         show "Loading console font and map"; busy
42                         if [ ! -z $FB ]; then                   
43                                 # Check for devfs (workaround: -a option don't work at all)
44                                 if [ -d /dev/vc ]; then
45                                         pattern="s/\/dev\/vc\///g"
46                                 else
47                                         pattern="s/\/dev\/tty//g"
48                                 fi
49                                 
50                                 tty=`/usr/bin/tty | sed $pattern`
51                                 for a in $SET_FONT_TERMINALS; do
52                                         /usr/bin/open -c $a -s -w -- $CMD
53                                 done
54                                 
55                                 if [ $tty = "/dev/console" ]; then tty=1; fi
56                                 /usr/bin/switchto $tty
57                         else
58                                 $CMD
59                         fi
60                         ok
61                 fi
62                 if [ -n "$KEYTABLE" ]
63                 then
64                         run_cmd "Loading keyboard table" loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0
65                 fi
66                 echo "Enabling SAK sequence"
67                 echo Control Alt keycode 101 = SAK | loadkeys
68                 ;;
69         stop)
70                 # Nothing to stop
71                 ;;
72         status)
73                 # Nothing to report
74                 ;;
75         *)
76                 msg_usage "$0 {start|stop|status|restart}"
77                 exit 1
78 esac
79
80 exit 0
This page took 0.033842 seconds and 3 git commands to generate.