source: bootscripts/lfs/init.d/console@ 5bc19fc

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 5bc19fc was 0cda898, checked in by Bruce Dubbs <bdubbs@…>, 13 years ago

Rewrite bootscripts and Chaper 7

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9574 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 3.1 KB
Line 
1#!/bin/sh
2########################################################################
3# Begin console
4#
5# Description : Sets keymap and screen font
6#
7# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
8# Alexander E. Patrakov
9# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
10#
11# Version : LFS 7.0
12#
13########################################################################
14
15. /lib/boot/functions
16
17### BEGIN INIT INFO
18# Provides: console
19# Required-Start:
20# Should-Start: $local_fs
21# Required-Stop:
22# Should-Stop:
23# Default-Start: S
24# Default-Stop:
25# Short-Description: Sets up a localised console.
26# Description: Sets up fonts and language settings for the user's
27# local as defined by /etc/sysconfig/console.
28# X-LFS-Provided-By: LFS
29### END INIT INFO
30
31# Native English speakers probably don't have /etc/sysconfig/console at all
32if [ -r /etc/sysconfig/console ]; then
33 . /etc/sysconfig/console
34else
35 exit 0
36fi
37
38is_true() {
39 [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
40}
41
42failed=0
43
44case "${1}" in
45 start)
46 boot_mesg "Setting up Linux console..."
47 # There should be no bogus failures below this line!
48
49 # Figure out if a framebuffer console is used
50 [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0
51
52 # Figure out the command to set the console into the
53 # desired mode
54 is_true "${UNICODE}" &&
55 MODE_COMMAND="${ECHO} -en '\033%G' && kbd_mode -u" ||
56 MODE_COMMAND="${ECHO} -en '\033%@\033(K' && kbd_mode -a"
57
58 # On framebuffer consoles, font has to be set for each vt in
59 # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
60
61 ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
62 MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
63
64 # Apply that command to all consoles mentioned in
65 # /etc/inittab. Important: in the UTF-8 mode this should
66 # happen before setfont, otherwise a kernel bug will
67 # show up and the unicode map of the font will not be
68 # used.
69 # FIXME: Fedora Core also initializes two spare consoles
70 # - do we want that?
71
72 for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
73 grep -o '\btty[[:digit:]]*\b'`
74 do
75 openvt -f -w -c ${TTY#tty} -- \
76 /bin/sh -c "${MODE_COMMAND}" || failed=1
77 done
78
79 # Set the font (if not already set above) and the keymap
80 is_true "${USE_FB}" || [ -z "${FONT}" ] ||
81 setfont $FONT ||
82 failed=1
83 [ -z "${KEYMAP}" ] ||
84 loadkeys ${KEYMAP} >/dev/null 2>&1 ||
85 failed=1
86 [ -z "${KEYMAP_CORRECTIONS}" ] ||
87 loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 ||
88 failed=1
89
90 # Convert the keymap from $LEGACY_CHARSET to UTF-8
91 [ -z "$LEGACY_CHARSET" ] ||
92 dumpkeys -c "$LEGACY_CHARSET" |
93 loadkeys -u >/dev/null 2>&1 ||
94 failed=1
95
96 # If any of the commands above failed, the trap at the
97 # top would set $failed to 1
98 ( exit $failed )
99 evaluate_retval
100 ;;
101 *)
102 echo $"Usage:" "${0} {start}"
103 exit 1
104 ;;
105esac
106
107# End console
Note: See TracBrowser for help on using the repository browser.