A feature that I wish Linux package managers had

August 5, 2009

One of the things that I wish Linux package managers like yum and Apt had was a convenient way of retrieving the original, stock version of some file and optionally reinstalling it into its original place. I'd expect (and wouldn't mind) that this would require re-downloading the original package that the file came from (and thus it was restricted to packages that were still in the package repository and hadn't been obsoleted and removed by some more recent package).

You might wonder what use this is. Well, perhaps you are more carefully organized than we are, but I find myself periodically wondering 'what did we change in file X?', for various varieties of X, and then trying to answer the question. While we have our customized files carefully saved in our reinstall area, we don't necessarily have the original file and especially we may not have the original file from the current OS release (if we have, for example, been carrying a customized file forward from OS release to OS release instead of attempting to redo our changes on top of each release's version).

(While careful use of a sufficiently sophisticated version control system can make it possible to keep track of all of this, it takes a bunch of additional work that you have to do all the time, even during emergencies when you're doing quick hacks to get the system going again.)

You can already do this by hand if you want, and I have, but it's a bunch of tedious work that the package manager could automate. Personally I think that it's a common enough thing (either in the 'I want to check the original' form or in the 'whoops, let's revert to stock configuration' form) that it should be a package manager feature.

(Today I found myself using 'apt-get purge lighttpd; apt-get install lighttpd' on a test system as the easiest way to get the stock lighttpd.conf file to look at. And you know, it was, and this is not a slam at Apt; I probably would have done the same thing with yum on an RPM-based system.)

Sidebar: how to do it by hand

The incantations that I know of for doing this in a yum-based system or an apt-based one are:

  • for yum: use yumdownloader to get a copy of the .rpm for the package into some convenient scratch directory, then use 'rpm2cpio <whatever>.rpm | cpio -di' to unpack it. Fish out the desired file.

  • for Apt: get the .deb from somewhere (there is probably a magic apt way to do this that's analogous to yumdownloader; I just go to package.ubuntu.com, search around, and follow the links to the binary packages), then use 'dpkg-deb -x <whatever>.deb scratchdir' to unpack it. Fish out the desired file.

As I score this, the two sides come out about equal in the end.

Written on 05 August 2009.
« A downside to syndication feed readers respecting permanent HTTP redirects
A rule for Internet software »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Wed Aug 5 02:14:14 2009
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.