svn commit: r244553 - head/usr.sbin/pkg

Devin Teske devin.teske at fisglobal.com
Fri Dec 21 20:21:57 UTC 2012


Sweet!

This will simplify things on the bsdconfig side for the pkgng module I'm writing.
-- 
Devin

On Dec 21, 2012, at 12:01 PM, Matthew Seaman wrote:

> Author: matthew (ports committer)
> Date: Fri Dec 21 20:01:13 2012
> New Revision: 244553
> URL: http://svnweb.freebsd.org/changeset/base/244553
> 
> Log:
>  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.
> 
>  Approved by:	bapt
>  MFC after:	2 weeks
> 
> Modified:
>  head/usr.sbin/pkg/pkg.c
> 
> Modified: head/usr.sbin/pkg/pkg.c
> ==============================================================================
> --- head/usr.sbin/pkg/pkg.c	Fri Dec 21 19:36:08 2012	(r244552)
> +++ head/usr.sbin/pkg/pkg.c	Fri Dec 21 20:01:13 2012	(r244553)
> @@ -452,6 +452,16 @@ 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) {
> +			printf("%s", "pkg is not installed\n");
> +			exit(EXIT_FAILURE);
> +		}
> +
> 		/*
> 		 * Do not ask for confirmation if either of stdin or stdout is
> 		 * not tty. Check the environment to see if user has answer

_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.


More information about the svn-src-head mailing list