source: bootscripts/lfs/init.d/console@ 17c6532

11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 bdubbs/gcc13 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng 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 17c6532 was 17c6532, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

Do not redefine is_true in the console script

There is a better version in init-functions

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[1c48007]1#!/bin/sh
2########################################################################
[0cda898]3# Begin console
[1c48007]4#
5# Description : Sets keymap and screen font
6#
7# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
[0cda898]8# Alexander E. Patrakov
[f874424]9# DJ Lucas - dj@linuxfromscratch.org
[0cda898]10# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
[1c48007]11#
[0cda898]12# Version : LFS 7.0
[1c48007]13#
14########################################################################
15
[0cda898]16### BEGIN INIT INFO
17# Provides: console
[6903d5e]18# Required-Start: $local_fs
[66dfc3e]19# Should-Start: udev_retry
[0cda898]20# Required-Stop:
21# Should-Stop:
22# Default-Start: S
23# Default-Stop:
24# Short-Description: Sets up a localised console.
25# Description: Sets up fonts and language settings for the user's
26# local as defined by /etc/sysconfig/console.
27# X-LFS-Provided-By: LFS
28### END INIT INFO
[1c48007]29
[f874424]30. /lib/lsb/init-functions
31
[1c48007]32# Native English speakers probably don't have /etc/sysconfig/console at all
[f874424]33[ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
[1c48007]34
35failed=0
36
37case "${1}" in
[0cda898]38 start)
[17698aa]39 # See if we need to do anything
40 if [ -z "${KEYMAP}" ] && [ -z "${KEYMAP_CORRECTIONS}" ] &&
[a44ae577]41 [ -z "${FONT}" ] && [ -z "${LEGACY_CHARSET}" ] &&
42 ! is_true "${UNICODE}"; then
[17698aa]43 exit 0
44 fi
45
[0cda898]46 # There should be no bogus failures below this line!
[f874424]47 log_info_msg "Setting up Linux console..."
[0cda898]48
49 # Figure out if a framebuffer console is used
[f874424]50 [ -d /sys/class/graphics/fb0 ] && use_fb=1 || use_fb=0
[0cda898]51
52 # Figure out the command to set the console into the
53 # desired mode
54 is_true "${UNICODE}" &&
[f874424]55 MODE_COMMAND="echo -en '\033%G' && kbd_mode -u" ||
56 MODE_COMMAND="echo -en '\033%@\033(K' && kbd_mode -a"
[0cda898]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
[f874424]61 ! is_true "${use_fb}" || [ -z "${FONT}" ] ||
[0cda898]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
70 for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
71 grep -o '\btty[[:digit:]]*\b'`
72 do
73 openvt -f -w -c ${TTY#tty} -- \
74 /bin/sh -c "${MODE_COMMAND}" || failed=1
75 done
76
77 # Set the font (if not already set above) and the keymap
[620c6d0]78 [ "${use_fb}" == "1" ] || [ -z "${FONT}" ] || setfont $FONT || failed=1
[f874424]79
[0cda898]80 [ -z "${KEYMAP}" ] ||
81 loadkeys ${KEYMAP} >/dev/null 2>&1 ||
82 failed=1
[a44ae577]83
[0cda898]84 [ -z "${KEYMAP_CORRECTIONS}" ] ||
85 loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 ||
86 failed=1
87
88 # Convert the keymap from $LEGACY_CHARSET to UTF-8
89 [ -z "$LEGACY_CHARSET" ] ||
[f874424]90 dumpkeys -c "$LEGACY_CHARSET" | loadkeys -u >/dev/null 2>&1 ||
[0cda898]91 failed=1
92
93 # If any of the commands above failed, the trap at the
94 # top would set $failed to 1
[a44ae577]95 ( exit $failed )
[0cda898]96 evaluate_retval
[f874424]97
98 exit $failed
[a44ae577]99 ;;
[f874424]100
[a44ae577]101 *)
[17698aa]102 echo "Usage: ${0} {start}"
[a44ae577]103 exit 1
104 ;;
[1c48007]105esac
106
[0cda898]107# End console
Note: See TracBrowser for help on using the repository browser.