GitLabのアップデートの前にパッケージのバージョンを見たかったため、やり方を調べたメモ
apt の場合
apt-cache policy <package name>
を使用する
aptの場合
$ sudo apt-get update
$ apt-cache policy gitlab-ce | head
gitlab-ce:
Installed: 8.16.1-ce.0
Candidate: 8.17.2-ce.0
Version table:
8.17.2-ce.0 0
500 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ trusty/main amd64 Packages
8.17.1-ce.2 0
500 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ trusty/main amd64 Packages
8.17.0-ce.0 0
500 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ trusty/main amd64 Packages
特定バージョンの最新バージョン名を取得
$ export specific_version=8.11.0
$ apt-cache policy gitlab-ce | tail -n +5 | grep -v "http" | awk '{print $1}' | sort -r | grep ${specific_version} | head -n 1
8.11.0-ce.1
aptitude の場合
aptitude versions <package name>
を使用する。
aptitudeはaptと逆順表示なので注意。
aptitudeの場合
$ sudo aptitude update
$ aptitude versions gitlab-ce | tail
p 8.16.3-ce.0 trusty 500
p 8.16.3-ce.1 trusty 500
p 8.16.4-ce.0 trusty 500
p 8.16.5-ce.0 trusty 500
p 8.16.5-ce.1 trusty 500
p 8.16.6-ce.0 trusty 500
p 8.16.7-ce.0 trusty 500
p 8.17.0-ce.0 trusty 500
p 8.17.1-ce.2 trusty 500
p 8.17.2-ce.0 trusty 500
参考
Check package version using apt-get/aptitude? - Unix & Linux Stack Exchange