summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1993-09-08 01:46:59 +0000
committerjkh <jkh@FreeBSD.org>1993-09-08 01:46:59 +0000
commita9f8298bb52cc157641b92eff37cf0d20331694e (patch)
treeadb33570452c71ecc86b865a045231a48cff8156 /usr.sbin/pkg_install
parentb5d03499d0524de12f1910209e14e204b49e2e8d (diff)
downloadFreeBSD-src-a9f8298bb52cc157641b92eff37cf0d20331694e.zip
FreeBSD-src-a9f8298bb52cc157641b92eff37cf0d20331694e.tar.gz
Added two new options, one of which is fairly far reaching:
-q turns on "quiet" mode, where informational headers and such are not dumped, just the information. -L Shows full pathnames of files comprising a package. With -q, this can be useful for doing fileset operations, such as "du -s `pkg_info -q -L foo_bin`" to see how much space package "foo_bin" is taking up.
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/info/info.h3
-rw-r--r--usr.sbin/pkg_install/info/main.c11
-rw-r--r--usr.sbin/pkg_install/info/perform.c8
-rw-r--r--usr.sbin/pkg_install/info/pkg_info.117
-rw-r--r--usr.sbin/pkg_install/info/show.c57
5 files changed, 81 insertions, 15 deletions
diff --git a/usr.sbin/pkg_install/info/info.h b/usr.sbin/pkg_install/info/info.h
index 6a13134..b978bd4 100644
--- a/usr.sbin/pkg_install/info/info.h
+++ b/usr.sbin/pkg_install/info/info.h
@@ -31,14 +31,17 @@
#define SHOW_REQUIRE 0x20
#define SHOW_PREFIX 0x40
#define SHOW_INDEX 0x80
+#define SHOW_FILES 0x100
extern int Flags;
extern Boolean AllInstalled;
+extern Boolean Quiet;
extern char *InfoPrefix;
extern char *PlayPen;
extern char *CheckPkg;
extern void show_file(char *, char *);
extern void show_plist(char *, Package *, plist_t);
+extern void show_files(char *, Package *);
#endif /* _INST_INFO_H_INCLUDE */
diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c
index a049799..d5ea455 100644
--- a/usr.sbin/pkg_install/info/main.c
+++ b/usr.sbin/pkg_install/info/main.c
@@ -26,10 +26,11 @@ static char *rcsid = "$Header: /usr1/cvs/jkh/pkg_install/info/main.c,v 1.5 1993/
#include "lib.h"
#include "info.h"
-static char Options[] = "acde:fikrpIvhl:";
+static char Options[] = "acde:fikrpLqIvhl:";
int Flags = 0;
Boolean AllInstalled = FALSE;
+Boolean Quiet = FALSE;
char *InfoPrefix = "";
char *PlayPen = NULL;
char *CheckPkg = NULL;
@@ -87,10 +88,18 @@ main(int argc, char **argv)
Flags |= SHOW_REQUIRE;
break;
+ case 'L':
+ Flags |= SHOW_FILES;
+ break;
+
case 'l':
InfoPrefix = optarg;
break;
+ case 'q':
+ Quiet = TRUE;
+ break;
+
case 't':
PlayPen = optarg;
break;
diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c
index 7b75f48..53a2135 100644
--- a/usr.sbin/pkg_install/info/perform.c
+++ b/usr.sbin/pkg_install/info/perform.c
@@ -125,7 +125,8 @@ pkg_do(char *pkg)
}
else {
/* Start showing the package contents */
- printf("%sInformation for %s:\n\n", InfoPrefix, pkg);
+ if (!Quiet)
+ printf("%sInformation for %s:\n\n", InfoPrefix, pkg);
if (Flags & SHOW_COMMENT)
show_file("Comment:\n", COMMENT_FNAME);
if (Flags & SHOW_DESC)
@@ -138,7 +139,10 @@ pkg_do(char *pkg)
show_file("De-Install script:\n", DEINSTALL_FNAME);
if (Flags & SHOW_PREFIX)
show_plist("Prefix(s):\n", &plist, PLIST_CWD);
- puts(InfoPrefix);
+ if (Flags & SHOW_FILES)
+ show_files("Files:\n", &plist);
+ if (!Quiet)
+ puts(InfoPrefix);
}
free_plist(&plist);
leave_playpen();
diff --git a/usr.sbin/pkg_install/info/pkg_info.1 b/usr.sbin/pkg_install/info/pkg_info.1
index a08d214..1f28c17 100644
--- a/usr.sbin/pkg_install/info/pkg_info.1
+++ b/usr.sbin/pkg_install/info/pkg_info.1
@@ -48,12 +48,19 @@ Turns on verbose output.
.B \-p
Show the installation prefix for each package.
.TP
+.B \-q
+Be "quiet" in emitting report headers and such, just dump the
+raw info (basically, assume a non-human reading).
+.TP
.B \-c
Show the comment (one liner) field for each package.
.TP
.B \-d
Show the long description field for each package.
.TP
+.B \-f
+Show the packing list instructions for each package.
+.TP
.B \-i
Show the install script (if any) for each package.
.TP
@@ -63,6 +70,11 @@ Show the de-install script (if any) for each package.
.B \-r
Show the requirements script (if any) for each package.
.TP
+.B \-L
+Show the files within each package. This is different from just
+viewing the packing list, since full pathnames for everything
+are generated.
+.TP
.BI "\-e\ " pkg-name
If the package identified by
.I pkg-name
@@ -71,13 +83,16 @@ allows you to easily test for the presence of another (perhaps
prerequisite) package from a script.
.TP
.BI "\-l\ " str
-Prefix each catagory of information shown with
+Prefix each information catagory header (see
+.I \-q)
+shown with
.I str.
This is primarily of use to front-end programs who want to request a
lot of different information fields at once for a package, but don't
necessary want the output intermingled in such a way that they can't
organize it. This lets you add a special token to the start of
each field.
+.TP
.BI "\-t\ " template
Use
.I template
diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c
index b18c162..3000ccf 100644
--- a/usr.sbin/pkg_install/info/show.c
+++ b/usr.sbin/pkg_install/info/show.c
@@ -32,7 +32,8 @@ show_file(char *title, char *fname)
char line[1024];
int n;
- printf("%s%s", InfoPrefix, title);
+ if (!Quiet)
+ printf("%s%s", InfoPrefix, title);
fp = fopen(fname, "r");
if (!fp) {
whinge("show_file: Can't open '%s' for reading.", fname);
@@ -51,7 +52,8 @@ show_plist(char *title, Package *plist, plist_t type)
PackingList p;
Boolean ign = FALSE;
- printf("%s%s", InfoPrefix, title);
+ if (!Quiet)
+ printf("%s%s", InfoPrefix, title);
p = plist->head;
while (p) {
if (p->type != type && type != -1) {
@@ -61,35 +63,38 @@ show_plist(char *title, Package *plist, plist_t type)
switch(p->type) {
case PLIST_FILE:
if (ign) {
- printf("File: %s (ignored)\n", p->name);
+ printf(Quiet ? "%s\n" : "File: %s (ignored)\n", p->name);
ign = FALSE;
}
else
- printf("File: %s\n", p->name);
+ printf(Quiet ? "%s\n" : "File: %s\n", p->name);
break;
case PLIST_CWD:
- printf("\tCWD to %s\n", p->name);
+ printf(Quiet ? "@cwd %s\n" : "\tCWD to %s\n", p->name);
break;
case PLIST_CMD:
- printf("\tEXEC '%s'\n", p->name);
+ printf(Quiet ? "@exec %s\n" : "\tEXEC '%s'\n", p->name);
break;
case PLIST_CHMOD:
- printf("\tCHMOD to %s\n", p->name ? p->name : "(no default)");
+ printf(Quiet ? "@chmod %s\n" : "\tCHMOD to %s\n",
+ p->name ? p->name : "(clear default)");
break;
case PLIST_CHOWN:
- printf("\tCHOWN to %s\n", p->name ? p->name : "(no default)");
+ printf(Quiet ? "@chown %s\n" : "\tCHOWN to %s\n",
+ p->name ? p->name : "(clear default)");
break;
case PLIST_CHGRP:
- printf("\tCHGRP to %s\n", p->name ? p->name : "(no default)");
+ printf(Quiet ? "@chgrp %s\n" : "\tCHGRP to %s\n",
+ p->name ? p->name : "(clear default)");
break;
case PLIST_COMMENT:
- printf("\tComment: %s\n", p->name);
+ printf(Quiet ? "@comment %s\n" : "\tComment: %s\n", p->name);
break;
case PLIST_IGNORE:
@@ -97,7 +102,7 @@ show_plist(char *title, Package *plist, plist_t type)
break;
case PLIST_NAME:
- printf("\tPackage name: %s\n", p->name);
+ printf(Quiet ? "@name %s\n" : "\tPackage name: %s\n", p->name);
break;
default:
@@ -108,3 +113,33 @@ show_plist(char *title, Package *plist, plist_t type)
}
}
+/* Show all files in the packing list (except ignored ones) */
+void
+show_files(char *title, Package *plist)
+{
+ PackingList p;
+ Boolean ign = FALSE;
+ char *dir = ".";
+
+ if (!Quiet)
+ printf("%s%s", InfoPrefix, title);
+ p = plist->head;
+ while (p) {
+ switch(p->type) {
+ case PLIST_FILE:
+ if (!ign)
+ printf("%s/%s\n", dir, p->name);
+ ign = FALSE;
+ break;
+
+ case PLIST_CWD:
+ dir = p->name;
+ break;
+
+ case PLIST_IGNORE:
+ ign = TRUE;
+ break;
+ }
+ p = p->next;
+ }
+}
OpenPOWER on IntegriCloud