#!/bin/sh # # Load keytable # # This must be executed *after* /usr is mounted. # This means is /usr is NFS-mounted, it needs to # run after networking and NFS mounts are up. # # chkconfig: 2345 75 05 # description: This package loads the selected keyboard map as set in \ # /etc/sysconfig/keyboard. This can be selected using the kbdconfig \ # utility. You should leave this enabled for most machines. # config: /etc/sysconfig/keyboard [ -f /etc/sysconfig/keyboard ] || exit 0 [ -f /usr/bin/loadkeys ] || exit 0 # Source function library. . /etc/rc.d/init.d/functions case "$1" in start) # Read the keyboard config . /etc/sysconfig/keyboard if [ "${KEYTABLE:-bogus}" != "bogus" ]; then if [ "`locale charmap`" = "UTF-8" ]; then case "$KEYTABLE" in *uni|*.uni.*) UNIKEYTABLE="$KEYTABLE" ;; *kmap*) UNIKEYTABLE="`echo $KEYTABLE | sed 's/.kmap/.uni.kmap/'`" ;; *) UNIKEYTABLE="${KEYTABLE}.uni" ;; esac action "Loading keymap: $UNIKEYTABLE" \ loadkeys $UNIKEYTABLE < /dev/tty0 || \ loadkeys $KEYTABLE < /dev/tty0 else # load the keyboard map action "Loading keymap: $KEYTABLE" \ loadkeys $KEYTABLE < /dev/tty0 fi fi # search the charset used if [ -z "$KBCHARSET" -a -r "$KEYTABLE" ]; then FILETOGREP="$KEYTABLE" else FILETOGREP="/usr/lib/kbd/keymaps/i386/*/$KEYTABLE*map.gz" fi if [ -z "$KBCHARSET" -a -r "$FILETOGREP" ]; then KBCHARSET=`zgrep ^charset $FILETOGREP 2> /dev/null |\ cut -d' ' -f2 | \ tr '\"' ' ' | tr -d ' '` fi if [ -z "$KBCHARSET" ]; then KBCHARSET=`echo $KEYTABLE | cut -d'-' -f2 | cut -d'.' -f1` fi # load compose definitions case $KBCHARSET in iso-8859-1) KBCHARSET=latin1;; iso-8859-2) KBCHARSET=latin2;; iso-8859-3) KBCHARSET=latin3;; iso-8859-4) KBCHARSET=latin4;; iso-8859-7) KBCHARSET=8859_7;; iso-8859-8) KBCHARSET=8859_8;; iso-8859-9*) KBCHARSET=latin5;; iso-8859-13) KBCHARSET=latin7;; iso-8859-14) KBCHARSET=latin8;; iso-8859-15) KBCHARSET=latin9;; latin0) KBCHARSET=latin9;; tcvn*) KBCHARSET=tcvn;; viscii*) KBCHARSET=viscii;; *) KBCHARSET=latin;; esac action "Loading compose keys: compose.$KBCHARSET.inc" \ loadkeys compose.${KBCHARSET}.inc if [ "$BACKSPACE" = "BackSpace" ]; then echo -n "The BackSpace key sends: ^H" loadkeys backspace.inc 2> /dev/null \ && success || failure else echo -n "The BackSpace key sends: ^?" loadkeys delete.inc 2> /dev/null \ && success || failure fi echo if [ -n "$GRP_TOGGLE" ]; then action "Loading toggle definition: $GRP_TOGGLE.inc" \ loadkeys ${GRP_TOGGLE}.inc fi touch /var/lock/subsys/keytable ;; stop) rm -f /var/lock/subsys/keytable ;; restart|reload) $0 start ;; status) echo "No status available for this package" exit 0 ;; *) echo "Usage: keytable {start|stop|restart|reload|status}" exit 1 esac exit 0