diff options
author | jkh <jkh@FreeBSD.org> | 1995-04-19 14:02:01 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-04-19 14:02:01 +0000 |
commit | 496b8887e48a335e5e33705160dc24bae20631d5 (patch) | |
tree | 3b42c69766f04e0b864e2304219ca415145e0c76 /usr.sbin/pkg_install/info/perform.c | |
parent | 0ff5903c59102c69837dc4317ea80fe6d8a12450 (diff) | |
download | FreeBSD-src-496b8887e48a335e5e33705160dc24bae20631d5.zip FreeBSD-src-496b8887e48a335e5e33705160dc24bae20631d5.tar.gz |
Add support for the ${PKG_DBDIR} environment variable. /var/db/pkg is the
default, and probably not something you'd ever change, but now it's
possible to do so for local/custom installations.
Diffstat (limited to 'usr.sbin/pkg_install/info/perform.c')
-rw-r--r-- | usr.sbin/pkg_install/info/perform.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c index bde7b2e..902436b 100644 --- a/usr.sbin/pkg_install/info/perform.c +++ b/usr.sbin/pkg_install/info/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.10 1994/12/06 00:51:45 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.11 1995/01/05 01:10:12 swallace Exp $"; #endif /* @@ -33,16 +33,20 @@ int pkg_perform(char **pkgs) { int i, err_cnt = 0; + char *tmp; signal(SIGINT, cleanup); + tmp = getenv(PKG_DBDIR); + if (!tmp) + tmp = DEF_LOG_DIR; /* Overriding action? */ if (AllInstalled || CheckPkg) { - if (isdir(LOG_DIR)) { + if (isdir(tmp)) { DIR *dirp; struct dirent *dp; - dirp = opendir(LOG_DIR); + dirp = opendir(tmp); if (dirp) { for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) { @@ -106,7 +110,10 @@ pkg_do(char *pkg) } } else { - sprintf(log_dir, "%s/%s", LOG_DIR, pkg); + char *tmp; + + sprintf(log_dir, "%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR, + pkg); if (!fexists(log_dir)) { whinge("Can't find package '%s' installed or in a file!", pkg); return 1; |