15

I have qt project and deb package that is built using following command: dpkg-buildpackage -us -uc

After this action, my package is ready to install. But if I have my package installed and I want install the same or newer, it removes all files which were installed by this deb package. Only action that works is removing old package before installing newer using following command: dpkg --remove myqtapp

P.S. To install Deb package I use dpkg -i ...

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Vlad
  • 151
  • 1
  • 1
  • 3
  • Use newer branch of Debian for newer packages, e.g. testing. – Ipor Sircer Nov 29 '18 at 16:05
  • I guess you'll need to have a look at your own pre-/postinstall scripts and determine whether all the files you're distributing are actually put in sensible places ... – tink Nov 29 '18 at 16:40
  • did you solve this problem? i'm struggling with the same problem right now, new install overrides files modified. I think with preInst and postInst we can backup all the current files and restore them after install but i think there would be a better approach – raultm Mar 12 '22 at 10:16

1 Answers1

23

dpkg --install package.deb should cleanly upgrade from an older version of a package to a newer one without issue. If it is complaining about a conflict, then the new package is not an upgrade but is instead an actual different package, and upgrading is (rightly) not performed. If you are not going to use apt repositories for package management, ensure you are obtaining the deb file from the same source as the older version and that it is provided as an upgrade to the prior package.

DopeGhoti
  • 73,792
  • 8
  • 97
  • 133
  • Is there any way to set this up for auto-update? Like I installed WPS office via `dpkg` but have to download `.deb` file and update it manually everytime. Thanks. – theProcrastinator Jan 22 '22 at 07:19
  • That is beyond the scope of this question, but if you can procedurally determine a URL from which you can obtain the latest package file, you could set to a `cron` job to fetch the package, determine if its hash has changed from the last installed version, and if so install it. – DopeGhoti Jan 24 '22 at 14:27