I'm designing a product, written in C and runs on a standard installation of Debian Lenny.
We install it to our own dedicated hardware (basically an Intel Xeon server) via a locally managed debian repository. We use Debian's normal package management system to deploy and upgrade the product.
It is installed on our own hardware so we have rigid control over exactly what is on every machine.
Currently our package installation scripts - postinst, preinst, postrm, prerm, etc.
have support for installing, removing, and purging the package that contains our software.
I have been tasked with implementing "upgrade" support. Currently the only functionality we have to upgrade the software is to remove the existing package, and reinstall the new one - it is destructive to our configuration, database, etc. which is obviously not ideal.
I don't really know how Debian's package manager handles "upgrades".
I know there are places where you can hook in to the upgrade process, e.g. preinst and postinst are called with "upgrade" arguments. I am currently studying this document:
But I was hoping I could get your expert opinions on how Debian package upgrade works from a package-developer's point of view and generate some high-level discussion on what I should be doing and looking for as far s implementing upgrade functionality in our package system goes.