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

Re: WARNING about XFree86!



Zed Pobre <zed@moebius.interdestination.com> writes:

> [1  <text/plain; us-ascii (7bit)>]
> On Mon, Oct 19, 1998 at 05:44:11PM -0400, Branden Robinson wrote:
> >
> > packaging errors should use the new version (3.3.2.3a-3).  Other should use
> > dpkg or dselect to put their X packages on hold.

>     Hm?  You can use dpkg to put packages on hold from the command
> line?  Could someone tell me how this works, please?  I have a
> personal dislike for dselect... :)

Replace "install" with "hold" in the "/var/lib/dpkg/status" file, or
save the following perl script as "dpkg-hold", make it executable and
do:

  dpkg-hold xbase xlib6g

(Apologies to those whose perl is more elegant than mine.)


Steve
dunham@cse.msu.edu


#!/usr/bin/perl
# Place packages on hold

if ($#ARGV<0) {
  print "Usage: $0 package1 package2 ...\n";
  exit;
}

open INFILE,"</var/lib/dpkg/status" or
  die "Error: Can't open status file.\n";
open OUTFILE,">/var/lib/dpkg/status.new" or 
  die "Error: Can't open output file.\n";

my %list;
for (@ARGV) {$list{$_}++;}

while(<INFILE>) {
  if (/^Package: (.*)/) {$package = $1;};
  if (/^Status:/ && $list{$package} !=0) {
    my $a,$b,$c;
    ($a,$b,$c)= split ' ',$_,3; 
    print OUTFILE "$a hold $c";
    print "Put $package on hold.\n";
    next;
  };
  print OUTFILE $_;
}

! -e "/var/lib/dpkg/status.new" &&  
  die "Error: Output file doesn't exist.\n";
-z "/var/lib/dpkg/status.new" &&  
  die "Error: Output file has zero length.\n";

unlink("/var/lib/dpkg/status.old");
(link("/var/lib/dpkg/status", "/var/lib/dpkg/status.old")
 && unlink("/var/lib/dpkg/status")
 && link("/var/lib/dpkg/status.new","/var/lib/dpkg/status") 
 && unlink("/var/lib/dpkg/status.new") )
  || die ("Can't replace status file\n");


Reply to: