summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-12-02 00:04:39 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-12-02 00:04:39 +0000
commit04864e2eb6b849b02c8fccf1398296d9296adc5a (patch)
tree71c112ffe809a26a747a8ed137692a5d1360f421
parent859dc54df90d518610952af4eda423b96c0628f6 (diff)
make sure we don't call Update::is_needed if we're not doing pkg_add -r.
-rw-r--r--usr.sbin/pkg_add/pkg_add15
1 files 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 <espie@openbsd.org>
#
@@ -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})) {