A feature that I wish Linux package managers had
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
Sidebar: how to do it by hand
The incantations that I know of for doing this in a
or an apt-based one are:
yumdownloaderto get a copy of the
.rpmfor 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
.debfrom 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.
Comments on this page:Written on 05 August 2009.