Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Debian packages and "upgrade" support

Posted on 2011-09-02
4
Medium Priority
?
434 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month12 days, 21 hours left to enroll

972 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