Pre-emptive Request: Backing up installed packages.

Darryl Clarke smartssa at gmail.com
Thu Jan 26 07:46:47 UTC 2006


On 26/01/06, Michael T. Richter <ttmrichter at gmail.com> wrote:
> I'm getting the distinct impression that I'm going to have to resort to
> backing up /home and reinstalling Ubuntu to get access to my audio
> hardware again.  The problem is that I've downloaded and installed an
> obscene number of packages from Synaptic.  (It's really quite addictive,
> isn't it?)  Is there any convenient way to automate getting a list of
> packages that have been installed placed on a file somewhere and then
> automagically reinstalling them without having to select them one by one
> through Synaptic?  (And, too, a convenient way to backup the repository
> information?)

Here's my quick and dirty way to get a list which can then be 'read'
by synaptic to reinstall everything.  Synaptic will happily ignore
things already installed:

for i in `dpkg -l | cut -f3 -d\  `;
    do echo "$i\tinstall" >> installed.txt;
done

If anybody knows a better way, let me know ;)

Basically it takes a list of installed packages (dpkg -l) and appends
an 'install' instruction to the end of it on a line by line basis. 
Synaptic can then be used to read this file and mark packages
accordingly.

Note, there are two spaces after -d\

You'll also have to edit the .txt after generating it to get rid of
the first three lines of garbage.

As for the repository stuff, I wouldn't waste time backing up file
listings (as they get regenerated as soon as you update anyways), but
if you want to actually backup already downloaded files, they are in
/var/cache/apt/archives

--
~ Darryl  ~ smartssa at gmail.com
http://smartssa.com / http://darrylclarke.com




More information about the ubuntu-users mailing list