Author: bapt
Date: Tue Jan 15 09:14:18 2013
New Revision: 245451
URL: http://svnweb.freebsd.org/changeset/base/245451

Log:
  MFC r244553,244594,244608,244639
  
  In preparation for making 'pkg -N' the one true method of determining
  whether a system has been configured to use pkgng, cause /usr/sbin/pkg
  recognise a -n option and exit with a failure code when the pkg port
  is not installed
  
  Submitted by: matthew

Modified:
  stable/9/usr.sbin/pkg/pkg.c
Directory Properties:
  stable/9/usr.sbin/pkg/   (props changed)

Modified: stable/9/usr.sbin/pkg/pkg.c
==============================================================================
--- stable/9/usr.sbin/pkg/pkg.c Tue Jan 15 08:26:16 2013        (r245450)
+++ stable/9/usr.sbin/pkg/pkg.c Tue Jan 15 09:14:18 2013        (r245451)
@@ -452,6 +452,14 @@ main(__unused int argc, char *argv[])
            getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE);
 
        if (access(pkgpath, X_OK) == -1) {
+               /* 
+                * To allow 'pkg -N' to be used as a reliable test for whether
+                * a system is configured to use pkg, don't bootstrap pkg
+                * when that argument is given as argv[1].
+                */
+               if (argv[1] != NULL && strcmp(argv[1], "-N") == 0)
+                       errx(EXIT_FAILURE, "pkg is not installed");
+
                /*
                 * Do not ask for confirmation if either of stdin or stdout is
                 * not tty. Check the environment to see if user has answer
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to