Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating a package that needs to depend on a package if another is installed, but needs a different dependency if no such package is installed. Is that possible using just the control file of the .deb, or are other tools needed? This package is actually meant for Ubuntu, so any tools unavailable in Ubuntu repositories can't be used.

share|improve this question
The control file is static so no you can't change dependencies based on if a package is installed or not. What exactly do you want to achieve? Maybe have a look at Provides or do something like Depends: NotInstalled | Installed, – Ulrich Dangel Aug 3 '12 at 13:45
@UlrichDangel Can you add that as an answer? – hexafraction Aug 3 '12 at 13:51
up vote 5 down vote accepted

The control file is static so no you can't change dependencies on some external parameters but the Debian Policy specifies | as a way to specify alternative package names, in your case it would be something like:

Depends: Package1 | Package2

where Package1 is the default dependency.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.