<?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="ch-scripts-bootscripts" role="wrap" revision="sysv">
  <?dbhtml filename="bootscripts.html"?>

  <sect1info condition="script">
    <productname>lfs-bootscripts</productname>
    <productnumber>&lfs-bootscripts-version;</productnumber>
    <address>&lfs-bootscripts-url;</address>
  </sect1info>

  <title>LFS-Bootscripts-&lfs-bootscripts-version;</title>

  <indexterm zone="ch-scripts-bootscripts">
    <primary sortas="a-Bootscripts">Bootscripts</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <para>LFS-Bootscripts 软件包包含一组在引导和关机过程中，
    启动和停止 LFS 系统的脚本。
    它们的配置文件和自定义引导过程的方法将在后续章节中描述。</para>

    <segmentedlist>
      <segtitle>&buildtime;</segtitle>
      <segtitle>&diskspace;</segtitle>

      <seglistitem>
        <seg>&lfs-bootscripts-ch7-sbu;</seg>
        <seg>&lfs-bootscripts-ch7-du;</seg>
      </seglistitem>
    </segmentedlist>

  </sect2>

  <sect2 role="installation">
    <title>安装 LFS-Bootscripts</title>

    <para>安装该软件包：</para>

<screen><userinput remap="install">make install</userinput></screen>

  </sect2>

  <sect2 id="contents-bootscripts" role="content">
    <title>LFS-Bootscripts 的内容</title>
    <segmentedlist>
      <segtitle>安装的脚本</segtitle>
      <segtitle>安装的目录</segtitle>

      <seglistitem>
        <seg>checkfs, cleanfs, console, functions, halt, ifdown,
        ifup, localnet, modules, mountfs, mountvirtfs, network, rc, reboot,
        sendsignals, setclock, ipv4-static, swap, sysctl, sysklogd, template,
        udev, 以及 udev_retry</seg>
        <seg>/etc/rc.d, /etc/init.d (符号链接), /etc/sysconfig,
        /lib/services, /lib/lsb (符号链接)</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">简要描述</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="checkfs-bootscripts">
        <term><command>checkfs</command></term>
        <listitem>
          <para>在挂载文件系统前检查文件系统完整性
          (日志文件系统和网络文件系统除外)</para>
          <indexterm zone="ch-scripts-bootscripts checkfs-bootscripts">
            <primary sortas="d-checkfs">checkfs</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="cleanfs-bootscripts">
        <term><command>cleanfs</command></term>
        <listitem>
          <para>删除在重启过程中不应保留的文件，例如
          <filename class="directory">/var/run/</filename> 和
		  <filename class="directory">/var/lock/</filename> 中的文件；
		  重新创建
          <filename>/var/run/utmp</filename> 并删除可能存在的
          <filename>/etc/nologin</filename>, <filename>/fastboot</filename>,
          以及 <filename>/forcefsck</filename> 文件</para>
          <indexterm zone="ch-scripts-bootscripts cleanfs-bootscripts">
            <primary sortas="d-cleanfs">cleanfs</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="console-bootscripts">
        <term><command>console</command></term>
        <listitem>
          <para>加载用户希望使用的键盘布局对应的键映射表，
          并加载屏幕字体</para>
          <indexterm zone="ch-scripts-bootscripts console-bootscripts">
            <primary sortas="d-console">console</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="functions-bootscripts">
        <term><command>functions</command></term>
        <listitem>
          <para>包含若干启动脚本使用的错误处理和状态检查等脚本</para>
          <indexterm zone="ch-scripts-bootscripts functions-bootscripts">
            <primary sortas="d-functions">functions</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="halt-bootscripts">
        <term><command>halt</command></term>
        <listitem>
          <para>停止系统运行</para>
          <indexterm zone="ch-scripts-bootscripts halt-bootscripts">
            <primary sortas="d-halt">halt</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="ifdown-bootscripts">
        <term><command>ifdown</command></term>
        <listitem>
          <para>停用网络设备</para>
          <indexterm zone="ch-scripts-bootscripts ifdown-bootscripts">
            <primary sortas="d-ifdown">ifdown</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="ifup-bootscripts">
        <term><command>ifup</command></term>
        <listitem>
          <para>启用网络设备</para>
          <indexterm zone="ch-scripts-bootscripts ifup-bootscripts">
            <primary sortas="d-ifup">ifup</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="localnet-bootscripts">
        <term><command>localnet</command></term>
        <listitem>
          <para>设置系统主机名和本地回环设备</para>
          <indexterm zone="ch-scripts-bootscripts localnet-bootscripts">
            <primary sortas="d-localnet">localnet</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="modules-bootscripts">
        <term><command>modules</command></term>
        <listitem>
          <para>加载
          <filename>/etc/sysconfig/modules</filename> 中指定的模块，
          并在加载过程中使用该文件中给定的参数</para>
          <indexterm zone="ch-scripts-bootscripts modules-bootscripts">
            <primary sortas="d-modules">modules</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="mountfs-bootscripts">
        <term><command>mountfs</command></term>
        <listitem>
          <para>挂载所有文件系统，标为
          <emphasis>noauto</emphasis> 的文件系统和网络文件系统除外</para>
          <indexterm zone="ch-scripts-bootscripts mountfs-bootscripts">
            <primary sortas="d-mountfs">mountfs</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="mountvirtfs-bootscripts">
        <term><command>mountvirtfs</command></term>
        <listitem>
          <para>挂载 <systemitem
          class="filesystem">proc</systemitem> 等虚拟内核文件系统</para>
          <indexterm zone="ch-scripts-bootscripts mountvirtfs-bootscripts">
            <primary sortas="d-mountvirtfs">mountvirtfs</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="network-bootscripts">
        <term><command>network</command></term>
        <listitem>
          <para>设定网卡等网络接口，并（在可能的情况下）设定默认网关</para>
          <indexterm zone="ch-scripts-bootscripts network-bootscripts">
            <primary sortas="d-network">network</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="rc-bootscripts">
        <term><command>rc</command></term>
        <listitem>
          <para>主要运行级别控制脚本；
          它负责逐个运行所有其他脚本，
          运行的顺序根据脚本符号链接的名称确定</para>
          <indexterm zone="ch-scripts-bootscripts rc-bootscripts">
            <primary sortas="d-rc">rc</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="reboot-bootscripts">
        <term><command>reboot</command></term>
        <listitem>
          <para>重启系统</para>
          <indexterm zone="ch-scripts-bootscripts reboot-bootscripts">
            <primary sortas="d-reboot">reboot</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="sendsignals-bootscripts">
        <term><command>sendsignals</command></term>
        <listitem>
          <para>确认在系统重启或停止运行前，所有进程已经终止</para>
          <indexterm zone="ch-scripts-bootscripts sendsignals-bootscripts">
            <primary sortas="d-sendsignals">sendsignals</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="setclock-bootscripts">
        <term><command>setclock</command></term>
        <listitem>
          <para>在硬件时钟没有设定为 UTC 时，将内核时钟重设为本地时间</para>
          <indexterm zone="ch-scripts-bootscripts setclock-bootscripts">
            <primary sortas="d-setclock">setclock</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="ipv4-static-bootscripts">
        <term><command>ipv4-static</command></term>
        <listitem>
          <para>提供为网络接口分配静态网际互联协议（IP）地址的功能</para>
          <indexterm zone="ch-scripts-bootscripts ipv4-static-bootscripts">
            <primary sortas="d-ipv4-static">ipv4-static</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="swap-bootscripts">
        <term><command>swap</command></term>
        <listitem>
          <para>启用或禁用交换空间</para>
          <indexterm zone="ch-scripts-bootscripts swap-bootscripts">
            <primary sortas="d-swap">swap</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="sysctl-bootscripts">
        <term><command>sysctl</command></term>
        <listitem>
          <para>如果
          <filename>/etc/sysctl.conf</filename> 存在，
          将其中的系统配置选项值加载到内核</para>
          <indexterm zone="ch-scripts-bootscripts sysctl-bootscripts">
            <primary sortas="d-sysctl">sysctl</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="sysklogd-bootscripts">
        <term><command>sysklogd</command></term>
        <listitem>
          <para>启动或停止系统与内核日志守护进程</para>
          <indexterm zone="ch-scripts-bootscripts sysklogd-bootscripts">
            <primary sortas="d-sysklogd">sysklogd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="template-bootscripts">
        <term><command>template</command></term>
        <listitem>
          <para>为其他守护进程创建自定义启动脚本的模板</para>
          <indexterm zone="ch-scripts-bootscripts template-bootscripts">
            <primary sortas="d-template">template</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="udev-bootscripts">
        <term><command>udev</command></term>
        <listitem>
          <para>准备 <filename class="directory">/dev</filename>
          目录，并启动 udev</para>
          <indexterm zone="ch-scripts-bootscripts udev-bootscripts">
            <primary sortas="d-udev">udev</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="udev-retry-bootscripts">
        <term><command>udev_retry</command></term>
        <listitem>
          <para>重试失败的 udev 事件，如果必要的话，将生成的规则从
          <filename class="directory">/run/udev</filename> 拷贝到
          <filename class="directory">/etc/udev/rules.d</filename></para>
          <indexterm zone="ch-scripts-bootscripts udev-retry-bootscripts">
            <primary sortas="d-udev-retry">udev_retry</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
