From owner-svn-src-all@FreeBSD.ORG Mon Nov 26 05:11:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 309053EA; Mon, 26 Nov 2012 05:11:04 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 090BA8FC14; Mon, 26 Nov 2012 05:11:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ5B3Km002299; Mon, 26 Nov 2012 05:11:03 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQ5B3Dm002296; Mon, 26 Nov 2012 05:11:03 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211260511.qAQ5B3Dm002296@svn.freebsd.org> From: Eitan Adler Date: Mon, 26 Nov 2012 05:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243553 - in head/usr.sbin/pkg_install: add lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 05:11:04 -0000 Author: eadler Date: Mon Nov 26 05:11:03 2012 New Revision: 243553 URL: http://svnweb.freebsd.org/changeset/base/243553 Log: Use modern license instead of being consistent with the other pkg_ tools Use a more informative message Fix some style(9) nits. Bump version number In pkg_add only warn users after the chroot is performed. Submitted by: gavin, jilles Reviewed by: beat, bapt Approved by: cperciva MFC after: 1 month Modified: head/usr.sbin/pkg_install/add/main.c head/usr.sbin/pkg_install/lib/lib.h head/usr.sbin/pkg_install/lib/pkgng.c Modified: head/usr.sbin/pkg_install/add/main.c ============================================================================== --- head/usr.sbin/pkg_install/add/main.c Mon Nov 26 04:40:26 2012 (r243552) +++ head/usr.sbin/pkg_install/add/main.c Mon Nov 26 05:11:03 2012 (r243553) @@ -136,7 +136,6 @@ main(int argc, char **argv) static char temppackageroot[MAXPATHLEN]; static char pkgaddpath[MAXPATHLEN]; - warnpkgng(); if (*argv[0] != '/' && strchr(argv[0], '/') != NULL) PkgAddCmd = realpath(argv[0], pkgaddpath); else @@ -295,6 +294,7 @@ main(int argc, char **argv) if (chroot(".")) errx(1, "chroot to %s failed", Chroot); } + warnpkgng(); /* Make sure the sub-execs we invoke get found */ setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin", Modified: head/usr.sbin/pkg_install/lib/lib.h ============================================================================== --- head/usr.sbin/pkg_install/lib/lib.h Mon Nov 26 04:40:26 2012 (r243552) +++ head/usr.sbin/pkg_install/lib/lib.h Mon Nov 26 05:11:03 2012 (r243553) @@ -99,7 +99,7 @@ * Version of the package tools - increase whenever you make a change * in the code that is not cosmetic only. */ -#define PKG_INSTALL_VERSION 20120918 +#define PKG_INSTALL_VERSION 20121024 #define PKG_WRAPCONF_FNAME "/var/db/pkg_install.conf" #define main(argc, argv) real_main(argc, argv) Modified: head/usr.sbin/pkg_install/lib/pkgng.c ============================================================================== --- head/usr.sbin/pkg_install/lib/pkgng.c Mon Nov 26 04:40:26 2012 (r243552) +++ head/usr.sbin/pkg_install/lib/pkgng.c Mon Nov 26 05:11:03 2012 (r243553) @@ -1,6 +1,6 @@ -/* - * FreeBSD install - a package for the installation and maintenance - * of non-core utilities. +/*- + * Copyright (c) 2012 Eitan Adler + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -11,19 +11,33 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * Eitan Adler - * - * detect pkgng's existence and warn + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * + * $FreeBSD$ */ #include -__FBSDID("$FreeBSD$"); #include "lib.h" #include -void warnpkgng(void) { +static const char message[] = "You appear to be using the newer pkg(1) tool on \ +this system for package management, rather than the legacy package \ +management tools (pkg_*). The legacy tools should no longer be used on \ +this system."; + +void warnpkgng(void) +{ char pkgngpath[MAXPATHLEN]; char *pkgngdir; @@ -34,5 +48,5 @@ void warnpkgng(void) { strcat(pkgngpath, "/local.sqlite"); if (access(pkgngpath, F_OK) == 0) - warnx("Don't use the pkg_ tools if you are using pkgng"); + warnx(message); }