Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkg.8: Add example usage of how to use pkg -N safely
Bryan Drewery committed 12 years ago
commit 59b9f369d4a25cf841173153b24c502b13d34da6
parent 5924d7d
1 file changed +23 -0
modified pkg/pkg.8
@@ -91,6 +91,29 @@ The exit status should be a reliable indication of whether a system
is configured to use
.Nm
as its package management system or not.
+
.Pp
+
The
+
.Fl N
+
flag was not released at the initial release of
+
.Nm
+
and did not exist in every released version of the bootstrapper in
+
.Pa /usr/sbin/pkg .
+
Because of this, it may not be enough to just call
+
.Nm Fl N ,
+
as the bootstrapper may be invoked.
+
The following script is the best way to detect if
+
.Nm
+
is installed and ready for use. This also assumes that the installed
+
.Nm
+
is at least version 1.0.13.
+
.Bd -literal -offset indent
+
  if [ -f /var/db/pkg/local.sqlite ] &&
+
      pkg -N >/dev/null 2>&1; then
+
    # pkgng-specifics
+
  else
+
    # pkg_install-specifics
+
  fi
+
.Ed
.It Fl j Ao jail name or id Ac
.Nm
will execute in the given