summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2012-11-26 05:11:03 +0000
committereadler <eadler@FreeBSD.org>2012-11-26 05:11:03 +0000
commit7bec6c5d6838f84a8e0ddc0b8c227958f254172a (patch)
treedf33d076d6054a12bfcfd784f6e2a30f498a061c
parentf3a37c74222c2ca5335e58db06ab78166dafb431 (diff)
downloadFreeBSD-src-7bec6c5d6838f84a8e0ddc0b8c227958f254172a.zip
FreeBSD-src-7bec6c5d6838f84a8e0ddc0b8c227958f254172a.tar.gz
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
-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 563e04b..c91c8b6 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 88fcf34..a96214b 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 76c8ad8..d9eae2f 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);
}
OpenPOWER on IntegriCloud