summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2004-12-16 11:38:27 +0000
committerespie <espie@openbsd.org>2004-12-16 11:38:27 +0000
commit5b77f7dff63bbb9f7307a2afa3e2b3f25edafe70 (patch)
tree2daf412feeffd16e1a95ef72d47f0bce6ae72e22
parentbetter conflict: conflict with partial installations, always conflict with (diff)
downloadwireguard-openbsd-5b77f7dff63bbb9f7307a2afa3e2b3f25edafe70.tar.xz
wireguard-openbsd-5b77f7dff63bbb9f7307a2afa3e2b3f25edafe70.zip
if -f installed, don't treat reinstallation as errors.
if the package is installed, report it's there, don't give any conflict message.
-rw-r--r--usr.sbin/pkg_add/pkg_add14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 92b1352fabd..33d6df58559 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.144 2004/12/16 11:19:58 espie Exp $
+# $OpenBSD: pkg_add,v 1.145 2004/12/16 11:38:27 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -83,6 +83,18 @@ sub can_install($$$)
my %conflicts = map {($_,1)} @conflicts;
@conflicts = keys %conflicts;
+ if (defined $conflicts{$pkgname}) {
+ if ($state->{forced}->{installed}) {
+ # deal with replacing later, not an error.
+ if (!$state->{replace}) {
+ return undef;
+ }
+ } else {
+ print "Can't install $pkgname because it's already installed\n";
+ $errors++;
+ return undef;
+ }
+ }
if (!$state->{replace} || @conflicts >= 2) {
print "Can't install $pkgname because of conflicts (",join(',', @conflicts), ")\n";
$errors++;