<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="materials-introduction">
  <?dbhtml filename="introduction.html"?>

  <title>概述</title>

  <!--para>This chapter includes a list of packages that need to be downloaded in
  order to build a basic Linux system. The listed version numbers correspond to
  versions of the software that are known to work, and this book is based on
  their use. We highly recommend against using newer versions because the build
  commands for one version may not work with a newer version. The newest package
  versions may also have problems that require work-arounds. These work-arounds
  will be developed and stabilized in the development version of the
  book.</para-->
  <para>本章包含了构建基本的 Linux 系统时需要下载的软件包列表。
	  我们给出的版本号对应于已经确定可以正常工作的版本，
	  本书是基于这些版本编写的。我们强烈反对使用更新的版本，
	  因为特定版本可用的构建命令未必适用于新版本。
	  最新版本的软件包可能有需要排查的问题，
	  我们会在本书的开发过程中进行排查，将解决方案找到并固定下来。</para>

  <!--para>Download locations may not always be accessible. If a download
  location has changed since this book was published, Google (<ulink
  url="http://www.google.com/"/>) provides a useful search engine for
  most packages. If this search is unsuccessful, try one of the
  alternative means of downloading discussed at <ulink
  url="&lfs-root;lfs/packages.html#packages"/>. </para-->
  <para>本书列出的下载位置可能失效。如果本书发布后，
	  某个下载位置发生变化，可以用 Google
	  (<ulink url="http://www.google.com/"/>)
	  提供的搜索引擎找到大多数软件包。如果搜索不到，尝试
	  <ulink url="&lfs-root;lfs/packages.html#packages"/>
	  给出的备用地址。</para>

  <!--para>Downloaded packages and patches will need to be stored somewhere
  that is conveniently available throughout the entire build. A working
  directory is also required to unpack the sources and build them.
  <filename class="directory">$LFS/sources</filename> can be used both
  as the place to store the tarballs and patches and as a working
  directory. By using this directory, the required elements will be
  located on the LFS partition and will be available during all stages
  of the building process.</para-->
  <para>下载好的软件包和补丁需要保存在一个适当的位置，
	  使得在整个构建过程中都能容易地访问它们。另外，还需要一个工作目录，
	  以便解压和编译软件包。我们可以将
	  <filename class="directory">$LFS/sources</filename>
	  既用于保存软件包和补丁，又作为工作目录。
	  这样，我们需要的所有东西都在 LFS 分区中，
	  因此在整个构建过程中都能够访问。</para>

  <!--para>To create this directory, execute the following command, as user
  <systemitem class="username">root</systemitem>, before starting the download
  session:</para-->
  <para>为了创建这个目录，在开始下载软件包之前，
	  以<systemitem class="username">root</systemitem>身份执行：</para>

<screen role="nodump"><userinput>mkdir -v $LFS/sources</userinput></screen>

  <!--para>Make this directory writable and sticky. <quote>Sticky</quote>
  means that even if multiple users have write permission on a
  directory, only the owner of a file can delete the file within a
  sticky directory. The following command will enable the write and
  sticky modes:</para-->
  <para>下面为该目录添加写入权限和 sticky 标志。<quote>Sticky</quote>
	  标志使得即使有多个用户对该目录有写入权限，
	  也只有文件所有者能够删除其中的文件。输入以下命令，
	  启用写入权限和 sticky 标志：</para>

<screen role="nodump"><userinput>chmod -v a+wt $LFS/sources</userinput></screen>

  <!--para>An easy way to download all of the packages and patches is by using
  <ulink url="../wget-list">wget-list</ulink> as an input to
  <command>wget</command>. For example:</para-->
  <para>一个简便地下载所有软件包和补丁的方式是使用本书附带的
	  <ulink url="../wget-list">wget-list</ulink> 作为
	  <command>wget</command> 命令的输入。例如：</para>

<screen role="nodump"><userinput>wget --input-file=wget-list --continue --directory-prefix=$LFS/sources</userinput></screen>

  <note><title>译注</title>
	  <para>这些文件分布在国外的不同站点上，可能下载很慢。
		  可以使用一个国内镜像站：</para>
	  <screen role="nodump"><userinput>sed 's@.*/@<replaceable>ftp://mirrors.ustc.edu.cn</replaceable>/lfs/lfs-packages/8.2/@' wget-list |
    wget -i- --continue --directory-prefix=$LFS/sources</userinput></screen>

	  <para>命令中的中国科学技术大学镜像站 (斜体) 可以换成其他镜像站，
		  推荐西安电子科技大学校内用户使用内网镜像站
		  <ulink url="https://linux.xidian.edu.cn/mirrors"/>。</para>
  </note>

  <!--para>Additionally, starting with LFS-7.0, there is a separate file,
  <ulink url="../md5sums">md5sums</ulink>, which can be used to verify that all
  the correct packages are available before proceeding.  Place that file in
  <filename class="directory">$LFS/sources</filename> and run:</para-->
  <para>另外，自 LFS-7.0 以来，本书提供一个单独的文件
	  <ulink url="../md5sums">md5sums</ulink>，用来检查所有软件包的正确性。
	  将该文件复制到<filename class="directory">$LFS/sources</filename>，
	  运行以下命令即可得到检查结果：</para>

<screen role="nodump"><userinput>pushd $LFS/sources
md5sum -c md5sums
popd</userinput></screen>

  <note><title>译注</title>
	  <para><filename>wget-list</filename> 和 <filename>md5sum</filename>
		  文件是 sysvinit 版本和 systemd 版本共用的，
		  下载到的少数几个<quote>多余</quote>软件包属于另一个版本。
	  </para>
  </note>


</sect1>
