Provided by: dpkg_1.19.0.5ubuntu2.4_amd64 bug

名前

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

書式

       update-alternatives [option...] command

説明

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

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

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

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

       When each package providing a file with a particular functionality is  installed,  changed
       or  removed,  update-alternatives  is  called to update information about that file in the
       alternatives system.  update-alternatives is usually called from the postinst  (configure)
       or prerm (remove and deconfigure) scripts in Debian packages.

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

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

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

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

       When  using  the --config option, update-alternatives will list all of the choices for the
       link group of which given 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  auto  mode.  You  will
       need  to  use the --auto option in order to return to the automatic mode (or you can rerun
       --config and select the entry marked as automatic).

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

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

用語

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

       一般名 (generic name / alternative link)
              /usr/bin/editor のような名前。 alternatives  システムによって、類似の機能を持つ複数
              のファイルのいずれかを参照する。

       選択肢名 (alternative name)
              alternatives ディレクトリに存在するシンボリックリンク名

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

       alternatives ディレクトリ
              シンボリックリンクを保持するディレクトリ。デフォルトは /etc/alternatives。

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

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

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

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

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

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

コマンド

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

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

       --set name path
              プログラム pathname の選択肢として設定する。 --config  と同等だが、こちらは非対
              話的であるため、スクリプト向けである。

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

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

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

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

       --display 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.

       --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 auto or manual), and the last one contains the current choice in the
              alternative (beware: it's a filename and thus might contain spaces).

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

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

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

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

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

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

オプション

       --altdir directory
              alternatives ディレクトリをデフォルトから変えたいときに指定する。

       --admindir directory
              administrative ディレクトリをデフォルトから変えたいときに指定する。

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

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

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

       --verbose
              Generate more comments about what is being done.

       --quiet
              エラー以外のコメントを出力しない。

終了ステータス

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

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

環境変数

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

ファイル

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

       /var/lib/dpkg/alternatives/
              デフォルトの administration  ディレクトリ。  --admindir  オプションによって変更でき
              る。

QUERY FORMAT

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

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

       Link: link
              選択肢の一般名

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

       Status: status
              選択肢の状況 (auto もしくは manual)

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

       Value: currently-selected-alternative
              現在選択されている選択肢のパス。リンクが存在しない場合、none という特別な値が設定さ
              れる場合がある。

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

       Alternative: path-of-this-alternative
              このブロックの選択肢のパス。

       Priority: priority-value
              この選択肢の priority の値。

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

   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

診断メッセージ

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

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

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

              update-alternatives --display vi

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

              update-alternatives --config vi

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

              update-alternatives --auto vi

関連項目

       ln(1), FHS, the Filesystem Hierarchy Standard.

翻訳者

       高橋 基信 <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>.

翻訳校正

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