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 | <!-- <!ENTITY which-download-http "http://www.xs4all.nl/~carlo17/which/which-&which-version;.tar.gz">-->
|
---|
8 |
|
---|
9 | <!ENTITY which-download-http "&gnu-http;/which/which-&which-version;.tar.gz">
|
---|
10 | <!ENTITY which-download-ftp " ">
|
---|
11 | <!ENTITY which-md5sum "097ff1a324ae02e0a3b0369f07a7544a">
|
---|
12 | <!ENTITY which-size "148 KB">
|
---|
13 | <!ENTITY which-buildsize "1 MB">
|
---|
14 | <!ENTITY which-time "less than 0.1 SBU">
|
---|
15 | ]>
|
---|
16 |
|
---|
17 | <sect1 id="which" xreflabel="Which-&which-version;">
|
---|
18 | <?dbhtml filename="which.html"?>
|
---|
19 |
|
---|
20 |
|
---|
21 | <title>Which-&which-version; and Alternatives</title>
|
---|
22 |
|
---|
23 | <para>
|
---|
24 | The presence or absence of the <command>which</command> program in the
|
---|
25 | main LFS book is probably one of the most contentious issues on the
|
---|
26 | mailing lists. It has resulted in at least one flame war in the past. To
|
---|
27 | hopefully put an end to this once and for all, presented here are two
|
---|
28 | options for equipping your system with <command>which</command>. The
|
---|
29 | question of which <quote><command>which</command></quote> is for you to
|
---|
30 | decide.
|
---|
31 | </para>
|
---|
32 |
|
---|
33 | <indexterm zone="which">
|
---|
34 | <primary sortas="a-Which">Which</primary>
|
---|
35 | </indexterm>
|
---|
36 |
|
---|
37 | <sect2 role="package">
|
---|
38 | <title>Introduction to GNU Which</title>
|
---|
39 |
|
---|
40 | <para>
|
---|
41 | The first option is to install the actual GNU
|
---|
42 | <application>which</application> package.
|
---|
43 | </para>
|
---|
44 |
|
---|
45 | &lfs122_checked;
|
---|
46 |
|
---|
47 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
48 | <itemizedlist spacing="compact">
|
---|
49 | <listitem>
|
---|
50 | <para>
|
---|
51 | Download (HTTP): <ulink url="&which-download-http;"/>
|
---|
52 | </para>
|
---|
53 | </listitem>
|
---|
54 | <listitem>
|
---|
55 | <para>
|
---|
56 | Download (FTP): <ulink url="&which-download-ftp;"/>
|
---|
57 | </para>
|
---|
58 | </listitem>
|
---|
59 | <listitem>
|
---|
60 | <para>
|
---|
61 | Download MD5 sum: &which-md5sum;
|
---|
62 | </para>
|
---|
63 | </listitem>
|
---|
64 | <listitem>
|
---|
65 | <para>
|
---|
66 | Download size: &which-size;
|
---|
67 | </para>
|
---|
68 | </listitem>
|
---|
69 | <listitem>
|
---|
70 | <para>
|
---|
71 | Estimated disk space required: &which-buildsize;
|
---|
72 | </para>
|
---|
73 | </listitem>
|
---|
74 | <listitem>
|
---|
75 | <para>
|
---|
76 | Estimated build time: &which-time;
|
---|
77 | </para>
|
---|
78 | </listitem>
|
---|
79 | </itemizedlist>
|
---|
80 |
|
---|
81 | </sect2>
|
---|
82 |
|
---|
83 | <sect2 role="installation">
|
---|
84 | <title>Installation of Which</title>
|
---|
85 |
|
---|
86 | <para>
|
---|
87 | Install <application>which</application> by running the following
|
---|
88 | commands:
|
---|
89 | </para>
|
---|
90 |
|
---|
91 | <screen><userinput>./configure --prefix=/usr &&
|
---|
92 | make</userinput></screen>
|
---|
93 |
|
---|
94 | <para>
|
---|
95 | This package does not come with a test suite.
|
---|
96 | </para>
|
---|
97 |
|
---|
98 | <para>
|
---|
99 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
100 | </para>
|
---|
101 |
|
---|
102 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
103 |
|
---|
104 | </sect2>
|
---|
105 |
|
---|
106 | <sect2 role="content">
|
---|
107 | <title>Contents</title>
|
---|
108 |
|
---|
109 | <segmentedlist>
|
---|
110 | <segtitle>Installed Program</segtitle>
|
---|
111 | <segtitle>Installed Libraries</segtitle>
|
---|
112 | <segtitle>Installed Directories</segtitle>
|
---|
113 |
|
---|
114 | <seglistitem>
|
---|
115 | <seg>which</seg>
|
---|
116 | <seg>None</seg>
|
---|
117 | <seg>None</seg>
|
---|
118 | </seglistitem>
|
---|
119 | </segmentedlist>
|
---|
120 |
|
---|
121 | <variablelist>
|
---|
122 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
123 | <?dbfo list-presentation="list"?>
|
---|
124 | <?dbhtml list-presentation="table"?>
|
---|
125 |
|
---|
126 | <varlistentry id="which-prog">
|
---|
127 | <term><command>which</command></term>
|
---|
128 | <listitem>
|
---|
129 | <para>
|
---|
130 | shows the full path of (shell) commands installed in your
|
---|
131 | <envar>PATH</envar>
|
---|
132 | </para>
|
---|
133 | <indexterm zone="which which-prog">
|
---|
134 | <primary sortas="b-which">which</primary>
|
---|
135 | </indexterm>
|
---|
136 | </listitem>
|
---|
137 | </varlistentry>
|
---|
138 |
|
---|
139 | </variablelist>
|
---|
140 |
|
---|
141 | </sect2>
|
---|
142 |
|
---|
143 | <sect2 role="installation">
|
---|
144 | <title>The 'which' Script</title>
|
---|
145 |
|
---|
146 | <para>
|
---|
147 | The second option (for those who don't want to install the package)
|
---|
148 | is to create a simple script (execute as the
|
---|
149 | <systemitem class="username">root</systemitem> user):
|
---|
150 | </para>
|
---|
151 |
|
---|
152 | <screen role="root"><userinput>cat > /usr/bin/which << "EOF"
|
---|
153 | <literal>#!/bin/bash
|
---|
154 | type -pa "$@" | head -n 1 ; exit ${PIPESTATUS[0]}</literal>
|
---|
155 | EOF
|
---|
156 | chmod -v 755 /usr/bin/which
|
---|
157 | chown -v root:root /usr/bin/which</userinput></screen>
|
---|
158 |
|
---|
159 | <para>
|
---|
160 | This should work OK and is probably the easiest solution
|
---|
161 | for most cases, but is not the most comprehensive implementation.
|
---|
162 | </para>
|
---|
163 |
|
---|
164 | </sect2>
|
---|
165 |
|
---|
166 | </sect1>
|
---|