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/add/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/add/perform.c')
-rw-r--r-- | usr.sbin/pkg_install/add/perform.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index b594596..415df59 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.14 1995/04/09 15:04:52 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.15 1995/04/10 08:01:44 jkh Exp $"; #endif /* @@ -58,6 +58,7 @@ pkg_do(char *pkg) { char pkg_fullname[FILENAME_MAX]; char home[FILENAME_MAX]; + char *tmp; FILE *cfile; int code = 0; PackingList p; @@ -131,9 +132,10 @@ pkg_do(char *pkg) } setenv(PKG_PREFIX_VNAME, (p = find_plist(&Plist, PLIST_CWD)) ? p->name : NULL, 1); - PkgName = (p = find_plist(&Plist, PLIST_NAME)) ? p->name : "anonymous"; /* Protect against old packages with bogus @name fields */ - sprintf(LogDir, "%s/%s", LOG_DIR, basename_of(PkgName)); + PkgName = (p = find_plist(&Plist, PLIST_NAME)) ? p->name : "anonymous"; + sprintf(LogDir, "%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR, + basename_of(PkgName)); if (isdir(LogDir)) { whinge("Package `%s' already recorded as installed.\n", PkgName); code = 1; @@ -269,8 +271,9 @@ pkg_do(char *pkg) code = 1; goto success; /* well, partial anyway */ } - /* Protect against old packages with bogus @name fields */ - sprintf(LogDir, "%s/%s", LOG_DIR, basename_of(PkgName)); + sprintf(LogDir, "%s/%s", + (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR, + basename_of(PkgName)); if (Verbose) printf("Attempting to record package into %s..\n", LogDir); if (make_hierarchy(LogDir)) { @@ -305,8 +308,9 @@ pkg_do(char *pkg) if (Verbose) printf("Attempting to record dependency on package `%s'\n", p->name); - sprintf(contents, "%s/%s/%s", LOG_DIR, basename_of(p->name), - REQUIRED_BY_FNAME); + sprintf(contents, "%s/%s/%s", + (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR, + basename_of(p->name), REQUIRED_BY_FNAME); cfile = fopen(contents, "a"); if (!cfile) { whinge("Can't open dependency file '%s'!\n\tDependency registration incomplete.", |