#+TITLE: TIL: Debian's apt-get satisfy #+LANGUAGE: en Debian's APT accepts the syntax =apt-get install 'some-package=1.32'= to install an exact version of a package. TIL about [[https://manpages.debian.org/bookworm/apt/apt-get.8.en.html#:~:text=satisfy%20causes%20apt-get%20to%20satisfy%20the%20given%20dependency%20strings][=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=. [[https://www.debian.org/doc/debian-policy/ch-relationships.html][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, [[https://manpages.debian.org/bookworm/apt/apt.8.en.html#SCRIPT_USAGE_AND_DIFFERENCES_FROM_OTHER_APT_TOOLS][=apt= comes with the following note]]: #+BEGIN_QUOTE 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 like =apt-get(8)= and =apt-cache(8)= as well. =apt(8)= just changes the default value of some options (see =apt.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. #+END_QUOTE