TIL: Debian's apt-get satisfy
Debian's APT accepts the syntax apt-get install 'some-package=1.32'
to
install an exact version of a package. TIL about apt-get satisfy
, which lets
you ask for a version range, as in:
apt-get satisfy 'some-package (>=1.30)'
I found it useful for a CI script fragment where I don't care if the executor
runs Debian or Ubuntu, I only want to ensure that I'm using a recent enough
version of some-package
.
The syntax is the same as in the Depends:
field of a control
file. You
pretty much have to use quotes to avoid the shell interpreting brackets or
redirection characters. Several packages are separated with commas, as in
apt-get satisfy 'foo (>=1.8), bar (> 2.3)'
.
Remember to use apt-get
in scripts, apt
comes with the following note:
The
apt(8)
commandline is designed as an end-user tool and it may change behavior between versions. While it tries not to break backward compatibility this is not guaranteed either if a change seems beneficial for interactive use.All features of
apt(8)
are available in dedicated APT tools likeapt-get(8)
andapt-cache(8)
as well.apt(8)
just changes the default value of some options (seeapt.conf(5)
and specifically the Binary scope). So you should prefer using these commands (potentially with some additional options enabled) in your scripts as they keep backward compatibility as much as possible.