summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-07-24 11:50:04 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-07-24 11:50:04 +0000
commit78e244c86fcf016f66edb8207f5886fc16edb5ae (patch)
treec5dac747b24d8a94a6b2b066c223e16ba7bfcf15 /usr.sbin
parent27bf10dd2c87d87fb27302da0ad92960e6634083 (diff)
postpone decision whether to replace already installed packages in -r mode,
so that we get to execute is_needed and actually comparing full signatures.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/pkg_add16
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index c8a5175ed55..79ad00d13f1 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.175 2005/06/29 22:54:31 espie Exp $
+# $OpenBSD: pkg_add,v 1.176 2005/07/24 11:50:03 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -53,15 +53,12 @@ sub can_install($$$)
my %conflicts = map {($_,1)} @conflicts;
if (defined $conflicts{$pkgname}) {
- if ($state->{forced}->{installed}) {
- # deal with replacing later, not an error.
- if (!$state->{replace}) {
- return undef;
+ if (!$state->{replace}) {
+ if (!$state->{forced}->{installed}) {
+ print "Can't install $pkgname because it's already installed\n";
+ $state->{installed}->{$handle->{pkgname}} = 1;
+ $errors++;
}
- } else {
- print "Can't install $pkgname because it's already installed\n";
- $state->{installed}->{$handle->{pkgname}} = 1;
- $errors++;
return undef;
}
}
@@ -621,6 +618,7 @@ sub install_package
if (is_installed($plist->pkgname()) && !$state->{forced}->{installed}) {
if ($state->{replace}) {
if (!OpenBSD::Update::is_needed($plist, $state)) {
+ $state->{installed}->{$handle->{pkgname}} = 1;
$handle->close();
return ();
}