Relatively recently, I created my own package files_1.deb for debian to install some files on remote branch servers. Files are in the root of the package. Now I create another deb-package, say files_2.deb, which contains additional files, also in the root of the package.

But when the dpkg -i files_2.deb command is dpkg -i files_2.deb on a remote server, the files that were in files_1.deb are unexpectedly deleted on the server.

How can this be banned? The postrm file is not in both packages for removal.

    1 answer 1

    Most likely, not the files are deleted, but the package is updated.

    you probably called the packages files_1 and files_2 . and since the underscore character is not valid in the package name , but serves to separate the package name from the optional epoch field, then, from the point of view of the package manager, it is the same package (only with different epochs).

    therefore, the package files (with era 2 ) is installed and replaces the package of the same name files (with era 1 ).


    If you want files from both packages to be present, the most logical thing is to install both of these packages. Naturally, they must have different names.

    • I need an update, but that the files are not deleted, because Apparently when updating, the files that were copied from it are deleted. I stumbled upon that the dpkg-divert utility in the preinst file can help, but I just can’t figure out how to use it, I don’t understand it more precisely) - nerik
    • A package management system is still far from a version control system for files. when updating a package, files of the old version are deleted (configuration files are renamed, unless configured otherwise). the mechanism of sabotage was invented to allow the substitution of files of one installed package with files of another installed package. - aleksandr barakin
    • @nerik, I added the answer. - aleksandr barakin