Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Dec 2012 12:21:52 -0800
From:      Devin Teske <devin.teske@fisglobal.com>
To:        Matthew Seaman <matthew@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r244553 - head/usr.sbin/pkg
Message-ID:  <F26D7F9A-5029-4DB0-8545-DA87B784FFD3@fisglobal.com>
In-Reply-To: <201212212001.qBLK1DCQ027189@svn.freebsd.org>
References:  <201212212001.qBLK1DCQ027189@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Sweet!

This will simplify things on the bsdconfig side for the pkgng module I'm wr=
iting.
--=20
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
>=20
> 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.
>=20
>  Approved by:	bapt
>  MFC after:	2 weeks
>=20
> Modified:
>  head/usr.sbin/pkg/pkg.c
>=20
> Modified: head/usr.sbin/pkg/pkg.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- 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);
>=20
> 	if (access(pkgpath, X_OK) =3D=3D -1) {
> +		/*=20
> +		 * 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] !=3D NULL && strcmp(argv[1], "-n") =3D=3D 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 confidentia=
l. If you are not the intended recipient, please: (i) delete the message an=
d all copies; (ii) do not disclose, distribute or use the message in any ma=
nner; and (iii) notify the sender immediately. In addition, please be aware=
 that any message addressed to our domain is subject to archiving and revie=
w by persons other than the intended recipient. Thank you.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F26D7F9A-5029-4DB0-8545-DA87B784FFD3>