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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2922 - (show annotations) (download)
Tue Sep 25 15:55:47 2007 UTC (7 years, 3 months ago) by vapier
File size: 2225 byte(s)
Skip consolefont setup when RC_TTY_NUMBER is set to 0.
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 if [ ${RC_TTY_NUMBER} -eq 0 ] ; then
28 ebegin "Skipping font setup (RC_TTY_NUMBER == 0); you should disable this init.d"
29 eend 0
30 return 0
31 fi
32
33 local x= param= sf_param= retval=1
34
35 # Get additional parameters
36 if [ -n "${CONSOLETRANSLATION}" ] ; then
37 param="${param} -m ${CONSOLETRANSLATION}"
38 fi
39 if [ -n "${UNICODEMAP}" ] ; then
40 param="${param} -u ${UNICODEMAP}"
41 fi
42
43 # Set the console font
44 local errmsg=
45 ebegin "Setting user font"
46 if [ -x /bin/setfont ] ; then
47 # We patched setfont to have --tty support ...
48 if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] || \
49 [ -n "$(setfont --help 2>&1 | grep -e '-C')" ]
50 then
51 if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] ; then
52 sf_param="--tty="
53 else
54 sf_param="-C "
55 fi
56 local ttydev=
57 [ -d /dev/vc ] \
58 && ttydev=/dev/vc/ \
59 || ttydev=/dev/tty
60
61 x=1
62 while [ ${x} -le "${RC_TTY_NUMBER}" ] ; do
63 /bin/setfont ${CONSOLEFONT} ${param} \
64 ${sf_param}/${ttydev}${x} > /dev/null
65 retval=$?
66 x=$((${x} + 1))
67 done
68 else
69 /bin/setfont ${CONSOLEFONT} ${param} > /dev/null
70 retval=$?
71 fi
72 errmsg="Failed to set user font"
73 else
74 retval=1
75 errmsg="/bin/setfont not found"
76 fi
77 eend ${retval} "${errmsg}"
78
79 # Store the last font so we can use it ASAP on boot
80 if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ] ; then
81 mkdir -p "${RC_LIBDIR}"/console
82
83 for font in /usr/share/consolefonts/"${CONSOLEFONT}".* ; do : ; done
84 cp "${font}" "${RC_LIBDIR}"/console
85 echo "$(basename "${font}")" > "${RC_LIBDIR}"/console/font
86 if [ "${UNICODE}" = "yes" ] ; then
87 echo > "${RC_LIBDIR}"/console/unicode
88 else
89 rm -f "${RC_LIBDIR}"/console/unicode
90 fi
91 fi
92
93 return ${retval}
94 }
95
96 # vim: set ts=4 :

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20