Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2012 05:11:03 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
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
Message-ID:  <201211260511.qAQ5B3Dm002296@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
 
 #include "lib.h"
 #include <err.h>
 
-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);
 }



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