/[baselayout]/trunk/init.d.Linux/consolefont
Gentoo

Contents of /trunk/init.d.Linux/consolefont

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2775 - (show annotations) (download)
Fri Jul 13 00:04:20 2007 UTC (7 years, 2 months ago) by uberlord
File size: 2078 byte(s)
Use echo instead of touch - saves on forking
1 #!/sbin/runscript
2 # Copyright 1999-2007 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 description="Sets a font for the consoles."
6
7 depend() {
8 need localmount
9 need keymaps # sets up terminal encoding scheme
10 after hotplug
11 }
12
13 start() {
14 # Forget about any font until we are successful
15 rm -rf "${RC_LIBDIR}"/console
16
17 case "${RC_SYS}" in
18 UML|VPS|XEN) return 0 ;;
19 esac
20
21 if [ -z "${CONSOLEFONT}" ] ; then
22 ebegin $"Using the default console font"
23 eend 0
24 return 0
25 fi
26
27 local x= param= sf_param= retval=1
28
29 # Get additional parameters
30 if [ -n "${CONSOLETRANSLATION}" ] ; then
31 param="${param} -m ${CONSOLETRANSLATION}"
32 fi
33 if [ -n "${UNICODEMAP}" ] ; then
34 param="${param} -u ${UNICODEMAP}"
35 fi
36
37 # Set the console font
38 local errmsg=
39 ebegin "Setting user font"
40 if [ -x /bin/setfont ] ; then
41 # We patched setfont to have --tty support ...
42 if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] || \
43 [ -n "$(setfont --help 2>&1 | grep -e '-C')" ]
44 then
45 if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] ; then
46 sf_param="--tty="
47 else
48 sf_param="-C "
49 fi
50 local ttydev=
51 [ -d /dev/vc ] \
52 && ttydev=/dev/vc/ \
53 || ttydev=/dev/tty
54
55 x=1
56 while [ ${x} -le "${RC_TTY_NUMBER}" ] ; do
57 /bin/setfont ${CONSOLEFONT} ${param} \
58 ${sf_param}/${ttydev}${x} > /dev/null
59 retval=$?
60 x=$((${x} + 1))
61 done
62 else
63 /bin/setfont ${CONSOLEFONT} ${param} > /dev/null
64 retval=$?
65 fi
66 errmsg="Failed to set user font"
67 else
68 retval=1
69 errmsg="/bin/setfont not found"
70 fi
71 eend ${retval} "${errmsg}"
72
73 # Store the last font so we can use it ASAP on boot
74 if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ] ; then
75 mkdir -p "${RC_LIBDIR}"/console
76
77 for font in /usr/share/consolefonts/"${CONSOLEFONT}".* ; do : ; done
78 cp "${font}" "${RC_LIBDIR}"/console
79 echo "$(basename "${font}")" > "${RC_LIBDIR}"/console/font
80 if [ "${UNICODE}" = "yes" ] ; then
81 echo > "${RC_LIBDIR}"/console/unicode
82 else
83 rm -f "${RC_LIBDIR}"/console/unicode
84 fi
85 fi
86
87 return ${retval}
88 }
89
90 # vim: set ts=4 :

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20