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