2 * FreeBSD install - a package for the installation and maintainance
3 * of non-core utilities.
8 * This is the create module.
12 #include <sys/cdefs.h>
13 __FBSDID("$FreeBSD$");
19 static char Options[] = "EGYNORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:";
21 match_t MatchType = MATCH_GLOB;
29 char *PostInstall = NULL;
30 char *DeInstall = NULL;
31 char *PostDeInstall = NULL;
32 char *Contents = NULL;
34 char *ExcludeFrom = NULL;
37 char *Conflicts = NULL;
39 char *InstalledPkg = NULL;
40 char PlayPen[FILENAME_MAX];
41 int Dereference = FALSE;
42 int PlistOnly = FALSE;
43 int Recursive = FALSE;
44 enum zipper Zipper = GZIP;
46 static void usage __P((void));
49 main(int argc, char **argv)
52 char **pkgs, **start, *tmp;
55 while ((ch = getopt(argc, argv, Options)) != -1)
62 MatchType = MATCH_REGEX;
66 MatchType = MATCH_EREGEX;
70 MatchType = MATCH_EXACT;
118 PostInstall = optarg;
126 PostDeInstall = optarg;
134 strlcpy(PlayPen, optarg, sizeof(PlayPen));
138 ExcludeFrom = optarg;
171 InstalledPkg = optarg;
172 while ((tmp = strrchr(optarg, (int)'/')) != NULL) {
175 * If character after the '/' is alphanumeric, then we've
176 * found the package name. Otherwise we've come across
177 * a trailing '/' and need to continue our quest.
199 /* Get all the remaining package names, if any */
203 /* If no packages, yelp */
204 if ((pkgs == start) && (InstalledPkg == NULL))
205 warnx("missing package name"), usage();
207 if ((start[0] != NULL) && (start[1] != NULL)) {
208 warnx("only one package name allowed ('%s' extraneous)", start[1]);
211 if (start[0] == NULL)
212 start[0] = InstalledPkg;
213 if (!pkg_perform(start)) {
215 warnx("package creation failed");
225 fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
226 "usage: pkg_create [-YNOhvyz] [-P pkgs] [-C conflicts] [-p prefix] ",
227 " [-i iscript] [-I piscript] [-k dscript] [-K pdscript] ",
228 " [-r rscript] [-t template] [-X excludefile] ",
229 " [-D displayfile] [-m mtreefile] [-o origin] ",
230 " [-s srcdir] [-S basedir] ",
231 " -c comment -d description -f packlist pkg-filename",
232 " pkg_create [-EGYNhvxyzR] -b pkg-name [pkg-filename]");