1993-08-26 01:19:55 +00:00
|
|
|
#ifndef lint
|
1997-10-08 07:48:21 +00:00
|
|
|
static const char rcsid[] =
|
|
|
|
"$Id: main.c,v 1.16 1997/06/06 12:19:11 jkh Exp $";
|
1993-08-26 01:19:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FreeBSD install - a package for the installation and maintainance
|
|
|
|
* of non-core utilities.
|
|
|
|
*
|
|
|
|
* Jordan K. Hubbard
|
|
|
|
* 18 July 1993
|
|
|
|
*
|
|
|
|
* This is the create module.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1997-10-08 07:48:21 +00:00
|
|
|
#include <err.h>
|
1993-08-26 01:19:55 +00:00
|
|
|
#include "lib.h"
|
|
|
|
#include "create.h"
|
|
|
|
|
1997-06-06 12:19:11 +00:00
|
|
|
static char Options[] = "YNOhvf:p:P:c:d:i:k:r:t:X:D:m:s:";
|
1993-08-26 01:19:55 +00:00
|
|
|
|
|
|
|
char *Prefix = NULL;
|
|
|
|
char *Comment = NULL;
|
|
|
|
char *Desc = NULL;
|
1997-06-06 12:19:11 +00:00
|
|
|
char *SrcDir = NULL;
|
1994-12-06 00:51:50 +00:00
|
|
|
char *Display = NULL;
|
1993-08-26 01:19:55 +00:00
|
|
|
char *Install = NULL;
|
|
|
|
char *DeInstall = NULL;
|
|
|
|
char *Contents = NULL;
|
|
|
|
char *Require = NULL;
|
1993-09-12 20:45:31 +00:00
|
|
|
char *ExcludeFrom = NULL;
|
1994-12-06 00:51:50 +00:00
|
|
|
char *Mtree = NULL;
|
1995-04-09 15:05:01 +00:00
|
|
|
char *Pkgdeps = NULL;
|
1997-06-06 12:19:11 +00:00
|
|
|
char PlayPen[FILENAME_MAX];
|
1994-05-19 18:27:41 +00:00
|
|
|
int Dereference = 0;
|
1995-04-22 00:03:18 +00:00
|
|
|
int PlistOnly = 0;
|
1993-08-26 01:19:55 +00:00
|
|
|
|
1997-10-08 07:48:21 +00:00
|
|
|
static void usage __P((void));
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int ch;
|
|
|
|
char **pkgs, **start;
|
|
|
|
|
|
|
|
pkgs = start = argv;
|
1997-03-31 05:11:47 +00:00
|
|
|
while ((ch = getopt(argc, argv, Options)) != -1)
|
1993-08-26 01:19:55 +00:00
|
|
|
switch(ch) {
|
|
|
|
case 'v':
|
|
|
|
Verbose = TRUE;
|
|
|
|
break;
|
|
|
|
|
1994-04-05 14:05:40 +00:00
|
|
|
case 'N':
|
|
|
|
AutoAnswer = NO;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Y':
|
|
|
|
AutoAnswer = YES;
|
|
|
|
break;
|
|
|
|
|
1995-04-22 00:03:18 +00:00
|
|
|
case 'O':
|
|
|
|
PlistOnly = YES;
|
|
|
|
break;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
case 'p':
|
|
|
|
Prefix = optarg;
|
|
|
|
break;
|
|
|
|
|
1997-06-06 12:19:11 +00:00
|
|
|
case 's':
|
|
|
|
SrcDir = optarg;
|
|
|
|
break;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
case 'f':
|
|
|
|
Contents = optarg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'c':
|
|
|
|
Comment = optarg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
Desc = optarg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'i':
|
|
|
|
Install = optarg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'k':
|
|
|
|
DeInstall = optarg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'r':
|
|
|
|
Require = optarg;
|
|
|
|
break;
|
|
|
|
|
1993-09-05 04:54:24 +00:00
|
|
|
case 't':
|
1995-10-25 15:38:37 +00:00
|
|
|
strcpy(PlayPen, optarg);
|
1993-09-05 04:54:24 +00:00
|
|
|
break;
|
|
|
|
|
1993-09-12 20:45:31 +00:00
|
|
|
case 'X':
|
|
|
|
ExcludeFrom = optarg;
|
|
|
|
break;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
case 'h':
|
1994-05-19 18:27:41 +00:00
|
|
|
Dereference = 1;
|
|
|
|
break;
|
|
|
|
|
1994-12-06 00:51:50 +00:00
|
|
|
case 'D':
|
|
|
|
Display = optarg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'm':
|
|
|
|
Mtree = optarg;
|
|
|
|
break;
|
|
|
|
|
1995-04-09 15:05:01 +00:00
|
|
|
case 'P':
|
|
|
|
Pkgdeps = optarg;
|
|
|
|
break;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
case '?':
|
|
|
|
default:
|
1997-10-08 07:48:21 +00:00
|
|
|
usage();
|
1993-08-26 01:19:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1995-05-30 03:57:47 +00:00
|
|
|
argc -= optind;
|
1993-08-26 01:19:55 +00:00
|
|
|
argv += optind;
|
|
|
|
|
|
|
|
/* Get all the remaining package names, if any */
|
|
|
|
while (*argv)
|
|
|
|
*pkgs++ = *argv++;
|
|
|
|
|
|
|
|
/* If no packages, yelp */
|
|
|
|
if (pkgs == start)
|
1997-10-08 07:48:21 +00:00
|
|
|
warnx("missing package name"), usage();
|
1993-08-26 01:19:55 +00:00
|
|
|
*pkgs = NULL;
|
|
|
|
if (start[1])
|
1997-10-08 07:48:21 +00:00
|
|
|
warnx("only one package name allowed ('%s' extraneous)", start[1]),
|
|
|
|
usage();
|
1993-08-26 01:19:55 +00:00
|
|
|
if (!pkg_perform(start)) {
|
|
|
|
if (Verbose)
|
1997-10-08 07:48:21 +00:00
|
|
|
warnx("package creation failed");
|
1993-08-26 01:19:55 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1997-10-08 07:48:21 +00:00
|
|
|
static void
|
|
|
|
usage()
|
1993-08-26 01:19:55 +00:00
|
|
|
{
|
1997-10-08 07:48:21 +00:00
|
|
|
fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
|
|
|
"usage: pkg_create [-YNOhv] [-P pkgs] [-p prefix] [-f contents] [-i iscript]",
|
|
|
|
" [-k dscript] [-r rscript] [-t template] [-X excludefile]",
|
|
|
|
" [-D displayfile] [-m mtreefile] -c comment -d description",
|
|
|
|
" -f packlist pkg-name");
|
1993-08-26 01:19:55 +00:00
|
|
|
exit(1);
|
|
|
|
}
|