summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorKirill Ponomarev <krion@FreeBSD.org>2005-11-11 08:08:04 +0000
committerKirill Ponomarev <krion@FreeBSD.org>2005-11-11 08:08:04 +0000
commit2714cf5ceb80d5fb261fa74eabcadd6a38255289 (patch)
tree50b4494ea195faa2bbe46d3e9beb7f608b73739e /usr.sbin
parentf14716c8509406eacf4b48cc84aad366e68a77da (diff)
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_install/create/create.h1
-rw-r--r--usr.sbin/pkg_install/create/main.c17
-rw-r--r--usr.sbin/pkg_install/create/perform.c37
-rw-r--r--usr.sbin/pkg_install/create/pkg_create.113
4 files changed, 61 insertions, 7 deletions
diff --git a/usr.sbin/pkg_install/create/create.h b/usr.sbin/pkg_install/create/create.h
index 33c3db742e13..9450170be821 100644
--- a/usr.sbin/pkg_install/create/create.h
+++ b/usr.sbin/pkg_install/create/create.h
@@ -23,6 +23,7 @@
#ifndef _INST_CREATE_H_INCLUDE
#define _INST_CREATE_H_INCLUDE
+extern match_t MatchType;
extern char *Prefix;
extern char *Comment;
extern char *Desc;
diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c
index 4869bfd5c49e..1c3af2945020 100644
--- a/usr.sbin/pkg_install/create/main.c
+++ b/usr.sbin/pkg_install/create/main.c
@@ -16,8 +16,9 @@ __FBSDID("$FreeBSD$");
#include "lib.h"
#include "create.h"
-static char Options[] = "YNORhjvyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:";
+static char Options[] = "EGYNORhjvxyzf: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;
char *Desc = NULL;
@@ -57,6 +58,18 @@ main(int argc, char **argv)
Verbose = TRUE;
break;
+ case 'x':
+ MatchType = MATCH_REGEX;
+ break;
+
+ case 'E':
+ MatchType = MATCH_EREGEX;
+ break;
+
+ case 'G':
+ MatchType = MATCH_EXACT;
+ break;
+
case 'N':
AutoAnswer = NO;
break;
@@ -216,6 +229,6 @@ usage()
" [-D displayfile] [-m mtreefile] [-o origin] ",
" [-s srcdir] [-S basedir] ",
" -c comment -d description -f packlist pkg-filename",
-" pkg_create [-YNhvyzR] -b pkg-name [pkg-filename]");
+" pkg_create [-EGYNhvxyzR] -b pkg-name [pkg-filename]");
exit(1);
}
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index 3f7ab47984f0..51a3cfa4d740 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -81,9 +81,40 @@ pkg_perform(char **pkgs)
suf = "tar";
if (InstalledPkg != NULL) {
- if (!Recursive)
- return (create_from_installed(InstalledPkg, pkg, suf));
- return (create_from_installed_recursive(pkg, suf));
+ char *pkgglob[] = { InstalledPkg, NULL };
+ char **matched, **pkgs;
+ int i, error;
+
+ pkgs = pkgglob;
+ if (MatchType != MATCH_EXACT) {
+ matched = matchinstalled(MatchType, pkgs, &error);
+ if (!error && matched != NULL)
+ pkgs = matched;
+ else if (MatchType != MATCH_GLOB)
+ errx(1, "no packages match pattern");
+ }
+ /*
+ * Is there is only one installed package matching the pattern,
+ * we need to respect the optional pkg-filename parameter. If,
+ * however, the pattern matches several packages, this parameter
+ * makes no sense and is ignored.
+ */
+ if (pkgs[1] == NULL) {
+ if (pkg == InstalledPkg)
+ pkg = *pkgs;
+ InstalledPkg = *pkgs;
+ if (!Recursive)
+ return (create_from_installed(InstalledPkg, pkg, suf));
+ return (create_from_installed_recursive(pkg, suf));
+ }
+ for (i = 0; pkgs[i] != NULL; i++) {
+ InstalledPkg = pkg = pkgs[i];
+ if (!Recursive)
+ create_from_installed(pkg, pkg, suf);
+ else
+ create_from_installed_recursive(pkg, suf);
+ }
+ return TRUE;
}
get_dash_string(&Comment);
diff --git a/usr.sbin/pkg_install/create/pkg_create.1 b/usr.sbin/pkg_install/create/pkg_create.1
index 3336dc1646ef..de6206af5029 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 June 29, 2004
+.Dd November 8, 2005
.Dt PKG_CREATE 1
.Os
.Sh NAME
@@ -52,7 +52,7 @@
.Fl f Ar packlist
.Ar pkg-filename
.Nm
-.Op Fl YNRhvy
+.Op Fl EGYNRhvxy
.Fl b Ar pkg-name
.Op Ar pkg-filename
.Sh DESCRIPTION
@@ -341,6 +341,15 @@ also create package files for all packages required by
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
+Use basic regular expressions for
+.Ar pkg-name .
+.It Fl E
+Use extended (modern) regular expressions for
+.Ar pkg-name .
+.It Fl G
+Use exact matching for
+.Ar pkg-name .
.El
.Sh PACKING LIST DETAILS
The