オプションを更新するにはブラウザをどのように追加しますか?

オプションを更新するにはブラウザをどのように追加しますか?

Debian 10 にはデフォルトブラウザを選択するコマンドがあります。

 update-alternatives --config x-www-browser

.debファイルからWaterfoxをインストールしましたが、利用可能なブラウザのリストには表示されません。追加する方法はありますか?

ベストアンサー1

あなたの設定は私に似ているかもしれません。ここではx-www-browser、FirefoxとGoogle Chrome用のリンクグループに2つの項目があります。これを例に挙げましょう。

$ update-alternatives --display x-www-browser
x-www-browser - auto mode
  link best version is /usr/bin/google-chrome-stable
  link currently points to /usr/bin/google-chrome-stable
  link x-www-browser is /usr/bin/x-www-browser
  slave x-www-browser.1.gz is /usr/share/man/man1/x-www-browser.1.gz
/usr/bin/firefox-esr - priority 70
  slave x-www-browser.1.gz: /usr/share/man/man1/firefox-esr.1.gz
/usr/bin/google-chrome-stable - priority 200

選択した項目を指す2つのシンボリックリンクが設定されています。

$ ls -l /usr/bin/x-www-browser
lrwxrwxrwx 1 root root 31 Sep 16  2018 /usr/bin/x-www-browser -> /etc/alternatives/x-www-browser
$ ls -l /etc/alternatives/x-www-browser 
lrwxrwxrwx 1 root root 29 May  4 20:45 /etc/alternatives/x-www-browser -> /usr/bin/google-chrome-stable

インタラクティブメニューには、Google Chromeが自動的に選択されたものとして表示されます(最も高い優先順位)。

$ update-alternatives --config x-www-browser
There are 2 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                           Priority   Status
------------------------------------------------------------
* 0            /usr/bin/google-chrome-stable   200       auto mode
  1            /usr/bin/firefox-esr            70        manual mode
  2            /usr/bin/google-chrome-stable   200       manual mode

Press <enter> to keep the current choice[*], or type selection number:

アイテムを追加

エントリを追加するには、--installコマンド、リンク、リンク名、プログラムパス、および優先順位が必要です。

必要に応じてWaterfoxのパスと優先順位を変更します。

sudo update-alternatives \
  --install /usr/bin/x-www-browser x-www-browser /usr/local/bin/waterfox 210

結果:

$ update-alternatives --config x-www-browser
There are 3 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                           Priority   Status
------------------------------------------------------------
* 0            /usr/local/bin/waterfox         210       auto mode
  1            /usr/bin/firefox-esr            70        manual mode
  2            /usr/bin/google-chrome-stable   200       manual mode
  3            /usr/local/bin/waterfox         210       manual mode

Press <enter> to keep the current choice[*], or type selection number:

Firefox について上記のようにオプションのアフィリエイトリンクを設定できます。 Firefoxを選択すると、x-www-browser.1.gzマニュアルページへの追加リンクが確立されます。/usr/share/man/man1/firefox-esr.1.gz

for構文は--slaveforと同じ--installですが、優先順位はありません。たとえば、次のようになります。

sudo update-alternatives \
  --install /usr/bin/x-www-browser x-www-browser /usr/local/bin/waterfox 210 \
  --slave /usr/share/man/man1/x-www-browser.1.gz x-www-browser.1.gz /usr/local/share/man/man1/waterfox.1.gz

アイテムの削除

Waterfoxを再度削除するには、リンク名とパスが必要です。

sudo update-alternatives --remove x-www-browser /usr/local/bin/waterfox

おすすめ記事