summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-10-19 10:41:20 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-10-19 10:41:20 +0000
commit600c195b61888ec0dd2f50ed8231ac363e97e24c (patch)
tree13789a358398d9fe95ef87d24f0ed5ab72f69b5d /usr.sbin/pkg_add
parentb79f89b4549b69f0f486aca1b268f78d40e64ad0 (diff)
mark links being extracted with `zap', so that they do not get recorded
into partial plists until they've gone through an actual install. Prevents partial replacements from destroying genuine links in packages when they get uninstalled.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm3
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm3
3 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index e3bf3bf536c..98f0b159fbc 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.42 2005/09/24 12:52:19 espie Exp $
+# $OpenBSD: Add.pm,v 1.43 2005/10/19 10:41:19 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -332,8 +332,10 @@ sub install
File::Path::mkpath(dirname($destdir.$fullname));
if (defined $self->{link}) {
link($destdir.$self->{link}, $destdir.$fullname);
+ delete $self->{zap};
} elsif (defined $self->{symlink}) {
symlink($self->{symlink}, $destdir.$fullname);
+ delete $self->{zap};
} else {
rename($self->{tempname}, $destdir.$fullname) or
Fatal "Can't move ", $self->{tempname}, " to $fullname: $!";
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 0ee0f853ac7..c8b0287e159 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.78 2005/09/04 22:47:56 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.79 2005/10/19 10:41:19 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -261,6 +261,7 @@ use File::Basename;
sub write
{
my ($self, $fh) = @_;
+ return if defined $self->{zap};
print $fh "\@ignore\n" if defined $self->{ignore};
print $fh "\@comment no checksum\n" if defined $self->{nochecksum};
$self->SUPER::write($fh);
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index 9db13adf5fe..4238434e4c3 100644
--- a/usr.sbin/pkg_add/OpenBSD/Update.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Update.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Update.pm,v 1.57 2005/09/09 09:11:38 espie Exp $
+# $OpenBSD: Update.pm,v 1.58 2005/10/19 10:41:19 espie Exp $
#
# Copyright (c) 2004 Marc Espie <espie@openbsd.org>
#
@@ -62,6 +62,7 @@ sub extract
my $file = $self->prepare_to_extract($state);
if (defined $self->{link} || defined $self->{symlink}) {
+ $self->{zap} = 1;
return;
}