From 44b9b09a0ebc7efd092d8c5cb27ca52a02e16be3 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Mon, 7 Feb 2005 00:52:36 +0000 Subject: take size of metainfo into account when checking if the file system is large enough before installing a package. --- usr.sbin/pkg_add/OpenBSD/Add.pm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index d93e1eb7768..c398179d06f 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.30 2005/01/13 00:27:39 espie Exp $ +# $OpenBSD: Add.pm,v 1.31 2005/02/07 00:52:35 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie # @@ -98,6 +98,27 @@ sub validate_plist($$) $problems++; } } + my $dest = installed_info($pkgname); + my $dir = $plist->{dir}; + for my $i (info_names()) { + if (-e "$dir/$i") { + my $size = (stat _)[7]; + my $fname = "$dest/$i"; + my $s = OpenBSD::Vstat::add($fname, $size, \$pkgname); + next unless defined $s; + if ($s->{ro}) { + Warn "Error: ", $s->{dev}, " is read-only ($fname)\n"; + $problems++; + } + if ($state->{forced}->{kitchensink} && $state->{not}) { + next; + } + if ($s->avail() < 0) { + Warn "Error: ", $s->{dev}, " is not large enough ($fname)\n"; + $problems++; + } + } + } if (@$colliding > 0) { require OpenBSD::CollisionReport; -- cgit v1.2.3