1
0

settingenviron.po 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. msgid ""
  2. msgstr ""
  3. "Project-Id-Version: PACKAGE VERSION\n"
  4. "POT-Creation-Date: 2020-06-23 15:47+0800\n"
  5. "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  6. "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  7. "Language-Team: LANGUAGE <LL@li.org>\n"
  8. "Language: zh_CN\n"
  9. "MIME-Version: 1.0\n"
  10. "Content-Type: text/plain; charset=UTF-8\n"
  11. "Content-Transfer-Encoding: 8bit\n"
  12. "X-Generator: Translate Toolkit 2.2.5\n"
  13. #. type: Content of: <sect1><title>
  14. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:11
  15. msgid "Setting Up the Environment"
  16. msgstr "配置环境"
  17. #. type: Content of: <sect1><para>
  18. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:13
  19. msgid ""
  20. "Set up a good working environment by creating two new startup files for the "
  21. "<command>bash</command> shell. While logged in as user <systemitem class="
  22. "\"username\">lfs</systemitem>, issue the following command to create a new "
  23. "<filename>.bash_profile</filename>:"
  24. msgstr ""
  25. "为了配置一个良好的工作环境,我们为 <command>bash</command> 创建两个新的启动脚"
  26. "本。以 <systemitem class=\"username\">lfs</systemitem> 的身份,执行以下命令,"
  27. "创建一个新的 <filename>.bash_profile</filename>:"
  28. #. type: Content of: <sect1><screen>
  29. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:18
  30. #, no-wrap
  31. msgid ""
  32. "<userinput>cat &gt; ~/.bash_profile &lt;&lt; \"EOF\"\n"
  33. "<literal>exec env -i HOME=$HOME TERM=$TERM PS1='\\u:\\w\\$ ' /bin/bash</literal>\n"
  34. "EOF</userinput>"
  35. msgstr ""
  36. "<userinput>cat &gt; ~/.bash_profile &lt;&lt; \"EOF\"\n"
  37. "<literal>exec env -i HOME=$HOME TERM=$TERM PS1='\\u:\\w\\$ ' /bin/bash</literal>\n"
  38. "EOF</userinput>"
  39. # swap two labels
  40. #. type: Content of: <sect1><para>
  41. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:22
  42. msgid ""
  43. "When logged on as user <systemitem class=\"username\">lfs</systemitem>, the "
  44. "initial shell is usually a <emphasis>login</emphasis> shell which reads the "
  45. "<filename>/etc/profile</filename> of the host (probably containing some "
  46. "settings and environment variables) and then <filename>.bash_profile</"
  47. "filename>. The <command>exec env -i.../bin/bash</command> command in the "
  48. "<filename>.bash_profile</filename> file replaces the running shell with a "
  49. "new one with a completely empty environment, except for the <envar>HOME</"
  50. "envar>, <envar>TERM</envar>, and <envar>PS1</envar> variables. This ensures "
  51. "that no unwanted and potentially hazardous environment variables from the "
  52. "host system leak into the build environment. The technique used here "
  53. "achieves the goal of ensuring a clean environment."
  54. msgstr ""
  55. "在以 <systemitem class=\"username\">lfs</systemitem> 用户登录时,初始的 "
  56. "shell 一般是一个<emphasis>登录</emphasis> shell。它读取宿主系统的 <filename>/"
  57. "etc/profile</filename> 文件 (可能包含一些设置和环境变量),然后读取 "
  58. "<filename>.bash_profile</filename>。我们在 <filename>.bash_profile</"
  59. "filename> 中使用 <command>exec env -i.../bin/bash</command> 命令,新建一个除"
  60. "了 <envar>HOME</envar>, <envar>TERM</envar> 以及 <envar>PS1</envar> 外没有任"
  61. "何环境变量的 shell,替换当前 shell,防止宿主环境中不必要和有潜在风险的环境变"
  62. "量进入编译环境。通过使用以上技巧,我们创建了一个干净环境。"
  63. #. type: Content of: <sect1><para>
  64. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:34
  65. msgid ""
  66. "The new instance of the shell is a <emphasis>non-login</emphasis> shell, "
  67. "which does not read, and execute, the conten of <filename>/etc/profile</"
  68. "filename> or <filename>.bash_profile</filename> files, but rather reads, and "
  69. "executes, the <filename>.bashrc</filename> file instead. Create the "
  70. "<filename>.bashrc</filename> file now:"
  71. msgstr ""
  72. "新的 shell 实例是 <emphasis>非登录</emphasis> shell,它不会读取和执行 "
  73. "<filename>/etc/profile</filename> 或者 <filename>.bash_profile</filename> 的"
  74. "内容,而是读取并执行 <filename>.bashrc</filename> 文件。现在我们就创建一个 "
  75. "<filename>.bashrc</filename> 文件:"
  76. #. type: Content of: <sect1><screen>
  77. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:40
  78. #, no-wrap
  79. msgid ""
  80. "<userinput>cat &gt; ~/.bashrc &lt;&lt; \"EOF\"\n"
  81. "<literal>set +h\n"
  82. "umask 022\n"
  83. "LFS=/mnt/lfs\n"
  84. "LC_ALL=POSIX\n"
  85. "LFS_TGT=$(uname -m)-lfs-linux-gnu\n"
  86. "PATH=/usr/bin\n"
  87. "if [ ! -L /bin ]; then PATH=/bin:$PATH; fi\n"
  88. "PATH=$LFS/tools/bin:$PATH\n"
  89. "export LFS LC_ALL LFS_TGT PATH</literal>\n"
  90. "EOF</userinput>"
  91. msgstr ""
  92. "<userinput>cat &gt; ~/.bashrc &lt;&lt; \"EOF\"\n"
  93. "<literal>set +h\n"
  94. "umask 022\n"
  95. "LFS=/mnt/lfs\n"
  96. "LC_ALL=POSIX\n"
  97. "LFS_TGT=$(uname -m)-lfs-linux-gnu\n"
  98. "PATH=/usr/bin\n"
  99. "if [ ! -L /bin ]; then PATH=/bin:$PATH; fi\n"
  100. "PATH=$LFS/tools/bin:$PATH\n"
  101. "export LFS LC_ALL LFS_TGT PATH</literal>\n"
  102. "EOF</userinput>"
  103. #. type: Content of: <sect1><variablelist><title>
  104. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:53
  105. msgid "The meaning of the settings in <filename>.bashrc</filename>"
  106. msgstr "<filename>.bashrc</filename> 中设定的含义:"
  107. #. type: Content of: <sect1><variablelist><varlistentry><term>
  108. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:56
  109. msgid "<parameter>set +h</parameter>"
  110. msgstr "<parameter>set +h</parameter>"
  111. #. type: Content of: <sect1><variablelist><varlistentry><listitem><para>
  112. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:58
  113. msgid ""
  114. "The <command>set +h</command> command turns off <command>bash</command>'s "
  115. "hash function. Hashing is ordinarily a useful feature&mdash;<command>bash</"
  116. "command> uses a hash table to remember the full path of executable files to "
  117. "avoid searching the <envar>PATH</envar> time and again to find the same "
  118. "executable. However, the new tools should be used as soon as they are "
  119. "installed. By switching off the hash function, the shell will always search "
  120. "the <envar>PATH</envar> when a program is to be run. As such, the shell will "
  121. "find the newly compiled tools in <filename class=\"directory\">$LFS/tools</"
  122. "filename> as soon as they are available without remembering a previous "
  123. "version of the same program in a different location."
  124. msgstr ""
  125. "<command>set +h</command> 命令关闭 <command>bash</command> 的散列功能。一般情"
  126. "况下,散列是很有用的 —— <command>bash</command> 使用一个散列表维护各个可执行"
  127. "文件的完整路径,这样就不用每次都在 <envar>PATH</envar> 指定的目录中搜索可执行"
  128. "文件。然而,在构建 LFS 时,我们希望总是使用最新安装的工具。因此,需要关闭散列"
  129. "功能,使得 shell 在运行程序时总是搜索 <envar>PATH</envar>。这样,shell 总是能"
  130. "够找到 <filename class=\"directory\">$LFS/tools</filename> 目录中那些最新编译"
  131. "的工具,而不是使用之前记忆的另一个目录中的程序。"
  132. #. type: Content of: <sect1><variablelist><varlistentry><term>
  133. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:73
  134. msgid "<parameter>umask 022</parameter>"
  135. msgstr "<parameter>umask 022</parameter>"
  136. #. type: Content of: <sect1><variablelist><varlistentry><listitem><para>
  137. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:75
  138. msgid ""
  139. "Setting the user file-creation mask (umask) to 022 ensures that newly "
  140. "created files and directories are only writable by their owner, but are "
  141. "readable and executable by anyone (assuming default modes are used by the "
  142. "<function>open(2)</function> system call, new files will end up with "
  143. "permission mode 644 and directories with mode 755)."
  144. msgstr ""
  145. "将用户的文件创建掩码 (umask) 设定为 022,保证只有文件所有者可以写新创建的文件"
  146. "和目录,但任何人都可读取、执行它们。(如果 <function>open(2)</function> 系统调"
  147. "用使用默认模式,则新文件将具有权限码 644,而新目录具有权限码 755)。"
  148. #. type: Content of: <sect1><variablelist><varlistentry><term>
  149. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:84
  150. msgid "<parameter>LFS=/mnt/lfs</parameter>"
  151. msgstr "<parameter>LFS=/mnt/lfs</parameter>"
  152. #. type: Content of: <sect1><variablelist><varlistentry><listitem><para>
  153. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:86
  154. msgid ""
  155. "The <envar>LFS</envar> variable should be set to the chosen mount point."
  156. msgstr "<envar>LFS</envar> 环境变量必须被设定为之前选择的挂载点。"
  157. #. type: Content of: <sect1><variablelist><varlistentry><term>
  158. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:92
  159. msgid "<parameter>LC_ALL=POSIX</parameter>"
  160. msgstr "<parameter>LC_ALL=POSIX</parameter>"
  161. #. type: Content of: <sect1><variablelist><varlistentry><listitem><para>
  162. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:94
  163. msgid ""
  164. "The <envar>LC_ALL</envar> variable controls the localization of certain "
  165. "programs, making their messages follow the conventions of a specified "
  166. "country. Setting <envar>LC_ALL</envar> to <quote>POSIX</quote> or <quote>C</"
  167. "quote> (the two are equivalent) ensures that everything will work as "
  168. "expected in the chroot environment."
  169. msgstr ""
  170. "<envar>LC_ALL</envar> 环境变量控制某些程序的本地化行为,使得它们以特定国家的"
  171. "语言和惯例输出消息。将 <envar>LC_ALL</envar> 设置为 <quote>POSIX</quote> 或"
  172. "者 <quote>C</quote>(这两种设置是等价的) 可以保证在 chroot 环境中所有命令的行"
  173. "为完全符合预期,而与宿主的本地化设置无关。"
  174. #. type: Content of: <sect1><variablelist><varlistentry><term>
  175. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:103
  176. msgid "<parameter>LFS_TGT=(uname -m)-lfs-linux-gnu</parameter>"
  177. msgstr "<parameter>LFS_TGT=(uname -m)-lfs-linux-gnu</parameter>"
  178. #. type: Content of: <sect1><variablelist><varlistentry><listitem><para>
  179. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:105
  180. msgid ""
  181. "The <envar>LFS_TGT</envar> variable sets a non-default, but compatible "
  182. "machine description for use when building our cross compiler and linker and "
  183. "when cross compiling our temporary toolchain. More information is contained "
  184. "in <xref linkend=\"ch-tools-toolchaintechnotes\" role=\"\"/>."
  185. msgstr ""
  186. "<envar>LFS_TGT</envar>变量设定了一个非默认,但与宿主系统兼容的机器描述符。该"
  187. "描述符被用于构建交叉编译器和交叉编译临时工具链。<xref linkend=\"ch-tools-"
  188. "toolchaintechnotes\" role=\"\"/>包含了关于这个描述符的更多信息。"
  189. #. type: Content of: <sect1><variablelist><varlistentry><term>
  190. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:113
  191. msgid "<parameter>PATH=/usr/bin</parameter>"
  192. msgstr "<parameter>PATH=/usr/bin</parameter>"
  193. #. type: Content of: <sect1><variablelist><varlistentry><listitem><para>
  194. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:115
  195. msgid ""
  196. "Many modern linux distributions have merged <filename class=\"directory\">/"
  197. "bin</filename> and <filename class=\"directory\">/usr/bin</filename>. When "
  198. "this is the case, the standard <envar>PATH</envar> variable needs just to be "
  199. "set to <filename class=\"directory\">/usr/bin/</filename> for the <xref "
  200. "linkend=\"chapter-temporary-tools\"/> environment. When this is not the "
  201. "case, the following line adds <filename class=\"directory\">/bin</filename> "
  202. "to the path."
  203. msgstr ""
  204. "许多现代 Linux 发行版合并了 <filename class=\"directory\">/bin</filename> 和 "
  205. "<filename class=\"directory\">/usr/bin</filename>。在这种情况下,标准 "
  206. "<envar>PATH</envar> 变量只需要被设定为 <filename class=\"directory\">/usr/"
  207. "bin</filename>,即可满足<xref linkend=\"chapter-temporary-tools\"/>的环境。否"
  208. "则,后续命令将会增加 <filename class=\"directory\">/bin</filename> 到搜索路径"
  209. "中。"
  210. #. type: Content of: <sect1><variablelist><varlistentry><term>
  211. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:127
  212. msgid "<parameter>if [ ! -L /bin ]; then PATH=/bin:$PATH; fi</parameter>"
  213. msgstr "<parameter>if [ ! -L /bin ]; then PATH=/bin:$PATH; fi</parameter>"
  214. #. type: Content of: <sect1><variablelist><varlistentry><listitem><para>
  215. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:129
  216. msgid ""
  217. "If <filename class=\"directory\">/bin</filename> is not a symbolic link, "
  218. "then it has to be added to the <envar>PATH</envar> variable."
  219. msgstr ""
  220. "如果 <filename class=\"directory\">/bin</filename> 不是符号链接,则它需要被添"
  221. "加到 <envar>PATH</envar> 变量中。"
  222. #. type: Content of: <sect1><variablelist><varlistentry><term>
  223. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:135
  224. msgid "<parameter>PATH=$LFS/tools/bin:$PATH</parameter>"
  225. msgstr "<parameter>PATH=$LFS/tools/bin:$PATH</parameter>"
  226. #. type: Content of: <sect1><variablelist><varlistentry><listitem><para>
  227. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:137
  228. msgid ""
  229. "By putting <filename class=\"directory\">$LFS/tools/bin</filename> ahead of "
  230. "the standard <envar>PATH</envar>, the cross-compiler installed at the "
  231. "beginning of <xref linkend=\"chapter-cross-tools\"/> is picked up by the "
  232. "shell immediately after its installation. This, combined with turning off "
  233. "hashing, limits the risk that the compiler from the host be used instead of "
  234. "the cross-compiler."
  235. msgstr ""
  236. "我们将 <filename class=\"directory\">$LFS/tools/bin</filename> 附加在默认的 "
  237. "<envar>PATH</envar> 环境变量之前,这样在<xref linkend=\"chapter-cross-tools"
  238. "\"/>中,我们一旦安装了新的程序,shell 就能立刻使用它们。这与关闭散列功能相结"
  239. "合,降低了在第 5 章环境中新程序可用时错误地使用宿主系统中旧程序的风险。"
  240. #. type: Content of: <sect1><variablelist><varlistentry><term>
  241. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:147
  242. msgid "<parameter>export LFS LC_ALL LFS_TGT PATH</parameter>"
  243. msgstr "<parameter>export LFS LC_ALL LFS_TGT PATH</parameter>"
  244. #. type: Content of: <sect1><variablelist><varlistentry><listitem><para>
  245. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:149
  246. msgid ""
  247. "While the above commands have set some variables, in order to make them "
  248. "visible within any sub-shells, we export them."
  249. msgstr ""
  250. "前面的命令设定了一些变量,为了让所有子 shell 都能使用这些变量,需要导出它们。"
  251. #. type: Content of: <sect1><important><para>
  252. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:158
  253. msgid ""
  254. "Several commercial distributions add a non-documented instantiation of "
  255. "<filename>/etc/bash.bashrc</filename> to the initialization of "
  256. "<command>bash</command>. This file has the potential to modify the "
  257. "<systemitem class=\"username\">lfs</systemitem> user's environment in ways "
  258. "that can affect the building of critical LFS packages. To make sure the "
  259. "<systemitem class=\"username\">lfs</systemitem> user's envronment is clean, "
  260. "check for the presence of <filename>/etc/bash.bashrc</filename> and, if "
  261. "present, move it out of the way. As the <systemitem class=\"username"
  262. "\">root</systemitem> user, run:"
  263. msgstr ""
  264. "一些商业发行版在 <command>bash</command> 初始化过程中,未做文档说明地增加了 "
  265. "<filename>/etc/bash.bashrc</filename>。该文件可能修改 <systemitem class="
  266. "\"username\">lfs</systemitem> 用户的环境,并影响 LFS 关键软件包的构建。为"
  267. "了保证 <systemitem class=\"username\">lfs</systemitem> 用户环境的纯净,检查 "
  268. "<filename>/etc/bash.bashrc</filename> 是否存在,如果它存在就将它移走。以 "
  269. "<systemitem class=\"username\">root</systemitem> 用户身份,运行:"
  270. #. type: Content of: <sect1><important><screen>
  271. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:169
  272. #, no-wrap
  273. msgid "<userinput>[ ! -e /etc/bash.bashrc ] || mv -v /etc/bash.bashrc /etc/bash.bashrc.NOUSE</userinput>"
  274. msgstr "<userinput>[ ! -e /etc/bash.bashrc ] || mv -v /etc/bash.bashrc /etc/bash.bashrc.NOUSE</userinput>"
  275. #. type: Content of: <sect1><important><para>
  276. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:171
  277. msgid ""
  278. "After use of the <systemitem class=\"username\">lfs</systemitem> user is "
  279. "finished at the beginning of <xref linkend=\"chapter-chroot-temporary-tools"
  280. "\"/>, you can restore <filename>/etc/bash.bashrc</filename> (if desired)."
  281. msgstr ""
  282. "在<xref linkend=\"chapter-chroot-temporary-tools\"/>一章开始后,就不再使用 "
  283. "<systemitem class=\"username\">lfs</systemitem> 用户,您 (如果希望的话) 可以"
  284. "复原 <filename>/etc/bash.bashrc</filename> 文件。"
  285. #. type: Content of: <sect1><important><para>
  286. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:176
  287. msgid ""
  288. "Note that the LFS Bash package we will build in <xref linkend=\"ch-system-"
  289. "bash\"/> is not configured to load or execute <filename>/etc/bash.bashrc</"
  290. "filename>, so this file is useless on a completed LFS system."
  291. msgstr ""
  292. "注意我们将会在<xref linkend=\"ch-system-bash\"/>中构建的 LFS Bash 软件包未被"
  293. "配置为读取或执行 <filename>/etc/bash.bashrc</filename>,因此它在完整的 LFS 系"
  294. "统中没有作用。"
  295. #. type: Content of: <sect1><para>
  296. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:182
  297. msgid ""
  298. "Finally, to have the environment fully prepared for building the temporary "
  299. "tools, source the just-created user profile:"
  300. msgstr ""
  301. "最后,为了完全准备好编译临时工具的环境,指示 shell 读取刚才创建的配置文件:"
  302. #. type: Content of: <sect1><screen>
  303. #: /home/xry111/svn-repos/LFS-BOOK/chapter04/settingenviron.xml:185
  304. #, no-wrap
  305. msgid "<userinput>source ~/.bash_profile</userinput>"
  306. msgstr "<userinput>source ~/.bash_profile</userinput>"