I'm working in some Debian packages and at some point I'd like to add optional dependencies, e.g. if foo-pkg is marked as to be installed at the same time as my-pkg let foo-pkg install first and then continue with my-pkg, if foo-pkg is not available or not marked to be installed just continue.

I could use the Recommend: field but as far as my tests has gone it doesn't force apt-get to install foo-pkg first, also, I don't have control over foo-pkg, any ideas?


Why do you want your package to be installed after? Does your postinst configure your package differently if it finds the other package is installed? If so then you can use a trigger to cause your package to be reconfigured any time the other package is installed.

Follows some documentation:

| improve this answer | |
  • Indeed, it configures the package differently, I also forgot to mention I don't have control over the other package, right now it can be reconfigured with dpkg-reconfigure once the other package has been installed but it's a two step process. – Javier López Feb 24 '17 at 0:19
  • @chilicuil, you can use a file trigger on some file in the other package ( such as its main program ) and dpkg will notify your maintainer scripts after the other program is installed or removed. – psusi Feb 24 '17 at 1:45
  • that would be great, unfortunatelly I don't have control over the other package – Javier López Feb 24 '17 at 19:18
  • @chilicuil, you don't need control over the other package. You register interest in a file in your own package and dpkg takes care of the rest. – psusi Feb 25 '17 at 1:29
  • could you point to some example/documentation? – Javier López Feb 25 '17 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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