summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorjlam <jlam>2003-09-09 13:34:11 +0000
committerjlam <jlam>2003-09-09 13:34:11 +0000
commit15b3ff6e55d37e552085256f25ce9f8fe41a0d82 (patch)
tree592f4a1f3f25626ed3e7a37c3154b8e10443fd3c /pkgtools/pkg_install
parent42109833e2c75d9ae175136f76baab1858cf4c5c (diff)
downloadpkgsrc-15b3ff6e55d37e552085256f25ce9f8fe41a0d82.tar.gz
Bump version to 20030907. Changes from previous version include:
* Teaching pkg_add(1) to be smarter about how to add a depoted packge. * "pkg_delete foo" only deletes foo if it's a unique package. * Make "pkg_delete -O foo" for delete file entries for foo from pkgdb.byfile.db actually work. * Teach pkg_admin(1) two new commands "add" and "delete" for working with pkgdb.byfile.db. * pkg_view(1) uses the new pkg_admin(1) commands to keep the pkgdb.byfile.db files consistent in each view. * Man page fixes.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/DESCR4
-rw-r--r--pkgtools/pkg_install/files/add/perform.c54
-rw-r--r--pkgtools/pkg_install/files/add/pkg_add.122
-rw-r--r--pkgtools/pkg_install/files/add/pkg_add.cat115
-rw-r--r--pkgtools/pkg_install/files/admin/main.c221
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.143
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.cat1151
-rw-r--r--pkgtools/pkg_install/files/create/pkg_create.1105
-rw-r--r--pkgtools/pkg_install/files/create/pkg_create.cat162
-rw-r--r--pkgtools/pkg_install/files/delete/perform.c58
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.14
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.cat12
-rw-r--r--pkgtools/pkg_install/files/info/perform.c12
-rw-r--r--pkgtools/pkg_install/files/info/pkg_info.14
-rw-r--r--pkgtools/pkg_install/files/info/pkg_info.cat12
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c25
-rw-r--r--pkgtools/pkg_install/files/lib/str.c6
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
-rw-r--r--pkgtools/pkg_install/files/view/linkfarm.111
-rw-r--r--pkgtools/pkg_install/files/view/linkfarm.cat18
-rw-r--r--pkgtools/pkg_install/files/view/pkg_view.178
-rw-r--r--pkgtools/pkg_install/files/view/pkg_view.cat191
-rw-r--r--pkgtools/pkg_install/files/view/pkg_view.sh.in5
23 files changed, 580 insertions, 407 deletions
diff --git a/pkgtools/pkg_install/DESCR b/pkgtools/pkg_install/DESCR
index 31d349ff13c..8182a97f52a 100644
--- a/pkgtools/pkg_install/DESCR
+++ b/pkgtools/pkg_install/DESCR
@@ -1,4 +1,4 @@
This is a copy of NetBSD-current's pkg_* tools in a format which
-is able to be installed as a package. To prevent deinstallation,
-they don't register themselves as a package. On NetBSD, they simply
+is able to be installed as a package. To prevent deinstallation,
+they don't register themselves as a package. On NetBSD, they simply
replace the tools in /usr/sbin.
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c
index 50d213123d5..c20209aaf96 100644
--- a/pkgtools/pkg_install/files/add/perform.c
+++ b/pkgtools/pkg_install/files/add/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.9 2003/09/02 08:28:23 jlam Exp $ */
+/* $NetBSD: perform.c,v 1.10 2003/09/09 13:34:17 jlam Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.9 2003/09/02 08:28:23 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.10 2003/09/09 13:34:17 jlam Exp $");
#endif
#endif
@@ -86,8 +86,9 @@ installprereq(const char *name, int *errc)
if (Verbose)
printf("Loading it from %s.\n", name);
path_setenv("PKG_PATH");
- if (vsystem("%s/pkg_add -s %s %s%s%s %s%s %s%s%s %s%s",
+ if (vsystem("%s/pkg_add -K %s -s %s %s%s%s %s%s %s%s%s %s%s",
BINDIR,
+ _pkgdb_getPKGDB_DIR(),
get_verification(),
NoView ? "-L " : "",
View ? "-w " : "",
@@ -124,7 +125,7 @@ pkg_do(const char *pkg)
char replace_to[FILENAME_MAX];
int replacing = 0;
char *where_to, *extract;
- char *dbdir;
+ char dbdir[FILENAME_MAX];
const char *exact;
FILE *cfile;
int errc;
@@ -297,18 +298,17 @@ pkg_do(const char *pkg)
if (fexists(VIEWS_FNAME))
is_depoted_pkg = TRUE;
- dbdir = _pkgdb_getPKGDB_DIR();
- (void) snprintf(LogDir, sizeof(LogDir), "%s/%s", dbdir, PkgName);
-
- /* check if the dbdir is wrong because this is a depoted package */
+ /*
+ * Depoted packages' dbdir is the same as DEPOTBASE. Non-depoted
+ * packages' dbdir comes from the command-line or the environment.
+ */
if (is_depoted_pkg) {
- if ((p = find_plist(&Plist, PLIST_CWD))) {
- if (strcmp(p->name, LogDir) != 0) {
- warnx("%s is not the depot directory for %s.",
- dbdir, PkgName);
- goto success;
- }
- }
+ p = find_plist(&Plist, PLIST_CWD);
+ (void) strlcpy(dbdir, dirname_of(p->name), sizeof(dbdir));
+ (void) strlcpy(LogDir, p->name, sizeof(LogDir));
+ } else {
+ (void) strlcpy(dbdir, _pkgdb_getPKGDB_DIR(), sizeof(dbdir));
+ (void) snprintf(LogDir, sizeof(LogDir), "%s/%s", dbdir, PkgName);
}
/* make sure dbdir actually exists! */
@@ -634,12 +634,18 @@ ignore_replace_depends_check:
}
}
- /* Now finally extract the entire show if we're not going direct */
- if (!inPlace && !Fake)
- if (!extract_plist(".", &Plist)) {
- errc = 1;
- goto fail;
- }
+ /*
+ * Now finally extract the entire show if we're not going direct.
+ * We need to reset the package dbdir so that extract_plist()
+ * updates the correct pkgdb.byfile.db database.
+ */
+ if (!inPlace && !Fake) {
+ _pkgdb_setPKGDB_DIR(dbdir);
+ if (!extract_plist(".", &Plist)) {
+ errc = 1;
+ goto fail;
+ }
+ }
if (!Fake && fexists(MTREE_FNAME)) {
if (Verbose)
@@ -785,8 +791,9 @@ ignore_replace_depends_check:
/* Add the package to a default view. */
if (!Fake && !NoView && is_depoted_pkg) {
if (Verbose) {
- printf("%s/pkg_view %s%s %s%s %sadd %s\n",
+ printf("%s/pkg_view -d %s %s%s %s%s %sadd %s\n",
BINDIR,
+ dbdir,
View ? "-w " : "",
View ? View : "",
Viewbase ? "-W " : "",
@@ -794,8 +801,9 @@ ignore_replace_depends_check:
Verbose ? "-v " : "",
PkgName);
}
- vsystem("%s/pkg_view %s%s %s%s %sadd %s",
+ vsystem("%s/pkg_view -d %s %s%s %s%s %sadd %s",
BINDIR,
+ dbdir,
View ? "-w " : "",
View ? View : "",
Viewbase ? "-W " : "",
diff --git a/pkgtools/pkg_install/files/add/pkg_add.1 b/pkgtools/pkg_install/files/add/pkg_add.1
index 786e6e525c3..045ca273307 100644
--- a/pkgtools/pkg_install/files/add/pkg_add.1
+++ b/pkgtools/pkg_install/files/add/pkg_add.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.3 2003/09/01 16:27:11 jlam Exp $
+.\" $NetBSD: pkg_add.1,v 1.4 2003/09/09 13:34:18 jlam Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" @(#)pkg_add.1
.\"
-.Dd August 15, 2002
+.Dd September 8, 2003
.Dt PKG_ADD 1
.Os
.Sh NAME
@@ -251,6 +251,9 @@ The default
.Ar viewbase
directory is set by
.Xr pkg_view 1 .
+This value also may be set from the
+.Ev LOCALBASE
+environment variable.
.It Fl w Ar view
Set the
.Ar view
@@ -259,6 +262,9 @@ The default
.Ar view
is set by
.Xr pkg_view 1 .
+This value also may be set from the
+.Ev PKG_VIEW
+environment variable.
.El
.Pp
One or more
@@ -466,6 +472,14 @@ flag to
.Cm pkg_add .
.Sh ENVIRONMENT
.Bl -tag -width PKG_TMPDIR
+.It Ev LOCALBASE
+This is the location of the
+.Ar viewbase
+directory in which all the views are managed.
+The default
+.Ar viewbase
+directory is
+.Pa /usr/pkg .
.It Ev PKG_DBDIR
If the
.Fl K
@@ -489,6 +503,10 @@ FTP URLs may not end with a slash.
Staging directory for installing packages, defaults to /var/tmp.
Set to directory with lots of free disk if you run out of
space when installing a binary package.
+.It Ev PKG_VIEW
+The default view can be specified in the
+.Ev PKG_VIEW
+environment variable.
.El
.Sh EXAMPLES
In all cases,
diff --git a/pkgtools/pkg_install/files/add/pkg_add.cat1 b/pkgtools/pkg_install/files/add/pkg_add.cat1
index 94cc6072c31..395b30beab6 100644
--- a/pkgtools/pkg_install/files/add/pkg_add.cat1
+++ b/pkgtools/pkg_install/files/add/pkg_add.cat1
@@ -135,11 +135,13 @@ OOPPTTIIOONNSS
--WW _v_i_e_w_b_a_s_e
Set _v_i_e_w_b_a_s_e as the base directory for the managed views. The
- default _v_i_e_w_b_a_s_e directory is set by pkg_view(1).
+ default _v_i_e_w_b_a_s_e directory is set by pkg_view(1). This value al-
+ so may be set from the LOCALBASE environment variable.
--ww _v_i_e_w
Set the _v_i_e_w to which packages should be added after installa-
- tion. The default _v_i_e_w is set by pkg_view(1).
+ tion. The default _v_i_e_w is set by pkg_view(1). This value also
+ may be set from the PKG_VIEW environment variable.
One or more _p_k_g_-_n_a_m_e arguments may be specified, each being either a file
containing the package (these usually ending with the ``.tgz'' suffix) or
@@ -263,6 +265,10 @@ TTEECCHHNNIICCAALL DDEETTAAIILLSS
user might change it with the --pp flag to ppkkgg__aadddd.
EENNVVIIRROONNMMEENNTT
+ LOCALBASE This is the location of the _v_i_e_w_b_a_s_e directory in which all
+ the views are managed. The default _v_i_e_w_b_a_s_e directory is
+ _/_u_s_r_/_p_k_g.
+
PKG_DBDIR If the --KK flag isn't given, then PKG_DBDIR is the location of
the package database directory. The default package database
directory is _/_v_a_r_/_d_b_/_p_k_g.
@@ -279,6 +285,9 @@ EENNVVIIRROONNMMEENNTT
/var/tmp. Set to directory with lots of free disk if you run
out of space when installing a binary package.
+ PKG_VIEW The default view can be specified in the PKG_VIEW environment
+ variable.
+
EEXXAAMMPPLLEESS
In all cases, ppkkgg__aadddd will try to install binary packages listed in de-
pendencies list.
@@ -325,4 +334,4 @@ BBUUGGSS
Sure to be others.
-NetBSD 1.6.1_STABLE August 15, 2002 5
+NetBSD 1.6.1_STABLE September 8, 2003 6
diff --git a/pkgtools/pkg_install/files/admin/main.c b/pkgtools/pkg_install/files/admin/main.c
index c446c907294..f7dc8cd09f1 100644
--- a/pkgtools/pkg_install/files/admin/main.c
+++ b/pkgtools/pkg_install/files/admin/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.10 2003/09/02 08:28:25 jlam Exp $ */
+/* $NetBSD: main.c,v 1.11 2003/09/09 13:34:18 jlam Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: main.c,v 1.10 2003/09/02 08:28:25 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2003/09/09 13:34:18 jlam Exp $");
#endif
/*
@@ -174,26 +174,122 @@ check1pkg(const char *pkgdir)
pkgcnt++;
}
+/*
+ * add1pkg(<pkg>)
+ * adds the files listed in the +CONTENTS of <pkg> into the
+ * pkgdb.byfile.db database file in the current package dbdir. It
+ * returns the number of files added to the database file.
+ */
+static int
+add1pkg(const char *pkgdir)
+{
+ FILE *f;
+ plist_t *p;
+ package_t Plist;
+ char contents[FILENAME_MAX];
+ char *PkgDBDir, *PkgName, *dirp;
+ char file[FILENAME_MAX];
+ char dir[FILENAME_MAX];
+ int cnt;
+
+ if (!pkgdb_open(ReadWrite))
+ err(EXIT_FAILURE, "cannot open pkgdb");
+
+ PkgDBDir = _pkgdb_getPKGDB_DIR();
+ (void) snprintf(contents, sizeof(contents), "%s/%s", PkgDBDir, pkgdir);
+ if (!(isdir(contents) || islinktodir(contents)))
+ errx(EXIT_FAILURE, "`%s' does not exist.", contents);
+
+ (void) strlcat(contents, "/", sizeof(contents));
+ (void) strlcat(contents, CONTENTS_FNAME, sizeof(contents));
+ if ((f = fopen(contents, "r")) == NULL)
+ errx(EXIT_FAILURE, "%s: can't open `%s'", pkgdir, CONTENTS_FNAME);
+
+ Plist.head = Plist.tail = NULL;
+ read_plist(&Plist, f);
+ if ((p = find_plist(&Plist, PLIST_NAME)) == NULL) {
+ errx(EXIT_FAILURE, "Package `%s' has no @name, aborting.", pkgdir);
+ }
+
+ PkgName = p->name;
+ dirp = NULL;
+ for (p = Plist.head; p; p = p->next) {
+ switch(p->type) {
+ case PLIST_FILE:
+ if (dirp == NULL) {
+ errx(EXIT_FAILURE, "@cwd not yet found, please send-pr!");
+ }
+ (void) snprintf(file, sizeof(file), "%s/%s", dirp, p->name);
+ if (!(isfile(file) || islinktodir(file))) {
+ warnx("%s: File `%s' is in %s but not on filesystem!",
+ PkgName, file, CONTENTS_FNAME);
+ } else {
+ pkgdb_store(file, PkgName);
+ cnt++;
+ }
+ break;
+ case PLIST_CWD:
+ if (strcmp(p->name, ".") != 0) {
+ dirp = p->name;
+ } else {
+ (void) snprintf(dir, sizeof(dir), "%s/%s", PkgDBDir, pkgdir);
+ dirp = dir;
+ }
+ break;
+ case PLIST_IGNORE:
+ p = p->next;
+ break;
+ case PLIST_SHOW_ALL:
+ case PLIST_SRC:
+ case PLIST_CMD:
+ case PLIST_CHMOD:
+ case PLIST_CHOWN:
+ case PLIST_CHGRP:
+ case PLIST_COMMENT:
+ case PLIST_NAME:
+ case PLIST_UNEXEC:
+ case PLIST_DISPLAY:
+ case PLIST_PKGDEP:
+ case PLIST_MTREE:
+ case PLIST_DIR_RM:
+ case PLIST_IGNORE_INST:
+ case PLIST_OPTION:
+ case PLIST_PKGCFL:
+ case PLIST_BLDDEP:
+ break;
+ }
+ }
+ free_plist(&Plist);
+ fclose(f);
+ pkgdb_close();
+
+ return cnt;
+}
+
+static void
+delete1pkg(const char *pkgdir)
+{
+ if (!pkgdb_open(ReadWrite))
+ err(EXIT_FAILURE, "cannot open pkgdb");
+ (void) pkgdb_remove_pkg(pkgdir);
+ pkgdb_close();
+}
+
static void
rebuild(void)
{
- DIR *dp;
- struct dirent *de;
- FILE *f;
- plist_t *p;
- char *PkgName, dir[FILENAME_MAX], *dirp = NULL;
- char *PkgDBDir = NULL, file[FILENAME_MAX];
- char cachename[FILENAME_MAX];
+ DIR *dp;
+ struct dirent *de;
+ char *PkgDBDir;
+ char cachename[FILENAME_MAX];
pkgcnt = 0;
filecnt = 0;
- if (unlink(_pkgdb_getPKGDB_FILE(cachename, sizeof(cachename))) != 0 && errno != ENOENT)
+ (void) _pkgdb_getPKGDB_FILE(cachename, sizeof(cachename));
+ if (unlink(cachename) != 0 && errno != ENOENT)
err(EXIT_FAILURE, "unlink %s", cachename);
- if (!pkgdb_open(ReadWrite))
- err(EXIT_FAILURE, "cannot open pkgdb");
-
setbuf(stdout, NULL);
PkgDBDir = _pkgdb_getPKGDB_DIR();
chdir(PkgDBDir);
@@ -204,9 +300,7 @@ rebuild(void)
if (dp == NULL)
err(EXIT_FAILURE, "opendir failed");
while ((de = readdir(dp))) {
- package_t Plist;
-
- if (!isdir(de->d_name))
+ if (!(isdir(de->d_name) || islinktodir(de->d_name)))
continue;
if (strcmp(de->d_name, ".") == 0 ||
@@ -219,76 +313,11 @@ rebuild(void)
printf(".");
#endif
- chdir(de->d_name);
-
- f = fopen(CONTENTS_FNAME, "r");
- if (f == NULL)
- err(EXIT_FAILURE, "can't open %s/%s", de->d_name, CONTENTS_FNAME);
-
- Plist.head = Plist.tail = NULL;
- read_plist(&Plist, f);
- p = find_plist(&Plist, PLIST_NAME);
- if (p == NULL)
- errx(EXIT_FAILURE, "Package %s has no @name, aborting.",
- de->d_name);
- PkgName = p->name;
- for (p = Plist.head; p; p = p->next) {
- switch (p->type) {
- case PLIST_FILE:
- if (dirp == NULL) {
- warnx("dirp not initialized, please send-pr!");
- abort();
- }
-
- (void) snprintf(file, sizeof(file), "%s/%s", dirp, p->name);
-
- if (!(isfile(file) || islinktodir(file)))
- warnx("%s: File %s is in %s but not on filesystem!",
- PkgName, file, CONTENTS_FNAME);
- else {
- pkgdb_store(file, PkgName);
- filecnt++;
- }
- break;
- case PLIST_CWD:
- if (strcmp(p->name, ".") != 0)
- dirp = p->name;
- else {
- (void) snprintf(dir, sizeof(dir), "%s/%s", PkgDBDir, de->d_name);
- dirp = dir;
- }
- break;
- case PLIST_IGNORE:
- p = p->next;
- break;
- case PLIST_SHOW_ALL:
- case PLIST_SRC:
- case PLIST_CMD:
- case PLIST_CHMOD:
- case PLIST_CHOWN:
- case PLIST_CHGRP:
- case PLIST_COMMENT:
- case PLIST_NAME:
- case PLIST_UNEXEC:
- case PLIST_DISPLAY:
- case PLIST_PKGDEP:
- case PLIST_MTREE:
- case PLIST_DIR_RM:
- case PLIST_IGNORE_INST:
- case PLIST_OPTION:
- case PLIST_PKGCFL:
- case PLIST_BLDDEP:
- break;
- }
- }
- free_plist(&Plist);
- fclose(f);
+ filecnt += add1pkg(de->d_name);
pkgcnt++;
-
- chdir("..");
}
+ chdir("..");
closedir(dp);
- pkgdb_close();
printf("\n");
printf("Stored %d file%s from %d package%s in %s.\n",
@@ -313,7 +342,7 @@ checkall(void)
if (dp == NULL)
err(EXIT_FAILURE, "opendir failed");
while ((de = readdir(dp))) {
- if (!isdir(de->d_name))
+ if (!(isdir(de->d_name) || islinktodir(de->d_name)))
continue;
if (strcmp(de->d_name, ".") == 0 ||
@@ -561,11 +590,21 @@ main(int argc, char *argv[])
pkgdb_dump();
+ } else if (strcasecmp(argv[0], "add") == 0) {
+ argv++; /* "add" */
+ while (*argv != NULL) {
+ add1pkg(*argv);
+ argv++;
+ }
+ } else if (strcasecmp(argv[0], "delete") == 0) {
+ argv++; /* "delete" */
+ while (*argv != NULL) {
+ delete1pkg(*argv);
+ argv++;
+ }
}
#ifdef PKGDB_DEBUG
- else if (strcasecmp(argv[0], "del") == 0 ||
- strcasecmp(argv[0], "delete") == 0) {
-
+ else if (strcasecmp(argv[0], "delkey") == 0) {
int rc;
if (!pkgdb_open(ReadWrite))
@@ -581,7 +620,7 @@ main(int argc, char *argv[])
pkgdb_close();
- } else if (strcasecmp(argv[0], "add") == 0) {
+ } else if (strcasecmp(argv[0], "addkey") == 0) {
int rc;
@@ -620,9 +659,11 @@ usage(void)
"Where 'commands' and 'args' are:\n"
" rebuild - rebuild pkgdb from +CONTENTS files\n"
" check [pkg ...] - check md5 checksum of installed files\n"
+ " add pkg ... - add pkg files to database\n"
+ " delete pkg ... - delete file entries for pkg in database\n"
#ifdef PKGDB_DEBUG
- " add key value - add key and value\n"
- " delete key - delete reference to key\n"
+ " addkey key value - add key and value\n"
+ " delkey key - delete reference to key\n"
#endif
" lsall /path/to/pkgpattern - list all pkgs matching the pattern\n"
" lsbest /path/to/pkgpattern - list pkgs matching the pattern best\n"
diff --git a/pkgtools/pkg_install/files/admin/pkg_admin.1 b/pkgtools/pkg_install/files/admin/pkg_admin.1
index 903945ebdae..86682c94bd5 100644
--- a/pkgtools/pkg_install/files/admin/pkg_admin.1
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_admin.1,v 1.2 2003/09/01 16:27:12 jlam Exp $
+.\" $NetBSD: pkg_admin.1,v 1.3 2003/09/09 13:34:18 jlam Exp $
.\"
.\" Copyright (c) 1999-2002 Hubert Feyrer. All rights reserved.
.\"
@@ -28,7 +28,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd August 4, 2002
+.Dd September 8, 2003
.Dt PKG_ADMIN 1
.Os
.Sh NAME
@@ -48,9 +48,9 @@
This command performs various administrative tasks around the
.Nx
Packages System.
-Available commands are:
-.Pp
-.Bl -tag -width check
+.Sh OPTIONS
+The following command-line options are supported:
+.Bl -tag -width indent
.It Fl K Ar pkg_dbdir
Set
.Ar pkg_dbdir
@@ -60,8 +60,6 @@ taken from the value of the environment variable
.Ev PKG_DBDIR
if it's set, otherwise it defaults to
.Pa /var/db/pkg .
-.It Fl V
-Print version number and exit.
.It Fl s Ar sfx_pattern
Set the shell glob pattern for package suffices when matching package
names for
@@ -69,6 +67,18 @@ names for
and
.Cm lsbest .
The default pattern is ".t[bg]z".
+.It Fl V
+Print version number and exit.
+.El
+.Pp
+The following commands are supported:
+.Bl -tag -width indent
+.It Cm add Ar pkg ...
+For each listed package, write the absolute pathnames of the files listed in
+its +CONTENTS file together with the package they belong to into the package
+database.
+This should be used only by
+.Xr pkg_view 1 .
.It Cm check Op Ar pkg ...
Use this command to check the files belonging to some or all of the
packages installed on the local machine against their MD5 checksum
@@ -82,14 +92,18 @@ The packages' +CONTENTS files will be parsed and the MD5
checksum will be checked for every file found.
A warning message is printed if the expected checksum differs from the
checksum of the file on disk.
-.Pp
+.It Cm delete Ar pkg ...
+For each listed package, remove all file entries in the package database that
+belong to the package.
+This should be used only by
+.Xr pkg_view 1 .
.It Cm dump
Dump the contents of the package database, similar to
.Cm pkg_info -F .
Columns are printed for the keyfield used in the pkgdb - the filename -,
and the data field - the package the file belongs to.
-.It Cm lsall /dir/pkgpattern
-.It Cm lsbest /dir/pkgpattern
+.It Cm lsall Ar /dir/pkgpattern
+.It Cm lsbest Ar /dir/pkgpattern
List all/best package matching pattern in the given directory.
Can be used to work around limitations of /bin/sh and other
filename globbing mechanisms.
@@ -119,8 +133,12 @@ yui# pkg_admin lsall /usr/pkgsrc/packages/i386ELF/All/'{mit,unproven}-pthread*'
/usr/pkgsrc/packages/i386ELF/All/mit-pthreads-1.60b6.tgz
/usr/pkgsrc/packages/i386ELF/All/unproven-pthreads-0.15.tgz
.Ed
-.It Cm pmatch pattern pkg
-Returns true if pkg matches pattern, false else.
+.It Cm pmatch Ar pattern Ar pkg
+Returns true if
+.Ar pkg
+matches
+.Ar pattern ,
+otherwise returns false.
.It Cm rebuild
Rebuild the package database mapping from scratch, scanning
subdirectories in
@@ -162,6 +180,7 @@ The default package database directory is
.Xr pkg_create 1 ,
.Xr pkg_delete 1 ,
.Xr pkg_info 1 ,
+.Xr pkg_view 1 ,
.Xr packages 7
.Sh HISTORY
The
diff --git a/pkgtools/pkg_install/files/admin/pkg_admin.cat1 b/pkgtools/pkg_install/files/admin/pkg_admin.cat1
index 6710b4eca03..cb4665f31a0 100644
--- a/pkgtools/pkg_install/files/admin/pkg_admin.cat1
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.cat1
@@ -8,81 +8,97 @@ SSYYNNOOPPSSIISS
DDEESSCCRRIIPPTTIIOONN
This command performs various administrative tasks around the NetBSD
- Packages System. Available commands are:
+ Packages System.
- --KK _p_k_g___d_b_d_i_r
- Set _p_k_g___d_b_d_i_r as the package database directory. If this option
- isn't specified, then the package database directory is taken from
- the value of the environment variable PKG_DBDIR if it's set, oth-
- erwise it defaults to _/_v_a_r_/_d_b_/_p_k_g.
+OOPPTTIIOONNSS
+ The following command-line options are supported:
- --VV Print version number and exit.
+ --KK _p_k_g___d_b_d_i_r
+ Set _p_k_g___d_b_d_i_r as the package database directory. If this option
+ isn't specified, then the package database directory is taken
+ from the value of the environment variable PKG_DBDIR if it's set,
+ otherwise it defaults to _/_v_a_r_/_d_b_/_p_k_g.
--ss _s_f_x___p_a_t_t_e_r_n
- Set the shell glob pattern for package suffices when matching
- package names for llssaallll and llssbbeesstt. The default pattern is
- ".t[bg]z".
+ Set the shell glob pattern for package suffices when matching
+ package names for llssaallll and llssbbeesstt. The default pattern is
+ ".t[bg]z".
+
+ --VV Print version number and exit.
+
+ The following commands are supported:
+
+ aadddd _p_k_g _._._.
+ For each listed package, write the absolute pathnames of the
+ files listed in its +CONTENTS file together with the package they
+ belong to into the package database. This should be used only by
+ pkg_view(1).
cchheecckk [_p_k_g _._._.]
- Use this command to check the files belonging to some or all of
- the packages installed on the local machine against their MD5
- checksum noted in their +CONTENTS files. If no additional argu-
- ment is given, the files of all installed packages are checked,
- else only the named packages will be checked (wildcards can be
- used here, see pkg_info(1)).
-
- The packages' +CONTENTS files will be parsed and the MD5 checksum
- will be checked for every file found. A warning message is print-
- ed if the expected checksum differs from the checksum of the file
- on disk.
-
- dduummpp Dump the contents of the package database, similar to ppkkgg__iinnffoo --FF.
- Columns are printed for the keyfield used in the pkgdb - the file-
- name -, and the data field - the package the file belongs to.
-
- llssaallll //ddiirr//ppkkggppaatttteerrnn
-
- llssbbeesstt //ddiirr//ppkkggppaatttteerrnn
- List all/best package matching pattern in the given directory.
- Can be used to work around limitations of /bin/sh and other file-
- name globbing mechanisms. This option implements matching of pkg-
- wildcards against arbitrary files, useful mainly in the build sys-
- tem itself. See pkg_info(1) for a description of the pattern.
-
- Example:
-
- yui# cd /usr/pkgsrc/packages/i386ELF/All/
- yui# ls unzip*
- unzip-5.40.tgz unzip-5.41.tgz
- yui# pkg_admin lsall 'unzip*'
- /usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz
- /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
- yui# pkg_admin lsall 'unzip>=5.40'
- /usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz
- /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
- yui# pkg_admin lsall 'unzip>=5.41'
- /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
- yui# pkg_admin lsbest 'unzip>=5.40'
- /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
- yui# pkg_admin lsall /usr/pkgsrc/packages/i386ELF/All/'{mit,unproven}-pthread*'
- /usr/pkgsrc/packages/i386ELF/All/mit-pthreads-1.60b6.tgz
- /usr/pkgsrc/packages/i386ELF/All/unproven-pthreads-0.15.tgz
-
- ppmmaattcchh ppaatttteerrnn ppkkgg
- Returns true if pkg matches pattern, false else.
+ Use this command to check the files belonging to some or all of
+ the packages installed on the local machine against their MD5
+ checksum noted in their +CONTENTS files. If no additional argu-
+ ment is given, the files of all installed packages are checked,
+ else only the named packages will be checked (wildcards can be
+ used here, see pkg_info(1)).
+
+ The packages' +CONTENTS files will be parsed and the MD5 checksum
+ will be checked for every file found. A warning message is
+ printed if the expected checksum differs from the checksum of the
+ file on disk.
+
+ ddeelleettee _p_k_g _._._.
+ For each listed package, remove all file entries in the package
+ database that belong to the package. This should be used only by
+ pkg_view(1).
+
+ dduummpp Dump the contents of the package database, similar to ppkkgg__iinnffoo
+ --FF. Columns are printed for the keyfield used in the pkgdb - the
+ filename -, and the data field - the package the file belongs to.
+
+ llssaallll _/_d_i_r_/_p_k_g_p_a_t_t_e_r_n
+
+ llssbbeesstt _/_d_i_r_/_p_k_g_p_a_t_t_e_r_n
+ List all/best package matching pattern in the given directory.
+ Can be used to work around limitations of /bin/sh and other file-
+ name globbing mechanisms. This option implements matching of
+ pkg-wildcards against arbitrary files, useful mainly in the build
+ system itself. See pkg_info(1) for a description of the pattern.
+
+ Example:
+
+ yui# cd /usr/pkgsrc/packages/i386ELF/All/
+ yui# ls unzip*
+ unzip-5.40.tgz unzip-5.41.tgz
+ yui# pkg_admin lsall 'unzip*'
+ /usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz
+ /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
+ yui# pkg_admin lsall 'unzip>=5.40'
+ /usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz
+ /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
+ yui# pkg_admin lsall 'unzip>=5.41'
+ /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
+ yui# pkg_admin lsbest 'unzip>=5.40'
+ /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
+ yui# pkg_admin lsall /usr/pkgsrc/packages/i386ELF/All/'{mit,unproven}-pthread*'
+ /usr/pkgsrc/packages/i386ELF/All/mit-pthreads-1.60b6.tgz
+ /usr/pkgsrc/packages/i386ELF/All/unproven-pthreads-0.15.tgz
+
+ ppmmaattcchh _p_a_t_t_e_r_n _p_k_g
+ Returns true if _p_k_g matches _p_a_t_t_e_r_n, otherwise returns false.
rreebbuuiilldd
- Rebuild the package database mapping from scratch, scanning subdi-
- rectories in _/_v_a_r_/_d_b_/_p_k_g for _+_C_O_N_T_E_N_T_S files, parsing them and
- writing the resulting absolute pathnames together with the package
- they belong to into the package database.
+ Rebuild the package database mapping from scratch, scanning sub-
+ directories in _/_v_a_r_/_d_b_/_p_k_g for _+_C_O_N_T_E_N_T_S files, parsing them and
+ writing the resulting absolute pathnames together with the pack-
+ age they belong to into the package database.
- This option is intended to be used for upgrading from non-pkgdb-
- pkg_* tools to pkgdb-pkg_* tools, further manipulation of the
- pkgdb will be done by pkg_add(1), pkg_delete(1), and
- pkg_create(1).
+ This option is intended to be used for upgrading from non-pkgdb-
+ pkg_* tools to pkgdb-pkg_* tools, further manipulation of the
+ pkgdb will be done by pkg_add(1), pkg_delete(1), and
+ pkg_create(1).
- Needs to be run as root.
+ Needs to be run as root.
EENNVVIIRROONNMMEENNTT
PKG_DBDIR
@@ -95,7 +111,8 @@ FFIILLEESS
/var/db/pkg/<pkg>/+CONTENTS
SSEEEE AALLSSOO
- pkg_add(1), pkg_create(1), pkg_delete(1), pkg_info(1), packages(7)
+ pkg_add(1), pkg_create(1), pkg_delete(1), pkg_info(1), pkg_view(1),
+ packages(7)
HHIISSTTOORRYY
The ppkkgg__aaddmmiinn command first appeared in NetBSD 1.4.
@@ -103,4 +120,4 @@ HHIISSTTOORRYY
AAUUTTHHOORRSS
The ppkkgg__aaddmmiinn command was written by Hubert Feyrer.
-NetBSD 1.6.1_STABLE August 4, 2002 2
+NetBSD 1.6.1_STABLE September 8, 2003 2
diff --git a/pkgtools/pkg_install/files/create/pkg_create.1 b/pkgtools/pkg_install/files/create/pkg_create.1
index edd79d1a98f..eb527bfdea6 100644
--- a/pkgtools/pkg_install/files/create/pkg_create.1
+++ b/pkgtools/pkg_install/files/create/pkg_create.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_create.1,v 1.4 2003/09/01 16:27:12 jlam Exp $
+.\" $NetBSD: pkg_create.1,v 1.5 2003/09/09 13:34:18 jlam Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -24,7 +24,7 @@
.\" [jkh] Took John's changes back and made some additional extensions for
.\" better integration with FreeBSD's new ports collection.
.\"
-.Dd January 10, 2003
+.Dd September 2, 2003
.Dt PKG_CREATE 1
.Os
.Sh NAME
@@ -37,28 +37,22 @@
.Op Fl B Ar build-info-file
.Ek
.Bk -words
-.Op Fl C Ar cpkgs
-.Ek
-.Bk -words
-.Op Fl D Ar displayfile
-.Ek
-.Bk -words
-.Op Fl K Ar pkg_dbdir
+.Op Fl b Ar build-version-file
.Ek
.Bk -words
-.Op Fl P Ar dpkgs
+.Op Fl C Ar cpkgs
.Ek
.Bk -words
-.Op Fl X Ar excludefile
+.Op Fl D Ar displayfile
.Ek
.Bk -words
-.Op Fl b Ar build-version-file
+.Op Fl I Ar realprefix
.Ek
.Bk -words
.Op Fl i Ar iscript
.Ek
.Bk -words
-.Op Fl I Ar realprefix
+.Op Fl K Ar pkg_dbdir
.Ek
.Bk -words
.Op Fl k Ar dscript
@@ -70,24 +64,30 @@
.Op Fl m Ar mtreefile
.Ek
.Bk -words
-.Op Fl p Ar prefix
+.Op Fl n Ar preserve-file
.Ek
.Bk -words
-.Op Fl r Ar rscript
+.Op Fl P Ar dpkgs
.Ek
.Bk -words
-.Op Fl s Ar size-pkg-file
+.Op Fl p Ar prefix
+.Ek
+.Bk -words
+.Op Fl r Ar rscript
.Ek
.Bk -words
.Op Fl S Ar size-all-file
.Ek
.Bk -words
-.Op Fl n Ar preserve-file
+.Op Fl s Ar size-pkg-file
.Ek
.Bk -words
.Op Fl t Ar template
.Ek
.Bk -words
+.Op Fl X Ar excludefile
+.Ek
+.Bk -words
.Fl c Ar comment
.Ek
.Bk -words
@@ -140,7 +140,9 @@ and is meant as a convenient shorthand for specifying multiple
.Cm @pkgcfl
directives in the packing list (see PACKING LIST DETAILS section below).
.It Fl c Ar [-]desc
-Fetch package ``one line description'' from file
+Fetch package
+.Pq one line description
+from file
.Ar desc
or, if preceded by
.Cm - ,
@@ -159,7 +161,9 @@ the argument itself.
.It Fl E
Add an empty views file to the package.
.It Fl f Ar packlist
-Fetch ``packing list'' for package from the file
+Fetch
+.Pq packing list
+for package from the file
.Ar packlist
or
.Cm stdin
@@ -226,9 +230,17 @@ where
is the name of the first directory named by a
.Cm @cwd
directive.
+.It Fl n Ar preserve-file
+The file is used to denote that the package should not be deleted.
+This is intended for use where the deletion of packages may present
+a bootstrap problem.
.It Fl O
-Go into a `packing list Only' mode.
-This is used to do `fake pkg_add' operations when a package is installed.
+Go into a
+.Pq packing list only
+mode.
+This is used to do
+.Pq fake pkg_add
+operations when a package is installed.
In such cases, it is necessary to know what the final, adjusted packing
list will look like.
.It Fl P Ar dpkgs
@@ -246,7 +258,9 @@ directives.
.It Fl p Ar prefix
Set
.Ar prefix
-as the initial directory ``base'' to start from in selecting files for
+as the initial directory
+.Pq base
+to start from in selecting files for
the package.
.It Fl R
Re-order any directories in the pkg/PLIST file into reverse alphabetic
@@ -255,26 +269,24 @@ parent directories.
.It Fl r Ar rscript
Set
.Ar rscript
-to be the ``requirements'' procedure for the package.
+to be the
+.Pq requirements
+procedure for the package.
This can be any executable program (or shell script).
It will be invoked automatically at installation/deinstallation time to
determine whether or not installation/deinstallation should proceed.
.It Fl S Ar size-all-file
Store the given file for later querying with the
.Xr pkg_info 1
-.Ar -S
+.Fl S
flag.
The file is expected to contain the size (in bytes) of all files of
this package plus any required packages added up and stored as a
ASCII string, terminated by a newline.
-.It Fl n Ar preserve-file
-The file is used to denote that the package should not be deleted.
-This is intended for use where the deletion of packages may present
-a bootstrap problem.
.It Fl s Ar size-pkg-file
Store the given file for later querying with the
.Xr pkg_info 1
-.Ar -s
+.Fl s
flag.
The file is expected to contain the the size (in bytes) of all files of
this package added up and stored as a ASCII string, terminated by a newline.
@@ -289,7 +301,9 @@ but it may be necessary to override it in the situation where
space in your
.Pa /tmp
directory is limited.
-Be sure to leave some number of `X' characters for
+Be sure to leave some number of
+.Sq X
+characters for
.Xr mktemp 3
to fill in with a unique ID.
.It Fl U
@@ -307,15 +321,13 @@ argument to
.Cm tar
when creating final package.
See
-.Cm tar
-man page (or run
-.Cm tar
-with
-.Fl -help
-flag) for further information on using this flag.
+.Xr tar 1
+for further information on using this flag.
.El
.Sh PACKING LIST DETAILS
-The ``packing list'' format (see
+The
+.Pq packing list
+format (see
.Fl f )
is fairly simple, being
nothing more than a single column of filenames to include in the
@@ -366,13 +378,17 @@ Expand to the current directory prefix, as set with
in the example case
.Pa /usr/local .
.It Cm "\&%B"
-Expand to the ``basename'' of the fully qualified filename, that
+Expand to the
+.Pq basename
+of the fully qualified filename, that
is the current directory prefix, plus the last filespec, minus
the trailing filename.
In the example case, that would be
.Pa /usr/local/bin .
.It Cm "\&%f"
-Expand to the ``filename'' part of the fully qualified name, or
+Expand to the
+.Pq filename
+part of the fully qualified name, or
the converse of
.Cm \&%B ,
being in the example case,
@@ -394,8 +410,9 @@ as a result of adding the package, but not directly known to the package's
table of contents (and hence not automatically removable).
The advantage of using
.Cm @unexec
-over a deinstallation script is that you can use the ``special
-sequence expansion'' to get at files regardless of where they've
+over a deinstallation script is that you can use the
+.Pq special sequence expansion
+to get at files regardless of where they've
been potentially redirected (see
.Fl p ) .
.It Cm @mode Ar mode
@@ -525,12 +542,12 @@ command first appeared in
.Fx .
.Sh AUTHORS
.Bl -tag -width indent -compact
-.It "Jordan Hubbard"
+.It Jordan Hubbard
most of the work
-.It "John Kohl"
+.It John Kohl
refined it for
.Nx
-.It "Hubert Feyrer"
+.It Hubert Feyrer
.Nx
wildcard dependency processing, pkgdb, pkg size recording etc.
.El
diff --git a/pkgtools/pkg_install/files/create/pkg_create.cat1 b/pkgtools/pkg_install/files/create/pkg_create.cat1
index 942d0026e1e..3610916dd25 100644
--- a/pkgtools/pkg_install/files/create/pkg_create.cat1
+++ b/pkgtools/pkg_install/files/create/pkg_create.cat1
@@ -4,13 +4,13 @@ NNAAMMEE
ppkkgg__ccrreeaattee - a utility for creating software package distributions
SSYYNNOOPPSSIISS
- ppkkgg__ccrreeaattee [--EEhhllOORRUUVVvv] [--BB _b_u_i_l_d_-_i_n_f_o_-_f_i_l_e] [--CC _c_p_k_g_s] [--DD _d_i_s_p_l_a_y_f_i_l_e]
- [--KK _p_k_g___d_b_d_i_r] [--PP _d_p_k_g_s] [--XX _e_x_c_l_u_d_e_f_i_l_e]
- [--bb _b_u_i_l_d_-_v_e_r_s_i_o_n_-_f_i_l_e] [--ii _i_s_c_r_i_p_t] [--II _r_e_a_l_p_r_e_f_i_x]
- [--kk _d_s_c_r_i_p_t] [--LL _S_r_c_D_i_r] [--mm _m_t_r_e_e_f_i_l_e] [--pp _p_r_e_f_i_x]
- [--rr _r_s_c_r_i_p_t] [--ss _s_i_z_e_-_p_k_g_-_f_i_l_e] [--SS _s_i_z_e_-_a_l_l_-_f_i_l_e]
- [--nn _p_r_e_s_e_r_v_e_-_f_i_l_e] [--tt _t_e_m_p_l_a_t_e] --cc _c_o_m_m_e_n_t --dd _d_e_s_c_r_i_p_t_i_o_n
- --ff _p_a_c_k_l_i_s_t _p_k_g_-_n_a_m_e
+ ppkkgg__ccrreeaattee [--EEhhllOORRUUVVvv] [--BB _b_u_i_l_d_-_i_n_f_o_-_f_i_l_e] [--bb _b_u_i_l_d_-_v_e_r_s_i_o_n_-_f_i_l_e]
+ [--CC _c_p_k_g_s] [--DD _d_i_s_p_l_a_y_f_i_l_e] [--II _r_e_a_l_p_r_e_f_i_x] [--ii _i_s_c_r_i_p_t]
+ [--KK _p_k_g___d_b_d_i_r] [--kk _d_s_c_r_i_p_t] [--LL _S_r_c_D_i_r] [--mm _m_t_r_e_e_f_i_l_e]
+ [--nn _p_r_e_s_e_r_v_e_-_f_i_l_e] [--PP _d_p_k_g_s] [--pp _p_r_e_f_i_x] [--rr _r_s_c_r_i_p_t]
+ [--SS _s_i_z_e_-_a_l_l_-_f_i_l_e] [--ss _s_i_z_e_-_p_k_g_-_f_i_l_e] [--tt _t_e_m_p_l_a_t_e]
+ [--XX _e_x_c_l_u_d_e_f_i_l_e] --cc _c_o_m_m_e_n_t --dd _d_e_s_c_r_i_p_t_i_o_n --ff _p_a_c_k_l_i_s_t _p_k_g_-
+ _n_a_m_e
DDEESSCCRRIIPPTTIIOONN
The ppkkgg__ccrreeaattee command is used to create packages that will subsequently
@@ -47,7 +47,7 @@ OOPPTTIIOONNSS
low).
--cc _[_-_]_d_e_s_c
- Fetch package ``one line description'' from file _d_e_s_c or, if pre-
+ Fetch package (one line description) from file _d_e_s_c or, if pre-
ceded by --, the argument itself. This string should also give
some idea of which version of the product (if any) the package
represents.
@@ -63,8 +63,8 @@ OOPPTTIIOONNSS
--EE Add an empty views file to the package.
--ff _p_a_c_k_l_i_s_t
- Fetch ``packing list'' for package from the file _p_a_c_k_l_i_s_t or
- ssttddiinn if _p_a_c_k_l_i_s_t is a -- (dash).
+ Fetch (packing list) for package from the file _p_a_c_k_l_i_s_t or ssttddiinn
+ if _p_a_c_k_l_i_s_t is a -- (dash).
--hh Force tar to follow symbolic links, so that the files they point
to are dumped, rather than the links themselves.
@@ -105,8 +105,13 @@ OOPPTTIIOONNSS
_p_r_e_f_i_x, where _p_r_e_f_i_x is the name of the first directory named by
a @@ccwwdd directive.
- --OO Go into a `packing list Only' mode. This is used to do `fake
- pkg_add' operations when a package is installed. In such cases,
+ --nn _p_r_e_s_e_r_v_e_-_f_i_l_e
+ The file is used to denote that the package should not be delet-
+ ed. This is intended for use where the deletion of packages may
+ present a bootstrap problem.
+
+ --OO Go into a (packing list only) mode. This is used to do (fake
+ pkg_add) operations when a package is installed. In such cases,
it is necessary to know what the final, adjusted packing list
will look like.
@@ -120,7 +125,7 @@ OOPPTTIIOONNSS
form of @@bbllddddeepp directives.
--pp _p_r_e_f_i_x
- Set _p_r_e_f_i_x as the initial directory ``base'' to start from in se-
+ Set _p_r_e_f_i_x as the initial directory (base) to start from in se-
lecting files for the package.
--RR Re-order any directories in the pkg/PLIST file into reverse al-
@@ -128,25 +133,20 @@ OOPPTTIIOONNSS
removed before parent directories.
--rr _r_s_c_r_i_p_t
- Set _r_s_c_r_i_p_t to be the ``requirements'' procedure for the package.
+ Set _r_s_c_r_i_p_t to be the (requirements) procedure for the package.
This can be any executable program (or shell script). It will be
invoked automatically at installation/deinstallation time to de-
termine whether or not installation/deinstallation should pro-
ceed.
--SS _s_i_z_e_-_a_l_l_-_f_i_l_e
- Store the given file for later querying with the pkg_info(1) _-_S
+ Store the given file for later querying with the pkg_info(1) --SS
flag. The file is expected to contain the size (in bytes) of all
files of this package plus any required packages added up and
stored as a ASCII string, terminated by a newline.
- --nn _p_r_e_s_e_r_v_e_-_f_i_l_e
- The file is used to denote that the package should not be delet-
- ed. This is intended for use where the deletion of packages may
- present a bootstrap problem.
-
--ss _s_i_z_e_-_p_k_g_-_f_i_l_e
- Store the given file for later querying with the pkg_info(1) _-_s
+ Store the given file for later querying with the pkg_info(1) --ss
flag. The file is expected to contain the the size (in bytes) of
all files of this package added up and stored as a ASCII string,
terminated by a newline.
@@ -167,11 +167,11 @@ OOPPTTIIOONNSS
--XX _e_x_c_l_u_d_e_f_i_l_e
Pass _e_x_c_l_u_d_e_f_i_l_e as a ----eexxcclluuddee--ffrroomm argument to ttaarr when creat-
- ing final package. See ttaarr man page (or run ttaarr with ----hheellpp
- flag) for further information on using this flag.
+ ing final package. See tar(1) for further information on using
+ this flag.
PPAACCKKIINNGG LLIISSTT DDEETTAAIILLSS
- The ``packing list'' format (see --ff) is fairly simple, being nothing more
+ The (packing list) format (see --ff) is fairly simple, being nothing more
than a single column of filenames to include in the package. However,
since absolute pathnames are generally a bad idea for a package that
could be installed potentially anywhere, there is another method of spec-
@@ -197,11 +197,11 @@ PPAACCKKIINNGG LLIISSTT DDEETTAAIILLSS
the example case _b_i_n_/_e_m_a_c_s
%%DD Expand to the current directory prefix, as set with @@ccwwdd,
in the example case _/_u_s_r_/_l_o_c_a_l.
- %%BB Expand to the ``basename'' of the fully qualified file-
- name, that is the current directory prefix, plus the last
- filespec, minus the trailing filename. In the example
- case, that would be _/_u_s_r_/_l_o_c_a_l_/_b_i_n.
- %%ff Expand to the ``filename'' part of the fully qualified
+ %%BB Expand to the (basename) of the fully qualified filename,
+ that is the current directory prefix, plus the last file-
+ spec, minus the trailing filename. In the example case,
+ that would be _/_u_s_r_/_l_o_c_a_l_/_b_i_n.
+ %%ff Expand to the (filename) part of the fully qualified
name, or the converse of %%BB, being in the example case,
_e_m_a_c_s.
@@uunneexxeecc _c_o_m_m_a_n_d
@@ -213,7 +213,7 @@ PPAACCKKIINNGG LLIISSTT DDEETTAAIILLSS
package, but not directly known to the package's table of con-
tents (and hence not automatically removable). The advantage of
using @@uunneexxeecc over a deinstallation script is that you can use
- the ``special sequence expansion'' to get at files regardless of
+ the (special sequence expansion) to get at files regardless of
where they've been potentially redirected (see --pp).
@@mmooddee _m_o_d_e
Set default permission for all subsequently extracted files to
@@ -310,4 +310,4 @@ BBUUGGSS
cations due to exec argument-space limitations (this depends on the value
returned by ssyyssccoonnff(___S_C___A_R_G___M_A_X)).
-NetBSD 1.6.1_STABLE January 10, 2003 5
+NetBSD 1.6.1_STABLE September 2, 2003 5
diff --git a/pkgtools/pkg_install/files/delete/perform.c b/pkgtools/pkg_install/files/delete/perform.c
index d5197fe1c63..59d74fcb5e9 100644
--- a/pkgtools/pkg_install/files/delete/perform.c
+++ b/pkgtools/pkg_install/files/delete/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.5 2003/09/02 08:28:27 jlam Exp $ */
+/* $NetBSD: perform.c,v 1.6 2003/09/09 13:34:19 jlam Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.5 2003/09/02 08:28:27 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.6 2003/09/09 13:34:19 jlam Exp $");
#endif
#endif
@@ -617,22 +617,44 @@ pkg_do(char *pkg)
(void) snprintf(LogDir, sizeof(LogDir), "%s/%s",
_pkgdb_getPKGDB_DIR(), pkg);
- if (!fexists(LogDir) || !isdir(LogDir)) {
- {
- /* Check if the given package name matches something
- * with 'pkg-[0-9]*' */
- char try[FILENAME_MAX];
- snprintf(try, FILENAME_MAX, "%s-[0-9]*", pkg);
- if (findmatchingname(_pkgdb_getPKGDB_DIR(), try,
- add_to_list_fn, &pkgs) != 0) {
- return 0; /* we've just appended some names to the pkgs list,
- * they will be processed after this package. */
+ if (!fexists(LogDir) || !(isdir(LogDir) || islinktodir(LogDir))) {
+ /* Check if the given package name matches something
+ * with 'pkg-[0-9]*' */
+ char try[FILENAME_MAX];
+ lpkg_head_t trypkgs;
+ lpkg_t *lpp;
+ int qlen = 0;
+
+ TAILQ_INIT(&trypkgs);
+ snprintf(try, FILENAME_MAX, "%s-[0-9]*", pkg);
+ if (findmatchingname(_pkgdb_getPKGDB_DIR(), try,
+ add_to_list_fn, &trypkgs) == NULL) {
+ warnx("package '%s' not installed", pkg);
+ return 1;
+ }
+
+ TAILQ_FOREACH(lpp, &trypkgs, lp_link)
+ qlen++;
+
+ if (qlen > 1) {
+ warnx("'%s' matches more than one package:", pkg);
+ while ((lpp = TAILQ_FIRST(&trypkgs))) {
+ TAILQ_REMOVE(&trypkgs, lpp, lp_link);
+ fprintf(stderr, "\t%s\n", lpp->lp_name);
+ free_lpkg(lpp);
}
+ return 1;
}
- /* No match */
- warnx("package '%s' not installed", pkg);
- return 1;
+ /*
+ * Append the package names we've discovered to the
+ * pkgs list after this one, and return 0 so that we
+ * continue processing the pkgs list.
+ */
+ TAILQ_FOREACH(lpp, &trypkgs, lp_link)
+ TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
+
+ return 0;
}
if (!getcwd(home, FILENAME_MAX)) {
cleanup(0);
@@ -687,7 +709,9 @@ pkg_do(char *pkg)
if (Verbose) {
printf("Deleting package %s instance from `%s' view\n", pkg, view);
}
- if (vsystem("%s -K %s %s", ProgramPath, view, pkg) != 0) {
+ if (vsystem("%s -K %s %s%s", ProgramPath, view,
+ (Force > 1) ? "-f -f " : (Force == 1) ? "-f " : "",
+ pkg) != 0) {
warnx("unable to delete package %s from view %s", pkg, view);
(void) fclose(fp);
return 1;
@@ -814,7 +838,7 @@ pkg_do(char *pkg)
if (is_depoted_pkg) {
(void) vsystem("%s %s/+*", REMOVE_CMD, LogDir);
if (isemptydir(LogDir))
- (void) vsystem("%s %s", RMDIR_CMD, LogDir);
+ (void) fexec(RMDIR_CMD, LogDir, NULL);
else
warnx("%s is not empty", LogDir);
return 0;
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.1 b/pkgtools/pkg_install/files/delete/pkg_delete.1
index daa1fc7ff8a..80c938a1d5b 100644
--- a/pkgtools/pkg_install/files/delete/pkg_delete.1
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_delete.1,v 1.3 2003/09/01 16:27:13 jlam Exp $
+.\" $NetBSD: pkg_delete.1,v 1.4 2003/09/09 13:34:20 jlam Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" from FreeBSD: @(#)pkg_delete.1
.\"
-.Dd March 8, 1999
+.Dd September 2, 2003
.Dt PKG_DELETE 1
.Os
.Sh NAME
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.cat1 b/pkgtools/pkg_install/files/delete/pkg_delete.cat1
index 8157cb3b809..63e96352a77 100644
--- a/pkgtools/pkg_install/files/delete/pkg_delete.cat1
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.cat1
@@ -146,4 +146,4 @@ AAUUTTHHOORRSS
NetBSD wildcard dependency processing, pkgdb, recursive "down"
delete, etc.
-NetBSD 1.6.1_STABLE March 8, 1999 3
+NetBSD 1.6.1_STABLE September 2, 2003 3
diff --git a/pkgtools/pkg_install/files/info/perform.c b/pkgtools/pkg_install/files/info/perform.c
index cdd04593f85..15f1b0ac015 100644
--- a/pkgtools/pkg_install/files/info/perform.c
+++ b/pkgtools/pkg_install/files/info/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.9 2003/09/02 08:28:28 jlam Exp $ */
+/* $NetBSD: perform.c,v 1.10 2003/09/09 13:34:21 jlam Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.9 2003/09/02 08:28:28 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.10 2003/09/09 13:34:21 jlam Exp $");
#endif
#endif
@@ -138,7 +138,7 @@ pkg_do(char *pkg)
*/
(void) snprintf(log_dir, sizeof(log_dir), "%s/%s",
_pkgdb_getPKGDB_DIR(), pkg);
- if (!fexists(log_dir) || !isdir(log_dir)) {
+ if (!fexists(log_dir) || !(isdir(log_dir) || islinktodir(log_dir))) {
{
/* Check if the given package name matches
* something with 'pkg-[0-9]*' */
@@ -271,7 +271,7 @@ foundpkg(const char *found, void *vp)
/* we only want to display this if it really is a directory */
snprintf(buf, sizeof(buf), "%s/%s", data, found);
- if (!isdir(buf)) {
+ if (!(isdir(buf) || islinktodir(buf))) {
/* return value seems to be ignored for now */
return -1;
}
@@ -304,7 +304,7 @@ CheckForPkg(char *pkgspec, char *dbdir)
}
/* simple match */
(void) snprintf(buf, sizeof(buf), "%s/%s", dbdir, pkgspec);
- error = !isdir(buf);
+ error = !(isdir(buf) || islinktodir(buf));
if (!error && !Quiet) {
printf("%s\n", pkgspec);
}
@@ -343,7 +343,7 @@ pkg_perform(lpkg_head_t *pkghead)
if (CheckPkg) {
err_cnt += CheckForPkg(CheckPkg, dbdir);
} else if (AllInstalled) {
- if (!(isdir(dbdir) || islinktodir(dbdir)))
+ if (!isdir(dbdir))
return 1;
if (File2Pkg) {
diff --git a/pkgtools/pkg_install/files/info/pkg_info.1 b/pkgtools/pkg_install/files/info/pkg_info.1
index 8ff80ed9971..dd3483fcc1e 100644
--- a/pkgtools/pkg_install/files/info/pkg_info.1
+++ b/pkgtools/pkg_install/files/info/pkg_info.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_info.1,v 1.2 2003/09/01 16:27:13 jlam Exp $
+.\" $NetBSD: pkg_info.1,v 1.3 2003/09/09 13:34:21 jlam Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" @(#)pkg_info.1
.\"
-.Dd March 4, 1999
+.Dd September 2, 2003
.Dt PKG_INFO 1
.Os
.Sh NAME
diff --git a/pkgtools/pkg_install/files/info/pkg_info.cat1 b/pkgtools/pkg_install/files/info/pkg_info.cat1
index 880ce4d797c..0426a53083f 100644
--- a/pkgtools/pkg_install/files/info/pkg_info.cat1
+++ b/pkgtools/pkg_install/files/info/pkg_info.cat1
@@ -168,4 +168,4 @@ AAUUTTHHOORRSS
NetBSD wildcard dependency processing, pkgdb, depends displaying,
pkg size display etc.
-NetBSD 1.6.1_STABLE March 4, 1999 3
+NetBSD 1.6.1_STABLE September 2, 2003 3
diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c
index 3a3af0a925b..a49da580c1b 100644
--- a/pkgtools/pkg_install/files/lib/pkgdb.c
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pkgdb.c,v 1.18 2003/09/08 05:58:10 jlam Exp $ */
+/* $NetBSD: pkgdb.c,v 1.19 2003/09/09 13:34:21 jlam Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: pkgdb.c,v 1.18 2003/09/08 05:58:10 jlam Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.19 2003/09/09 13:34:21 jlam Exp $");
#endif
/*
@@ -86,8 +86,8 @@ static char pkgdb_cache[FILENAME_MAX];
/*
* Open the pkg-database
* Return value:
- * 0: everything ok
- * -1: error, see errno
+ * 1: everything ok
+ * 0: error
*/
int
pkgdb_open(int mode)
@@ -220,7 +220,12 @@ pkgdb_remove(const char *key)
return (*pkgdbp->del) (pkgdbp, &keyd, 0);
}
-/* remove any entry from the cache which has a data field of `pkg' */
+/*
+ * Remove any entry from the cache which has a data field of `pkg'.
+ * Return value:
+ * 1: everything ok
+ * 0: error
+ */
int
pkgdb_remove_pkg(const char *pkg)
{
@@ -229,23 +234,25 @@ pkgdb_remove_pkg(const char *pkg)
int type;
int ret;
int cc;
+ char cachename[FILENAME_MAX];
if (pkgdbp == NULL) {
return 0;
}
+ (void) _pkgdb_getPKGDB_FILE(cachename, sizeof(cachename));
cc = strlen(pkg);
for (ret = 1, type = R_FIRST; (*pkgdbp->seq)(pkgdbp, &key, &data, type) == 0 ; type = R_NEXT) {
- if (cc == data.size && strncmp(data.data, pkg, cc) == 0) {
+ if ((cc + 1) == data.size && strncmp(data.data, pkg, cc) == 0) {
if (Verbose) {
- printf("Removing file %s from pkgdb\n", (char *)key.data);
+ printf("Removing file `%s' from %s\n", (char *)key.data, cachename);
}
switch ((*pkgdbp->del)(pkgdbp, &key, 0)) {
case -1:
- warn("Error removing %s from pkgdb", (char *) key.data);
+ warn("Error removing `%s' from %s", (char *)key.data, cachename);
ret = 0;
break;
case 1:
- warn("Key %s not present in pkgdb", (char *) key.data);
+ warn("Key `%s' not present in %s", (char *)key.data, cachename);
ret = 0;
break;
diff --git a/pkgtools/pkg_install/files/lib/str.c b/pkgtools/pkg_install/files/lib/str.c
index 53a2ede3f94..e8c1911eb9b 100644
--- a/pkgtools/pkg_install/files/lib/str.c
+++ b/pkgtools/pkg_install/files/lib/str.c
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.4 2003/09/02 08:28:36 jlam Exp $ */
+/* $NetBSD: str.c,v 1.5 2003/09/09 13:34:21 jlam Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
#else
-__RCSID("$NetBSD: str.c,v 1.4 2003/09/02 08:28:36 jlam Exp $");
+__RCSID("$NetBSD: str.c,v 1.5 2003/09/09 13:34:21 jlam Exp $");
#endif
#endif
@@ -656,7 +656,7 @@ add_to_list_fn(const char *pkg, void *vp)
char fn[FILENAME_MAX];
snprintf(fn, sizeof(fn), "%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
- if (!isfile(fn)) { /* might as well use sanity_check() */
+ if (isdir(fn) || islinktodir(fn)) {
lpp = alloc_lpkg(pkg);
TAILQ_INSERT_TAIL(pkgs, lpp, lp_link);
}
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 77edc41b290..f370873ce14 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.11 2003/09/03 14:06:00 jlam Exp $ */
+/* $NetBSD: version.h,v 1.12 2003/09/09 13:34:21 jlam Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@@ -33,6 +33,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
-#define PKGTOOLS_VERSION "20030824"
+#define PKGTOOLS_VERSION "20030907"
#endif /* _INST_LIB_VERSION_H_ */
diff --git a/pkgtools/pkg_install/files/view/linkfarm.1 b/pkgtools/pkg_install/files/view/linkfarm.1
index 02beed32781..ebf5a11e017 100644
--- a/pkgtools/pkg_install/files/view/linkfarm.1
+++ b/pkgtools/pkg_install/files/view/linkfarm.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: linkfarm.1,v 1.2 2003/09/01 16:51:31 wiz Exp $
+.\" $NetBSD: linkfarm.1,v 1.3 2003/09/09 13:34:21 jlam Exp $
.\"
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -31,15 +31,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd July 13, 2003
+.Dd September 2, 2003
.Dt LINKFARM 1
.Os
.Sh NAME
.Nm linkfarm
-.Nd a utility for managing symbolic links to package files
+.Nd manage symbolic links to package files
.Sh SYNOPSIS
.Nm
-.Op Ar options
+.Op Fl cDnRVv
+.Op Fl d Ar stowdir
+.Op Fl s Ar subdir
+.Op Fl t Ar target
.Ar package
.Sh DESCRIPTION
The
diff --git a/pkgtools/pkg_install/files/view/linkfarm.cat1 b/pkgtools/pkg_install/files/view/linkfarm.cat1
index 8492e07776b..aae854b99aa 100644
--- a/pkgtools/pkg_install/files/view/linkfarm.cat1
+++ b/pkgtools/pkg_install/files/view/linkfarm.cat1
@@ -1,10 +1,10 @@
LINKFARM(1) NetBSD Reference Manual LINKFARM(1)
NNAAMMEE
- lliinnkkffaarrmm - a utility for managing symbolic links to package files
+ lliinnkkffaarrmm - manage symbolic links to package files
SSYYNNOOPPSSIISS
- lliinnkkffaarrmm [_o_p_t_i_o_n_s] _p_a_c_k_a_g_e
+ lliinnkkffaarrmm [--ccDDnnRRVVvv] [--dd _s_t_o_w_d_i_r] [--ss _s_u_b_d_i_r] [--tt _t_a_r_g_e_t] _p_a_c_k_a_g_e
DDEESSCCRRIIPPTTIIOONN
The lliinnkkffaarrmm command is used to manage a "linkfarm", a directory tree of
@@ -59,9 +59,9 @@ EENNVVIIRROONNMMEENNTT
defaults to "info/dir *[~#] *.OLD *.orig *,v".
SSEEEE AALLSSOO
- pkg_views(1), lndir(1)
+ lndir(1), pkg_view(1)
AAUUTTHHOORRSS
The lliinnkkffaarrmm utility was written by Alistair G. Crooks <agc@netbsd.org>.
-NetBSD 1.6.1_STABLE July 13, 2003 1
+NetBSD 1.6.1_STABLE September 2, 2003 1
diff --git a/pkgtools/pkg_install/files/view/pkg_view.1 b/pkgtools/pkg_install/files/view/pkg_view.1
index 4aa05762f0e..bc6c5dc33ab 100644
--- a/pkgtools/pkg_install/files/view/pkg_view.1
+++ b/pkgtools/pkg_install/files/view/pkg_view.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_view.1,v 1.4 2003/09/03 14:06:01 jlam Exp $
+.\" $NetBSD: pkg_view.1,v 1.5 2003/09/09 13:34:22 jlam Exp $
.\"
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -31,23 +31,28 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd July 13, 2003
+.Dd September 8, 2003
.Dt PKG_VIEW 1
.Os
.Sh NAME
.Nm pkg_view
-.Nd a utility for managing package views
+.Nd add and delete instances of depoted packages in views
.Sh SYNOPSIS
.Nm
-.Op Ar options
+.Op Ar nVv
+.Op Fl d Ar stowdir
+.Op Fl i Ar ignore
+.Op Fl k Ar pkg_dbdir
+.Op Fl W Ar viewbase
+.Op Fl w Ar view
.Ar command
.Ar package ...
.Sh DESCRIPTION
The
.Nm
-command is used to add and delete packages in
+command is used to add and delete instances of depoted packages in
.Ar stowdir
-into a
+in a
.Ar view
in the
.Ar viewbase
@@ -56,16 +61,15 @@ directory.
.Bf -emphasis
Since the
.Nm
-command may execute scripts or programs contained within a package file,
+command may execute scripts or programs provided by a package file,
your system may be susceptible to ``Trojan horses'' or other subtle
attacks from miscreants who create dangerous package files.
.Pp
You are advised to verify the competence and identity of those who
provide installable package files.
-For extra protection, use the
-.Fl M
-flag to extract the package file, and inspect its contents and scripts
-to ensure it poses no danger to your system's integrity.
+For extra protection, examine all the package control files in the
+package database directory
+.Pa ( /usr/pkg/packages/\*[Lt]pkg-name\*[Gt]/ ) .
Pay particular attention to any +INSTALL, +DEINSTALL, +REQUIRE
or +MTREE_DIRS files, and inspect the +CONTENTS file for
.Cm @cwd ,
@@ -77,7 +81,7 @@ and
.Cm @unexec
directives, and/or use the
.Xr pkg_info 1
-command to examine the package file.
+command to examine the installed package control files.
.Ef
.Sh OPTIONS
The following command-line options are supported:
@@ -85,14 +89,14 @@ The following command-line options are supported:
.It Fl d Ar stowdir
Set
.Ar stowdir
-as the directory in which the installed packages can be found.
+as the directory in which the depoted packages can be found.
If this option isn't specified, then the
.Ar stowdir
is taken from the value of the environment variable
.Ev DEPOTBASE
if it's set, otherwise the default
.Ar stowdir
-is the
+is the path to the
.Pa packages
directory under
.Ar viewbase .
@@ -101,7 +105,7 @@ Add
.Ar ignore
to the list of files in
.Ar package
-that should ignored when adding or removing the package from
+that should ignored when adding or removing the package instance from
.Ar view .
.It Fl k Ar pkg_dbdir
Set
@@ -113,7 +117,7 @@ taken from the value of the environment variable
otherwise it defaults to
.Pa /var/db/pkg .
.It Fl n
-Don't actually execute the commands for manipulating the depoted packages.
+Don't actually execute the commands for manipulating the package instances.
.It Fl V
Print the version number and exit.
.It Fl v
@@ -137,7 +141,7 @@ Set
.Ar view
as the directory in
.Ar viewbase
-in which the packages should be added or removed.
+in which the package instances should be added or deleted.
The default
.Ar view
is the empty view but may be overridden by the
@@ -147,15 +151,15 @@ environment variable.
.Pp
The following commands are supported:
.Bl -tag -width indent
-.It Ar add
-Add the listed packages into
+.It Cm add
+Add the listed package instances into
.Ar view .
-.It Ar check
-Check whether the listed packages are present in
+.It Cm check
+Check whether the listed package instances are present in
.Ar view .
If they are not present, then return 0, otherwise return 1.
-.It Ar delete
-Delete the listed packages from
+.It Cm delete
+Delete the listed package instances from
.Ar view .
.El
.Sh ENVIRONMENT
@@ -189,20 +193,20 @@ otherwise it defaults to
.It Ev PLIST_IGNORE_FILES
This can be used to specify files in
.Ar package
-that should ignored when adding or removing the package from
+that should ignored when adding or removing the package instance from
.Ar view .
.Ev PLIST_IGNORE_FILES
is a space-separated list of shell glob patterns that match files relative
to the
.Ar package
-directory, and it defaults to "info/dir *[~#] *.OLD *.orig *,v".
+depot directory, and it defaults to "info/dir *[~#] *.OLD *.orig *,v".
This is overridden by any
.Ev _PLIST_IGNORE_FILES
setting in a package's
.Ar build-info-file
(see
-.Xr pkg_create 1
-) if it exists.
+.Xr pkg_create 1 )
+if it exists.
.It Ev PKG_VIEW
The default view can be specified in the
.Ev PKG_VIEW
@@ -210,37 +214,37 @@ environment variable.
.El
.Sh FILES
.Bl -tag -width indent
-.It Pa <pkg-dbdir>/<package>/+INSTALL
+.It Pa \*[Lt]pkg-dbdir\*[Gt]/\*[Lt]package\*[Gt]/+INSTALL
If the package contains an
.Ar install
script (see
.Xr pkg_create 1 ) ,
-then after the package is added into a view, the script is executed
-with the following arguments:
+then after the package instance is added into a view, the script is
+executed with the following arguments:
.Bl -tag -width package
.It Ar package
-The name of the package being installed.
+The name of the package instance being added.
.It Cm VIEW-INSTALL
Keyword denoting that the script is to perform any actions needed after
-the package is added to a view.
+the package instance is added to a view.
.El
.Pp
If the
.Ar install
script exits with a non-zero status code, the installation is terminated.
-.It Pa <pkg-dbdir>/<package>/+DEINSTALL
+.It Pa \*[Lt]pkg-dbdir\*[Gt]/\*[Lt]package\*[Gt]/+DEINSTALL
If the package contains an
.Ar deinstall
script (see
.Xr pkg_create 1 ) ,
-then before the package is removed from a view, the script is executed
-with the following arguments:
+then before the package instance is deleted from a view, the script is
+executed with the following arguments:
.Bl -tag -width package
.It Ar package
-The name of the package being installed.
+The name of the package instance being deleted.
.It Cm VIEW-DEINSTALL
Keyword denoting that the script is to perform any actions needed before
-the package is removed from a view.
+the package instance is deleted from a view.
.El
.Pp
If the
diff --git a/pkgtools/pkg_install/files/view/pkg_view.cat1 b/pkgtools/pkg_install/files/view/pkg_view.cat1
index 4d006ba9c7a..3e2a9e5a34f 100644
--- a/pkgtools/pkg_install/files/view/pkg_view.cat1
+++ b/pkgtools/pkg_install/files/view/pkg_view.cat1
@@ -1,43 +1,43 @@
PKG_VIEW(1) NetBSD Reference Manual PKG_VIEW(1)
NNAAMMEE
- ppkkgg__vviieeww - a utility for managing package views
+ ppkkgg__vviieeww - add and delete instances of depoted packages in views
SSYYNNOOPPSSIISS
- ppkkgg__vviieeww [_o_p_t_i_o_n_s] _c_o_m_m_a_n_d _p_a_c_k_a_g_e _._._.
+ ppkkgg__vviieeww [_n_V_v] [--dd _s_t_o_w_d_i_r] [--ii _i_g_n_o_r_e] [--kk _p_k_g___d_b_d_i_r] [--WW _v_i_e_w_b_a_s_e] [--ww
+ _v_i_e_w] _c_o_m_m_a_n_d _p_a_c_k_a_g_e _._._.
DDEESSCCRRIIPPTTIIOONN
- The ppkkgg__vviieeww command is used to add and delete packages in _s_t_o_w_d_i_r into a
- _v_i_e_w in the _v_i_e_w_b_a_s_e directory.
+ The ppkkgg__vviieeww command is used to add and delete instances of depoted pack-
+ ages in _s_t_o_w_d_i_r in a _v_i_e_w in the _v_i_e_w_b_a_s_e directory.
WWAARRNNIINNGG
- _S_i_n_c_e _t_h_e ppkkgg__vviieeww _c_o_m_m_a_n_d _m_a_y _e_x_e_c_u_t_e _s_c_r_i_p_t_s _o_r _p_r_o_g_r_a_m_s _c_o_n_t_a_i_n_e_d
- _w_i_t_h_i_n _a _p_a_c_k_a_g_e _f_i_l_e_, _y_o_u_r _s_y_s_t_e_m _m_a_y _b_e _s_u_s_c_e_p_t_i_b_l_e _t_o _`_`_T_r_o_j_a_n _h_o_r_s_-
- _e_s_'_' _o_r _o_t_h_e_r _s_u_b_t_l_e _a_t_t_a_c_k_s _f_r_o_m _m_i_s_c_r_e_a_n_t_s _w_h_o _c_r_e_a_t_e _d_a_n_g_e_r_o_u_s _p_a_c_k_a_g_e
- _f_i_l_e_s_.
+ _S_i_n_c_e _t_h_e ppkkgg__vviieeww _c_o_m_m_a_n_d _m_a_y _e_x_e_c_u_t_e _s_c_r_i_p_t_s _o_r _p_r_o_g_r_a_m_s _p_r_o_v_i_d_e_d _b_y _a
+ _p_a_c_k_a_g_e _f_i_l_e_, _y_o_u_r _s_y_s_t_e_m _m_a_y _b_e _s_u_s_c_e_p_t_i_b_l_e _t_o _`_`_T_r_o_j_a_n _h_o_r_s_e_s_'_' _o_r _o_t_h_-
+ _e_r _s_u_b_t_l_e _a_t_t_a_c_k_s _f_r_o_m _m_i_s_c_r_e_a_n_t_s _w_h_o _c_r_e_a_t_e _d_a_n_g_e_r_o_u_s _p_a_c_k_a_g_e _f_i_l_e_s_.
_Y_o_u _a_r_e _a_d_v_i_s_e_d _t_o _v_e_r_i_f_y _t_h_e _c_o_m_p_e_t_e_n_c_e _a_n_d _i_d_e_n_t_i_t_y _o_f _t_h_o_s_e _w_h_o _p_r_o_-
- _v_i_d_e _i_n_s_t_a_l_l_a_b_l_e _p_a_c_k_a_g_e _f_i_l_e_s_. _F_o_r _e_x_t_r_a _p_r_o_t_e_c_t_i_o_n_, _u_s_e _t_h_e --MM _f_l_a_g _t_o
- _e_x_t_r_a_c_t _t_h_e _p_a_c_k_a_g_e _f_i_l_e_, _a_n_d _i_n_s_p_e_c_t _i_t_s _c_o_n_t_e_n_t_s _a_n_d _s_c_r_i_p_t_s _t_o _e_n_s_u_r_e
- _i_t _p_o_s_e_s _n_o _d_a_n_g_e_r _t_o _y_o_u_r _s_y_s_t_e_m_'_s _i_n_t_e_g_r_i_t_y_. _P_a_y _p_a_r_t_i_c_u_l_a_r _a_t_t_e_n_t_i_o_n
- _t_o _a_n_y _+_I_N_S_T_A_L_L_, _+_D_E_I_N_S_T_A_L_L_, _+_R_E_Q_U_I_R_E _o_r _+_M_T_R_E_E___D_I_R_S _f_i_l_e_s_, _a_n_d _i_n_s_p_e_c_t
- _t_h_e _+_C_O_N_T_E_N_T_S _f_i_l_e _f_o_r @@ccwwdd_, @@mmooddee _(_c_h_e_c_k _f_o_r _s_e_t_u_i_d_)_, @@ddiirrrrmm_, @@eexxeecc_, _a_n_d
- @@uunneexxeecc _d_i_r_e_c_t_i_v_e_s_, _a_n_d_/_o_r _u_s_e _t_h_e pkg_info(_1) _c_o_m_m_a_n_d _t_o _e_x_a_m_i_n_e _t_h_e
- _p_a_c_k_a_g_e _f_i_l_e_.
+ _v_i_d_e _i_n_s_t_a_l_l_a_b_l_e _p_a_c_k_a_g_e _f_i_l_e_s_. _F_o_r _e_x_t_r_a _p_r_o_t_e_c_t_i_o_n_, _e_x_a_m_i_n_e _a_l_l _t_h_e
+ _p_a_c_k_a_g_e _c_o_n_t_r_o_l _f_i_l_e_s _i_n _t_h_e _p_a_c_k_a_g_e _d_a_t_a_b_a_s_e _d_i_r_e_c_t_o_r_y
+ _(_/_u_s_r_/_p_k_g_/_p_a_c_k_a_g_e_s_/_<_p_k_g_-_n_a_m_e_>_/_)_. _P_a_y _p_a_r_t_i_c_u_l_a_r _a_t_t_e_n_t_i_o_n _t_o _a_n_y _+_I_N_-
+ _S_T_A_L_L_, _+_D_E_I_N_S_T_A_L_L_, _+_R_E_Q_U_I_R_E _o_r _+_M_T_R_E_E___D_I_R_S _f_i_l_e_s_, _a_n_d _i_n_s_p_e_c_t _t_h_e _+_C_O_N_-
+ _T_E_N_T_S _f_i_l_e _f_o_r @@ccwwdd_, @@mmooddee _(_c_h_e_c_k _f_o_r _s_e_t_u_i_d_)_, @@ddiirrrrmm_, @@eexxeecc_, _a_n_d @@uunneexxeecc
+ _d_i_r_e_c_t_i_v_e_s_, _a_n_d_/_o_r _u_s_e _t_h_e pkg_info(_1) _c_o_m_m_a_n_d _t_o _e_x_a_m_i_n_e _t_h_e _i_n_s_t_a_l_l_e_d
+ _p_a_c_k_a_g_e _c_o_n_t_r_o_l _f_i_l_e_s_.
OOPPTTIIOONNSS
The following command-line options are supported:
--dd _s_t_o_w_d_i_r
- Set _s_t_o_w_d_i_r as the directory in which the installed packages can
- be found. If this option isn't specified, then the _s_t_o_w_d_i_r is
- taken from the value of the environment variable DEPOTBASE if
- it's set, otherwise the default _s_t_o_w_d_i_r is the _p_a_c_k_a_g_e_s directory
- under _v_i_e_w_b_a_s_e.
+ Set _s_t_o_w_d_i_r as the directory in which the depoted packages can be
+ found. If this option isn't specified, then the _s_t_o_w_d_i_r is taken
+ from the value of the environment variable DEPOTBASE if it's set,
+ otherwise the default _s_t_o_w_d_i_r is the path to the _p_a_c_k_a_g_e_s direc-
+ tory under _v_i_e_w_b_a_s_e.
--ii _i_g_n_o_r_e
Add _i_g_n_o_r_e to the list of files in _p_a_c_k_a_g_e that should ignored
- when adding or removing the package from _v_i_e_w.
+ when adding or removing the package instance from _v_i_e_w.
--kk _p_k_g___d_b_d_i_r
Set _p_k_g___d_b_d_i_r as the package database directory for the default
@@ -45,8 +45,8 @@ OOPPTTIIOONNSS
database directory is taken from the value of the environment
variable PKG_DBDIR, otherwise it defaults to _/_v_a_r_/_d_b_/_p_k_g.
- --nn Don't actually execute the commands for manipulating the depoted
- packages.
+ --nn Don't actually execute the commands for manipulating the package
+ instances.
--VV Print the version number and exit.
@@ -59,18 +59,19 @@ OOPPTTIIOONNSS
by the LOCALBASE environment variable.
--ww _v_i_e_w
- Set _v_i_e_w as the directory in _v_i_e_w_b_a_s_e in which the packages
- should be added or removed. The default _v_i_e_w is the empty view
- but may be overridden by the PKG_VIEW environment variable.
+ Set _v_i_e_w as the directory in _v_i_e_w_b_a_s_e in which the package in-
+ stances should be added or deleted. The default _v_i_e_w is the emp-
+ ty view but may be overridden by the PKG_VIEW environment vari-
+ able.
The following commands are supported:
- _a_d_d Add the listed packages into _v_i_e_w.
+ aadddd Add the listed package instances into _v_i_e_w.
- _c_h_e_c_k Check whether the listed packages are present in _v_i_e_w. If they
- are not present, then return 0, otherwise return 1.
+ cchheecckk Check whether the listed package instances are present in _v_i_e_w.
+ If they are not present, then return 0, otherwise return 1.
- _d_e_l_e_t_e Delete the listed packages from _v_i_e_w.
+ ddeelleettee Delete the listed package instances from _v_i_e_w.
EENNVVIIRROONNMMEENNTT
DEPOTBASE
@@ -89,12 +90,12 @@ EENNVVIIRROONNMMEENNTT
PLIST_IGNORE_FILES
This can be used to specify files in _p_a_c_k_a_g_e that should ignored
- when adding or removing the package from _v_i_e_w.
+ when adding or removing the package instance from _v_i_e_w.
PLIST_IGNORE_FILES is a space-separated list of shell glob pat-
- terns that match files relative to the _p_a_c_k_a_g_e directory, and it
- defaults to "info/dir *[~#] *.OLD *.orig *,v". This is overrid-
- den by any _PLIST_IGNORE_FILES setting in a package's _b_u_i_l_d_-_i_n_f_o_-
- _f_i_l_e (see pkg_create(1) ) if it exists.
+ terns that match files relative to the _p_a_c_k_a_g_e depot directory,
+ and it defaults to "info/dir *[~#] *.OLD *.orig *,v". This is
+ overridden by any _PLIST_IGNORE_FILES setting in a package's
+ _b_u_i_l_d_-_i_n_f_o_-_f_i_l_e (see pkg_create(1)) if it exists.
PKG_VIEW
The default view can be specified in the PKG_VIEW environment
@@ -103,28 +104,30 @@ EENNVVIIRROONNMMEENNTT
FFIILLEESS
<pkg-dbdir>/<package>/+INSTALL
If the package contains an _i_n_s_t_a_l_l script (see pkg_create(1)),
- then after the package is added into a view, the script is exe-
- cuted with the following arguments:
+ then after the package instance is added into a view, the script
+ is executed with the following arguments:
- _p_a_c_k_a_g_e The name of the package being installed.
+ _p_a_c_k_a_g_e The name of the package instance being added.
VVIIEEWW--IINNSSTTAALLLL
Keyword denoting that the script is to perform any ac-
- tions needed after the package is added to a view.
+ tions needed after the package instance is added to a
+ view.
If the _i_n_s_t_a_l_l script exits with a non-zero status code, the in-
stallation is terminated.
<pkg-dbdir>/<package>/+DEINSTALL
If the package contains an _d_e_i_n_s_t_a_l_l script (see pkg_create(1)),
- then before the package is removed from a view, the script is ex-
- ecuted with the following arguments:
+ then before the package instance is deleted from a view, the
+ script is executed with the following arguments:
- _p_a_c_k_a_g_e The name of the package being installed.
+ _p_a_c_k_a_g_e The name of the package instance being deleted.
VVIIEEWW--DDEEIINNSSTTAALLLL
Keyword denoting that the script is to perform any ac-
- tions needed before the package is removed from a view.
+ tions needed before the package instance is deleted from
+ a view.
If the _d_e_i_n_s_t_a_l_l script exits with a non-zero status code, the
de-installation is terminated.
@@ -138,4 +141,4 @@ SSEEEE AALLSSOO
AAUUTTHHOORRSS
The ppkkgg__vviieeww utility was written by Alistair G. Crooks <agc@netbsd.org>.
-NetBSD 1.6.1_STABLE July 13, 2003 3
+NetBSD 1.6.1_STABLE September 8, 2003 3
diff --git a/pkgtools/pkg_install/files/view/pkg_view.sh.in b/pkgtools/pkg_install/files/view/pkg_view.sh.in
index 447c27813e4..8f78b4eba1b 100644
--- a/pkgtools/pkg_install/files/view/pkg_view.sh.in
+++ b/pkgtools/pkg_install/files/view/pkg_view.sh.in
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: pkg_view.sh.in,v 1.1 2003/09/08 04:49:07 jlam Exp $
+# $NetBSD: pkg_view.sh.in,v 1.2 2003/09/09 13:34:22 jlam Exp $
#
# Copyright (c) 2001 Alistair G. Crooks. All rights reserved.
@@ -49,6 +49,7 @@ linkfarmprog="@sbindir@/linkfarm"
lnprog="@LN@"
mkdirprog="@MKDIR@"
paxprog="@PAX@"
+pkgadminprog="@sbindir@/pkg_admin"
pkginfoprog="@sbindir@/pkg_info"
rmprog="@RM@"
rmdirprog="@RMDIR@"
@@ -215,6 +216,7 @@ while [ $# -gt 0 ]; do
echo "${depot_pkg_dbdir}/$1" > ${pkg_dbdir}/$1/+DEPOT
;;
esac
+ $doit $pkgadminprog -K ${pkg_dbdir} add $1
if [ -f ${pkg_dbdir}/$1/+INSTALL ]; then
$doit $chmodprog +x ${pkg_dbdir}/$1/+INSTALL
$doit $envprog -i PKG_PREFIX=${targetdir} ${pkg_dbdir}/$1/+INSTALL $1 VIEW-INSTALL
@@ -264,6 +266,7 @@ while [ $# -gt 0 ]; do
esac
$doit $rmprog ${temp}
$doit $rmprog -rf ${pkg_dbdir}/$1
+ $doit $pkgadminprog -K ${pkg_dbdir} delete $1
;;
esac
shift