pkgng.c revision 243553
1127043Sjhb/*- 2127043Sjhb * Copyright (c) 2012 Eitan Adler 3127043Sjhb * All rights reserved. 4127043Sjhb * 5127043Sjhb * Redistribution and use in source and binary forms, with or without 6127043Sjhb * modification, are permitted provided that the following conditions 7127043Sjhb * are met: 8127043Sjhb * 1. Redistributions of source code must retain the above copyright 9127043Sjhb * notice, this list of conditions and the following disclaimer. 10127043Sjhb * 2. Redistributions in binary form must reproduce the above copyright 11127043Sjhb * notice, this list of conditions and the following disclaimer in the 12127043Sjhb * documentation and/or other materials provided with the distribution. 13127043Sjhb * 14127043Sjhb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15127043Sjhb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16127043Sjhb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17127043Sjhb * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18127043Sjhb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19127043Sjhb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20127043Sjhb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21127043Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22127043Sjhb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23127043Sjhb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24127043Sjhb * SUCH DAMAGE. 25127043Sjhb * 26127043Sjhb * $FreeBSD: head/usr.sbin/pkg_install/lib/pkgng.c 243553 2012-11-26 05:11:03Z eadler $ 27127043Sjhb */ 28127043Sjhb 29127043Sjhb#include <sys/cdefs.h> 30127043Sjhb 31153295Sdougb#include "lib.h" 32136224Smtm#include <err.h> 33127043Sjhb 34127043Sjhbstatic const char message[] = "You appear to be using the newer pkg(1) tool on \ 35127043Sjhbthis system for package management, rather than the legacy package \ 36127043Sjhbmanagement tools (pkg_*). The legacy tools should no longer be used on \ 37163063Sflzthis system."; 38127043Sjhb 39127043Sjhbvoid warnpkgng(void) 40127043Sjhb{ 41127043Sjhb char pkgngpath[MAXPATHLEN]; 42127043Sjhb char *pkgngdir; 43127043Sjhb 44127043Sjhb pkgngdir = getenv("PKG_DBDIR"); 45127043Sjhb if (pkgngdir == NULL) 46127043Sjhb pkgngdir = "/var/db/pkg"; 47127043Sjhb strcpy(pkgngpath, pkgngdir); 48127043Sjhb strcat(pkgngpath, "/local.sqlite"); 49127043Sjhb 50127043Sjhb if (access(pkgngpath, F_OK) == 0) 51127043Sjhb warnx(message); 52127043Sjhb} 53127043Sjhb