Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

apt-get で特定のパッケージを更新対象から除外する場合

apt-get upgrade するとずら〜っとパッケージ名が上がってくるけど、特定のパッケージだけはこれを無視したい(これを "hold" と言う)、という場合に。mozilla-firebird は upgrade すると extension の再インストールが必要になるので、debian-unstable とか testing ではこれを設定しておくと吉かもしれない。

# 無視対象に入れる
echo (package name) hold | dpkg --set-selections
# 例えば echo mozilla-firefox hold | dpkg --set-selections

# 無視対象から外す
echo (package name) install | dpkg --set-selections
# 例えば echo mozilla-firefox install | dpkg --set-selections 

パッケージ名に "mozilla" を含むものを全て除外したい、という場合は次のようにしたらいいんじゃないかと。

for i in `apt-cache pkgnames | grep mozilla`; do echo $i | dpkg --set-selections; done