Author: bapt
Date: Tue Jan 15 09:17:07 2013
New Revision: 245452
URL: http://svnweb.freebsd.org/changeset/base/245452

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/8/usr.sbin/pkg/pkg.c
Directory Properties:
  stable/8/usr.sbin/pkg/   (props changed)

Modified: stable/8/usr.sbin/pkg/pkg.c
==============================================================================
--- stable/8/usr.sbin/pkg/pkg.c Tue Jan 15 09:14:18 2013        (r245451)
+++ stable/8/usr.sbin/pkg/pkg.c Tue Jan 15 09:17:07 2013        (r245452)
@@ -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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to