pkgng.c revision 241830
1241830Seadler/* 2241830Seadler * FreeBSD install - a package for the installation and maintenance 3241830Seadler * of non-core utilities. 4241830Seadler * 5241830Seadler * Redistribution and use in source and binary forms, with or without 6241830Seadler * modification, are permitted provided that the following conditions 7241830Seadler * are met: 8241830Seadler * 1. Redistributions of source code must retain the above copyright 9241830Seadler * notice, this list of conditions and the following disclaimer. 10241830Seadler * 2. Redistributions in binary form must reproduce the above copyright 11241830Seadler * notice, this list of conditions and the following disclaimer in the 12241830Seadler * documentation and/or other materials provided with the distribution. 13241830Seadler * 14241830Seadler * Eitan Adler 15241830Seadler * 16241830Seadler * detect pkgng's existence and warn 17241830Seadler * 18241830Seadler */ 19241830Seadler 20241830Seadler#include <sys/cdefs.h> 21241830Seadler__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/lib/pkgng.c 241830 2012-10-22 02:12:20Z eadler $"); 22241830Seadler 23241830Seadler#include "lib.h" 24241830Seadler#include <err.h> 25241830Seadler 26241830Seadlervoid warnpkgng(void) { 27241830Seadler char pkgngpath[MAXPATHLEN]; 28241830Seadler char *pkgngdir; 29241830Seadler 30241830Seadler pkgngdir = getenv("PKG_DBDIR"); 31241830Seadler if (pkgngdir == NULL) 32241830Seadler pkgngdir = "/var/db/pkg"; 33241830Seadler strcpy(pkgngpath, pkgngdir); 34241830Seadler strcat(pkgngpath, "/local.sqlite"); 35241830Seadler 36241830Seadler if (access(pkgngpath, F_OK) == 0) 37241830Seadler warnx("Don't use the pkg_ tools if you are using pkgng"); 38241830Seadler} 39