Add -F option to not fail on already installed packages.

Submitted by:   Eugene Grosbein <eugen@grosbein.pp.ru>
This commit is contained in:
phk 2006-03-09 14:49:19 +00:00
parent 5a08101277
commit 057f1af5e2
4 changed files with 13 additions and 5 deletions

View File

@ -29,6 +29,7 @@ extern char *Prefix;
extern Boolean PrefixRecursive;
extern Boolean NoInstall;
extern Boolean NoRecord;
extern Boolean FailOnAlreadyInstalled;
extern Boolean KeepPackage;
extern char *Mode;
extern char *Owner;

View File

@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$");
#include "lib.h"
#include "add.h"
static char Options[] = "hvIRfnrp:P:SMt:C:K";
static char Options[] = "hvIRfFnrp:P:SMt:C:K";
char *Prefix = NULL;
Boolean PrefixRecursive = FALSE;
@ -36,6 +36,7 @@ Boolean NoInstall = FALSE;
Boolean NoRecord = FALSE;
Boolean Remote = FALSE;
Boolean KeepPackage = FALSE;
Boolean FailOnAlreadyInstalled = TRUE;
char *Mode = NULL;
char *Owner = NULL;
@ -132,6 +133,10 @@ main(int argc, char **argv)
Force = TRUE;
break;
case 'F':
FailOnAlreadyInstalled = FALSE;
break;
case 'K':
KeepPackage = TRUE;
break;

View File

@ -245,9 +245,9 @@ pkg_do(char *pkg)
*/
if ((isinstalledpkg(Plist.name) > 0 ||
matchbyorigin(Plist.origin, NULL) != NULL) && !Force) {
warnx("package '%s' or its older version already installed",
Plist.name);
code = 1;
warnx("package '%s' or its older version already installed%s",
Plist.name, FailOnAlreadyInstalled ? "" : " (ignored)");
code = FailOnAlreadyInstalled != FALSE;
goto success; /* close enough for government work */
}

View File

@ -23,7 +23,7 @@
.Nd a utility for installing software package distributions
.Sh SYNOPSIS
.Nm
.Op Fl vInfrRMSK
.Op Fl vInfFrRMSK
.Op Fl t Ar template
.Op Fl p Ar prefix
.Op Fl P Ar prefix
@ -109,6 +109,8 @@ Although
.Nm
will still try to find and auto-install missing prerequisite packages,
a failure to find one will not be fatal.
.It Fl F
Already installed packages are not an error.
.It Fl p Ar prefix
Set
.Ar prefix