Add -i option for package installation without fetching and

installing its dependencies.

PR:		bin/117065
Submitted by:	Vladimir Ermakov <samflanker@gmail.com>
MFC after:	14 days
This commit is contained in:
Kirill Ponomarev 2007-11-10 09:40:39 +00:00
parent 989cbe408e
commit 2cd24b447e
4 changed files with 16 additions and 4 deletions

View File

@ -31,6 +31,7 @@ extern Boolean NoInstall;
extern Boolean NoRecord;
extern Boolean FailOnAlreadyInstalled;
extern Boolean KeepPackage;
extern Boolean IgnoreDeps;
extern char *Mode;
extern char *Owner;
extern char *Group;

View File

@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$");
#include "lib.h"
#include "add.h"
static char Options[] = "hvIRfFnrp:P:SMt:C:K";
static char Options[] = "hviIRfFnrp:P:SMt:C:K";
char *Prefix = NULL;
Boolean PrefixRecursive = FALSE;
@ -37,6 +37,7 @@ Boolean NoRecord = FALSE;
Boolean Remote = FALSE;
Boolean KeepPackage = FALSE;
Boolean FailOnAlreadyInstalled = TRUE;
Boolean IgnoreDeps = FALSE;
char *Mode = NULL;
char *Owner = NULL;
@ -167,6 +168,9 @@ main(int argc, char **argv)
case 'C':
Chroot = optarg;
break;
case 'i':
IgnoreDeps = TRUE;
break;
case 'h':
case '?':
@ -322,7 +326,7 @@ static void
usage()
{
fprintf(stderr, "%s\n%s\n",
"usage: pkg_add [-vInfFrRMSK] [-t template] [-p prefix] [-P prefix] [-C chrootdir]",
"usage: pkg_add [-viInfFrRMSK] [-t template] [-p prefix] [-P prefix] [-C chrootdir]",
" pkg-name [pkg-name ...]");
exit(1);
}

View File

@ -252,6 +252,7 @@ pkg_do(char *pkg)
}
/* Now check the packing list for conflicts */
if(!IgnoreDeps){
for (p = Plist.head; p != NULL; p = p->next) {
if (p->type == PLIST_CONFLICTS) {
int i;
@ -296,7 +297,7 @@ pkg_do(char *pkg)
!(deporigin != NULL && matchbyorigin(deporigin, NULL) != NULL)) {
char path[FILENAME_MAX], *cp = NULL;
if (!Fake) {
if (!Fake&&!IgnoreDeps) {
char prefixArg[2 + MAXPATHLEN]; /* "-P" + Prefix */
if (PrefixRecursive) {
strlcpy(prefixArg, "-P", sizeof(prefixArg));
@ -368,6 +369,7 @@ pkg_do(char *pkg)
else if (Verbose)
printf(" - already installed.\n");
}
}
if (code != 0)
goto bomb;
@ -514,6 +516,7 @@ pkg_do(char *pkg)
depnames[0] = p->name;
depnames[1] = NULL;
}
if(!IgnoreDeps){
for (i = 0; depnames[i] != NULL; i++) {
sprintf(contents, "%s/%s/%s", LOG_DIR, depnames[i],
REQUIRED_BY_FNAME);
@ -531,6 +534,7 @@ pkg_do(char *pkg)
}
}
}
}
if (Verbose)
printf("Package %s registered in %s\n", Plist.name, LogDir);
}

View File

@ -15,7 +15,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd January 9, 2006
.Dd November 10, 2007
.Dt PKG_ADD 1
.Os
.Sh NAME
@ -87,6 +87,9 @@ Turn on verbose output.
Keep any downloaded package in
.Ev PKGDIR
if it is defined or in current directory by default.
.It Fl i
Install the package without fetching and installing
dependencies.
.It Fl I
If any installation scripts (pre-install or post-install) exist for a given
package, do not execute them.