From owner-freebsd-ports Sat Jun 30 11:38:42 2001 Delivered-To: freebsd-ports@freebsd.org Received: from femail12.sdc1.sfba.home.com (femail12.sdc1.sfba.home.com [24.0.95.108]) by hub.freebsd.org (Postfix) with ESMTP id 84DB837BA26 for ; Sat, 30 Jun 2001 10:23:49 -0700 (PDT) (envelope-from stephen@math.missouri.edu) Received: from math.missouri.edu ([24.12.197.197]) by femail12.sdc1.sfba.home.com (InterMail vM.4.01.03.20 201-229-121-120-20010223) with ESMTP id <20010630172348.TQRP2743.femail12.sdc1.sfba.home.com@math.missouri.edu>; Sat, 30 Jun 2001 10:23:48 -0700 Message-ID: <3B3E0B22.4BDABD25@math.missouri.edu> Date: Sat, 30 Jun 2001 12:23:46 -0500 From: Stephen Montgomery-Smith X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Cynic Cc: ports@FreeBSD.ORG Subject: Re: a quirk in the ports framework References: <5.1.0.14.2.20010630083531.02944a60@mail.cz> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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() { 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