summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorjoerg <joerg>2008-04-07 13:07:14 +0000
committerjoerg <joerg>2008-04-07 13:07:14 +0000
commitc5aeea62ca2f4ed4f88c4a0133bfe84730c10518 (patch)
tree8a3240c568aa12264676de63befaf1655b86d75f /pkgtools/pkg_install
parent2aef8dfb57db4a25019a415b8c2feee81d6ac9c2 (diff)
downloadpkgsrc-c5aeea62ca2f4ed4f88c4a0133bfe84730c10518.tar.gz
pkg_install-20080407:
Add command to print effective value of configuration variables. Remove FETCH_CMD variable from pkg_admin, it is not used.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/admin/admin.h2
-rw-r--r--pkgtools/pkg_install/files/admin/config.c19
-rw-r--r--pkgtools/pkg_install/files/admin/main.c16
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.16
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.cat14
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
6 files changed, 38 insertions, 13 deletions
diff --git a/pkgtools/pkg_install/files/admin/admin.h b/pkgtools/pkg_install/files/admin/admin.h
index bcad1f6baeb..f7c9644e84e 100644
--- a/pkgtools/pkg_install/files/admin/admin.h
+++ b/pkgtools/pkg_install/files/admin/admin.h
@@ -37,7 +37,6 @@ extern int verbose;
extern const char *pkg_vulnerabilities_dir;
extern const char *pkg_vulnerabilities_file;
extern const char *pkg_vulnerabilities_url;
-extern const char *fetch_cmd;
extern const char *ignore_advisories;
extern const char tnf_vulnerability_base[];
@@ -50,5 +49,6 @@ void check_pkg_vulnerabilities(int, char **);
void fetch_pkg_vulnerabilities(int, char **);
void pkg_install_config(const char *);
+void pkg_install_show_variable(const char *);
void usage(void);
diff --git a/pkgtools/pkg_install/files/admin/config.c b/pkgtools/pkg_install/files/admin/config.c
index 2ac3e7e90e0..327cdba11bc 100644
--- a/pkgtools/pkg_install/files/admin/config.c
+++ b/pkgtools/pkg_install/files/admin/config.c
@@ -1,4 +1,4 @@
-/* $NetBSD: config.c,v 1.3 2008/03/21 14:47:53 joerg Exp $ */
+/* $NetBSD: config.c,v 1.4 2008/04/07 13:07:14 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: config.c,v 1.3 2008/03/21 14:47:53 joerg Exp $");
+__RCSID("$NetBSD: config.c,v 1.4 2008/04/07 13:07:14 joerg Exp $");
#endif
/*-
@@ -53,7 +53,6 @@ __RCSID("$NetBSD: config.c,v 1.3 2008/03/21 14:47:53 joerg Exp $");
const char *pkg_vulnerabilities_dir;
const char *pkg_vulnerabilities_file;
const char *pkg_vulnerabilities_url;
-const char *fetch_cmd = FTP_CMD;
const char *ignore_advisories = NULL;
const char tnf_vulnerability_base[] = "ftp://ftp.NetBSD.org/pub/NetBSD/packages/vulns";
@@ -65,7 +64,6 @@ static struct config_variable {
{ "PKGVULNDIR", &pkg_vulnerabilities_dir },
{ "PKGVULNURL", &pkg_vulnerabilities_url },
{ "IGNORE_URL", &ignore_advisories },
- { "FETCH_CMD", &fetch_cmd },
{ NULL, NULL }
};
@@ -97,3 +95,16 @@ pkg_install_config(const char *config_file)
err(EXIT_FAILURE, "asprintf failed");
}
}
+
+void
+pkg_install_show_variable(const char *var_name)
+{
+ struct config_variable *var;
+
+ for (var = config_variables; var->name != NULL; ++var) {
+ if (strcmp(var->name, var_name) != 0)
+ continue;
+ if (*var->var != NULL)
+ puts(*var->var);
+ }
+}
diff --git a/pkgtools/pkg_install/files/admin/main.c b/pkgtools/pkg_install/files/admin/main.c
index a8e81bb5b4d..a3952e6a80d 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.40 2008/03/23 01:04:47 dsainty Exp $ */
+/* $NetBSD: main.c,v 1.41 2008/04/07 13:07:14 joerg 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.40 2008/03/23 01:04:47 dsainty Exp $");
+__RCSID("$NetBSD: main.c,v 1.41 2008/04/07 13:07:14 joerg Exp $");
#endif
/*-
@@ -113,9 +113,10 @@ usage(void)
" pmatch pattern pkg - returns true if pkg matches pattern, otherwise false\n"
" fetch-pkg-vulnerabilities [-s] - fetch new vulnerability file\n"
" check-pkg-vulnerabilities [-s] <file> - check syntax and checksums of the vulnerability file\n"
- " audit [-es] [-t type] ...\n"
- " audit-pkg [-es] [-t type] ...\n"
- " audit-batch [-es] [-t type] ...\n",
+ " audit [-es] [-t type] ... - check installed packages for vulnerabilities\n"
+ " audit-pkg [-es] [-t type] ... - check listed packages for vulnerabilities\n"
+ " audit-batch [-es] [-t type] ... - check packages in listed files for vulnerabilities\n"
+ " config-var name - print current value of the configuration variable\n",
getprogname());
exit(EXIT_FAILURE);
}
@@ -521,6 +522,11 @@ main(int argc, char *argv[])
} else if (strcasecmp(argv[0], "unset") == 0) {
argv++; /* "unset" */
set_unset_variable(argv, TRUE);
+ } else if (strcasecmp(argv[0], "config-var") == 0) {
+ argv++;
+ if (argv == NULL || argv[1] != NULL)
+ errx(EXIT_FAILURE, "config-var takes exactly one argument");
+ pkg_install_show_variable(argv[0]);
}
#ifndef BOOTSTRAP
else if (strcasecmp(argv[0], "fetch-pkg-vulnerabilities") == 0) {
diff --git a/pkgtools/pkg_install/files/admin/pkg_admin.1 b/pkgtools/pkg_install/files/admin/pkg_admin.1
index 5287512f5d6..bc74c163b4c 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.16 2008/03/13 16:35:30 joerg Exp $
+.\" $NetBSD: pkg_admin.1,v 1.17 2008/04/07 13:07:14 joerg Exp $
.\"
.\" Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -164,6 +164,10 @@ Check format and hashes in the pkg-vulnerabilties file
If
.Fl s
is given, also check the embedded signature.
+.It Cm config-var Ar variable
+Print the current value of
+.Ar variable
+as used after parsing the configuration file.
.It Cm delete Ar pkg ...
For each listed package, remove all file entries in the package database that
belong to the package.
diff --git a/pkgtools/pkg_install/files/admin/pkg_admin.cat1 b/pkgtools/pkg_install/files/admin/pkg_admin.cat1
index 35545c6af18..f8e4f609dd3 100644
--- a/pkgtools/pkg_install/files/admin/pkg_admin.cat1
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.cat1
@@ -90,6 +90,10 @@ OOPPTTIIOONNSS
Check format and hashes in the pkg-vulnerabilties file _f_i_l_e. If
--ss is given, also check the embedded signature.
+ ccoonnffiigg--vvaarr _v_a_r_i_a_b_l_e
+ Print the current value of _v_a_r_i_a_b_l_e as used after parsing the
+ configuration file.
+
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
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index f6ceb3da2fa..3943599651d 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.98 2008/04/04 15:21:32 joerg Exp $ */
+/* $NetBSD: version.h,v 1.99 2008/04/07 13:07:14 joerg 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 "20080402"
+#define PKGTOOLS_VERSION "20080407"
#endif /* _INST_LIB_VERSION_H_ */