pkgng.c revision 241830
124275Sache/*
224275Sache * FreeBSD install - a package for the installation and maintenance
324275Sache * of non-core utilities.
424275Sache *
524275Sache * Redistribution and use in source and binary forms, with or without
624275Sache * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * Eitan Adler
15 *
16 * detect pkgng's existence and warn
17 *
18 */
19
20#include <sys/cdefs.h>
21__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/lib/pkgng.c 241830 2012-10-22 02:12:20Z eadler $");
22
23#include "lib.h"
24#include <err.h>
25
26void warnpkgng(void) {
27	char pkgngpath[MAXPATHLEN];
28	char *pkgngdir;
29
30	pkgngdir = getenv("PKG_DBDIR");
31	if (pkgngdir == NULL)
32		pkgngdir = "/var/db/pkg";
33	strcpy(pkgngpath, pkgngdir);
34	strcat(pkgngpath, "/local.sqlite");
35
36	if (access(pkgngpath, F_OK) == 0)
37		warnx("Don't use the pkg_ tools if you are using pkgng");
38}
39