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 #if defined(__FreeBSD_version) && __FreeBSD_version >= 500039
45 enum zipper Zipper = BZIP2;
47 enum zipper Zipper = GZIP;
51 static void usage __P((void));
54 main(int argc, char **argv)
57 char **pkgs, **start, *tmp;
60 while ((ch = getopt(argc, argv, Options)) != -1)
67 MatchType = MATCH_REGEX;
71 MatchType = MATCH_EREGEX;
75 MatchType = MATCH_EXACT;
123 PostInstall = optarg;
131 PostDeInstall = optarg;
139 strlcpy(PlayPen, optarg, sizeof(PlayPen));
143 ExcludeFrom = optarg;
176 InstalledPkg = optarg;
177 while ((tmp = strrchr(optarg, (int)'/')) != NULL) {
180 * If character after the '/' is alphanumeric, then we've
181 * found the package name. Otherwise we've come across
182 * a trailing '/' and need to continue our quest.
204 /* Get all the remaining package names, if any */
208 /* If no packages, yelp */
209 if ((pkgs == start) && (InstalledPkg == NULL))
210 warnx("missing package name"), usage();
212 if ((start[0] != NULL) && (start[1] != NULL)) {
213 warnx("only one package name allowed ('%s' extraneous)", start[1]);
216 if (start[0] == NULL)
217 start[0] = InstalledPkg;
218 if (!pkg_perform(start)) {
220 warnx("package creation failed");
230 fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
231 "usage: pkg_create [-YNOhjvyz] [-C conflicts] [-P pkgs] [-p prefix]",
232 " [-i iscript] [-I piscript] [-k dscript] [-K pdscript]",
233 " [-r rscript] [-s srcdir] [-S basedir]",
234 " [-t template] [-X excludefile]",
235 " [-D displayfile] [-m mtreefile] [-o originpath]",
236 " -c comment -d description -f packlist pkg-filename",
237 " pkg_create [-EGYNRhvxy] -b pkg-name [pkg-filename]");