[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [IMPORTANT] Disaster Preperations!

On Tue, Mar 16, 1999 at 08:20:30AM -0800, Joseph Carter wrote:
> The only thing more than this which is truly important IMO is a list
> of installed packages (dpkg --get-selections > some/file) and /home if
> you can back that up now and then.  From there, you can pretty much
> recover a system nicely even if you have to erase everything and start
> over for some reason.

unfortunately, 'dpkg --get-selections' isn't as useful as it could be.
it only lists the packages selected for install, and not those which
have been removed or purged. this means, that you end with all standard
selections *plus* your selections list when you feed it back into 'dpkg

e.g. if you select another MTA (such as postfix or smail etc), then you
end up with both that MTA and exim selected for install.

my ugly-hack solution to this problem was the following shell script
outputs a selections list which covers install, deinstall, purge, hold,

it's ugly because a) it reads directly from /var/lib/dpkg/status which
is a bad thing to do, and b) it assumes that the 'Status' line will
always follow the corresponding 'Package' line (true in practice but
assumptions are bad).

It has worked for me when i've needed it. i use it to build proxy
servers for clients without having to spend hours selecting packages in

---cut here---/usr/local/bin/make-package-list.sh---cut here---
#! /bin/sh

egrep '^Package:|^Status:' /var/lib/dpkg/status | 
	sed -e 's/Package: //' -e 's/Status: //' -e 's/ ok .*//' | 
	xargs -n 2 echo

---cut here---/usr/local/bin/make-package-list.sh---cut here---

run it, save the output to a text file, and feed it into 
'dpkg --set-selections' when you need it.


craig sanders

Reply to: