diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2014-02-10 19:40:48 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2014-02-10 19:40:48 +0000 |
commit | 70c86f942e61319d39c1b4de9d530af6646dc7f3 (patch) | |
tree | 2d4c573238139a4d2b4d4a84139dcefa7592f8e4 /usr.sbin/pkg_add/OpenBSD | |
parent | e1a61ee6e51302c8a889463d2c56a5a69a3a9ad7 (diff) |
pattern for "our" temporary files is not random... get it out of the
normal "unknown files" routine and allow to remove them beforehand.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCheck.pm | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm b/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm index 48339569135..e9b0ba84eec 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCheck.pm,v 1.45 2014/01/10 16:09:08 espie Exp $ +# $OpenBSD: PkgCheck.pm,v 1.46 2014/02/10 19:40:47 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -739,6 +739,23 @@ sub display_unknown } } +sub display_tmps +{ + my ($self, $state) = @_; + $state->say("Unregistered temporary files:"); + for my $e (sort @{$state->{tmps}}) { + $state->say("\t#1", $e); + } + if ($state->{force}) { + unlink(@{$state->{tmps}}); + } elsif ($state->{interactive}) { + require OpenBSD::Interactive; + if (OpenBSD::Interactive::confirm("Remove")) { + unlink(@{$state->{tmps}}); + } + } +} + sub locate_unknown { my ($self, $state) = @_; @@ -793,9 +810,17 @@ sub localbase_check push(@{$state->{unknown}{dir}}, $File::Find::name); } else { return if $state->{known}{$File::Find::dir}{$_}; - push(@{$state->{unknown}{file}}, $File::Find::name); + if (m/^pkg\..{10}$/) { + push(@{$state->{tmps}}, $File::Find::name); + } else { + push(@{$state->{unknown}{file}}, + $File::Find::name); + } } }, OpenBSD::Paths->localbase); + if (defined $state->{tmps}) { + $self->display_tmps($state); + } if (defined $state->{unknown}) { if ($self->install_pkglocate($state)) { $self->locate_unknown($state); |