deb Depends deb

I use cpack to generate two deb
A.deb depends on B.deb
I want to install A.deb with double click and the process of installation(A.deb) will check if the B.deb exist. If no exist , it will download the B.deb and install it .
All of the installation, I just double click A.deb.
Do you have any idea?

I think this all depends on which program ends up handling the double click installation. I don’t think there is any way for you to write code that does that logic though for .deb packages. It just needs to be handled by a program (like aptitude which knows how to fetch the dependency (e.g., through configured repositories).

Cc: @kyle.edwards

If I know my A.deb need python-opencv. How to design the status that install A.deb with double click and the process will auto install python-opencv ?

All you can do is add a Depends (or Requires; I forget the dpkg terminology) entry to your package on python-opencv. It is up to the program handling the double click action to notice this and ensure it is also installed.

Do you have the suggest command for cmakelist to do the thing?
I try the CPACK_DEBIAN_PACKAGE_DEPENDS and it seem to only check if the lib exist. No install the lib.
SET(CPACK_DEBIAN_PACKAGE_DEPENDS “python-opencv (>= 2.1.0)”)

I think that’s the only mechanism provided. I would try “Open With…” a different application.

If I use the preinst method, is it a good method ?
Write a “apt install xxx” in preinst.

No, because that is likely to deadlock on the package database. While installing your package, you’re trying to install another which is unaware it is in an installation process already. Why is using a competent program that resolves dependencies not sufficient?

So I should apt install XXX in my build environment and make sure my project work. Then, pack the dependencies package(apt install XXX) when cpack.

I’m not sure what you’re saying is happening here. Are you going to repack the dependency files in your .deb or are you putting apt install in your install script bucket? Neither sounds good to me.

If my project use the command of “iostat” and I can install it with “sudo apt install sysstat” in my build environment. Make sure the project work. I cpack it to deb and call it A.deb.

Then, I put A.deb in another computer. I know the computer have no the “iostat”.

How can I trigger the “iostat install” when install the A.deb?

P.S.
iostat is a computer system monitor tool used to collect and show operating system storage input and output statistics.
Note: Linux iostat Command to Report CPU and I/O Statistics are listed below:

  • iostat: Get report and statistic.
  • iostat -x: Show more details statistics information.
  • iostat -c: Show only the cpu statistic.

You add a dependency from your .deb to the other .deb. Any .deb installer worth its salt will see the dependency you declared and install if necessary. If it doesn’t, it’s not a useful installer of .deb files.

Any .deb installer worth its salt will see the dependency you declared and install if necessary.

I should declared the dependency in the readme and let the user to install it with command apt install .