2008-03-03 05:14:01 +08:00
|
|
|
#!@PREFIX@/sbin/runscript
|
2008-01-11 23:31:10 +08:00
|
|
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
|
|
|
# All rights reserved. Released under the 2-clause BSD license.
|
2007-11-14 23:22:04 +08:00
|
|
|
|
2007-07-11 03:09:41 +08:00
|
|
|
description="Sets a font for the consoles."
|
|
|
|
|
2008-01-11 20:13:46 +08:00
|
|
|
depend()
|
|
|
|
{
|
2008-03-27 21:49:49 +08:00
|
|
|
need localmount termencoding
|
2007-04-05 19:18:42 +08:00
|
|
|
after hotplug
|
2008-03-04 01:19:56 +08:00
|
|
|
keyword noopenvz noprefix nouml novserver noxenu
|
2007-04-05 19:18:42 +08:00
|
|
|
}
|
|
|
|
|
2008-01-11 20:13:46 +08:00
|
|
|
start()
|
|
|
|
{
|
2007-04-05 19:18:42 +08:00
|
|
|
# Forget about any font until we are successful
|
|
|
|
rm -rf "${RC_LIBDIR}"/console
|
|
|
|
|
2007-11-24 06:23:20 +08:00
|
|
|
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
|
|
|
consolefont=${consolefont:-${CONSOLEFONT}}
|
|
|
|
unicodemap=${unicodemap:-${UNICODEMAP}}
|
|
|
|
consoletranslation=${consoletranslation:-${CONSOLETRANSLATION}}
|
|
|
|
|
|
|
|
if [ -z "${consolefont}" ]; then
|
|
|
|
ebegin "Using the default console font"
|
2007-04-05 19:18:42 +08:00
|
|
|
eend 0
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2007-11-24 06:23:20 +08:00
|
|
|
if [ "${ttyn}" = 0 ]; then
|
2007-12-14 22:12:38 +08:00
|
|
|
ebegin "Skipping font setup (rc_tty_number == 0)"
|
2007-09-25 23:55:47 +08:00
|
|
|
eend 0
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2008-03-27 21:49:49 +08:00
|
|
|
local x= param= sf_param= retval=0 ttydev=/dev/tty
|
2007-04-05 19:18:42 +08:00
|
|
|
|
|
|
|
# Get additional parameters
|
2007-11-24 06:23:20 +08:00
|
|
|
if [ -n "${consoletranslation}" ]; then
|
|
|
|
param="${param} -m ${consoletranslation}"
|
2007-04-05 19:18:42 +08:00
|
|
|
fi
|
2007-11-24 06:23:20 +08:00
|
|
|
if [ -n "${unicodemap}" ]; then
|
|
|
|
param="${param} -u ${unicodemap}"
|
2007-04-05 19:18:42 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Set the console font
|
2008-03-27 22:03:37 +08:00
|
|
|
ebegin "Setting console font [${consolefont}]"
|
2008-03-27 21:49:49 +08:00
|
|
|
[ -d /dev/vc ] && ttydev=/dev/vc/
|
2007-12-14 22:12:38 +08:00
|
|
|
x=1
|
|
|
|
while [ ${x} -le ${ttyn} ]; do
|
2007-12-15 04:09:53 +08:00
|
|
|
setfont ${consolefont} ${param} -C ${ttydev}${x} >/dev/null
|
2007-12-14 22:12:38 +08:00
|
|
|
retval=$((${retval} + $?))
|
|
|
|
x=$((${x} + 1))
|
|
|
|
done
|
|
|
|
eend ${retval}
|
2007-04-05 19:18:42 +08:00
|
|
|
|
|
|
|
# Store the last font so we can use it ASAP on boot
|
2007-11-24 06:23:20 +08:00
|
|
|
if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ]; then
|
2007-04-05 19:18:42 +08:00
|
|
|
mkdir -p "${RC_LIBDIR}"/console
|
2008-01-11 20:13:46 +08:00
|
|
|
for font in /usr/share/consolefonts/"${consolefont}".*; do
|
|
|
|
:
|
2008-03-23 20:24:15 +08:00
|
|
|
done
|
2007-04-26 16:02:21 +08:00
|
|
|
cp "${font}" "${RC_LIBDIR}"/console
|
2008-01-07 05:51:30 +08:00
|
|
|
echo "${font##*/}" > "${RC_LIBDIR}"/console/font
|
2007-11-28 23:45:03 +08:00
|
|
|
if yesno ${unicode:-${UNICODE}}; then
|
2008-03-27 21:49:49 +08:00
|
|
|
echo "" > "${RC_LIBDIR}"/console/unicode
|
2007-04-17 17:32:18 +08:00
|
|
|
else
|
|
|
|
rm -f "${RC_LIBDIR}"/console/unicode
|
|
|
|
fi
|
2008-03-27 21:49:49 +08:00
|
|
|
|
2007-04-05 19:18:42 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
return ${retval}
|
|
|
|
}
|