Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2013 09:14:18 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r245451 - stable/9/usr.sbin/pkg
Message-ID:  <201301150914.r0F9EI7c059550@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301150914.r0F9EI7c059550>