2013-12-21 14:51:11 -06:00
|
|
|
#!@SBINDIR@/openrc-run
|
2015-12-04 16:52:19 -06:00
|
|
|
# Copyright (c) 2007-2015 The OpenRC Authors.
|
|
|
|
# See the Authors file at the top-level directory of this distribution and
|
2021-12-20 20:07:00 -05:00
|
|
|
# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
|
2015-12-04 16:52:19 -06:00
|
|
|
#
|
|
|
|
# This file is part of OpenRC. It is subject to the license terms in
|
|
|
|
# the LICENSE file found in the top-level directory of this
|
2021-12-20 20:07:00 -05:00
|
|
|
# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
|
2015-12-04 16:52:19 -06:00
|
|
|
# This file may not be copied, modified, propagated, or distributed
|
|
|
|
# except according to the terms contained in the LICENSE file.
|
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()
|
|
|
|
{
|
2018-05-07 18:12:55 -05:00
|
|
|
need termencoding
|
2015-10-29 11:27:27 -05:00
|
|
|
after hotplug bootmisc modules
|
2016-07-31 13:01:17 -05:00
|
|
|
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
|
2007-04-05 11:18:42 +00:00
|
|
|
}
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
start()
|
|
|
|
{
|
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}}
|
|
|
|
|
2009-04-27 07:51:18 +00:00
|
|
|
if [ -z "$consolefont" ]; then
|
2007-11-23 22:23:20 +00:00
|
|
|
ebegin "Using the default console font"
|
2007-04-05 11:18:42 +00:00
|
|
|
eend 0
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2009-04-27 07:51:18 +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
|
2009-04-27 07:51:18 +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
|
2009-04-27 07:51:18 +00:00
|
|
|
param="$param -u $unicodemap"
|
2007-04-05 11:18:42 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Set the console font
|
2009-04-27 07:51:18 +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
|
2009-04-27 07:51:18 +00:00
|
|
|
while [ $x -le $ttyn ]; do
|
2009-08-19 16:49:35 +01:00
|
|
|
if ! setfont $consolefont $param -C $ttydev$x >/dev/null; then
|
|
|
|
retval=1
|
|
|
|
break
|
|
|
|
fi
|
2011-11-10 21:46:08 -05:00
|
|
|
: $(( x += 1 ))
|
2007-12-14 14:12:38 +00:00
|
|
|
done
|
2009-04-27 07:51:18 +00:00
|
|
|
eend $retval
|
2007-04-05 11:18:42 +00:00
|
|
|
|
2013-02-11 22:13:27 -05:00
|
|
|
# Store the font so we can use it ASAP on boot
|
2012-01-28 19:32:05 +01:00
|
|
|
if [ $retval -eq 0 ] && checkpath -W "$RC_LIBEXECDIR"; then
|
2009-05-23 20:38:12 +01:00
|
|
|
mkdir -p "$RC_LIBEXECDIR"/console
|
2013-02-11 22:13:27 -05:00
|
|
|
setfont -O "$RC_LIBEXECDIR"/console/font
|
2007-04-05 11:18:42 +00:00
|
|
|
fi
|
|
|
|
|
2009-04-27 07:51:18 +00:00
|
|
|
return $retval
|
2007-04-05 11:18:42 +00:00
|
|
|
}
|