OSDN Git Service

Update to 3.8
[linuxjf/JF.git] / docs / LFS-BOOK / scripts / apds13.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4   <head>
5     <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
6     <title>
7       D.13. /etc/rc.d/init.d/console
8     </title>
9     <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
10     <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
11     <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
12     "text/css" media="print" />
13   </head>
14   <body class="lfs" id="lfs-6.8">
15     <div class="navheader">
16       <h4>
17         Linux From Scratch - Version 6.8
18       </h4>
19       <h3>
20         付録 D. ブートスクリプトと sysconfig スクリプト version-20100627
21       </h3>
22       <ul>
23         <li class="prev">
24           <a accesskey="p" href="apds12.html" title=
25           "/etc/rc.d/init.d/cleanfs">前のページ</a>
26           <p>
27             /etc/rc.d/init.d/cleanfs
28           </p>
29         </li>
30         <li class="next">
31           <a accesskey="n" href="apds14.html" title=
32           "/etc/rc.d/init.d/localnet">次のページ</a>
33           <p>
34             /etc/rc.d/init.d/localnet
35           </p>
36         </li>
37         <li class="up">
38           <a accesskey="u" href="scripts.html" title=
39           "付録 D. ブートスクリプトと sysconfig スクリプト version-20100627">上に戻る</a>
40         </li>
41         <li class="home">
42           <a accesskey="h" href="../index.html" title=
43           "Linux From Scratch - Version 6.8">ホーム</a>
44         </li>
45       </ul>
46     </div>
47     <div class="wrap" lang="ja" xml:lang="ja">
48       <h1 class="sect1">
49         <a id="console" name="console"></a>D.13. /etc/rc.d/init.d/console
50       </h1>
51       <pre class="screen">
52 #!/bin/sh
53 ########################################################################
54 # Begin $rc_base/init.d/console
55 #
56 # Description : Sets keymap and screen font
57 #
58 # Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
59 #        Alexander E. Patrakov
60 #
61 # Version     : 00.03
62 #
63 # Notes       :
64 #
65 ########################################################################
66
67 . /etc/sysconfig/rc
68 . ${rc_functions}
69
70 # Native English speakers probably don't have /etc/sysconfig/console at all
71 if [ -f /etc/sysconfig/console ]
72 then
73     . /etc/sysconfig/console
74 else
75         exit 0
76 fi
77
78 is_true() {
79     [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
80 }
81
82 failed=0
83
84 case "${1}" in
85     start)
86         boot_mesg "Setting up Linux console..."
87         # There should be no bogus failures below this line!
88         
89         # Figure out if a framebuffer console is used
90         [ -d /sys/class/graphics/fb0 ] &amp;&amp; USE_FB=1 || USE_FB=0
91         
92         # Figure out the command to set the console into the
93         # desired mode
94         is_true "${UNICODE}" &amp;&amp;
95             MODE_COMMAND="${ECHO} -en '\033%G' &amp;&amp; kbd_mode -u" ||
96             MODE_COMMAND="${ECHO} -en '\033%@\033(K' &amp;&amp; kbd_mode -a"
97         
98         # On framebuffer consoles, font has to be set for each vt in
99         # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
100         
101         ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
102             MODE_COMMAND="${MODE_COMMAND} &amp;&amp; setfont ${FONT}"
103
104         # Apply that command to all consoles mentioned in
105         # /etc/inittab. Important: in the UTF-8 mode this should
106         # happen before setfont, otherwise a kernel bug will
107         # show up and the unicode map of the font will not be
108         # used.
109         # FIXME: Fedora Core also initializes two spare consoles
110         # - do we want that?
111         
112         for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
113             grep -o '\btty[[:digit:]]*\b'`
114         do
115             openvt -f -w -c ${TTY#tty} -- \
116                 /bin/sh -c "${MODE_COMMAND}" || failed=1
117         done
118
119         # Set the font (if not already set above) and the keymap
120         is_true "${USE_FB}" || [ -z "${FONT}" ] ||
121             setfont $FONT ||
122             failed=1
123         [ -z "${KEYMAP}" ] ||
124             loadkeys ${KEYMAP} &gt;/dev/null 2&gt;&amp;1 ||
125             failed=1
126         [ -z "${KEYMAP_CORRECTIONS}" ] ||
127             loadkeys ${KEYMAP_CORRECTIONS} &gt;/dev/null 2&gt;&amp;1 ||
128             failed=1
129
130         # Convert the keymap from $LEGACY_CHARSET to UTF-8
131         [ -z "$LEGACY_CHARSET" ] ||
132             dumpkeys -c "$LEGACY_CHARSET" |
133             loadkeys -u &gt;/dev/null 2&gt;&amp;1 ||
134             failed=1
135
136         # If any of the commands above failed, the trap at the
137         # top would set $failed to 1
138         ( exit $failed )
139         evaluate_retval
140         ;;
141     *)
142         echo $"Usage:" "${0} {start}"
143         exit 1
144         ;;
145 esac
146
147 # End $rc_base/init.d/console
148 </pre>
149     </div>
150     <div class="navfooter">
151       <ul>
152         <li class="prev">
153           <a accesskey="p" href="apds12.html" title=
154           "/etc/rc.d/init.d/cleanfs">前のページ</a>
155           <p>
156             /etc/rc.d/init.d/cleanfs
157           </p>
158         </li>
159         <li class="next">
160           <a accesskey="n" href="apds14.html" title=
161           "/etc/rc.d/init.d/localnet">次のページ</a>
162           <p>
163             /etc/rc.d/init.d/localnet
164           </p>
165         </li>
166         <li class="up">
167           <a accesskey="u" href="scripts.html" title=
168           "付録 D. ブートスクリプトと sysconfig スクリプト version-20100627">上に戻る</a>
169         </li>
170         <li class="home">
171           <a accesskey="h" href="../index.html" title=
172           "Linux From Scratch - Version 6.8">ホーム</a>
173         </li>
174       </ul>
175     </div>
176   </body>
177 </html>