3
# Provides: console-screen
4
# Required-Start: $local_fs $remote_fs
8
# Description: Set console screen modes and fonts
9
# Short-Description: Prepare console
12
# This is the boot script for the `kbd' package.
13
# It loads parameters from /etc/kbd/config and maybe loads
14
# default font and map.
15
# (c) 1997 Yann Dirson
17
# If setupcon is present, then we've been superseded by console-setup.
18
if type setupcon >/dev/null 2>&1; then
23
if [ -r /etc/$PKG/config ]; then
27
if [ -d /etc/$PKG/config.d ]; then
28
for i in `run-parts --list /etc/$PKG/config.d `; do
33
# do some magic with the variables for compatibility with the config
34
# file of console-tools
35
for vc in '' `set | grep "^.*_vc[0-9][0-9]*=" | sed 's/^.*\(_vc[0-9][0-9]*\)=.*/\1/'`
37
eval [ \"\${SCREEN_FONT$vc}\" ] && eval CONSOLE_FONT$vc=\${CONSOLE_FONT$vc:-\${SCREEN_FONT$vc}}
38
eval [ \"\${SCREEN_FONT_MAP$vc}\" ] && eval FONT_MAP$vc=\${FONT_MAP$vc:-\${SCREEN_FONT_MAP$vc}}
39
eval [ \"\${APP_CHARSET_MAP$vc}\" ] && eval CONSOLE_MAP$vc=\${CONSOLE_MAP$vc:-\${APP_CHARSET_MAP$vc}}
42
. /lib/lsb/init-functions
44
PATH=/sbin:/bin:/usr/sbin:/usr/bin
47
if which setupcon >/dev/null
52
# set DEVICE_PREFIX depending on devfs/udev
53
if [ -d /dev/vc ]; then
54
DEVICE_PREFIX="/dev/vc/"
56
DEVICE_PREFIX="/dev/tty"
59
# determine the system charmap
61
[ -r /etc/environment ] && ENV_FILE="/etc/environment"
62
[ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale"
63
[ "$ENV_FILE" ] && CHARMAP=$(set -a && . "$ENV_FILE" && locale charmap)
64
if [ "$CHARMAP" = "UTF-8" -a -z "$CONSOLE_MAP" ]
71
if [ -f /proc/fb ]; then
72
# They have a framebuffer device.
73
# That means we have work to do...
81
if [ -n "$UNICODE_MODE" -a -z "`eval echo \\$CONSOLE_MAP_vc$vc`" ]; then
86
if [ "${CONSOLE_FONT}" ]; then
87
$action "${CONSOLE_FONT}" < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
89
$action < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
95
# be sure the main program is installed
96
which setfont >/dev/null || return
99
# If we can't access the console, quit
100
CONSOLE_TYPE=`fgconsole 2>/dev/null` || return
102
if [ ! $CONSOLE_TYPE = "serial" ]; then
103
readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console
104
if [ $? -eq 0 ]; then
110
[ $VT = "no" ] && return
113
if [ "${DO_VCSTIME}" = "yes" ] && which vcstime >/dev/null; then
114
# Different device name for 2.6 kernels and devfs
115
if [ `uname -r | cut -f 2 -d .` = 6 ] && [ -e /dev/.devfsd ]; then
116
VCSTIME_OPT="-2 /dev/vcsa0"
120
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Starting clock on text console"
121
vcstime ${VCSTIME_OPT} &
122
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
125
LIST_CONSOLES=`sed -e '/^ *#/d' /etc/inittab | grep -e '\<tty[0-9]*\>' | awk -F: '{printf "%s ", $1}'`
127
# Global default font+map
128
if [ -z "${HAVE_SETUPCON}" -a "${CONSOLE_FONT}" ]; then
129
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up general console font"
130
sfm="${FONT_MAP}" && [ "$sfm" ] && sfm="-u $sfm"
131
acm="${CONSOLE_MAP}" && [ "$acm" ] && acm="-m $acm"
133
# Set for the first 6 VCs (as they are allocated in /etc/inittab)
134
for vc in $LIST_CONSOLES
136
if ! ( unicode_start_stop $vc \
137
&& setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm ${CONSOLE_FONT} $acm )
139
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
143
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
146
# Default to Unicode mode for new VTs?
147
if [ -f /sys/module/vt/parameters/default_utf8 ]; then
148
if [ -n "$UNICODE_MODE" ]; then
152
fi > /sys/module/vt/parameters/default_utf8
156
PERVC_FONTS="`set | grep "^CONSOLE_FONT_vc[0-9]*=" | tr -d \' `"
157
if [ -z "${HAVE_SETUPCON}" -a "${PERVC_FONTS}" ]; then
158
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC fonts"
159
for font in ${PERVC_FONTS}
161
# extract VC and FONTNAME info from variable setting
162
vc=`echo $font | cut -b16- | cut -d= -f1`
163
eval font=\$CONSOLE_FONT_vc$vc
164
# eventually find an associated SFM
165
eval sfm=\${FONT_MAP_vc${vc}}
166
[ "$sfm" ] && sfm="-u $sfm"
167
if ! ( unicode_start_stop $vc \
168
&& setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm $font )
170
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
174
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
179
PERVC_ACMS="`set | grep "^CONSOLE_MAP_vc[0-9]*=" | tr -d \' `"
180
if [ -z "${HAVE_SETUPCON}" -a "${PERVC_ACMS}" ]; then
181
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC ACM's"
182
for acm in ${PERVC_ACMS}
184
# extract VC and ACM_FONTNAME info from variable setting
185
vc=`echo $acm | cut -b15- | cut -d= -f1`
186
eval acm=\$CONSOLE_MAP_vc$vc
187
if ! setfont -C "${DEVICE_PREFIX}$vc" ${SETFONT_OPT} -m "$acm"; then
188
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
192
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
198
if [ "$BLANK_TIME" ]; then
199
setterm_args="$setterm_args -blank $BLANK_TIME"
201
if [ "$BLANK_DPMS" ]; then
202
setterm_args="$setterm_args -powersave $BLANK_DPMS"
204
if [ "$POWERDOWN_TIME" ]; then
205
setterm_args="$setterm_args -powerdown $POWERDOWN_TIME"
207
if [ "$setterm_args" ]; then
208
setterm $setterm_args
211
# Keyboard rate and delay
213
if [ -n "$KEYBOARD_RATE" ]; then
214
KBDRATE_ARGS="-r $KEYBOARD_RATE"
216
if [ -n "$KEYBOARD_DELAY" ]; then
217
KBDRATE_ARGS="$KBDRATE_ARGS -d $KEYBOARD_DELAY"
219
if [ -n "$KBDRATE_ARGS" ]; then
220
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting keyboard rate and delay"
221
kbdrate -s $KBDRATE_ARGS
222
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
225
# Inform gpm if present, of potential changes.
226
if [ -f /var/run/gpm.pid ]; then
227
kill -WINCH `cat /var/run/gpm.pid` 2> /dev/null
230
# Allow user to remap keys on the console
231
if [ -z "${HAVE_SETUPCON}" -a -r /etc/$PKG/remap ]; then
232
dumpkeys < ${DEVICE_PREFIX}1 | sed -f /etc/$PKG/remap | loadkeys --quiet
236
if [ -n "$LEDS" ]; then
237
for i in $LIST_CONSOLES
239
setleds -D $LEDS < $DEVICE_PREFIX$i
245
start|reload|restart|force-reload)
246
if [ -n "$HAVE_SETUPCON" ]
248
log_action_msg "Setting console screen modes"
250
log_action_msg "Setting console screen modes and fonts"