Solved

Debian packages and "upgrade" support

Posted on 2011-09-02
4
423 Views
Last Modified: 2012-05-12
Hi guys,

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:

http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html

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.

Thanks!
0
Comment
Question by:Frosty555
  • 3
4 Comments
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36474524
This is just a thought, not actually Debian upgrade doing.

For update/upgrade package, in deb package file, it contains the file list as meta data.
So, group those files into binary, document (man page) and configuration files.
When update, compare the file list,
1. overwrite the exist ones (files) except for the configuration files. New configuration files install as <filename>_debnew

2. delete those files in previous version only (Need to have file list comparison result).

3. Update the deb meta database for new version installation (with new files installed list).

So you don't need to uninstall the previous version.
So of packages like server/daemon need to in preinst to check the daemon running status and shut it down
before file overwriting.
0
 
LVL 31

Accepted Solution

by:
Frosty555 earned 0 total points
ID: 36543429
Hi Wesly,

While I appreciate your suggestions, we're reinventing the wheel which is exactly what I was trying to avoid by using debian's existing (and already very mature) package upgrade system.

I found this document:

http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html

Which precisely describes what I was looking for - a good description of the Debian package scripts, and a precise specification for exactly how an upgrade happens from a developer's point of view.
0
 
LVL 31

Author Closing Comment

by:Frosty555
ID: 36565440
found whitepaper on the subject
0
 
LVL 31

Author Comment

by:Frosty555
ID: 36543449
I realize looking at my comments now that the document I just posted is actually exactly the document I was talking about in my original question.... how about that!

I think what has happened here is that now I've spent some time diving into debian packages and understanding how they work, I finally UNDERSTAND that document. I didn't really know what it was talking about before, but now that I have done more research I have a better context and high level understanding of Debian packages from a developer's point of view, I understand the document and it is exactly the information I needed.

That high level overview of Debian package maintainer scripts from a developer's perspective was what I was trying to discuss in this question - I was hoping for a little more response. Oh well.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question