summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Ustar.pm25
1 files changed, 24 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm
index b4d24410ba6..2d7ce0bd46f 100644
--- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Ustar.pm,v 1.25 2005/06/18 12:52:29 espie Exp $
+# $OpenBSD: Ustar.pm,v 1.26 2005/06/18 13:17:11 espie Exp $
#
# Copyright (c) 2002-2004 Marc Espie <espie@openbsd.org>
#
@@ -152,6 +152,7 @@ sub next
if ($size % 512) {
$self->{swallow} += 512 - $size % 512;
}
+ $self->{cachename} = $name;
return $result;
}
@@ -302,6 +303,11 @@ sub write_contents
# only files have anything to write
}
+sub resolve_links
+{
+ # only hard links must cheat
+}
+
sub copy_contents
{
# only files need copying
@@ -311,6 +317,7 @@ sub copy
{
my ($self, $wrarc) = @_;
my $out = $wrarc->{fh};
+ $self->resolve_links($wrarc);
my $header = OpenBSD::Ustar::mkheader($self, $self->type());
print $out $header;
@@ -352,6 +359,18 @@ sub create
die "Can't link $self->{destdir}$linkname to $self->{destdir}$self->{name}: $!";
}
+sub resolve_links
+{
+ my ($self, $arc) = @_;
+
+ my $k = $self->{archive}.":".$self->{linkname};
+ if (defined $arc->{key}->{$k}) {
+ $self->{linkname} = $arc->{key}->{$k};
+ } else {
+ die "Can't copy link over: original NOT available\n";
+ }
+}
+
sub isLink() { 1 }
sub isHardLink() { 1 }
@@ -518,6 +537,10 @@ sub copy_contents
if ($size % 512) {
print $out "\0" x (512 - $size % 512);
}
+ my $k = $self->{archive}.":".$self->{archive}->{cachename};
+ if (!defined $arc->{key}->{$k}) {
+ $arc->{key}->{$k} = $self->{name};
+ }
}
sub isFile() { 1 }