diff --git a/usr.sbin/pkg_install/add/add.h b/usr.sbin/pkg_install/add/add.h index 5bbaa2e9ebdc..fe9b5fa29c7e 100644 --- a/usr.sbin/pkg_install/add/add.h +++ b/usr.sbin/pkg_install/add/add.h @@ -1,4 +1,4 @@ -/* $Id: add.h,v 1.3 1993/09/05 04:53:47 jkh Exp $ */ +/* $Id: add.h,v 1.4 1994/12/06 00:51:31 jkh Exp $ */ /* * FreeBSD install - a package for the installation and maintainance @@ -36,6 +36,7 @@ extern char *Directory; extern char *PkgName; extern char *PlayPen; extern add_mode_t AddMode; +extern char *Home; int make_hierarchy(char *); void extract_plist(char *, Package *); diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 341b700b46eb..e8b053b4baae 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -1,5 +1,5 @@ #ifndef lint -static char *rcsid = "$Id: main.c,v 1.4 1993/09/14 19:53:01 jkh Exp $"; +static char *rcsid = "$Id: main.c,v 1.5 1994/12/06 00:51:33 jkh Exp $"; #endif /* @@ -39,6 +39,7 @@ char *Group = NULL; char *PkgName = NULL; char *Directory = NULL; char *PlayPen = NULL; +char *Home = NULL; add_mode_t AddMode = NORMAL; int diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index f5f5f07ca9c3..da64fae6d00e 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.12 1994/11/17 10:53:21 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.13 1994/12/06 00:51:34 jkh Exp $"; #endif /* @@ -100,7 +100,7 @@ pkg_do(char *pkg) return 1; } sb.st_size *= 4; - (void)make_playpen(PlayPen, sb.st_size); + Home = make_playpen(PlayPen, sb.st_size); if (unpack(pkg_fullname, NULL)) return 1; @@ -142,13 +142,28 @@ pkg_do(char *pkg) for (p = Plist.head; p ; p = p->next) { if (p->type != PLIST_PKGDEP) continue; - if (Verbose) - printf("Checking dependency on package list `%s'\n", p->name); if (!Fake && vsystem("pkg_info -e %s", p->name)) { - whinge("Package `%s' depends on missing package `%s'%s.", PkgName, + char tmp[120]; + + sprintf(tmp, "%s/%s.tgz", Home, p->name); + if (fexists(tmp)) { + if (Verbose) + printf("Package `%s' depends on `%s': Trying to load it.\n", PkgName, p->name); + if (vsystem("pkg_add %s", tmp)) { + whinge("Autoload of dependency package `%s' failed!%s", + p->name, Force ? " (proceeding anyway)" : ""); + if (!Force) + code++; + } + else if (Verbose) + printf("Dependency `%s' loaded successfully.\n", p->name); + } + else { + whinge("Package `%s' depends on missing package `%s'%s.", PkgName, p->name, Force ? " (proceeding anyway)" : ""); - if (!Force) - code++; + if (!Force) + code++; + } } } if (code != 0) diff --git a/usr.sbin/pkg_install/create/create.h b/usr.sbin/pkg_install/create/create.h index e0ee4ccacefa..e64cf29366ac 100644 --- a/usr.sbin/pkg_install/create/create.h +++ b/usr.sbin/pkg_install/create/create.h @@ -1,4 +1,4 @@ -/* $Id: create.h,v 1.5 1994/05/19 18:27:38 alm Exp $ */ +/* $Id: create.h,v 1.6 1994/12/06 00:51:35 jkh Exp $ */ /* * FreeBSD install - a package for the installation and maintainance @@ -34,6 +34,7 @@ extern char *Require; extern char *PlayPen; extern char *ExcludeFrom; extern char *Mtree; +extern char *Pkgdeps; extern int Dereference; void check_list(char *, Package *); diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c index 623d7d117a6d..e3058dd3c392 100644 --- a/usr.sbin/pkg_install/create/main.c +++ b/usr.sbin/pkg_install/create/main.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: main.c,v 1.7 1994/05/19 18:27:40 alm Exp $"; +static const char *rcsid = "$Id: main.c,v 1.8 1994/12/06 00:51:36 jkh Exp $"; #endif /* @@ -16,7 +16,7 @@ static const char *rcsid = "$Id: main.c,v 1.7 1994/05/19 18:27:40 alm Exp $"; #include "lib.h" #include "create.h" -static char Options[] = "YNhvf:p:c:d:i:k:r:t:X:D:m:"; +static char Options[] = "YNhvf:p:P:c:d:i:k:r:t:X:D:m:"; char *Prefix = NULL; char *Comment = NULL; @@ -29,6 +29,7 @@ char *Require = NULL; char *PlayPen = NULL; char *ExcludeFrom = NULL; char *Mtree = NULL; +char *Pkgdeps = NULL; int Dereference = 0; int @@ -101,6 +102,10 @@ main(int argc, char **argv) Mtree = optarg; break; + case 'P': + Pkgdeps = optarg; + break; + case '?': default: usage(prog_name, NULL); @@ -153,6 +158,7 @@ usage(const char *name, const char *fmt, ...) fprintf(stderr, "-k script de-install script\n"); fprintf(stderr, "-D file install notice\n"); fprintf(stderr, "-m file mtree spec for directories\n"); + fprintf(stderr, "-P pkgs set package dependency list to pkgs\n"); fprintf(stderr, "-p prefix install prefix will be arg\n"); fprintf(stderr, "-r script pre/post requirements script\n"); fprintf(stderr, "-t temp use temp as template for mktemp()\n"); diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index 6d15ef8e3864..fb72a5114e01 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.13 1994/11/17 10:54:11 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.14 1994/12/06 00:51:37 jkh Exp $"; #endif /* @@ -62,6 +62,14 @@ pkg_perform(char **pkgs) else suffix = "tgz"; + /* Stick the dependencies, if any, at the top */ + while (Pkgdeps) { + cp = strsep(&Pkgdeps, " \t\n"); + if (*cp) { + add_plist(&plist, PLIST_PKGDEP, cp); + } + } + /* Slurp in the packing list */ read_plist(&plist, pkg_in); diff --git a/usr.sbin/pkg_install/create/pkg_create.1 b/usr.sbin/pkg_install/create/pkg_create.1 index c2fc2bb99cac..e5424a9e85b7 100644 --- a/usr.sbin/pkg_install/create/pkg_create.1 +++ b/usr.sbin/pkg_install/create/pkg_create.1 @@ -15,7 +15,7 @@ .\" .\" .\" @(#)pkg_create.8 -.\" $Id: pkg_create.1,v 1.11 1995/01/05 10:22:51 jkh Exp $ +.\" $Id: pkg_create.1,v 1.12 1995/01/05 10:37:09 jkh Exp $ .\" hacked up by John Kohl for NetBSD--fixed a few bugs, extended keywords, .\" added dependency tracking, etc. .\" @@ -28,6 +28,7 @@ .Sh SYNOPSIS .Nm .Op Fl YNhv +.Op Fl P Ar pkgs .Op Fl p Ar prefix .Op Fl f Ar contents .Op Fl i Ar iscript @@ -99,6 +100,14 @@ to be the install procedure for the package. This can be any executable program (or shell script). It will be invoked automatically when the package is later installed. .Em "Optional." +.It Fl P Ar pkgs +Sets the initial package dependency list to +.Ar pkgs. +This is assumed to be a whitespace separated list of package names +and is meant as a convenient shorthand for specifying multiple +.Cm @pkgdep +directives in the packing list (see PACKING LIST DETAILS section below). +.Em "Optional." .It Fl p Ar prefix Sets .Ar prefix