aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2012-11-26 05:11:03 +0000
committerEitan Adler <eadler@FreeBSD.org>2012-11-26 05:11:03 +0000
commit166fab99e0668431b1ebd3f47d55ccad462300e8 (patch)
treedf33d076d6054a12bfcfd784f6e2a30f498a061c /usr.sbin
parent42039c5bcecb7cfaa2e64fbcc499f6f68a47dd9a (diff)
downloadsrc-166fab99e0668431b1ebd3f47d55ccad462300e8.tar.gz
src-166fab99e0668431b1ebd3f47d55ccad462300e8.zip
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
Notes
Notes: svn path=/head/; revision=243553
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_install/add/main.c2
-rw-r--r--usr.sbin/pkg_install/lib/lib.h2
-rw-r--r--usr.sbin/pkg_install/lib/pkgng.c32
3 files changed, 25 insertions, 11 deletions
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index 563e04bd638d..c91c8b6da461 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -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",
diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h
index 88fcf34d72d9..a96214bc6005 100644
--- a/usr.sbin/pkg_install/lib/lib.h
+++ b/usr.sbin/pkg_install/lib/lib.h
@@ -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)
diff --git a/usr.sbin/pkg_install/lib/pkgng.c b/usr.sbin/pkg_install/lib/pkgng.c
index 76c8ad85934d..d9eae2f2cb7b 100644
--- a/usr.sbin/pkg_install/lib/pkgng.c
+++ b/usr.sbin/pkg_install/lib/pkgng.c
@@ -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);
}