diff --git a/usr.sbin/pkg/pkg.7 b/usr.sbin/pkg/pkg.7 --- a/usr.sbin/pkg/pkg.7 +++ b/usr.sbin/pkg/pkg.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 30, 2022 +.Dd August 24, 2022 .Dt PKG 7 .Os .Sh NAME @@ -32,16 +32,17 @@ .Nd a utility for manipulating packages .Sh SYNOPSIS .Nm +.Op Fl d .Ar command ... .Nm .Cm add -.Op Fl fy +.Op Fl dfy .Op Fl r Ar reponame .Ar pkg.txz .Nm .Fl N .Nm -.Op Fl 46 +.Op Fl 46d .Cm bootstrap .Op Fl fy .Op Fl r Ar reponame @@ -121,6 +122,17 @@ .Ar reponame has been specified, then the configuration for that repository will be used. .El +.Sh OPTIONS +The following options are supported by +.Nm : +.Bl -tag -width indent +.It Fl d, Fl -debug +Show debug information. +May be specified more than once to increase the level of detail. +When specified twice, +.Xr fetch 3 +debug output is enabled. +.El .Sh CONFIGURATION Configuration varies in whether it is in a repository configuration file or the global configuration file. diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -91,6 +91,8 @@ STAILQ_HEAD(fingerprint_list, fingerprint); +static int debug; + static int extract_pkg_static(int fd, char *p, int sz) { @@ -1113,6 +1115,7 @@ yes = false; struct option longopts[] = { + { "debug", no_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, { "only-ipv4", no_argument, NULL, '4' }, { "only-ipv6", no_argument, NULL, '6' }, @@ -1122,8 +1125,11 @@ snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", getlocalbase()); - while ((ch = getopt_long(argc, argv, "-:fr::yN46", longopts, NULL)) != -1) { + while ((ch = getopt_long(argc, argv, "-:dfr::yN46", longopts, NULL)) != -1) { switch (ch) { + case 'd': + debug++; + break; case 'f': force = true; break; @@ -1220,6 +1226,8 @@ break; } } + if (debug > 1) + fetchDebug = 1; if ((bootstrap_only && force) || access(pkgpath, X_OK) == -1) { /*