From 04864e2eb6b849b02c8fccf1398296d9296adc5a Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Thu, 2 Dec 2004 00:04:39 +0000 Subject: make sure we don't call Update::is_needed if we're not doing pkg_add -r. --- usr.sbin/pkg_add/pkg_add | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 954b31b1654..5c001d1734e 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.131 2004/11/27 16:38:26 espie Exp $ +# $OpenBSD: pkg_add,v 1.132 2004/12/02 00:04:38 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie # @@ -540,9 +540,16 @@ sub install_package my $plist = $handle->{plist}; - if (is_installed($plist->pkgname()) && !$state->{forced}->{installed} && !OpenBSD::Update::is_needed($plist, $state)) { - $handle->close(); - return (); + if (is_installed($plist->pkgname()) && !$state->{forced}->{installed}) { + if ($state->{replace}) { + if (!OpenBSD::Update::is_needed($plist, $state)) { + $handle->close(); + return (); + } + } else { + $handle->close(); + return (); + } } if ($plist->has('arch')) { unless ($plist->{arch}->check($state->{arch})) { -- cgit v1.2.3