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
This commit is contained in:
Eitan Adler 2012-11-26 05:11:03 +00:00
parent 42039c5bce
commit 166fab99e0
3 changed files with 25 additions and 11 deletions

View File

@ -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",

View File

@ -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)

View File

@ -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);
}