DEB how do I save the configuration files of packages that are deleted during the installation of my package?

34 views Asked by At

I am creating my own deb package that should replace the old packages. In his Control file, I write:

Provides: package1, package2
Conflicts: package1 package2
Replacements: package1, package2

Next, after I created it, I start installing it, in the output I see the following sequence

  1. Package1 is being deleted
  2. Package2 is being deleted
  3. the preinst script is launched

My problem is that I need to save the files that are deleted when package1 and package2 are deleted. Accordingly, I need the following to happen:

  1. calling some script that I carry in the deb package when trying to delete package1
  2. Package1 is being deleted
  3. calling some script that I carry in the deb package when trying to delete package1
  4. Package2 is being deleted
  5. the preinst script is launched

Is it possible to do this exclusively in the deb package that I am creating? That is, I want to run apt install ./mypackage.deb and what I want happened?

I have tried different configurations. I also tried to figure out if the dpkg triggers logic could help me, but I still couldn't figure out how these dpkg triggers work. And apparently this is not what is needed.

0

There are 0 answers