diff options
author | flz <flz@FreeBSD.org> | 2008-05-30 14:26:09 +0000 |
---|---|---|
committer | flz <flz@FreeBSD.org> | 2008-05-30 14:26:09 +0000 |
commit | 9a2047ba483ae2319d063ec4bd72a70e706bd7c1 (patch) | |
tree | 879a8bde309ee78659bbc86a35be8b5b8cb6071b /usr.sbin/pkg_install/add | |
parent | abbda8507b5aecb2e8c4a237e56eb32f4b2d1308 (diff) | |
download | FreeBSD-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/add')
-rw-r--r-- | usr.sbin/pkg_install/add/main.c | 29 | ||||
-rw-r--r-- | usr.sbin/pkg_install/add/pkg_add.1 | 28 |
2 files changed, 38 insertions, 19 deletions
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 7a94f19..1556897 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -21,14 +21,14 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <err.h> #include <sys/param.h> #include <sys/utsname.h> +#include <err.h> +#include <getopt.h> + #include "lib.h" #include "add.h" -static char Options[] = "hviIRfFnrp:P:SMt:C:K"; - char *Prefix = NULL; Boolean PrefixRecursive = FALSE; char *Chroot = NULL; @@ -95,6 +95,25 @@ int getosreldate(void); static void usage(void); +static char opts[] = "hviIRfFnrp:P:SMt:C:K"; +static struct option longopts[] = { + { "chroot", required_argument, NULL, 'C' }, + { "dry-run", no_argument, NULL, 'n' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "keep", no_argument, NULL, 'K' }, + { "master", no_argument, NULL, 'M' }, + { "no-deps", no_argument, NULL, 'i' }, + { "no-record", no_argument, NULL, 'R' }, + { "no-script", no_argument, NULL, 'I' }, + { "prefix", required_argument, NULL, 'p' }, + { "remote", no_argument, NULL, 'r' }, + { "template", required_argument, NULL, 't' }, + { "slave", no_argument, NULL, 'S' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } +}; + int main(int argc, char **argv) { @@ -110,7 +129,7 @@ main(int argc, char **argv) PkgAddCmd = argv[0]; start = argv; - while ((ch = getopt(argc, argv, Options)) != -1) { + while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) { switch(ch) { case 'v': Verbose++; @@ -170,12 +189,12 @@ main(int argc, char **argv) case 'C': Chroot = optarg; break; + case 'i': IgnoreDeps = TRUE; break; case 'h': - case '?': default: usage(); break; diff --git a/usr.sbin/pkg_install/add/pkg_add.1 b/usr.sbin/pkg_install/add/pkg_add.1 index dc2f3fc..8194758 100644 --- a/usr.sbin/pkg_install/add/pkg_add.1 +++ b/usr.sbin/pkg_install/add/pkg_add.1 @@ -15,7 +15,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 29, 2007 +.Dd May 30, 2008 .Dt PKG_ADD 1 .Os .Sh NAME @@ -81,31 +81,31 @@ working directory, .Nm will search them in each directory named by .Ev PKG_PATH . -.It Fl v +.It Fl v , -verbose Turn on verbose output. -.It Fl K +.It Fl K , -keep Keep any downloaded package in .Ev PKGDIR if it is defined or in current directory by default. -.It Fl i +.It Fl i , -no-deps Install the package without fetching and installing dependencies. -.It Fl I +.It Fl I , -no-scripts If any installation scripts (pre-install or post-install) exist for a given package, do not execute them. -.It Fl n +.It Fl n , -dry-run Do not actually install a package, just report the steps that would be taken if it was. -.It Fl R +.It Fl R , -no-record Do not record the installation of a package. This means that you cannot deinstall it later, so only use this option if you know what you are doing! -.It Fl r +.It Fl r , -remote Use the remote fetching feature. This will determine the appropriate objformat and release and then fetch and install the package. -.It Fl f +.It Fl f , -force Force installation to proceed even if prerequisite packages are not installed or the requirements script fails. Although @@ -114,7 +114,7 @@ will still try to find and auto-install missing prerequisite packages, a failure to find one will not be fatal. .It Fl F Already installed packages are not an error. -.It Fl p Ar prefix +.It Fl p , -prefix Ar prefix Set .Ar prefix as the directory in which to extract files from a package. @@ -162,7 +162,7 @@ flag on the command line, it overrides its effect, causing to use the given .Ar prefix recursively. -.It Fl t Ar template +.It Fl t , -template Ar template Use .Ar template as the input to @@ -185,7 +185,7 @@ You can get a performance boost by setting the staging area to reside on the same disk partition as target directories for package file installation; often this is .Pa /usr . -.It Fl M +.It Fl M , -master Run in .Cm MASTER mode. @@ -207,7 +207,7 @@ When used in conjunction with .Cm SLAVE mode, it allows you to make radical changes to the package structure before acting on its contents. -.It Fl S +.It Fl S , -slave Run in .Cm SLAVE mode. @@ -223,7 +223,7 @@ in the staging area, the location of which is read as a string from stdin. The complete packing list is also read from stdin, and the contents then acted on as normal. -.It Fl C Ar chrootdir +.It Fl C , -chroot Ar chrootdir Before doing any operations, .Xr chroot 2 to the |