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$");
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 int Regenerate
= TRUE
;
46 enum zipper Zipper
= BZIP2
;
49 static void usage(void);
51 static char opts
[] = "EGYNnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:";
52 static struct option longopts
[] = {
53 { "backup", required_argument
, NULL
, 'b' },
54 { "extended", no_argument
, NULL
, 'E' },
55 { "help", no_argument
, &Help
, TRUE
},
56 { "no", no_argument
, NULL
, 'N' },
57 { "no-glob", no_argument
, NULL
, 'G' },
58 { "origin", required_argument
, NULL
, 'o' },
59 { "plist-only", no_argument
, NULL
, 'O' },
60 { "prefix", required_argument
, NULL
, 'p' },
61 { "recursive", no_argument
, NULL
, 'R' },
62 { "regex", no_argument
, NULL
, 'x' },
63 { "template", required_argument
, NULL
, 't' },
64 { "verbose", no_argument
, NULL
, 'v' },
65 { "yes", no_argument
, NULL
, 'Y' },
70 main(int argc
, char **argv
)
73 char **pkgs
, **start
, *tmp
;
76 while ((ch
= getopt_long(argc
, argv
, opts
, longopts
, NULL
)) != -1)
83 MatchType
= MATCH_REGEX
;
87 MatchType
= MATCH_EREGEX
;
91 MatchType
= MATCH_EXACT
;
139 PostInstall
= optarg
;
147 PostDeInstall
= optarg
;
155 strlcpy(PlayPen
, optarg
, sizeof(PlayPen
));
159 ExcludeFrom
= optarg
;
192 InstalledPkg
= optarg
;
193 while ((tmp
= strrchr(optarg
, (int)'/')) != NULL
) {
196 * If character after the '/' is alphanumeric, then we've
197 * found the package name. Otherwise we've come across
198 * a trailing '/' and need to continue our quest.
228 /* Get all the remaining package names, if any */
232 /* If no packages, yelp */
233 if ((pkgs
== start
) && (InstalledPkg
== NULL
))
234 warnx("missing package name"), usage();
236 if ((start
[0] != NULL
) && (start
[1] != NULL
)) {
237 warnx("only one package name allowed ('%s' extraneous)", start
[1]);
240 if (start
[0] == NULL
)
241 start
[0] = InstalledPkg
;
242 if (!pkg_perform(start
)) {
244 warnx("package creation failed");
254 fprintf(stderr
, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
255 "usage: pkg_create [-YNOhjnvyz] [-C conflicts] [-P pkgs] [-p prefix]",
256 " [-i iscript] [-I piscript] [-k dscript] [-K pdscript]",
257 " [-r rscript] [-s srcdir] [-S basedir]",
258 " [-t template] [-X excludefile]",
259 " [-D displayfile] [-m mtreefile] [-o originpath]",
260 " -c comment -d description -f packlist pkg-filename",
261 " pkg_create [-EGYNRhnvxy] -b pkg-name [pkg-filename]");