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

Re: Bad points for debian (was: resetting dpkg)



Stuart Ballard replied off-list:
On Wed, Dec 29, 1999 at 09:14:42PM +0000, Stuart Ballard wrote
> John Pearson wrote:
> > 
> > I've attached a three-line awk filter that should do what's required,
> > in the event it comes up again.
> > 
> > Run it as
> > # dpkg -l | reset-selections.awk | dpkg --set-selections
> 
> This unfortunately has a bug: dpkg -l truncates the package names. For
> example, gnome-control-c instead of gnome-control-center. Any thoughts
> on a workaround?
> 
> Thanks,
> Stuart.

Aargh!! reality strikes again.

The attached 50-line perl script should do the trick; it reads
/var/lib/dpkg/status directly.

Use as

 # reset-selections.pl > my-selections

to check for errors then, when you're happy,

 # dpkg --set-selections < my-selections

The script uses the status strings found in /usr/doc/dpkg/internals.html;
if they change then this script will also need changing.  It also applies
some (very) basic sanity checks to the status file as it goes, which is
why you should review the output first.  The example usage avoids piping
directly to dpkg --set-selections, to avoid *any*possibility* of
file-locking deadlocks (this shouldn't be an issue, but a broken perl
might make it so).


John P.
-- 
huiac@camtech.net.au
john@huiac.apana.org.au
"Oh - I - you know - my job is to fear everything." - Bill Gates in Denmark

Attachment: reset-selections.pl
Description: Perl program


Reply to: