Previous Page | Next Page

  1. Introduction
  2. Boot Process
  3. Init and System Initialization
  4. rc.sysinit script
  5. rc script
  6. functions script
  7. Services
  8. apm daemon
  9. network startup
  10. The network script file
  11. The network-functions file
  12. Portmap startup
  13. Random initialization
  14. Syslog initialization
  15. Gated
  16. Atd
  17. cron initialization
  18. pcmcia
  19. inetd daemon
  20. named daemon
  21. lpd daemon
  22. mars-nwe
  23. netfs startup
  24. dhcpd daemon
  25. autofs daemon
  26. keytable daemon
  27. sendmail daemon
  28. gpm daemon
  29. httpd daemon
  30. xfs startup
  31. smb startup
  32. innd startup
  33. linuxconf startup
  34. rc.local script
  35. Init, Getty, Login
  36. The shell
  37. Shutting down
  38. X
  39. Conclusions
  40. App A. rc.sysinit listing
  41. App B. functions listing
  42. App C. rc listing
  43. Credits

Linux keytable

This script is used to load the appropriate keymap in the system according to the /etc/sysconfig/keyboard file. This script also loads the system font with the /sbin/setsysfont script. The setsysfont script uses the contents of the file /etc/sysconfig/i18n. These scripts do not run any daemon programs. My /etc/sysconfig/keyboard file:

KEYTABLE="us"

My /etc/sysconfig/i18n file:

LANG="en_US"
LC_ALL="en_US"
LINGUAS="en_US"

The /sbin/setsysfont script

#!/bin/sh

PATH=/bin:/usr/bin

if [ -f /etc/sysconfig/i18n ]; then
  . /etc/sysconfig/i18n
fi

if [ -x /bin/consolechars -o -x /usr/bin/consolechars ]; then
  if [ -n "$SYSFONT" ]; then
    ARGS=$SYSFONT
    if [ -n "$UNIMAP" ]; then
       ARGS="$ARGS --sfm $UNIMAP"
    fi
    if [ -n "$SYSFONTACM" ]; then
       ARGS="$ARGS --acm $SYSFONTACM"
    fi
    consolechars -f $ARGS
  fi
elif [ -x /usr/bin/setfont ]; then
  if [ -n "$SYSFONT" -a -n "$UNIMAP" ]; then
    /usr/bin/setfont $SYSFONT -u $UNIMAP
  elif [ -n "$SYSFONT" ]; then
    /usr/bin/setfont $SYSFONT
#  else
#    /usr/bin/setfont
  fi
else
  echo "can't set font"
  exit 1
fi
exit 0

The keytable startup script

#!/bin/sh
#
# Load keytable
#
# This must be executed *after* /usr is mounted.
# This means if /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

RETVAL=$?

case "$1" in
	start)
		# Load the proper keymap
		echo -n "Loading keymap: "
		. /etc/sysconfig/keyboard
		if [ "${KEYTABLE:-bogus}" != "bogus" ]; then
		# Specify VT0 in case we use a serial console
			loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0
			RETVAL=$?
		fi
		if [ -x /sbin/setsysfont ]; then
			echo -n "Loading system font: "
			/sbin/setsysfont
		fi
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/keytable
		;;
	stop)
		rm -f /var/lock/subsys/keytable
		;;
	restart|reload)
		$0 start
		RETVAL=$?
		;;
	status)
		echo "No status available for this package"
		exit 0
		;;
	*)
		echo "Usage: keytable {start|stop|restart|reload|status}"
		exit 1
esac

exit $RETVAL