[SLL] how to maintain same pkgs/versions on two machines with APT?

Phil Mocek pmocek-sll at mocek.org
Wed Feb 27 09:41:43 PST 2008


I'd like to periodically query one machine (Debian/lenny) for
installed packages and their versions, then use that information
to ensure that a second machine has the same packages installed by
installing or upgrading packages there as necessary.  I need not
follow downgrades performed on the source machine, though it would
be acceptable for this to happen.

I know how to get a list of packages with dpkg (use --get-selections
switch) but I haven't found a way to also show versions.

It appears that the apt-show-versions package provides a utility
whose output could be parsed to arrive at this information, but
also that doing so would be more complicated than simply pulling
out a couple columns.

Sample output from apt-show-versions:

libx11-6/lenny uptodate 2:1.0.3-7
libkrb53/lenny uptodate 1.6.dfsg.3~beta1-2
libcomerr2/lenny uptodate 1.40.6-1
php5-cli/lenny uptodate 5.2.5-2
sun-java5-jre/lenny uptodate 1.5.0-14-3
libsasl2-2/lenny upgradeable from 2.1.22.dfsg1-8 to 2.1.22.dfsg1-16


Because what I want to accomplish seems like it would be such a
common request, I'm concerned that I'm overlooking something
obvious.  I'd appreciate suggestions.

-- 
Phil Mocek


More information about the linux-list mailing list