1 |
r0bertz 08/04/20 09:32:41 |
2 |
|
3 |
Added: openrc-migration.xml |
4 |
Log: |
5 |
[zh_cn] added openrc-migration.xml |
6 |
|
7 |
Revision Changes Path |
8 |
1.1 xml/htdocs/doc/zh_cn/openrc-migration.xml |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/zh_cn/openrc-migration.xml?rev=1.1&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/zh_cn/openrc-migration.xml?rev=1.1&content-type=text/plain |
12 |
|
13 |
Index: openrc-migration.xml |
14 |
=================================================================== |
15 |
<?xml version='1.0' encoding='UTF-8'?> |
16 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
17 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/zh_cn/openrc-migration.xml,v 1.1 2008/04/20 09:32:40 r0bertz Exp $ --> |
18 |
<!-- English CVS version: 1.1 --> |
19 |
|
20 |
<guide link="/doc/zh_cn/openrc-migration.xml" lang="zh_cn"> |
21 |
<title>基础布局Baselayout和OpenRC迁移指南</title> |
22 |
|
23 |
<author title="作者"> |
24 |
<mail link="cardoe"/> |
25 |
</author> |
26 |
<author title="作者"> |
27 |
<mail link="nightmorph"/> |
28 |
</author> |
29 |
<author title="贡献者"> |
30 |
<mail link="uberlord"/> |
31 |
</author> |
32 |
<author title="译者"> |
33 |
<mail link="goldenshore999@×××××.com">周骞</mail> |
34 |
</author> |
35 |
<author title="编辑"> |
36 |
<mail link="r0bertz@g.o">张乐</mail> |
37 |
</author> |
38 |
|
39 |
<abstract> |
40 |
这个指南会指导你如何从baselayout-1迁移到baselayout-2和OpenRC。 |
41 |
</abstract> |
42 |
|
43 |
<!-- The content of this document is licensed under the CC-BY-SA license --> |
44 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
45 |
<license/> |
46 |
|
47 |
<version>1.0</version> |
48 |
<date>2008-04-11</date> |
49 |
|
50 |
<chapter> |
51 |
<title>背景知识</title> |
52 |
<section> |
53 |
<title>什么是baselayout?</title> |
54 |
<body> |
55 |
|
56 |
<p> |
57 |
为了让所有系统能正常得工作,Baselayout提供了一个基础的文件集合,比如<path>/etc/hosts</path>。她也为Gentoo提供了基础的文件系统布局(如目录<path>/etc</path>,<path>/var</path>,<path>/usr</path>,<path>/home</path>) |
58 |
</p> |
59 |
|
60 |
</body> |
61 |
</section> |
62 |
<section> |
63 |
<title>什么是OpenRC?</title> |
64 |
<body> |
65 |
|
66 |
<p> |
67 |
OpenRC是一个基于依赖关系的rc系统,可以和系统所提供任何init程序配合运行,一般指的是<path>/sbin/init</path>。但是她<e>不</e>是用来取代<path>/sbin/init</path>的。Gentoo Linux默认使用的init是由<c>sys-apps/sysvinit</c>提供,而Gentoo/FreeBSD则使用由<c>sys-freebsd/freebsd-sbin</c>提供的FreeBSD init。 |
68 |
</p> |
69 |
</body> |
70 |
</section> |
71 |
<section> |
72 |
<title>那么干嘛要迁移?</title> |
73 |
<body> |
74 |
|
75 |
<p> |
76 |
最初的Gentoo的rc系统是为baselayout-1建立并且完全是由bash写出来的。这里有几个缺陷。比如在启动的时候需要访问某些系统调用,而这样就需要增加基于C的调用。这些调用都是静态连接的,从而会让rc系统随时间的增长而不断膨大。 |
77 |
</p> |
78 |
|
79 |
<p> |
80 |
而且,在Gentoo扩展到其他平台如Gentoo/FreeBSD和Gentoo嵌入式之后,就更不可能要求有一个基于bash的rc系统了。所以完全用C写的baselayout-2应运而生,她只需要一个兼容POSIX的shell。在开发baselayout-2的过程中,我们发现把rc系统和仅仅提供基础文件和文件系统布局的baselayout分成不同的包会更好。于是OpenRC诞生了。 |
81 |
</p> |
82 |
|
83 |
<p> |
84 |
OpenRC主要由<uri link="http://roy.marples.name/openrc">Roy Marples</uri>开发,她支持Gentoo现在的所有变种(如Gentoo Linux,Gentoo/FreeBSD,Gentoo嵌入式和Gentoo Vserver)以及其他的平台如FreeBSD和NetBSD。 |
85 |
</p> |
86 |
|
87 |
</body> |
88 |
</section> |
89 |
</chapter> |
90 |
|
91 |
<chapter> |
92 |
<title>迁移到OpenRC</title> |
93 |
<section> |
94 |
<body> |
95 |
|
96 |
<p> |
97 |
迁移到OpenRC的过程是比较直接的;你的包管理器在常规升级的时候就已经包括了。重要的是在你安装新的<c>>=sys-apps/baselayout-2</c>和<c>sys-apps/openrc</c>之后的步骤。<e>一定要</e>运行<c>dispatch-conf</c>以确保<path>/etc</path>目录里的文件都已经更新到了最新版本。<brite>不这么做的话系统会无法启动</brite>,那样的话你就需要使用Gentoo LiveCD并按照以下步骤并来修复你的系统。 |
98 |
</p> |
99 |
|
100 |
<p> |
101 |
更新完配置文件后,在重启前复查以下几点。 |
102 |
</p> |
103 |
|
104 |
</body> |
105 |
</section> |
106 |
|
107 |
<section id="rc_conf"> |
108 |
<title>/etc/conf.d/rc</title> |
109 |
<body> |
110 |
|
111 |
<p> |
112 |
<path>/etc/conf.d/rc</path>文件将不再使用,所有里边的设置需要被迁移到<path>/etc/rc.conf</path>中相应的设置。请通读<path>/etc/rc.conf</path>和<path>/etc/conf.d/rc</path>后再迁移设置。在完成修改后删除文件<path>/etc/conf.d/rc。 |
113 |
</path> |
114 |
</p> |
115 |
|
116 |
</body> |
117 |
</section> |
118 |
|
119 |
<section id="modules"> |
120 |
<title>内核模块</title> |
121 |
<body> |
122 |
|
123 |
<p> |
124 |
一般情况下,当你想在启动的时候自动加载某些模块的话,就把模块名连同参数一起加入到<path>/etc/modules.autoload.d/kernel-2.6</path>里边。baselayout-2不再用这个文件了。在baselayout-2里,不管内核的版本是多少,自动加载模块和模块参数都被放到了<path>/etc/conf.d/modules</path>文件里边。 |
125 |
</p> |
126 |
|
127 |
<p> |
128 |
例子:老式的配置文件 |
129 |
</p> |
130 |
|
131 |
<pre caption="/etc/modules.autoload.d/kernel-2.6"> |
132 |
ivtv |
133 |
cx88_dvb video_br=2 |
134 |
</pre> |
135 |
|
136 |
<p> |
137 |
转换后应该是这样的: |
138 |
</p> |
139 |
|
140 |
<pre caption="/etc/conf.d/modules"> |
141 |
<comment># 启动时自动加载模块列表</comment> |
142 |
modules_2_6="ivtv cx88_dvb" |
143 |
<comment># 模块参数</comment> |
144 |
module_cx88_dvb_args_2_6="video_br=2" |
145 |
</pre> |
146 |
|
147 |
<p> |
148 |
以上例子中,模块以及其参数只会在使用2.6.x系列内核情况下生效。新版本配置文件允 |
149 |
许在针对不同内核版本的情况下对模块和参数进行细致微调。 |
150 |
</p> |
151 |
|
152 |
<p> |
153 |
一个更深入的例子: |
154 |
</p> |
155 |
|
156 |
<pre caption="一个关于/etc/conf.d/modules的详细例子"> |
157 |
<comment># 不管内核是什么版本,都加载模块ochi1394和ieee1394</comment> |
158 |
modules="ohci1394 ieee1394" |
159 |
<comment># 只有在2.6.X系列内核的时候加载tun和usbserial</comment> |
160 |
modules_2_6="tun usbserial" |
161 |
<comment># 只有在2.6.23内核时,才加载cx88_dvb</comment> |
162 |
modules_2_6_23="cx88_dvb" |
163 |
<comment># 内核版本2.6.23-gentoo-r5才加载ivtv</comment> |
164 |
modules_2_6_23_gentoo_r5="ivtv" |
165 |
|
166 |
<comment># 内核版本为2.6.23-gentoo-r5的时候,传递参数video_br=2给内核模块cx88_dvb</comment> |
167 |
module_cx88_dvb_args_2_6_23_gentoo_r5="video_br=2" |
168 |
<comment># 2.6.x系列内核的话,传递vendor和product参数给usbserial模块</comment> |
169 |
module_usbserial_args_2_6="vendor=0x1410 product=0x2110" |
170 |
<comment># 不管内核是什么版本,传递debug参数给模块ieee1394</comment> |
171 |
module_ieee1394_args="debug" |
172 |
</pre> |
173 |
|
174 |
<note> |
175 |
请注意<b>module_</b>和<b>modules_</b>之间的区别。 |
176 |
</note> |
177 |
|
178 |
</body> |
179 |
</section> |
180 |
<section id="volume"> |
181 |
<title>卷管理</title> |
182 |
<body> |
183 |
|
184 |
<p> |
185 |
在你切换到OpenRC和baselayout-2的时候,块储存设备的卷管理服务的迁移也应该自动完成了。但是如果没自动完成的话,你需要按照以下说明进行处理。 |
186 |
</p> |
187 |
|
188 |
<p> |
189 |
默认情况下块储存设备的卷管理服务不再被启动。意味着这些lvm,raid,swap,device-mapper (dm),dm-crypt,evms和类似的服务不会自动运行了。如果你要用到这些附加服务,你需要手动把相应的启动脚本加入到<c>boot</c> runlevel。不然,你的系统有可能不能正常启动。在你安装不同的卷管理服务的时候,相应的启动脚本会被安装到目录<path>/etc/init.d</path>里边。你必须确认<c>boot</c> runlevel包括了正确的启动脚本。 |
190 |
</p> |
191 |
|
192 |
<p> |
193 |
尽管OpenRC ebuild会尝试帮你完成迁移工作,你还是应该复查一下所有的卷管理服务看 |
194 |
看她们是否被正确迁移。 |
195 |
</p> |
196 |
|
197 |
<pre caption="检查boot runlevel的所有服务"> |
198 |
# <i>ls -l /etc/runlevels/boot/</i> |
199 |
</pre> |
200 |
|
201 |
<p> |
202 |
如果你知道你使用了mdraid,lvm和swap,但是却没在上边结果中看到的话,那你要运行以 |
203 |
下命令把启动脚本增加到<c>boot</c> runlevel中。 |
204 |
</p> |
205 |
|
206 |
<pre caption="把缺失的卷管理服务增加到boot runlevel中"> |
207 |
# <i>rc-update add raid boot</i> |
208 |
# <i>rc-update add lvm boot</i> |
209 |
# <i>rc-update add swap boot</i> |
210 |
</pre> |
211 |
|
212 |
</body> |
213 |
</section> |
214 |
<section> |
215 |
<title>时钟</title> |
216 |
<body> |
217 |
|
218 |
<p> |
219 |
设置时钟的文件不再叫<path>/etc/conf.d/clock</path>了,而是由系统原生的时钟调整工具的名字命名。这就是说Linux下这个文件叫<path>/etc/conf.d/hwclock</path>,而在FreeBSD中叫<path>/etc/conf.d/adjkerntz</path>。 |
220 |
</p> |
221 |
|
222 |
<p> |
223 |
还有,TIMEZONE变量也不再在这个文件里设置了。应该把这个变量的值写入文件<path>/etc/timezone</path>。请复查这两个文件并确定她们的正确性。 |
224 |
</p> |
225 |
|
226 |
</body> |
227 |
</section> |
228 |
|
229 |
<section> |
230 |
<title>XSESSION</title> |
231 |
<body> |
232 |
|
233 |
<p> |
234 |
XSESSION变量也不再在文件<path>/etc/rc.conf</path>中设置了。可以在由<c>x11-apps/xinit</c>提供的文件<path>/etc/env.d/90xsession</path>里设置XSESSION变量。 |
235 |
</p> |
236 |
|
237 |
<p> |
238 |
默认是<b>不</b>会迁移这个变量的,所以你需要编辑文件<path>/etc/env.d/90xsession |
239 |
</path>。 |
240 |
</p> |
241 |
|
242 |
<impo> |
243 |
在<path>/etc/env.d</path>里创建文件后必须运行命令<c>env-update</c>然后登出再登录 |
244 |
才能让修改生效。 |
245 |
</impo> |
246 |
|
247 |
</body> |
248 |
</section> |
249 |
<section> |
250 |
<title>EDITOR</title> |
251 |
<body> |
252 |
|
253 |
<p> |
254 |
EDITOR变量也不在<path>/etc/rc.conf</path>里了,也没有由其他包来提供这个设置。我们鼓励用户在他们自己的<path>~/.bashrc</path>文件中设置这个变量,或者新建一个文件<path>/etc/env.d/99editor</path>并且在里边设置。 |
255 |
</p> |
256 |
|
257 |
<impo> |
258 |
在<path>/etc/env.d</path>里创建文件后必须运行命令<c>env-update</c>然后登出再登录才能让修改生效。如果是在<path>~/.bashrc</path>里设置变量的话,你可以用命令<c> source ~/.bashrc</c>来使你的改动立即生效。 |
259 |
</impo> |
260 |
|
261 |
</body> |
262 |
</section> |
263 |
<section> |
264 |
<title>完成</title> |
265 |
<body> |
266 |
|
267 |
<p> |
268 |
在你完成了配置文件和启动脚本的更新后,最后一件事就是<b>重启</b>。这一步是必须的,因为系统状态信息在升级中不会被保留下来,所以你需要重启来达到这个目的。 |
269 |
</p> |
270 |
|
271 |
</body> |
272 |
</section> |
273 |
</chapter> |
274 |
</guide> |
275 |
|
276 |
|
277 |
|
278 |
-- |
279 |
gentoo-commits@l.g.o mailing list |