Search code examples
builddebianubuntu-12.04packaging

Package dependencies based on condition [debian]


For debian packages, Is that possible to have Depends name generated during install time based on some condition? For example,

For package PACKAGE-1, based on the kernel version it can depend on PACKAGE-A or PACKAGE-B... I cant hardcode depends package name during build time because its decided based on the system (kernel version) on its getting installed...such as Depends: PACKAGE-A [uname -r >= '3.13.0-40'], PACKAGE-B [uname -r < '3.13.0-40']

FYI Seems such dependencies can be created based on arch but couldn't any get if it can be customized further... Depends: foo [i386], bar [amd64]


Solution

  • You are correct- what you are asking for is not possible with current dpkg/apt.

    Unless this is for a kernel module, the right thing to do is probably to ship the binaries for both PACKAGE-A and PACKAGE-B in the same deb, and include a script that chooses between them at runtime.