findutils.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-findutils" role="wrap">
  8. <?dbhtml filename="findutils.html"?>
  9. <sect1info condition="script">
  10. <productname>findutils</productname>
  11. <productnumber>&findutils-version;</productnumber>
  12. <address>&findutils-url;</address>
  13. </sect1info>
  14. <title>Findutils-&findutils-version;</title>
  15. <indexterm zone="ch-system-findutils">
  16. <primary sortas="a-Findutils">Findutils</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>Findutils 软件包包含用于查找文件的程序。
  21. 这些程序能够递归地搜索目录树,以及创建、维护和搜索数据库
  22. (一般比递归搜索快,但在数据库最近没有更新时不可靠)。</para>
  23. <segmentedlist>
  24. <segtitle>&buildtime;</segtitle>
  25. <segtitle>&diskspace;</segtitle>
  26. <seglistitem>
  27. <seg>&findutils-ch6-sbu;</seg>
  28. <seg>&findutils-ch6-du;</seg>
  29. </seglistitem>
  30. </segmentedlist>
  31. </sect2>
  32. <sect2 role="installation">
  33. <title>安装 Findutils</title>
  34. <!-- this has been fixed in upstream gnulib, when a new version of
  35. findutils is released, please check #4055 to see if the change has been
  36. picked up in this package -->
  37. <para>首先,禁用一个在某些机器上会无限循环的测试:</para>
  38. <screen><userinput remap="pre">sed -i 's/test-lock..EXEEXT.//' tests/Makefile.in</userinput></screen>
  39. <para>然后,进行 glibc-2.28 要求的一些修补:</para>
  40. <screen><userinput remap="pre">sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c
  41. sed -i '/unistd/a #include &lt;sys/sysmacros.h&gt;' gl/lib/mountlist.c
  42. echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h</userinput></screen>
  43. <para>准备安装 Findutils:</para>
  44. <screen><userinput remap="configure">./configure --prefix=/usr --localstatedir=/var/lib/locate</userinput></screen>
  45. <variablelist>
  46. <title>配置选项的含义:</title>
  47. <varlistentry>
  48. <term><parameter>--localstatedir</parameter></term>
  49. <listitem>
  50. <para>该选项将 <command>locate</command>
  51. 数据库的位置改为
  52. <filename class="directory">/var/lib/locate</filename>,
  53. 以与 FHS 兼容。
  54. </para>
  55. </listitem>
  56. </varlistentry>
  57. </variablelist>
  58. <para>编译该软件包:</para>
  59. <screen><userinput remap="make">make</userinput></screen>
  60. <para>运行以下命令以测试编译结果:</para>
  61. <screen><userinput remap="test">make check</userinput></screen>
  62. <para>安装该软件包:</para>
  63. <screen><userinput remap="install">make install</userinput></screen>
  64. <para revision="sysv">LFS-Bootscripts 软件包中的某些脚本依赖于
  65. <command>find</command>。由于
  66. <filename class="directory">/usr</filename>
  67. 在引导早期阶段可能不可用,需要将这个程序移动到根分区。
  68. <command>updatedb</command> 脚本也需要进行修改,
  69. 以修正一个显式指定的路径:</para>
  70. <para revision="systemd"> BLFS 及 BLFS 之外的一些软件包预期
  71. <command>find</command> 程序在 <filename
  72. class="directory">/bin</filename> 中,因此要保证它被放置在那里:</para>
  73. <screen><userinput remap="install">mv -v /usr/bin/find /bin
  74. sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb</userinput></screen>
  75. </sect2>
  76. <sect2 id="contents-findutils" role="content">
  77. <title>Findutils 的内容</title>
  78. <segmentedlist>
  79. <segtitle>安装的程序</segtitle>
  80. <seglistitem>
  81. <seg>code, find, locate, oldfind, updatedb, 以及 xargs</seg>
  82. </seglistitem>
  83. </segmentedlist>
  84. <variablelist>
  85. <bridgehead renderas="sect3">简要描述</bridgehead>
  86. <?dbfo list-presentation="list"?>
  87. <?dbhtml list-presentation="table"?>
  88. <varlistentry id="code">
  89. <term><command>code</command></term>
  90. <listitem>
  91. <para>曾经被用于创建 <command>locate</command>
  92. 数据库;是 <command>frcode</command> 的前身</para>
  93. <indexterm zone="ch-system-findutils code">
  94. <primary sortas="b-code">code</primary>
  95. </indexterm>
  96. </listitem>
  97. </varlistentry>
  98. <varlistentry id="find">
  99. <term><command>find</command></term>
  100. <listitem>
  101. <para>在给定目录树中搜索满足给定条件的文件</para>
  102. <indexterm zone="ch-system-findutils find">
  103. <primary sortas="b-find">find</primary>
  104. </indexterm>
  105. </listitem>
  106. </varlistentry>
  107. <varlistentry id="locate">
  108. <term><command>locate</command></term>
  109. <listitem>
  110. <para>在文件名数据库中进行搜索,
  111. 报告包含特定字符串或匹配特定模式的文件名</para>
  112. <indexterm zone="ch-system-findutils locate">
  113. <primary sortas="b-locate">locate</primary>
  114. </indexterm>
  115. </listitem>
  116. </varlistentry>
  117. <varlistentry id="oldfind">
  118. <term><command>oldfind</command></term>
  119. <listitem>
  120. <para>旧版的 find ,使用不同的算法</para>
  121. <indexterm zone="ch-system-findutils oldfind">
  122. <primary sortas="b-oldfind">oldfind</primary>
  123. </indexterm>
  124. </listitem>
  125. </varlistentry>
  126. <varlistentry id="updatedb">
  127. <term><command>updatedb</command></term>
  128. <listitem>
  129. <para>更新 <command>locate</command> 数据库;
  130. 它扫描整个文件系统(包括当前挂载的其他文件系统,
  131. 除非被告知不这样做),并把找到的所有文件名加入数据库</para>
  132. <indexterm zone="ch-system-findutils updatedb">
  133. <primary sortas="b-updatedb">updatedb</primary>
  134. </indexterm>
  135. </listitem>
  136. </varlistentry>
  137. <varlistentry id="xargs">
  138. <term><command>xargs</command></term>
  139. <listitem>
  140. <para>可以将给定命令作用于一个列表中的所有文件</para>
  141. <indexterm zone="ch-system-findutils xargs">
  142. <primary sortas="b-xargs">xargs</primary>
  143. </indexterm>
  144. </listitem>
  145. </varlistentry>
  146. </variablelist>
  147. </sect2>
  148. </sect1>