diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-12-16 11:38:28 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-12-16 11:38:28 +0000 |
commit | 2876c57e1963fc9a1c5b22dc1d87eb9c90fbab7f (patch) | |
tree | 523a73d6bf68e56a0602f6f3c074df049ac6464b /usr.sbin/pkg_add | |
parent | 0da9c87af40816e6acd93dceb6a96c8faeff69ec (diff) |
if -f installed, don't treat reinstallation as errors.
if the package is installed, report it's there, don't give any conflict
message.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 14 |
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++; |