diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-06-13 12:51:19 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-06-13 12:51:19 +0000 |
commit | dc96153044394c55a72b1f22a5d8bf7011c751af (patch) | |
tree | 8d163f9e2a516bd2293c63d79b55952988ee41f7 | |
parent | 1ad4af8dc3ae49fa8a13a6e359a8fdabab36d3f5 (diff) |
$entry->{cwd} support while writing, for symetry.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Ustar.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm index 0f4bfc98536..09f3fe075da 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.18 2005/06/13 12:46:47 espie Exp $ +# $OpenBSD: Ustar.pm,v 1.19 2005/06/13 12:51:18 espie Exp $ # # Copyright (c) 2002-2004 Marc Espie <espie@openbsd.org> # @@ -160,6 +160,12 @@ sub mkheader } else { die "Can't fit such a name $name\n"; } + my $linkname = $entry->{linkname}; + if (defined $entry->{cwd}) { + my $cwd = $entry->{cwd}; + $cwd.='/' unless $cwd =~ m/\/$/; + $linkname =~ s/^\Q$cwd\E//; + } my $header; my $cksum = ' 'x8; for (1 .. 2) { @@ -172,7 +178,7 @@ sub mkheader sprintf("%o", $entry->{mtime}), $cksum, $type, - $entry->{linkname}, + $linkname, 'ustar', '00', $entry->{uname}, $entry->{gname}, |