summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-06-20 13:27:39 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-06-20 13:27:39 +0000
commit1a5d8bc25c022351355389bd2f3e1b52c34b5bee (patch)
tree701174891d5c2e525cc58ae82b2a4d7daa8725f5 /usr.sbin/pkg_add/OpenBSD
parentd1e87bd1161081c050d5072e0919c7ba53d40ff1 (diff)
flesh out the destdir() working. Provide a convenience close() method.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Ustar.pm28
1 files changed, 27 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm
index 2d7ce0bd46f..d86954a4923 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.26 2005/06/18 13:17:11 espie Exp $
+# $OpenBSD: Ustar.pm,v 1.27 2005/06/20 13:27:37 espie Exp $
#
# Copyright (c) 2002-2004 Marc Espie <espie@openbsd.org>
#
@@ -267,6 +267,30 @@ sub pad
print $fh "\0"x1024;
}
+sub close
+{
+ my $self = shift;
+ if (defined $self->{padout}) {
+ $self->pad();
+ }
+ close($self->{fh});
+}
+
+sub destdir
+{
+ my $self = shift;
+ if (@_ > 0) {
+ $self->{destdir} = shift;
+ } else {
+ return $self->{destdir};
+ }
+}
+
+sub fh
+{
+ return $_[0]->{fh};
+}
+
package OpenBSD::Ustar::Object;
sub set_modes
{
@@ -289,6 +313,7 @@ sub write
my $arc = $self->{archive};
my $out = $arc->{fh};
+ $arc->{padout} = 1;
my $header = OpenBSD::Ustar::mkheader($self, $self->type());
print $out $header;
$self->write_contents($arc);
@@ -318,6 +343,7 @@ sub copy
my ($self, $wrarc) = @_;
my $out = $wrarc->{fh};
$self->resolve_links($wrarc);
+ $wrarc->{padout} = 1;
my $header = OpenBSD::Ustar::mkheader($self, $self->type());
print $out $header;