Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jun 2001 12:23:46 -0500
From:      Stephen Montgomery-Smith <stephen@math.missouri.edu>
To:        Cynic <cynic@mail.cz>
Cc:        ports@FreeBSD.ORG
Subject:   Re: a quirk in the ports framework
Message-ID:  <3B3E0B22.4BDABD25@math.missouri.edu>
References:  <5.1.0.14.2.20010630083531.02944a60@mail.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
Cynic wrote:
> 
> The problem is simple: if an error occurrs during the install
> of a port, the files that have been istalled so far are nor
> deleted. And, because the install didn't finish, you can't
> # make deinstall either. This is not so bad with small pieces
> of software, but is a real PITA when you install something
> large.
> 

Try out this script - you type

name-of-script /usr/ports/xxx/yyy

and then it lists the commands to deinstall the package.  (If you are
brave you can change the "print" commands at the end of the file to
"sysinstall", or you can pipe it through sh.)

#!/usr/bin/perl -w

if (defined($ARGV[0])) {
  die "Cannot find pkg-plist"
    if (! -e "$ARGV[0]/pkg-plist");
  die "Cannot find Makefile"
    if (! -e "$ARGV[0]/Makefile");
  chdir $ARGV[0];
}
die "Cannot find pkg-plist" if (! -e "pkg-plist");
die "Cannot find Makefile" if (! -e "Makefile");

$make_plist_sub = "printf 'print-plist-sub:\\n" .
        "\\t\@echo \${PLIST_SUB}" .
        "\\n\\n.include \"Makefile\"'" .
        " | make -f - print-plist-sub";
foreach $s (split ' ',`$make_plist_sub`) {
  $s =~ /^(.*?)\=(.*)$/;
  $sub{$1} = $2;
}

$make_prefix = "printf 'print-prefix:\\n" .
        "\\t\@echo \${PREFIX}" .
        "\\n\\n.include \"Makefile\"'" .
        " | make -f - print-prefix";
$prefix = `$make_prefix`;
chomp($prefix);

open(LIST,"pkg-plist");

while(<LIST>) {
  s/\%\%(.*?)\%\%/$sub{$1}/g;
  s/\%D/$prefix/g;
  print "rm $prefix/$_" if !/^\@/;
  print "rmdir $prefix/$1\n" if /^\@dirrm (.*)$/;
  print "$1\n" if /^\@unexec (.*)$/;
}

-- 
Stephen Montgomery-Smith
stephen@math.missouri.edu
http://www.math.missouri.edu/~stephen

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B3E0B22.4BDABD25>