1 | <!--DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook V4.2//EN"--> |
---|
2 | <!-- Time-stamp: <07/09/29 22:57:25 ruby11> --> |
---|
3 | |
---|
4 | <chapter id="update-alternatives"> |
---|
5 | <title>update-alternatives による標準コマンドの切り替え</title> |
---|
6 | |
---|
7 | <!--chapterinfo> |
---|
8 | <author> |
---|
9 | <firstname>Takuya</firstname> |
---|
10 | <surname>Kobayashi</surname> |
---|
11 | </author> |
---|
12 | |
---|
13 | <abstract> |
---|
14 | <para> |
---|
15 | ここでは alternatives について記述します。 |
---|
16 | update-alternatives コマンドの display, list, config, set, all などの基本的な操作だけでなく、 |
---|
17 | alternatives の仕組みと install, remove, remove-all の利用例についても扱うこととします。 |
---|
18 | </para> |
---|
19 | </abstract> |
---|
20 | |
---|
21 | <pubdate>2007/9/29</pubdate> |
---|
22 | </chapterinfo--> |
---|
23 | |
---|
24 | |
---|
25 | <sect1 id="update-alternatives-1"> |
---|
26 | <title>機能の重複するプログラム</title> |
---|
27 | <para>いくつかのプログラムには、同様の機能をもったプログラムが複数用意されている場合があります。</para> |
---|
28 | <para>これらの中には、複数のものを同時にインストールしておけるものがあります。</para> |
---|
29 | |
---|
30 | <para>バージョンの異なるものを同時に複数インストールしておけるものでは、gcc のようなプログラムがあり、gcc,gcc4,gcc295 といったrpmパッケージがあります。</para> |
---|
31 | |
---|
32 | <para>また、ある程度同等な機能をもつものとしては <ulink url="vine-cups.html">cups</ulink> と <ulink url="vine-lprng.html">LPRng</ulink> のようなものがあります。</para> |
---|
33 | |
---|
34 | <para>ほかにも様々なものがあります。そうしたrpmパッケージの一覧は <xref linkend="alternatives-packages" /> を見てください。</para> |
---|
35 | |
---|
36 | <para>複数のプログラムをインストールしてある時に、どれをシステムの標準とするか、決定、選択、切り替えを行うために alternatives という仕組みがあります。</para> |
---|
37 | |
---|
38 | <para>この章では、alternatives の仕組みと、パッケージ alternatives に含まれている update-alternatives コマンドの利用方法を扱います。</para> |
---|
39 | |
---|
40 | <para>alternatives というパッケージは、cups など、切り替え可能なrpmパッケージが一つでもインストールされていればすでにインストールされているはずですが、インストールされていない場合には、スーパーユーザ(root)でインストールしてください。参照 <ulink url="inst_apps.html">パート III. アプリケーションの追加や削除</ulink> |
---|
41 | <screen># apt-get install alternatives</screen></para> |
---|
42 | |
---|
43 | <para>update-alternatives コマンドのマニュアルに日本語での詳細な説明があるので読んでください。 |
---|
44 | <screen>$ jman update-alternatives</screen></para> |
---|
45 | |
---|
46 | </sect1> |
---|
47 | |
---|
48 | |
---|
49 | <sect1 id="update-alternatives-2"> |
---|
50 | <title>alternatives の仕組み</title> |
---|
51 | <para>alternatives は、既存のファイルに新しい名前をつけて利用できるようにするシステムです。</para> |
---|
52 | <para>いくつかのファイルを同じ名前の元に登録すれば、切り替えられるようにすることができます。</para> |
---|
53 | |
---|
54 | <itemizedlist> |
---|
55 | <listitem><para>節目次</para> |
---|
56 | <itemizedlist> |
---|
57 | <listitem><xref linkend="word-and-directionay" /></listitem> |
---|
58 | <listitem><xref linkend="word_and_directory_explanation2_with_figure" /></listitem> |
---|
59 | <listitem><xref linkend="example_of_gcc" /></listitem> |
---|
60 | <listitem><xref linkend="master_link_and_slave_link" /></listitem> |
---|
61 | <listitem><xref linkend="state_information" /></listitem> |
---|
62 | <listitem><xref linkend="state_information_of_gcc" /></listitem> |
---|
63 | </itemizedlist> |
---|
64 | </listitem> |
---|
65 | </itemizedlist> |
---|
66 | |
---|
67 | <sect2 id="word-and-directionay"> |
---|
68 | <title>用語とディレクトリ</title> |
---|
69 | <para>alternative には仕組みを理解する上で必要となる 5つの用語と 2つのディレクトリ があります。</para> |
---|
70 | |
---|
71 | <itemizedlist> |
---|
72 | <listitem><para>用語</para> |
---|
73 | <itemizedlist> |
---|
74 | <listitem><para>総称名 generic name</para></listitem> |
---|
75 | <listitem><para>リンク名 link name</para></listitem> |
---|
76 | <listitem><para>選択候補 alternative</para></listitem> |
---|
77 | <listitem><para>優先度 priotity</para></listitem> |
---|
78 | <listitem><para>モード mode</para></listitem> |
---|
79 | </itemizedlist> |
---|
80 | </listitem> |
---|
81 | <listitem><para>ディレクトリ</para> |
---|
82 | <itemizedlist> |
---|
83 | <listitem><para><emphasis>alternatives directory</emphasis></para></listitem> |
---|
84 | <listitem><para><emphasis>administrative directory</emphasis></para></listitem> |
---|
85 | </itemizedlist> |
---|
86 | </listitem> |
---|
87 | </itemizedlist> |
---|
88 | |
---|
89 | <sect3 id="word_and_directory_explanation1"> |
---|
90 | |
---|
91 | <para><emphasis>総称名 generic name</emphasis> は、リンク名、選択候補、優先度、モードなどを一つのグループとして管理するための <emphasis>グループの名前</emphasis> です。</para> |
---|
92 | |
---|
93 | <para><emphasis>リンク名 link name</emphasis> は、alternatives によって作られる、新しい名前 です。この名前で、シンボリックリンクファイル<footnote><para>symbolic link file:他のファイル、ディレクトリを参照する形式のファイル</para></footnote>が作られ、一般的なコマンド、ファイルと同じように利用されることになります。</para> |
---|
94 | |
---|
95 | <para><emphasis>選択候補 alternative</emphasis> は、既存のファイル、実際のファイルです。「本体」といった感じのものになります。リンク名 で作られるファイルは最終的にこのファイルを参照することになります。</para> |
---|
96 | |
---|
97 | <para>選択候補ごとに、<emphasis>優先度 priority</emphasis> があります。数字で設定され、選択候補が複数ある場合には、数字の大きなものほど優先されます。</para> |
---|
98 | |
---|
99 | <para>優先度に従うかどうかを決める <emphasis>モード mode</emphasis> があります。モードには、パッケージの追加や削除などで、選択候補が追加されたり削除された時に、優先度が高いものに自動的に切り替わる <emphasis>auto</emphasis>(matic mode) と、すでに設定したもので固定しておく <emphasis>manual</emphasis>( mode) というものがあります。</para> |
---|
100 | <para>標準では、自動的に切り替える auto になっています。</para> |
---|
101 | |
---|
102 | <para><emphasis>alternatives directory</emphasis> は、どの候補を選択するかといった切り替えに利用するディレクトリです。Vine Linux では /etc/alternatives が利用されます。</para> |
---|
103 | |
---|
104 | <para><emphasis>administrative directory</emphasis> には、総称名ごとに、モード、リンク名、選択候補、優先度の情報が保存されます。Vine Linux では /var/lib/rpm/alternatives が利用されます。</para> |
---|
105 | <para>ここにあるファイルの中身については<xref linkend="state_information" />で説明します。</para> |
---|
106 | |
---|
107 | |
---|
108 | <para><ulink url="update-alternatives-3.html">update-alternatives コマンド</ulink>で切り替える時には 総称名 と 選択候補 を利用します。</para> |
---|
109 | |
---|
110 | <para>リンク名以外は alternatives という仕組みの中で利用されるものです。</para> |
---|
111 | |
---|
112 | <note><title>ノート</title> |
---|
113 | <para>一般的にシステムごとの設定ファイルなどは /etc/ というディレクトリ以下におかれて管理されるので、alternatives は /usr/bin/ にあるコマンドを直接変更するのではなく、/etc/alternatives 以下を経由して変更を行うようになっています。</para> |
---|
114 | |
---|
115 | <para>また、優先度などの情報は、パッケージのインストールやアンインストールなどで、選択候補が増えたり減ったり動的に変化するために、/var/lib/rpm/alternatives 以下におかれます。</para> |
---|
116 | <para>/etc や /var などのディレクトリの配置や意味などについては、FHS(Filesystem Hierarchy Standard)という規格があります。</para> |
---|
117 | </note> |
---|
118 | |
---|
119 | </sect3> |
---|
120 | |
---|
121 | </sect2> |
---|
122 | <sect2 id="word_and_directory_explanation2_with_figure"> |
---|
123 | <title>ファイルのつながり</title> |
---|
124 | <figure id="alternatives-master-only"> |
---|
125 | <graphic fileref="images/alternatives-master-only.png" /> |
---|
126 | <title>alternatives の概念図</title> |
---|
127 | </figure> |
---|
128 | |
---|
129 | <para>リンク名 があります。このファイルは、<emphasis>alternatives directory</emphasis> の中にある、<emphasis>総称名と同じ名前のファイル</emphasis> を参照しています。</para> |
---|
130 | |
---|
131 | <para>総称名 のもとに、2つの<emphasis>選択候補</emphasis> ファイルA と ファイルB が登録されています。</para> |
---|
132 | |
---|
133 | <para>優先度は、A が 20、 B が 10 となっています。</para> |
---|
134 | |
---|
135 | <para><emphasis>総称名と同じ名前のファイル</emphasis> は、優先度の高い ファイルA を参照します。</para> |
---|
136 | |
---|
137 | <para><emphasis>リンク名</emphasis> は <emphasis>総称名と同じ名前のファイル</emphasis> を経由して <emphasis>選択候補</emphasis>ファイルA を参照しています。</para> |
---|
138 | |
---|
139 | <sect3 id="example_of_gcc"> |
---|
140 | <title>gcc の場合</title> |
---|
141 | <para>GCC(GNU Compiler Collection) の、/usr/bin/gcc というコマンドを見てみましょう。</para> |
---|
142 | |
---|
143 | <para>Vine Linux 4.1 では、<xref linkend="gcc-packages" />のように 3つrpmパッケージが用意されています。<footnote><para>C++ をサポートするための gcc-c++ など関連したパッケージも GCC のバージョンごとに用意されています。</para></footnote></para> |
---|
144 | |
---|
145 | <table id="gcc-packages"> |
---|
146 | <title>GCC のパッケージ</title> |
---|
147 | <tgroup cols="4"> |
---|
148 | <thead> |
---|
149 | <row><entry>パッケージ名</entry><entry>GCCのバージョン</entry><entry>gccコマンド</entry><entry>優先度(priority)</entry></row> |
---|
150 | </thead> |
---|
151 | <tbody> |
---|
152 | <row><entry>gcc</entry><entry>3.3.6</entry><entry>/usr/bin/gcc-3.3.6</entry><entry>30</entry></row> |
---|
153 | <row><entry>gcc4</entry><entry>4.0.2</entry><entry>/usr/bin/gcc-4.0.2</entry><entry>20</entry></row> |
---|
154 | <row><entry>gcc295</entry><entry>2.95.3</entry><entry>/usr/bin/gcc-2.95.3</entry><entry>15</entry></row> |
---|
155 | </tbody> |
---|
156 | </tgroup> |
---|
157 | </table> |
---|
158 | |
---|
159 | <para>gcc というコマンドは一般的には /usr/bin/gcc ですが、それぞれのrpmパッケージでは /usr/bin/gcc-3.3.6 , /usr/bin/gcc-4.0.2 , /usr/bin/gcc-2.95.3 というコマンド(ファイル名)になっています。</para> |
---|
160 | <para>そして、alternatives を使って、この中のどれかを /usr/bin/gcc として使えるようにしています。</para> |
---|
161 | |
---|
162 | <figure id="alternatives-master-only-gcc"> |
---|
163 | <graphic fileref="images/alternatives-master-only-gcc.png" /> |
---|
164 | <title>gcc の場合</title> |
---|
165 | </figure> |
---|
166 | |
---|
167 | <para>/usr/bin/gcc があります。このファイルは、<emphasis>/etc/alternatives</emphasis> の中にある、<emphasis>総称名と同じ名前の gcc というファイル</emphasis> を参照しています。 |
---|
168 | <screen>$ file /usr/bin/gcc</screen> |
---|
169 | <screen>/usr/bin/gcc: symbolic link to `/etc/alternatives/gcc'</screen></para> |
---|
170 | |
---|
171 | <para>総称名 gcc のもとに、3つの<emphasis>選択候補</emphasis> /usr/bin/gcc-3.3.6 と /usr/bin/gcc-4.0.2 と /usr/bin/gcc-2.95.3 が登録されています。</para> |
---|
172 | |
---|
173 | <para>優先度は、/usr/bin/gcc-3.3.6 が 30 , /usr/bin/gcc-4.0.2 が 20 , /usr/bin/gcc-2.95.3 が 15 となっています。</para> |
---|
174 | |
---|
175 | <para><emphasis>/etc/alternatives/gcc </emphasis> は、優先度の最も高い /usr/bin/gcc-3.3.6 を参照します。 |
---|
176 | <screen>$ file /etc/alternatives/gcc</screen> |
---|
177 | <screen>/etc/alternatives/gcc: symbolic link to `/usr/bin/gcc-3.3.6'</screen></para> |
---|
178 | |
---|
179 | <para><emphasis>/usr/bin/gcc</emphasis> は <emphasis>/etc/alternatives/gcc</emphasis> を経由して <emphasis>選択候補</emphasis>/usr/bin/gcc-3.3.6 を参照しています。</para> |
---|
180 | </sect3> |
---|
181 | </sect2> |
---|
182 | |
---|
183 | <sect2 id="master_link_and_slave_link"> |
---|
184 | <title>リンクグループ(マスターリンクとスレーブリンク)</title> |
---|
185 | <para>alternatives には、プログラムが変更されたら同時にマニュアルページファイルも切り替える、といったように、複数のものを同時に切り替える仕組みがあります。</para> |
---|
186 | |
---|
187 | <para>総称名1 を切り替えたら、総称名2 のほうも同時に切り替えるというように、複数の総称名をグループ化することで、選択候補を同時に切り替えられるようにすることができます。</para> |
---|
188 | |
---|
189 | <para>基準となる総称名1 をマスターリンク(master link)と呼び、それと同時に変更される総称名2 をスレーブリンク(slave link)と呼びます。</para> |
---|
190 | |
---|
191 | <para>マスターリンクとスレーブリンクを合わせて、リンクグループ(link group)と呼びます。</para> |
---|
192 | |
---|
193 | <para>スレーブリンクは、マスターリンクに合わせて切り替わるものなので、モードと優先度を持ちません。総称名とリンク名と選択候補を持ちます。</para> |
---|
194 | |
---|
195 | <para>スレーブリンクは、<emphasis>無くてもいいもの</emphasis>なので、マスターリンクの選択候補1 にはスレーブリンクがあるけれど、選択候補2 にはスレーブリンクはない、といったようにもできます。全て対応させる必要はありません。</para> |
---|
196 | |
---|
197 | <para>また、スレーブリンクを複数持つこともできます。</para> |
---|
198 | |
---|
199 | <para>マスターリンクとスレーブリンクは、<xref linkend="alternatives-master-slave" />のような関係になります。</para> |
---|
200 | |
---|
201 | <figure id="alternatives-master-slave"> |
---|
202 | <graphic fileref="images/alternatives-master-slave.png" /> |
---|
203 | <title>alternatives の概念図(マスターリンクとスレーブリンク)</title> |
---|
204 | </figure> |
---|
205 | |
---|
206 | <para>総称名1 の選択候補 ファイルA と、総称名2 の選択候補 ファイルa が対応します。</para> |
---|
207 | <para>また、総称名1 の選択候補 ファイルB と、総称名2 の選択候補 ファイルb が対応します。</para> |
---|
208 | |
---|
209 | <para>リンク名1 に ファイルA を選択した時には、リンク名2 が ファイルa になります。</para> |
---|
210 | </sect2> |
---|
211 | |
---|
212 | |
---|
213 | <sect2 id="state_information"> |
---|
214 | <title>administrative directory におかれるファイル</title> |
---|
215 | |
---|
216 | <para><emphasis>administrative directory</emphasis> ( /var/lib/rpm/alternatives/ ) に 総称名と同じ名前のファイルがあり、総称名ごとに、モード、リンク名、選択候補、優先度の情報が保存されます。</para> |
---|
217 | |
---|
218 | <para>書式は次のようになります。</para> |
---|
219 | |
---|
220 | <screen>モード (auto か manual) |
---|
221 | リンク名 (/usr/bin/hoge など) |
---|
222 | 区切りとなる空行 |
---|
223 | 選択候補1 |
---|
224 | 選択候補1の優先度 |
---|
225 | 選択候補2 |
---|
226 | 選択候補2の優先度</screen> |
---|
227 | |
---|
228 | <para>スレーブリンクもある場合には次のような書式になります。</para> |
---|
229 | |
---|
230 | <screen>モード |
---|
231 | master link のリンク名 |
---|
232 | slave link1 の総称名 |
---|
233 | slave link1 のリンク名 |
---|
234 | slave link2 の総称名 |
---|
235 | slave link2 のリンク名 |
---|
236 | 区切りとなる空行 |
---|
237 | master link の選択候補1 |
---|
238 | master link の選択候補1の優先度 |
---|
239 | master link の選択候補1のslave link1の選択候補 |
---|
240 | master link の選択候補1のslave link2の選択候補 |
---|
241 | master link の選択候補2 |
---|
242 | master link の選択候補2の優先度 |
---|
243 | master link の選択候補2のslave link1の選択候補 |
---|
244 | master link の選択候補2のslave link2の選択候補 |
---|
245 | 区切りとなる空行</screen> |
---|
246 | |
---|
247 | <para>スレーブリンクのリンク名など、関連したファイルがどこにあるのかはこのファイルをみるとわかります。</para> |
---|
248 | |
---|
249 | <sect3 id="state_information_of_gcc"> |
---|
250 | <title>/var/lib/rpm/alternatives/gcc の場合</title> |
---|
251 | |
---|
252 | <para>/var/lib/rpm/alternatives/gcc は次のように書かれています。</para> |
---|
253 | <screen>auto モード |
---|
254 | /usr/bin/gcc master link のリンク名 |
---|
255 | c99 slave link1 の総称名 |
---|
256 | /usr/bin/c99 slave link1 のリンク名 |
---|
257 | cc slave link2 の総称名 |
---|
258 | /usr/bin/cc slave link2 のリンク名 |
---|
259 | i386-vine-linux-gcc slave link3 の総称名 |
---|
260 | /usr/bin/i386-vine-linux-gcc slave link3 のリンク名 |
---|
261 | c89 slave link4 の総称名 |
---|
262 | /usr/bin/c89 slave link4 のリンク名 |
---|
263 | (区切りとなる空行) |
---|
264 | /usr/bin/gcc-3.3.6 選択候補 1 |
---|
265 | 30 選択候補 1の優先度 |
---|
266 | /usr/bin/c99-3.3.6 選択候補 1のスレーブリンク 1の選択候補 |
---|
267 | /usr/bin/gcc-3.3.6 選択候補 1のスレーブリンク 2の選択候補 |
---|
268 | /usr/bin/i386-vine-linux-gcc-3.3.6 選択候補 1のスレーブリンク 3の選択候補 |
---|
269 | /usr/bin/c89-3.3.6 選択候補 1のスレーブリンク 4の選択候補 |
---|
270 | /usr/bin/gcc-2.95.3 選択候補 2 |
---|
271 | 15 選択候補 2の優先度 |
---|
272 | 選択候補 2のスレーブリンク 1の選択候補 (該当無し) |
---|
273 | /usr/bin/gcc-2.95.3 選択候補 2のスレーブリンク 2の選択候補 |
---|
274 | 選択候補 2のスレーブリンク 3の選択候補 (該当無し) |
---|
275 | 選択候補 2のスレーブリンク 4の選択候補 (該当無し) |
---|
276 | /usr/bin/gcc-4.0.2 選択候補 3 |
---|
277 | 20 選択候補 3の優先度 |
---|
278 | /usr/bin/c99-4.0.2 選択候補 3のスレーブリンク 1の選択候補 |
---|
279 | /usr/bin/gcc-4.0.2 選択候補 3のスレーブリンク 2の選択候補 |
---|
280 | /usr/bin/i386-vine-linux-gcc-4.0.2 選択候補 3のスレーブリンク 3の選択候補 |
---|
281 | /usr/bin/c89-4.0.2 選択候補 3のスレーブリンク 4の選択候補 |
---|
282 | (区切りとなる空行)</screen> |
---|
283 | </sect3> |
---|
284 | </sect2> |
---|
285 | |
---|
286 | </sect1> |
---|
287 | |
---|
288 | <sect1 id="update-alternatives-3"> |
---|
289 | <title>update-alternatives コマンドの使い方</title> |
---|
290 | |
---|
291 | <para>update-alternatives コマンドの利用方法を扱います。</para> |
---|
292 | <para>現在の設定を確認する方法、切り替える方法を扱います。</para> |
---|
293 | <para>登録と削除に関しては実際には次節で扱います。</para> |
---|
294 | |
---|
295 | <itemizedlist> |
---|
296 | <listitem><para>節目次</para> |
---|
297 | <itemizedlist> |
---|
298 | <listitem><xref linkend="common_options" /></listitem> |
---|
299 | <listitem><xref linkend="option_--list" /></listitem> |
---|
300 | <listitem><xref linkend="option_--display" /></listitem> |
---|
301 | <listitem><xref linkend="option_--config_--all_--set_--auto" /> |
---|
302 | <itemizedlist> |
---|
303 | <listitem><xref linkend="option_--config" /></listitem> |
---|
304 | <listitem><xref linkend="option_--all" /></listitem> |
---|
305 | <listitem><xref linkend="option_--set" /></listitem> |
---|
306 | <listitem><xref linkend="option_--auto" /></listitem> |
---|
307 | </itemizedlist> |
---|
308 | </listitem> |
---|
309 | <listitem><xref linkend="update-alternatives-4" /> |
---|
310 | <itemizedlist> |
---|
311 | <listitem><xref linkend="option_--install" /></listitem> |
---|
312 | <listitem><xref linkend="option_--slave" /></listitem> |
---|
313 | <listitem><xref linkend="option_--remove" /></listitem> |
---|
314 | <listitem><xref linkend="option_--remove-all" /></listitem> |
---|
315 | </itemizedlist> |
---|
316 | </listitem> |
---|
317 | </itemizedlist> |
---|
318 | </listitem> |
---|
319 | </itemizedlist> |
---|
320 | |
---|
321 | <sect2 id="common_options"> |
---|
322 | <title>オプション</title> |
---|
323 | <para>--help や --version というオプションを使うとバージョン情報とヘルプメッセージを表示します。</para> |
---|
324 | |
---|
325 | <screen>$ /sbin/update-alternatives <emphasis>--help</emphasis></screen> |
---|
326 | |
---|
327 | <para>--verbose というオプションを使うと、メッセージが詳細に表示される場合があります。</para> |
---|
328 | <para>--verbose は、他のオプションと合わせて利用します。</para> |
---|
329 | |
---|
330 | </sect2> |
---|
331 | |
---|
332 | <sect2 id="option_--list"> |
---|
333 | <title>選択候補を確認する</title> |
---|
334 | <para>選択候補を表示するには --list というオプションを用います。</para> |
---|
335 | |
---|
336 | <screen>$ /sbin/update-alternatives <emphasis>--list</emphasis> 総称名</screen> |
---|
337 | |
---|
338 | <para>これは変更するのではなく表示するだけなので一般ユーザーで実行できます。</para> |
---|
339 | |
---|
340 | <screen>$ /sbin/update-alternatives <emphasis>--list</emphasis> gcc</screen> |
---|
341 | <screen>/usr/bin/gcc-3.3.6 |
---|
342 | /usr/bin/gcc-2.95.3 |
---|
343 | /usr/bin/gcc-4.0.2</screen> |
---|
344 | |
---|
345 | <para>総称名 gcc に対して選択候補が 3つあることがわかります。</para> |
---|
346 | </sect2> |
---|
347 | |
---|
348 | <sect2 id="option_--display"> |
---|
349 | <title>現在の設定を確認する</title> |
---|
350 | <para>現在の設定を確認するには --display というオプションを用います。</para> |
---|
351 | |
---|
352 | <screen>$ /sbin/update-alternatives <emphasis>--display</emphasis> 総称名</screen> |
---|
353 | |
---|
354 | <para>これも一般ユーザーで実行できます。</para> |
---|
355 | |
---|
356 | <screen>$ /sbin/update-alternatives <emphasis>--display</emphasis> gcc</screen> |
---|
357 | <screen>1 <emphasis>gcc</emphasis> - <emphasis>status is auto</emphasis>. |
---|
358 | 2 link currently points to <emphasis>/usr/bin/gcc-3.3.6</emphasis> |
---|
359 | 3 <emphasis>/usr/bin/gcc-3.3.6</emphasis> - <emphasis>priority 30</emphasis> |
---|
360 | 4 slave c99: /usr/bin/c99-3.3.6 |
---|
361 | 5 slave cc: /usr/bin/gcc-3.3.6 |
---|
362 | 6 slave i386-vine-linux-gcc: /usr/bin/i386-vine-linux-gcc-3.3.6 |
---|
363 | 7 slave c89: /usr/bin/c89-3.3.6 |
---|
364 | 8 <emphasis>/usr/bin/gcc-2.95.3</emphasis> - <emphasis>priority 15</emphasis> |
---|
365 | 9 slave cc: /usr/bin/gcc-2.95.3 |
---|
366 | 10 <emphasis>/usr/bin/gcc-4.0.2</emphasis> - <emphasis>priority 20</emphasis> |
---|
367 | 11 <emphasis>slave c99</emphasis>: /usr/bin/c99-4.0.2 |
---|
368 | 12 <emphasis>slave cc</emphasis>: /usr/bin/gcc-4.0.2 |
---|
369 | 13 <emphasis>slave i386-vine-linux-gcc</emphasis>: /usr/bin/i386-vine-linux-gcc-4.0.2 |
---|
370 | 14 <emphasis>slave c89</emphasis>: /usr/bin/c89-4.0.2 |
---|
371 | 15 <emphasis>Current `best' version is /usr/bin/gcc-3.3.6.</emphasis></screen> |
---|
372 | |
---|
373 | <para>説明のために左端に行番号をつけています。</para> |
---|
374 | <para>1行目に総称名 gcc があり、mode の表示があります。status is <emphasis>auto</emphasis>. となっているので、優先度の一番高いものを自動的に選択するという状態です。</para> |
---|
375 | |
---|
376 | <para>2行目に link currently points to <emphasis>/usr/bin/gcc-3.3.6</emphasis> とあり、gcc-3.3.6 が選択されていることがわかります。</para> |
---|
377 | |
---|
378 | <para>manual モードで、選択候補が無いという場合には、 link currently <emphasis>absent</emphasis> となります。</para> |
---|
379 | <para>3,8,10行に<emphasis>優先度(priority)</emphasis>があり、gcc-3.3.6 が 30 , gcc-2.95.3 が 15 , gcc-4.0.2 が 20 となっていることがわかります。</para> |
---|
380 | <para>また、一番下の15行目に Current `best' version is /usr/bin/gcc-3.3.6. とあり、ここでも、優先度が一番高いのは gcc-3.3.6 であるということがわかります。</para> |
---|
381 | |
---|
382 | <para>4〜7,9,11〜14行の slave で指定されているものは、スレーブリンクです。(参照 <xref linkend="master_link_and_slave_link" />)</para> |
---|
383 | |
---|
384 | <para>その上の 3,8,10行にある /usr/bin/gcc-3.3.6 , /usr/bin/gcc-2.95.3 , /usr/bin/gcc-4.0.2 が マスターリンク です。</para> |
---|
385 | |
---|
386 | <para>マスターリンクである /usr/bin/gcc-4.0.2 を選択すると、スレーブリンクである c99,cc,i386-vine-linux-gcc,c89 も選択されたことになり、まとめて切り替えることができます。</para> |
---|
387 | </sect2> |
---|
388 | |
---|
389 | <sect2 id="option_--config_--all_--set_--auto"> |
---|
390 | <title>設定を切り替える</title> |
---|
391 | <para>ここから先の操作は スーパーユーザ(root) で行う必要があります。</para> |
---|
392 | |
---|
393 | <para>優先度が高いものを自動的に利用する、というのではなく選択するには、--config や --all や --set というオプションを用います。</para> |
---|
394 | |
---|
395 | <para>優先度に従い自動的に切り替えるように戻すには、--auto というオプションを用います。</para> |
---|
396 | |
---|
397 | <note> |
---|
398 | <para>rpmパッケージのインストール時に設定された alternatives は、パッケージのアンインストール時に manual( mode) から auto(matic mode) に切り替える処理が行われる場合がありますが、自分で alternatives として登録した場合などは、ファイルが削除されたりしてもモードの切り替えは行われないので、必要に応じて auto に戻したり、どれかを選択したりしてください。</para> |
---|
399 | </note> |
---|
400 | |
---|
401 | <sect3 id="option_--config"> |
---|
402 | <title>対話的に切り替える</title> |
---|
403 | <para>対話的に設定するには、--config というオプションを用います。 |
---|
404 | <screen># /sbin/update-alternatives --config 総称名</screen></para> |
---|
405 | |
---|
406 | <para>/usr/bin/gcc-3.3.6 ではなく /usr/bin/gcc-4.0.2 を利用するようにしてみます。</para> |
---|
407 | <screen># /sbin/update-alternatives --config gcc</screen> |
---|
408 | <screen> |
---|
409 | There are 3 alternatives which provide `gcc'. |
---|
410 | |
---|
411 | Selection Alternative |
---|
412 | ----------------------------------------------- |
---|
413 | *+ 1 /usr/bin/gcc-3.3.6 |
---|
414 | 2 /usr/bin/gcc-2.95.3 |
---|
415 | 3 /usr/bin/gcc-4.0.2 |
---|
416 | |
---|
417 | Press enter to keep the default[*], or type selection number: </screen> |
---|
418 | |
---|
419 | <para>と表示されます。</para> |
---|
420 | <para>* と書かれているものが現在選択されているものです。そのまま利用するのであれば <keycap>Enter</keycap> と入力します。この場合には モード は変更されません。</para> |
---|
421 | |
---|
422 | <para>3 /usr/bin/gcc-4.0.2 とあるので、<keycap>3</keycap> <keycap>Enter</keycap> と入力します。</para> |
---|
423 | <screen>Using `/usr/bin/gcc-4.0.2' to provide `gcc'.</screen> |
---|
424 | <para>と表示されて設定変更が完了しました。</para> |
---|
425 | |
---|
426 | <screen>$ /sbin/update-alternatives --display gcc</screen> |
---|
427 | <screen>gcc - status is manual. |
---|
428 | link currently points to /usr/bin/gcc-4.0.2 |
---|
429 | /usr/bin/gcc-3.3.6 - priority 30 |
---|
430 | slave c99: /usr/bin/c99-3.3.6 |
---|
431 | slave cc: /usr/bin/gcc-3.3.6 |
---|
432 | slave i386-vine-linux-gcc: /usr/bin/i386-vine-linux-gcc-3.3.6 |
---|
433 | slave c89: /usr/bin/c89-3.3.6 |
---|
434 | /usr/bin/gcc-2.95.3 - priority 15 |
---|
435 | slave cc: /usr/bin/gcc-2.95.3 |
---|
436 | /usr/bin/gcc-4.0.2 - priority 20 |
---|
437 | slave c99: /usr/bin/c99-4.0.2 |
---|
438 | slave cc: /usr/bin/gcc-4.0.2 |
---|
439 | slave i386-vine-linux-gcc: /usr/bin/i386-vine-linux-gcc-4.0.2 |
---|
440 | slave c89: /usr/bin/c89-4.0.2 |
---|
441 | Current `best' version is /usr/bin/gcc-3.3.6.</screen> |
---|
442 | |
---|
443 | <para>自分で選択したので一行目が status is <emphasis>manual</emphasis> となりました。</para> |
---|
444 | <para>二行目で link currently points to /usr/bin/gcc-4.0.2 となっていることが確認できます。</para> |
---|
445 | </sect3> |
---|
446 | |
---|
447 | <sect3 id="option_--all"> |
---|
448 | <title>全ての総称名について対話的に切り替える</title> |
---|
449 | <para>--all とすると、すべての 総称名 について順に --config で設定できます。 |
---|
450 | <screen># /sbin/update-alternatives --all</screen></para> |
---|
451 | |
---|
452 | <para><keycap>Enter</keycap> だけ入力していけば、何も変更せずに終了できるので、どんな 総称名 と選択候補 があるのか確認することもできます。</para> |
---|
453 | </sect3> |
---|
454 | |
---|
455 | <sect3 id="option_--set"> |
---|
456 | <title>直接指定して切り替える</title> |
---|
457 | <para>対話的に決定するのではなく、直接指定するには --set というオプションを用います。</para> |
---|
458 | <screen># /sbin/update-alternatives --set 総称名 選択候補</screen> |
---|
459 | |
---|
460 | <screen># /sbin/update-alternatives --set gcc /usr/bin/gcc-4.0.2</screen> |
---|
461 | |
---|
462 | <screen>Using `/usr/bin/gcc-4.0.2' to provide `gcc'.</screen> |
---|
463 | <para>と表示され /usr/bin/gcc-4.0.2 が選択されたことがわかります。</para> |
---|
464 | </sect3> |
---|
465 | |
---|
466 | <sect3 id="option_--auto"> |
---|
467 | <title>automatic modeに戻す</title> |
---|
468 | <para>manual( mode) から auto(matic mode) に戻すには --auto というオプションを用います。</para> |
---|
469 | |
---|
470 | <screen># /sbin/update-alternatives --auto 総称名</screen> |
---|
471 | |
---|
472 | <screen># /sbin/update-alternatives --auto gcc</screen> |
---|
473 | |
---|
474 | <para>特に何も表示されません。</para> |
---|
475 | |
---|
476 | <para><ulink url="update-alternatives-3.html#common_options">--verbose オプション</ulink>を使うと次のように表示されます。</para> |
---|
477 | <screen># /sbin/update-alternatives --verbose --auto gcc</screen> |
---|
478 | <screen>Setting up automatic selection of gcc. |
---|
479 | Checking available versions of gcc, updating links in /etc/alternatives ... |
---|
480 | (You may modify the symlinks there yourself if desired - see `man ln'.) |
---|
481 | Updating gcc (/usr/bin/gcc) to point to /usr/bin/gcc-3.3.6. |
---|
482 | Updating c99 (/usr/bin/c99) to point to /usr/bin/c99-3.3.6. |
---|
483 | Updating cc (/usr/bin/cc) to point to /usr/bin/gcc-3.3.6. |
---|
484 | Updating i386-vine-linux-gcc (/usr/bin/i386-vine-linux-gcc) to point to /usr/bin/i386-vine-linux-gcc-3.3.6. |
---|
485 | Updating c89 (/usr/bin/c89) to point to /usr/bin/c89-3.3.6. |
---|
486 | </screen> |
---|
487 | |
---|
488 | </sect3> |
---|
489 | </sect2> |
---|
490 | </sect1> |
---|
491 | |
---|
492 | <sect1 id="update-alternatives-4"> |
---|
493 | <title>登録と削除</title> |
---|
494 | <para>rpmパッケージであらかじめ設定されているものではなく、自分で 総称名 や 選択候補 を作成することもできます。</para> |
---|
495 | |
---|
496 | <para>登録には --install というオプションを、削除には --remove や --remove-all というオプションを用います。</para> |
---|
497 | |
---|
498 | <para>Editor という 総称名 で jed や vi や emacs を登録してみます。</para> |
---|
499 | |
---|
500 | <itemizedlist> |
---|
501 | <listitem><para>節目次</para> |
---|
502 | <itemizedlist> |
---|
503 | <listitem><xref linkend="option_--install" /> |
---|
504 | <itemizedlist> |
---|
505 | <listitem><xref linkend="--install-editor" /> |
---|
506 | <itemizedlist> |
---|
507 | <listitem><xref linkend="preparation" /></listitem> |
---|
508 | <listitem><xref linkend="--install" /></listitem> |
---|
509 | </itemizedlist> |
---|
510 | </listitem> |
---|
511 | <listitem><xref linkend="option_--slave" /> |
---|
512 | <itemizedlist> |
---|
513 | <listitem><xref linkend="preparation-for-slave-link" /></listitem> |
---|
514 | <listitem><xref linkend="--install-with--slave-option" /></listitem> |
---|
515 | </itemizedlist> |
---|
516 | </listitem> |
---|
517 | </itemizedlist> |
---|
518 | </listitem> |
---|
519 | <listitem><xref linkend="option_--remove" /> |
---|
520 | <itemizedlist> |
---|
521 | <listitem><xref linkend="--remove_alternatives" /></listitem> |
---|
522 | </itemizedlist> |
---|
523 | </listitem> |
---|
524 | <listitem><xref linkend="option_--remove-all" /> |
---|
525 | <itemizedlist> |
---|
526 | <listitem><xref linkend="--remove_generic_name" /></listitem> |
---|
527 | </itemizedlist> |
---|
528 | </listitem> |
---|
529 | </itemizedlist> |
---|
530 | </listitem> |
---|
531 | </itemizedlist> |
---|
532 | |
---|
533 | <sect2 id="option_--install"> |
---|
534 | <title>登録する</title> |
---|
535 | |
---|
536 | <para>登録には --install というオプションを用います。</para> |
---|
537 | <screen># /sbin/update-alternatives --install リンク名 総称名 選択候補 優先度</screen> |
---|
538 | |
---|
539 | <para>すでに同じ総称名で選択候補が登録されていた場合、選択候補が追加されることになります。</para> |
---|
540 | <para>優先度か候補を選択することによって、どの候補が用いられるかが決まるので、登録する順番は影響を与えません。</para> |
---|
541 | |
---|
542 | <sect3 id="--install-editor"> |
---|
543 | <title>/usr/bin/editor を作成する</title> |
---|
544 | |
---|
545 | <para>Editor という 総称名 で jed や vi や emacs を登録してみます。</para> |
---|
546 | |
---|
547 | <sect4 id="preparation"> |
---|
548 | <title>登録前の準備</title> |
---|
549 | <para>jed や vi や emacs は jed , vim , emacs というrpmパッケージに含まれています。必要であればインストールしてください。 |
---|
550 | <screen># apt-get install jed vim emacs</screen></para> |
---|
551 | |
---|
552 | <para>総称名を Editor<footnote><para>説明の中で総称名とリンク名を区別しやすくするためにここでは Editor としておきますが、総称名とリンク名を同じものにするほうが一般的かもしれません。</para></footnote>、リンク名は /usr/bin/editor にします。</para> |
---|
553 | |
---|
554 | <para>選択候補を調べます。コマンドがどこにあるかは、which や whereis や type といったコマンドで確認できます。</para> |
---|
555 | |
---|
556 | <note><para>それぞれの使い方は jman which や jman whereis や jman bash 確認してください。type は単独のコマンドファイルではなく bash に組み込まれているものなので jman type ではなく、jman bash になります。</para></note> |
---|
557 | |
---|
558 | <para>この場合はman page(マニュアルページファイル) の場所もわかる whereis が適しています。</para> |
---|
559 | <screen>$ whereis jed vi emacs</screen> |
---|
560 | <screen>jed: <emphasis>/usr/bin/jed</emphasis> /usr/lib/jed <emphasis>/usr/share/man/man1/jed.1.gz</emphasis> |
---|
561 | vi: <emphasis>/bin/vi</emphasis> <emphasis>/usr/share/man/man1p/vi.1p.gz</emphasis> |
---|
562 | emacs: <emphasis>/usr/bin/emacs</emphasis> /usr/lib/emacs /usr/share/emacs</screen> |
---|
563 | |
---|
564 | <para>選択候補は /usr/bin/jed , /bin/vi , /usr/bin/emacs になります。</para> |
---|
565 | <para>また、emacs は man page がありませんが、jed と vi は /usr/share/man/man1/jed.1.gz , /usr/share/man/man1p/vi.1p.gz に man page があることがわかりました。</para> |
---|
566 | |
---|
567 | <para>jed と vi の man page は |
---|
568 | <screen>$ rpm -qf /usr/share/man/man1/jed.1.gz /usr/share/man/man1p/vi.1p.gz</screen> |
---|
569 | <screen>jed-common-0.99.14-0vl6 |
---|
570 | man-pages-2.21-1vl2</screen> |
---|
571 | jed-common と man-pages のrpmパッケージに含まれています。</para> |
---|
572 | |
---|
573 | <para>優先度は /usr/bin/jed を 30、/bin/vi を 20、/usr/bin/emacs を 10 とします。</para> |
---|
574 | |
---|
575 | <para>整理すると<xref linkend="information_of_alternatives_for_editor" />のようになります。</para> |
---|
576 | |
---|
577 | <table id="information_of_alternatives_for_editor"> |
---|
578 | <title>editor の候補</title> |
---|
579 | <tgroup cols="3"> |
---|
580 | <thead> |
---|
581 | <row><entry>選択候補</entry><entry>優先度</entry><entry>man page</entry></row> |
---|
582 | </thead> |
---|
583 | <tbody> |
---|
584 | <row><entry>/usr/bin/jed</entry><entry>30</entry><entry>/usr/share/man/man1/jed.1.gz</entry></row> |
---|
585 | <row><entry>/bin/vi</entry><entry>20</entry><entry>/usr/share/man/man1p/vi.1p.gz</entry></row> |
---|
586 | <row><entry>/usr/bin/emacs</entry><entry>10</entry><entry>無し</entry></row> |
---|
587 | </tbody> |
---|
588 | </tgroup> |
---|
589 | </table> |
---|
590 | </sect4> |
---|
591 | |
---|
592 | <sect4 id="--install"> |
---|
593 | <title>実際に登録する</title> |
---|
594 | <para>ここでは、コマンドだけを登録してみます。</para> |
---|
595 | |
---|
596 | <example id="add_generic-name_Editor"> |
---|
597 | <title>総称名 Editor で jed vi emacs を登録する。</title> |
---|
598 | <para>jed を登録します。 |
---|
599 | <screen># /sbin/update-alternatives --install /usr/bin/editor Editor /usr/bin/jed 30</screen></para> |
---|
600 | <para>vi を登録します。 |
---|
601 | <screen># /sbin/update-alternatives --install /usr/bin/editor Editor /bin/vi 20</screen></para> |
---|
602 | <para>emacs を登録します。 |
---|
603 | <screen># /sbin/update-alternatives --install /usr/bin/editor Editor /usr/bin/emacs 10</screen></para> |
---|
604 | |
---|
605 | <para>これで、Editor として jed vi emacs を登録できました。</para> |
---|
606 | |
---|
607 | <ulink url="update-alternatives-3.html#option_--display">--display オプション</ulink>で確認してみます。 |
---|
608 | <screen>$ /sbin/update-alternatives --display Editor</screen> |
---|
609 | <screen>Editor - status is auto. |
---|
610 | link currently points to /usr/bin/jed |
---|
611 | /usr/bin/emacs - priority 30 |
---|
612 | /bin/vi - priority 20 |
---|
613 | /usr/bin/jed - priority 40 |
---|
614 | Current `best' version is /usr/bin/jed.</screen> |
---|
615 | </example> |
---|
616 | </sect4> |
---|
617 | </sect3> |
---|
618 | |
---|
619 | <sect3 id="option_--slave"> |
---|
620 | <title>スレーブリンクも登録する</title> |
---|
621 | <para>一つだけではなく、他のものも登録するには --install と一緒に --slave というオプションを用います。</para> |
---|
622 | <para>--slave にも --install の時と同じように リンク名 と 総称名 と 選択候補 が必要になります。</para> |
---|
623 | |
---|
624 | <screen># /sbin/update-alternatives --install リンク名1 総称名1 選択候補1 優先度1 \<footnote><para>コマンド入力で一行の文字数が多く途中で改行したい時には <keycap>\</keycap><keycap>Enter</keycap> を使います。通常<keycap>Enter</keycap>を押すと、コマンドの入力が終わったものとして解釈されますが、<keycap>\</keycap><keycap>Enter</keycap> とするとただの改行として扱われ、次の行に続きを入力できます。\ のような記号は、エスケープシーケンス(escape sequence)と呼ばれ、特殊な意味を持つ記号などを単なる文字として扱う場合に利用されます。</para></footnote> |
---|
625 | --slave リンク名2 総称名2 選択候補2</screen> |
---|
626 | |
---|
627 | <para>--slave オプションは複数回利用できます。</para> |
---|
628 | <screen># /sbin/update-alternatives --install リンク名1 総称名1 選択候補1 優先度1 \ |
---|
629 | --slave リンク名2 総称名2 選択候補2 \ |
---|
630 | --slave リンク名3 総称名3 選択候補3</screen> |
---|
631 | |
---|
632 | <sect4 id="preparation-for-slave-link"> |
---|
633 | <title>登録前の準備 (スレーブリンク)</title> |
---|
634 | <para>man pageも登録してみます。</para> |
---|
635 | <para>総称名は editor_man とします。</para> |
---|
636 | |
---|
637 | <para>man page の場所は、<xref linkend="information_of_alternatives_for_editor" /> のように jed が /usr/share/man/man1/jed.1.gz 、vi が /usr/share/man/man1p/vi.1p.gz となっています。</para> |
---|
638 | |
---|
639 | <para>man page がおかれる /usr/share/man/ 以下は、セクションという分類があるので、リンク名2 もそれぞれ同じディレクトリに作ることにします。</para> |
---|
640 | |
---|
641 | <table id="man_page_of_editor"> |
---|
642 | <title>editor の man page</title> |
---|
643 | <tgroup cols="2"> |
---|
644 | <thead> |
---|
645 | <row><entry>リンク名</entry><entry>選択候補</entry></row> |
---|
646 | </thead> |
---|
647 | <tbody> |
---|
648 | <row><entry>/usr/share/man/man1/editor.1.gz</entry><entry>/usr/share/man/man1/jed.1.gz</entry></row> |
---|
649 | <row><entry>/usr/share/man/man1p/editor.1.gz</entry><entry>/usr/share/man/man1p/vi.1p.gz</entry></row> |
---|
650 | </tbody> |
---|
651 | </tgroup> |
---|
652 | </table> |
---|
653 | |
---|
654 | <para>/usr/share/man/man1/editor.1.gz と /usr/share/man/man1p/editor.1.gz というファイルが無いということを確認しておきます。 |
---|
655 | <screen>$ stat /usr/share/man/man1/editor.1.gz /usr/share/man/man1p/editor.1.gz</screen> |
---|
656 | <screen>stat: `/usr/share/man/man1/editor.1.gz' の情報を取得できません: そのようなファイルやディレクトリはありません |
---|
657 | stat: `/usr/share/man/man1p/editor.1.gz' の情報を取得できません: そのようなファイルやディレクトリはありません</screen></para> |
---|
658 | </sect4> |
---|
659 | |
---|
660 | <sect4 id="--install-with--slave-option"> |
---|
661 | <title>--slave オプションも利用して登録する</title> |
---|
662 | <para>実際に登録してみます。</para> |
---|
663 | |
---|
664 | <example id="add_generic-name_Editor-with--slave-option"> |
---|
665 | <title>総称名 Editor で jed vi emacs を登録する。(--slave オプションも利用)</title> |
---|
666 | <para>jed を登録します。 |
---|
667 | <screen># /sbin/update-alternatives --install /usr/bin/editor Editor /usr/bin/jed 30 \ |
---|
668 | --slave /usr/share/man/man1/editor.1.gz editor-man /usr/share/man/man1/jed.1.gz</screen></para> |
---|
669 | <para>vi を登録します。 |
---|
670 | <screen># /sbin/update-alternatives --install /usr/bin/editor Editor /bin/vi 20 \ |
---|
671 | --slave /usr/share/man/man1p/editor.1.gz editor-man /usr/share/man/man1p/vi.1p.gz</screen></para> |
---|
672 | <para>emacs を登録します。 |
---|
673 | <screen># /sbin/update-alternatives --install /usr/bin/editor Editor /usr/bin/emacs 10</screen></para> |
---|
674 | </example> |
---|
675 | |
---|
676 | </sect4> |
---|
677 | </sect3> |
---|
678 | </sect2> |
---|
679 | |
---|
680 | <sect2 id="option_--remove"> |
---|
681 | <title>選択候補を削除する</title> |
---|
682 | |
---|
683 | <para>選択候補を削除するには、--remove というオプションを用います。</para> |
---|
684 | |
---|
685 | <para>総称名と選択候補を指定して、選択候補を一つ削除します。</para> |
---|
686 | <para>全ての選択候補が無くなる時には総称名も削除されます。</para> |
---|
687 | <para>manual( mode)の時に、選択されていた選択候補が削除されると auto(matic mode)に変更されます。</para> |
---|
688 | |
---|
689 | <para><screen># /sbin/update-alternatives --remove 総称名 選択候補</screen></para> |
---|
690 | |
---|
691 | <para>選択候補の確認は<ulink url="update-alternatives-3.html#option_--list">--list オプション</ulink>や<ulink url="update-alternatives-3.html#option_--display">--display オプション</ulink>が便利です。</para> |
---|
692 | |
---|
693 | <sect3 id="--remove_alternatives"> |
---|
694 | <title>選択候補 /usr/bin/emacs を削除する</title> |
---|
695 | |
---|
696 | <para><ulink url="update-alternatives-3.html#option_--list">--list オプション</ulink>で選択候補を確認しておきます。 |
---|
697 | <screen>$ /sbin/update-alternatives --list Editor</screen> |
---|
698 | <screen>/usr/bin/jed |
---|
699 | /bin/vi |
---|
700 | /usr/bin/emacs</screen></para> |
---|
701 | |
---|
702 | <para>総称名 Editor から 選択候補 /usr/bin/emacs を削除します。</para> |
---|
703 | <para><screen># /sbin/update-alternatives --remove Editor /usr/bin/emacs</screen></para> |
---|
704 | <para>通常、何も表示されません。</para> |
---|
705 | |
---|
706 | <para>manual( mode)で、選択されていた選択候補が削除された場合には、次のようにメッセーが出力され auto(matic mode)に変更されたことがわかります。</para> |
---|
707 | <para><screen># /sbin/update-alternatives --remove Editor /usr/bin/emacs</screen> |
---|
708 | <screen>Removing manually selected alternative - switching to auto mode</screen></para> |
---|
709 | |
---|
710 | <para><ulink url="update-alternatives-3.html#common_options">--verbose オプション</ulink>を使うと次のように表示されます。 |
---|
711 | <screen># /sbin/update-alternatives --verbose --remove Editor /usr/bin/emacs</screen> |
---|
712 | <screen>Checking available versions of Editor, updating links in /etc/alternatives ... |
---|
713 | (You may modify the symlinks there yourself if desired - see `man ln'.) |
---|
714 | Leaving Editor (/usr/bin/editor) pointing to /usr/bin/jed. |
---|
715 | Leaving editor-man (/usr/share/man/man1p/editor.1.gz) pointing to /usr/share/man/man1/jed.1.gz.</screen></para> |
---|
716 | |
---|
717 | <para>下の 2行に、現在選択されている選択候補 /usr/bin/jed , /usr/share/man/man1/jed.1.gz が表示されています。</para> |
---|
718 | </sect3> |
---|
719 | |
---|
720 | </sect2> |
---|
721 | |
---|
722 | <sect2 id="option_--remove-all"> |
---|
723 | <title>総称名を削除する</title> |
---|
724 | <para>総称名を指定して削除します。</para> |
---|
725 | <para>全ての選択候補が削除されます。</para> |
---|
726 | |
---|
727 | <para>総称名ごと削除するには --remove-all というオプションを用います。 |
---|
728 | <screen># /sbin/update-alternatives --remove-all 総称名</screen></para> |
---|
729 | |
---|
730 | <sect3 id="--remove_generic_name"> |
---|
731 | <title>総称名 Editor を削除する</title> |
---|
732 | |
---|
733 | <para>総称名 Editor を削除します。</para> |
---|
734 | <para><screen># /sbin/update-alternatives --remove-all Editor</screen></para> |
---|
735 | <para>通常、何も表示されません。</para> |
---|
736 | |
---|
737 | <para><ulink url="update-alternatives-3.html#common_options">--verbose オプション</ulink>を使うと次のように表示されます。 |
---|
738 | <screen># /sbin/update-alternatives --verbose --remove-all Editor</screen></para> |
---|
739 | <screen>Checking available versions of Editor, updating links in /etc/alternatives ... |
---|
740 | (You may modify the symlinks there yourself if desired - see `man ln'.) |
---|
741 | Discarding obsolete slave link editor-man (/usr/share/man/man1p/editor.1.gz). |
---|
742 | Last package providing Editor (/usr/bin/editor) removed, deleting it.</screen> |
---|
743 | |
---|
744 | <para>スレーブリンクである editor-man が削除されることなどがわかります。</para> |
---|
745 | </sect3> |
---|
746 | </sect2> |
---|
747 | |
---|
748 | </sect1> |
---|
749 | |
---|
750 | <sect1 id="alternatives-packages"> |
---|
751 | <title>alternatives で切り替えられるものが含まれているrpmパッケージ</title> |
---|
752 | |
---|
753 | <para>alternatives で切り替えできるものの 総称名(generic name) と rpmパッケージ名 を挙げておきます。<footnote><para>すべてのパッケージを挙げているわけではありません。また、選択候補が一つしかないものは挙げていません。</para></footnote></para> |
---|
754 | |
---|
755 | <table id="alternatives-packages-table"> |
---|
756 | <title>alternatives で切り替えられるものが含まれているrpmパッケージ</title> |
---|
757 | <tgroup cols="2"> |
---|
758 | <thead> |
---|
759 | <row><entry>総称名</entry><entry>rpmパッケージ名</entry></row> |
---|
760 | </thead> |
---|
761 | <tbody> |
---|
762 | <row><entry>apache2</entry><entry>apache2</entry></row> |
---|
763 | <row><entry>emacs</entry><entry>emacs,emacs22,xemacs</entry></row> |
---|
764 | <row><entry>cpp</entry><entry>gcc-cpp,gcc4-cpp,gcc295-cpp</entry></row> |
---|
765 | <row><entry>g77</entry><entry>gcc-g77,gcc295-g77</entry></row> |
---|
766 | <row><entry>gfortran</entry><entry>gcc4-gfortran</entry></row> |
---|
767 | <row><entry>gcc</entry><entry>gcc,gcc4,gcc295</entry></row> |
---|
768 | <row><entry>g++</entry><entry>gcc-c++,gcc4-c++,gcc295-c++</entry></row> |
---|
769 | <row><entry>gcj</entry><entry>gcc-java,gcc4-java,gcc295-java</entry></row> |
---|
770 | <row><entry>gij</entry><entry>libgcj,libgcj34</entry></row> |
---|
771 | <!-- <row><entry>pager</entry><entry>less,lv,more,w3m</entry></row> --> |
---|
772 | <row><entry>pear</entry><entry>php-pear,php5-pear</entry></row> |
---|
773 | <row><entry>php</entry><entry>php,php5</entry></row> |
---|
774 | <row><entry>print</entry><entry>cups,LPRng</entry></row> |
---|
775 | <row><entry>vi</entry><entry>vim,vim-tiny,vim-huge,vim-X11,jvim</entry></row> |
---|
776 | <row><entry>totem</entry><entry>totem-gstreamer,totem-xine</entry></row> |
---|
777 | </tbody> |
---|
778 | </tgroup> |
---|
779 | </table> |
---|
780 | |
---|
781 | </sect1> |
---|
782 | </chapter> |
---|
783 | |
---|
784 | <!-- EOF --> |
---|