2 * FreeBSD install - a package for the installation and maintainance
3 * of non-core utilities.
8 * This is the create module.
10 * $FreeBSD: src/usr.sbin/pkg_install/create/main.c,v 1.21.2.7 2002/05/29 18:31:11 obrien Exp $
11 * $DragonFly: src/usr.sbin/pkg_install/create/Attic/main.c,v 1.3 2003/11/03 19:31:39 eirikn Exp $
18 static char Options[] = "YNOhjvyzf:p:P:c:d:i:I:k:K:r:t:X:D:m:s:o:b:";
26 char *PostInstall = NULL;
27 char *DeInstall = NULL;
28 char *PostDeInstall = NULL;
29 char *Contents = NULL;
31 char *ExcludeFrom = NULL;
35 char *InstalledPkg = NULL;
36 char PlayPen[FILENAME_MAX];
37 int Dereference = FALSE;
38 int PlistOnly = FALSE;
39 enum zipper Zipper = GZIP;
41 static void usage(void);
44 main(int argc, char **argv)
47 char **pkgs, **start, *tmp;
50 while ((ch = getopt(argc, argv, Options)) != -1)
101 PostDeInstall = optarg;
109 strlcpy(PlayPen, optarg, sizeof(PlayPen));
113 ExcludeFrom = optarg;
146 InstalledPkg = optarg;
147 while ((tmp = strrchr(optarg, (int)'/')) != NULL) {
150 * If character after the '/' is alphanumeric, then we've
151 * found the package name. Otherwise we've come across
152 * a trailing '/' and need to continue our quest.
170 /* Get all the remaining package names, if any */
174 /* If no packages, yelp */
175 if ((pkgs == start) && (InstalledPkg == NULL))
176 warnx("missing package name"), usage();
178 if ((start[0] != NULL) && (start[1] != NULL)) {
179 warnx("only one package name allowed ('%s' extraneous)", start[1]);
182 if (start[0] == NULL)
183 start[0] = InstalledPkg;
184 if (!pkg_perform(start)) {
186 warnx("package creation failed");
196 fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n",
197 "usage: pkg_create [-YNOhvy] [-P pkgs] [-p prefix] [-f contents] [-i iscript]",
198 " [-I piscript] [-k dscript] [-K pdscript] [-r rscript] ",
199 " [-t template] [-X excludefile] [-D displayfile] ",
200 " [-m mtreefile] [-o origin] -c comment -d description ",
201 " -f packlist pkg-filename",
202 " pkg_create [-YNhvy] -b pkg-name [pkg-filename]");