summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install/create
diff options
context:
space:
mode:
authorflz <flz@FreeBSD.org>2008-05-30 14:26:09 +0000
committerflz <flz@FreeBSD.org>2008-05-30 14:26:09 +0000
commit9a2047ba483ae2319d063ec4bd72a70e706bd7c1 (patch)
tree879a8bde309ee78659bbc86a35be8b5b8cb6071b /usr.sbin/pkg_install/create
parentabbda8507b5aecb2e8c4a237e56eb32f4b2d1308 (diff)
downloadFreeBSD-src-9a2047ba483ae2319d063ec4bd72a70e706bd7c1.zip
FreeBSD-src-9a2047ba483ae2319d063ec4bd72a70e706bd7c1.tar.gz
- Add long options to pkg_install.
- Remove check for '-?' as it's not listed in authorized options. - Bump PKG_INSTALL_VERSION to 20080530.
Diffstat (limited to 'usr.sbin/pkg_install/create')
-rw-r--r--usr.sbin/pkg_install/create/main.c33
-rw-r--r--usr.sbin/pkg_install/create/pkg_create.126
2 files changed, 39 insertions, 20 deletions
diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c
index 14142ae..eb8fa15 100644
--- a/usr.sbin/pkg_install/create/main.c
+++ b/usr.sbin/pkg_install/create/main.c
@@ -12,12 +12,12 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <getopt.h>
#include <err.h>
+
#include "lib.h"
#include "create.h"
-static char Options[] = "EGYNnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:";
-
match_t MatchType = MATCH_GLOB;
char *Prefix = NULL;
char *Comment = NULL;
@@ -42,6 +42,7 @@ int Dereference = FALSE;
int PlistOnly = FALSE;
int Recursive = FALSE;
int Regenerate = TRUE;
+int Help = FALSE;
#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039
enum zipper Zipper = BZIP2;
#else
@@ -51,6 +52,24 @@ enum zipper Zipper = GZIP;
static void usage(void);
+static char opts[] = "EGYNnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:";
+static struct option longopts[] = {
+ { "backup", required_argument, NULL, 'b' },
+ { "extended", no_argument, NULL, 'E' },
+ { "help", no_argument, &Help, TRUE },
+ { "no", no_argument, NULL, 'N' },
+ { "no-glob", no_argument, NULL, 'G' },
+ { "origin", required_argument, NULL, 'o' },
+ { "plist-only", no_argument, NULL, 'O' },
+ { "prefix", required_argument, NULL, 'p' },
+ { "recursive", no_argument, NULL, 'R' },
+ { "regex", no_argument, NULL, 'x' },
+ { "template", required_argument, NULL, 't' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "yes", no_argument, NULL, 'Y' },
+ { NULL, 0, NULL, 0 },
+};
+
int
main(int argc, char **argv)
{
@@ -58,7 +77,7 @@ main(int argc, char **argv)
char **pkgs, **start, *tmp;
pkgs = start = argv;
- while ((ch = getopt(argc, argv, Options)) != -1)
+ while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
switch(ch) {
case 'v':
Verbose++;
@@ -193,11 +212,11 @@ main(int argc, char **argv)
Recursive = TRUE;
break;
- case 'n':
- Regenerate = FALSE;
- break;
+ case 0:
+ if (Help)
+ usage();
+ break;
- case '?':
default:
usage();
break;
diff --git a/usr.sbin/pkg_install/create/pkg_create.1 b/usr.sbin/pkg_install/create/pkg_create.1
index a65cfaf..a567fc4 100644
--- a/usr.sbin/pkg_install/create/pkg_create.1
+++ b/usr.sbin/pkg_install/create/pkg_create.1
@@ -23,7 +23,7 @@
.\" [jkh] Took John's changes back and made some additional extensions for
.\" better integration with FreeBSD's new ports collection.
.\"
-.Dd May 27, 2008
+.Dd May 30, 2008
.Dt PKG_CREATE 1
.Os
.Sh NAME
@@ -103,11 +103,11 @@ Fetch long description for package from file
or, if preceded by
.Cm - ,
the argument itself.
-.It Fl Y
+.It Fl Y , -yes
Assume a default answer of `Yes' for any questions asked.
-.It Fl N
+.It Fl N , -no
Assume a default answer of `No' for any questions asked.
-.It Fl O
+.It Fl O , -plist-only
Go into a `packing list Only' mode.
This is a custom hack for the
.Fx
@@ -115,7 +115,7 @@ This is a custom hack for the
and is used to do `fake pkg_add' operations when a port is installed.
In such cases, it is necessary to know what the final, adjusted packing
list will look like.
-.It Fl v
+.It Fl v , -verbose
Turn on verbose output.
.It Fl h
Force tar to follow symbolic links, so that the files they point to
@@ -179,7 +179,7 @@ recorded into the packing list along with the
using
.Cm @comment
directive.
-.It Fl p Ar prefix
+.It Fl p , -prefix Ar prefix
Set
.Ar prefix
as the initial directory
@@ -243,7 +243,7 @@ during package creation.
will be prefixed to all
.Cm @cwd
during package creation.
-.It Fl t Ar template
+.It Fl t , -template Ar template
Use
.Ar template
as the input to
@@ -296,7 +296,7 @@ where
is the name of the first directory named by a
.Cm @cwd
directive.
-.It Fl o Ar originpath
+.It Fl o , -origin Ar originpath
Record an
.Ar originpath ,
as location of the port from which package has been created in the
@@ -325,7 +325,7 @@ Compatibility synonym for
Use
.Xr gzip 1
utility to compress package tarball.
-.It Fl b Ar pkg-name
+.It Fl b , -backup Ar pkg-name
Create package file from a locally installed package named
.Ar pkg-name .
If the
@@ -334,20 +334,20 @@ is not specified, then resulting archive will be created in the
current directory and named
.Ar pkg-name
with an appropriate extraction suffix applied.
-.It Fl R
+.It Fl R , -recursive
When creating package file from a locally installed package
also create package files for all packages required by
.Ar pkg-name .
Resulting archive(s) will be created in the current directory
and named using name of the respective package with appropriate
extraction suffix applied.
-.It Fl x
+.It Fl x , -regex
Use basic regular expressions for
.Ar pkg-name .
-.It Fl E
+.It Fl E , -extended
Use extended (modern) regular expressions for
.Ar pkg-name .
-.It Fl G
+.It Fl G , -no-glob
Use exact matching for
.Ar pkg-name .
.It Fl n
OpenPOWER on IntegriCloud