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