summaryrefslogtreecommitdiffstats
path: root/man/ja/update-alternatives.pod
blob: ecf5a7c61f27bb47b1a3a532aa469b873c10c11d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
        *****************************************************
        *           GENERATED FILE, DO NOT EDIT             *
        * THIS IS NO SOURCE FILE, BUT RESULT OF COMPILATION *
        *****************************************************

This file was generated by po4a(7). Do not store it (in VCS, for example),
but store the PO file used as source file by po4a-translate.

In fact, consider this as a binary, and the PO file as a regular .c file:
If the PO get lost, keeping this translation up-to-date will be harder.

=encoding UTF-8

=head1 名前

update-alternatives - シンボリックリンクを管理してデフォルトのコマンドを決定する

=head1 書式

B<update-alternatives> [I<option>...] I<command>

=head1 説明

B<update-alternatives> は Debian の alternatives
システムを構成するシンボリックリンクを生成・削除・管理したり、リンクの情報を表示したりするツールである。

同一の、あるいは類似の機能を持つ複数のプログラムを一つのシステムに同時にインストールし、共存させることができる。例えば多くのシステムでは、複数のテキストエディタを共存させている。これにより、システムのユーザは好みに応じて別々のエディタを使うことができるようになる。しかしプログラムからすると、特に指定がなかったときにどのエディタを起動すれば良いのかという、なかなか難しい問題を抱えることになる。

Debian の alternatives
システムは、この問題を解決するためのものである。互いに置き換え可能な機能を提供する全てのファイルは、ファイルシステム中の「一般名 (generic
name)」を共有する。その一般名が実際にどのファイルを参照するかは、 alternatives
システムとシステム管理者とが決定する。例えば、テキストエディタである B<ed>(1) と B<nvi>(1)
の両方がシステムにインストールされていたとすると、一般名である I</usr/bin/editor> は、デフォルトでは I</usr/bin/nvi>
を参照する。システム管理者はこれを上書きし、 I</usr/bin/ed>
を参照させるようにすることもできる。こうすると、その後明示的な設定がなければ、 alternatives システムはその設定を変更しない。

一般名は、選ばれた「選択肢 (alternative)」への直接のシンボリックリンクではなく、 I<alternatives> I<ディレクトリ>
にある名前へのシンボリックリンクになっており、その名前が実際に参照されるファイルへのシンボリックリンクになっている。こうなっている理由は、システム管理者による変更を
I<%CONFDIR%> ディレクトリ以下で完結させるためである。なぜこうするのが良いかについては FHS に説明がある。

When each package providing a file with a particular functionality is
installed, changed or removed, B<update-alternatives> is called to update
information about that file in the alternatives system.
B<update-alternatives> is usually called from the following Debian package
maintainer scripts, B<postinst> (configure) to install the alternative and
from B<prerm> and B<postrm> (remove) to remove the alternative.  B<Note:> in
most (if not all) cases no other maintainer script actions should call
B<update-alternatives>, in particular neither of B<upgrade> nor
B<disappear>, as any other such action can lose the manual state of an
alternative, or make the alternative temporarily flip-flop, or completely
switch when several of them have the same priority.

複数の選択肢を同期させ、グループとして変更すると便利なことが多い。例えば B<vi>(1)
エディタのいろいろな派生システムが同時にインストールされていたとすると、 I</usr/share/man/man1/vi.1> が参照する man
ページは、 I</usr/bin/vi> が参照する実行ファイルに対応しているべきであろう。 B<update-alternatives> は、
I<master> リンクと I<slave> リンクによってこれを取り扱う。 master が変更されると、それに関連づけされた各 slave
も同時に変更される。 master リンクとそれに関連づけされた slave とは、 I<リンクグループ> を形成する。

各リンクグループは、いかなる時点においても、 automatic または manual の 2 つのモードのいずれかにある。グループが
automatic モードにある場合は、パッケージのインストール・削除の際にリンクを更新するか、どのように更新するかは、 alternatives
システムが自動的に決定する。 manual モードでは、 alternatives システムは (何らかの問題が発生した場合を除き)
リンクを変更せず、システム管理者の行った設定が保持される。

リンクグループがシステムに導入されると、まず automatic モードとして機能する。システム管理者がその設定を変更すると、次に
B<update-alternatives> がリンクグループに対して実行されたときに変更が認識され、そのリンクグループは自動的に manual
モードに切り換わる。

各選択肢は I<priority> 属性を持っている。リンクグループが automatic モードにあるときは、 I<priority>
のもっとも高いものが、そのグループのメンバーが参照する選択肢になる。

When using the B<--config> option, B<update-alternatives> will list all of
the choices for the link group of which given I<name> is the master
alternative name.  The current choice is marked with a ‘*’.  You will then
be prompted for your choice regarding this link group.  Depending on the
choice made, the link group might no longer be in I<auto> mode. You will
need to use the B<--auto> option in order to return to the automatic mode
(or you can rerun B<--config> and select the entry marked as automatic).

非対話的に設定をしたい場合は B<--set> オプションを代わりに使用する (以下を参照)。

同一のファイルを提供する異なるパッケージは、これを B<協調して> 行う必要がある。言い換えると、こうした場合、関連するパッケージのすべてで
B<update-alternatives> の使用が必須となる。B<update-alternatives>
機構を使用していないパッケージのファイルを上書きすることはできない。

=head1 用語

B<update-alternatives> の動作は極めて複雑なので、ここでいくつかの固有の用語を説明し、動作の理解の助けとしたい。

=over 

=item 一般名 (generic name / alternative link)

I</usr/bin/editor> のような名前。 alternatives システムによって、類似の機能を持つ複数のファイルのいずれかを参照する。

=item 選択肢名 (alternative name)

alternatives ディレクトリに存在するシンボリックリンク名

=item 選択肢 (alternative / alternative path)

ファイルシステム中の特定ファイルの名称、alternatives システムによって、一般名からのアクセスが可能となる。

=item alternatives ディレクトリ

シンボリックリンクを保持するディレクトリ。デフォルトは I<%CONFDIR%/alternatives>。

=item administrative ディレクトリ

B<update-alternatives> の状態情報を保持するディレクトリ。デフォルトは
I</var/lib/dpkg/alternatives>。

=item リンクグループ

関連するシンボリックリンクのセットで、グループ単位での更新を行うためのもの。

=item master リンク

リンクグループに属する選択肢のリンクで、グループ内の他のリンクの設定を決定するもの。

=item slave リンク

リンクグループに属する選択肢のリンクで、 master リンクの設定によって設定されるもの。

=item automatic モード

リンクグループが automatic モードにある場合、alternatives システムは、グループ内の各リンクが priority
のもっとも高い選択肢を参照することを担保する。

=item manual モード

リンクグループが manual モードにある場合、alternatives システムはシステム管理者の行った設定を一切変更しない。

=back

=head1 コマンド

=over 

=item B<--install> I<link name path priority> [B<--slave> I<link name path>]...

選択肢のグループをシステムに追加する。I<link> は master リンクの一般名、I<name> は alternatives
ディレクトリにおけるシンボリックリンクの名前、 I<path> は master リンクとなる選択肢の名前となる。B<--slave>
オプションに続く引数は、alternatives ディレクトリでの一般名およびシンボリックリンクの名前と slave
リンクとなる選択肢のパスの順となる。B<--slave> オプションと、それにに続く 3
つの引数のセットは、いくつ設定してもよく、まったく設定しないこともできる。master
となる選択肢は必ず存在している必要があり、存在していない場合は失敗となるが、slave
の選択肢がインストールされていない場合は、(依然として警告が表示されるものの) 対応する slave
の選択肢のリンクが単にインストールされないだけである。選択肢のリンクがインストールされるパスに、何らかの実ファイルがインストールされている場合、B<--force>
が指定されない限り、それらのファイルは保持される。

指定された選択肢の名前が既に alternatives
システム内に存在している場合、与えられた情報は、グループに対する新たな選択肢として追加される。それ以外の場合は、与えられた情報を用いて、新しいグループが
automatic モードで追加される。グループが automatic モードにあり、新たに追加された選択肢の priority
がそのグループに対してインストールされている他の選択肢のものより高い場合、シンボリックリンクは新たに追加された選択肢を参照するように更新される。

=item B<--set> I<name path>

Set the program I<path> as alternative for I<name>.  This is equivalent to
B<--config> but is non-interactive and thus scriptable.

=item B<--remove> I<name path>

(master の) 選択肢とそれに関連する全ての slave リンクを削除する。 I<name> は alternatives
ディレクトリ内の名前であり、 I<path> は I<name> のリンク先に指定されうるファイル名の絶対パスである。 I<name> が実際に
I<path> にリンクされている場合には、 I<name> は他の適切な選択肢を参照するよう更新される (グループは automatic
モードに戻される) が、そのような選択肢が残っていなければ削除される。関連する slave リンクも対応して更新 (削除) される。 I<name>
が現在その I<path> を参照していなければ、リンクの変更は行われない。その選択肢の情報が削除されるだけである。

=item B<--remove-all> I<name>

すべての選択肢と、それに関連するすべての slave リンクを削除する。 I<name> は、alternatives ディレクトリ内の名前である。

=item B<--all>

すべての選択肢に対して B<--config> を呼び出す。これは B<--skip-auto> と組み合わせることで、automatic
モードで設定されていないすべての選択肢を確認、設定する際に有用である。問題のある選択肢も表示される。問題のある選択肢をすべて修正するためには B<yes
'' | update-alternatives --force --all> を実行すればよい。

=item B<--auto> I<name>

I<name> で指定される選択肢のリンクグループを、automatic モードに変更する。この処理を行う際に、master
のシンボリックリンクと対応する各 slave は、現在インストールされている選択肢のうち、もっとも priority
の高いものを参照するように更新される。

=item B<--display> I<name>

Display information about the link group.  Information displayed includes
the group's mode (auto or manual), the master and slave links, which
alternative the master link currently points to, what other alternatives are
available (and their corresponding slave alternatives), and the highest
priority alternative currently installed.

=item B<--get-selections>

List all master alternative names (those controlling a link group)  and
their status (since version 1.15.0).  Each line contains up to 3 fields
(separated by one or more spaces). The first field is the alternative name,
the second one is the status (either B<auto> or B<manual>), and the last one
contains the current choice in the alternative (beware: it's a filename and
thus might contain spaces).

=item B<--set-selections>

Read configuration of alternatives on standard input in the format generated
by B<--get-selections> and reconfigure them accordingly (since version
1.15.0).

=item B<--query> I<name>

Display information about the link group like B<--display> does, but in a
machine parseable way (since version 1.15.0, see section B<QUERY FORMAT>
below).

=item B<--list> I<name>

リンクグループのすべての対象を表示する。

=item B<--config> I<name>

リンクグループで利用可能なすべての選択肢を表示し、対話的に選択肢の 1 つを選択できるようにする。これにより、リンクグループが更新される。

=item B<--help>

利用方法を表示して終了する。

=item B<--version>

バージョン情報を表示して終了する。

=back

=head1 オプション

=over 

=item B<--altdir> I<directory>

Specifies the alternatives directory, when this is to be different from the
default.  Defaults to «I<%CONFDIR%/alternatives>».

=item B<--admindir> I<directory>

Specifies the administrative directory, when this is to be different from
the default.  Defaults to «I<%ADMINDIR%/alternatives>»

=item B<--instdir> I<directory>

Specifies the installation directory where alternatives links will be
created (since version 1.20.1).  Defaults to «».

=item B<--root> I<directory>

Specifies the root directory (since version 1.20.1).  This also sets the
alternatives, installation and administrative directories to match.
Defaults to «».

=item B<--log> I<file>

Specifies the log file (since version 1.15.0), when this is to be different
from the default (%LOGDIR%/alternatives.log).

=item B<--force>

Allow replacing or dropping any real file that is installed where an
alternative link has to be installed or removed.

=item B<--skip-auto>

automatic モードで適切に設定されている選択肢について、設定の確認を行わない。このオプションは B<--config> および B<--all>
とともに指定した場合のみ有効である。

=item B<--quiet>

Do not generate any comments unless errors occur.

=item B<--verbose>

Generate more comments about what is being done.

=item B<--debug>

Generate even more comments, helpful for debugging, about what is being done
(since version 1.19.3).

=back

=head1 終了ステータス

=over 

=item B<0>

指定したアクションが正しく実行された。

=item B<2>

コマンドラインの解釈か、アクションの実行時に問題が発生した。

=back

=head1 環境変数

=over 

=item B<DPKG_ADMINDIR>

B<--admindir> オプションが指定されていない場合に、この変数が設定されていると、この値が administrative
ディレクトリの起点として使用される。

=back

=head1 ファイル

=over 

=item I<%CONFDIR%/alternatives/>

デフォルトの alternatives ディレクトリ。 B<--altdir> オプションによって変更できる。

=item I<%ADMINDIR%/alternatives/>

デフォルトの administration ディレクトリ。 B<--admindir> オプションによって変更できる。

=back

=head1 QUERY FORMAT

The B<--query> format is using an RFC822-like flat format. It's made of I<n>
+ 1 blocks where I<n> is the number of alternatives available in the queried
link group. The first block contains the following fields:

=over 

=item B<Name:> I<name>

alternative ディレクトリに存在する選択肢の名前

=item B<Link:> I<link>

選択肢の一般名

=item B<Slaves:> I<list-of-slaves>

このヘッダが存在している場合、B<以降の> 行には、この選択肢の master リンクに対応するすべての slave
リンクが記述される。これは、slave 毎に 1 行ずつ記述され、各行は、1 文字のスペースに続き、slave の選択肢の一般名、スペース、slave
リンクのパスが記述される。

=item B<Status:> I<status>

選択肢の状況 (B<auto> もしくは B<manual>)

=item B<Best:> I<best-choice>

このリンクグループで最適な選択肢のパス。利用可能な選択肢が存在しない場合、存在しない。

=item B<Value:> I<currently-selected-alternative>

現在選択されている選択肢のパス。リンクが存在しない場合、B<none> という特別な値が設定される場合がある。

=back

これ以外のブロックは、クエリ対象のリンクグループにおいて利用可能な選択肢を表示する。

=over 

=item B<Alternative:> I<path-of-this-alternative>

このブロックの選択肢のパス。

=item B<Priority:> I<priority-value>

この選択肢の priority の値。

=item B<Slaves:> I<list-of-slaves>

このヘッダが存在している場合、B<以降の> 行には、この選択肢の master リンクに対応するすべての slave
の選択肢が記述される。これは、slave 毎に 1 行ずつ記述され、各行は、1 文字のスペースに続き、slave の選択肢の一般名、スペース、slave
の選択肢のパスが記述される。

=back

=head2 Example

 $ update-alternatives --query editor
 Name: editor
 Link: /usr/bin/editor
 Slaves:
  editor.1.gz /usr/share/man/man1/editor.1.gz
  editor.fr.1.gz /usr/share/man/fr/man1/editor.1.gz
  editor.it.1.gz /usr/share/man/it/man1/editor.1.gz
  editor.pl.1.gz /usr/share/man/pl/man1/editor.1.gz
  editor.ru.1.gz /usr/share/man/ru/man1/editor.1.gz
 Status: auto
 Best: /usr/bin/vim.basic
 Value: /usr/bin/vim.basic

 Alternative: /bin/ed
 Priority: -100
 Slaves:
  editor.1.gz /usr/share/man/man1/ed.1.gz

 Alternative: /usr/bin/vim.basic
 Priority: 50
 Slaves:
  editor.1.gz /usr/share/man/man1/vim.1.gz
  editor.fr.1.gz /usr/share/man/fr/man1/vim.1.gz
  editor.it.1.gz /usr/share/man/it/man1/vim.1.gz
  editor.pl.1.gz /usr/share/man/pl/man1/vim.1.gz
  editor.ru.1.gz /usr/share/man/ru/man1/vim.1.gz

=head1 診断メッセージ

B<--verbose> を指定した場合、B<update-alternatives> は、実行中の処理内容を逐一標準出力に出力する。問題が起きると、
B<update-alternatives> はエラーメッセージを標準エラー出力に出力し、終了ステータス 2
を返す。これらの診断メッセージは、読めばわかるはずである。もしわからなければ、バグとして報告して欲しい。

=head1 例

例えば B<nvi> や B<vim> のように、テキストエディタ B<vi>
と互換性のあるプログラムを提供するパッケージが複数ある。どのパッケージが使われるかは、リンクグループ B<vi> によって制御される。リンクグループ
B<vi> にはプログラム自身のリンクと、関連する man ページのリンクが含まれる。

B<vi> を提供するパッケージとその現在の設定を表示するには、B<--display> アクションを使用する:

=over 

 update-alternatives --display vi

=back

特定の B<vi> の実装を選ぶには、root としてこのコマンドを実行し、一覧から数字を選ぶ:

=over 

 update-alternatives --config vi

=back

B<vi> 実装の選択を自動的に行なうように戻すには、root としてこのコマンドを実行する:

=over 

 update-alternatives --auto vi

=back

=head1 関連項目

B<ln>(1), FHS (the Filesystem Hierarchy Standard).


=head1 翻訳者

高橋 基信 <monyo@monyo.com>.
喜瀬 浩 <kise@fuyuneko.jp>.
関戸 幸一 <sekido@mbox.kyoto-inet.or.jp>.
鍋谷 栄展 <nabe@debian.or.jp>.
倉澤 望 <nabetaro@debian.or.jp>.
石川 睦 <ishikawa@linux.or.jp>.
鵜飼 文敏 <ukai@debian.or.jp>.
中野 武雄 <nakano@apm.seikei.ac.jp>.

=head1 翻訳校正

Debian JP Documentation ML <debian-doc@debian.or.jp>.