Allow the package entries in the pkgdbdir to be either directories or
symlinks to directories. This gives the user more rope, but lets those who know what they're doing to do what they want.
This commit is contained in:
parent
48fc13b7c2
commit
bfb9e5680c
|
@ -1,8 +1,8 @@
|
|||
/* $NetBSD: main.c,v 1.38 2003/09/08 07:04:40 jlam Exp $ */
|
||||
/* $NetBSD: main.c,v 1.39 2003/09/08 22:11:12 jlam Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: main.c,v 1.38 2003/09/08 07:04:40 jlam Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.39 2003/09/08 22:11:12 jlam Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -173,7 +173,7 @@ add1pkg(const char *pkgdir)
|
|||
|
||||
PkgDBDir = _pkgdb_getPKGDB_DIR();
|
||||
(void) snprintf(contents, sizeof(contents), "%s/%s", PkgDBDir, pkgdir);
|
||||
if (!isdir(contents))
|
||||
if (!(isdir(contents) || islinktodir(contents)))
|
||||
errx(EXIT_FAILURE, "`%s' does not exist.", contents);
|
||||
|
||||
(void) strlcat(contents, "/", sizeof(contents));
|
||||
|
@ -276,7 +276,7 @@ rebuild(void)
|
|||
if (dp == NULL)
|
||||
err(EXIT_FAILURE, "opendir failed");
|
||||
while ((de = readdir(dp))) {
|
||||
if (!isdir(de->d_name))
|
||||
if (!(isdir(de->d_name) || islinktodir(de->d_name)))
|
||||
continue;
|
||||
|
||||
if (strcmp(de->d_name, ".") == 0 ||
|
||||
|
@ -318,7 +318,7 @@ checkall(void)
|
|||
if (dp == NULL)
|
||||
err(EXIT_FAILURE, "opendir failed");
|
||||
while ((de = readdir(dp))) {
|
||||
if (!isdir(de->d_name))
|
||||
if (!(isdir(de->d_name) || islinktodir(de->d_name)))
|
||||
continue;
|
||||
|
||||
if (strcmp(de->d_name, ".") == 0 ||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: perform.c,v 1.44 2003/09/08 07:08:11 jlam Exp $ */
|
||||
/* $NetBSD: perform.c,v 1.45 2003/09/08 22:11:13 jlam Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: perform.c,v 1.44 2003/09/08 07:08:11 jlam Exp $");
|
||||
__RCSID("$NetBSD: perform.c,v 1.45 2003/09/08 22:11:13 jlam Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -607,7 +607,7 @@ pkg_do(char *pkg)
|
|||
|
||||
(void) snprintf(LogDir, sizeof(LogDir), "%s/%s",
|
||||
_pkgdb_getPKGDB_DIR(), pkg);
|
||||
if (!fexists(LogDir) || !isdir(LogDir)) {
|
||||
if (!fexists(LogDir) || !(isdir(LogDir) || islinktodir(LogDir))) {
|
||||
/* Check if the given package name matches something
|
||||
* with 'pkg-[0-9]*' */
|
||||
char try[FILENAME_MAX];
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: perform.c,v 1.47 2003/09/02 07:34:58 jlam Exp $ */
|
||||
/* $NetBSD: perform.c,v 1.48 2003/09/08 22:11:14 jlam Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: perform.c,v 1.47 2003/09/02 07:34:58 jlam Exp $");
|
||||
__RCSID("$NetBSD: perform.c,v 1.48 2003/09/08 22:11:14 jlam Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -120,7 +120,7 @@ pkg_do(char *pkg)
|
|||
*/
|
||||
(void) snprintf(log_dir, sizeof(log_dir), "%s/%s",
|
||||
_pkgdb_getPKGDB_DIR(), pkg);
|
||||
if (!fexists(log_dir) || !isdir(log_dir)) {
|
||||
if (!fexists(log_dir) || !(isdir(log_dir) || islinktodir(log_dir))) {
|
||||
{
|
||||
/* Check if the given package name matches
|
||||
* something with 'pkg-[0-9]*' */
|
||||
|
@ -253,7 +253,7 @@ foundpkg(const char *found, void *vp)
|
|||
|
||||
/* we only want to display this if it really is a directory */
|
||||
snprintf(buf, sizeof(buf), "%s/%s", data, found);
|
||||
if (!isdir(buf)) {
|
||||
if (!(isdir(buf) || islinktodir(buf))) {
|
||||
/* return value seems to be ignored for now */
|
||||
return -1;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ CheckForPkg(char *pkgspec, char *dbdir)
|
|||
}
|
||||
/* simple match */
|
||||
(void) snprintf(buf, sizeof(buf), "%s/%s", dbdir, pkgspec);
|
||||
error = !isdir(buf);
|
||||
error = !(isdir(buf) || islinktodir(buf));
|
||||
if (!error && !Quiet) {
|
||||
printf("%s\n", pkgspec);
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ pkg_perform(lpkg_head_t *pkghead)
|
|||
if (CheckPkg) {
|
||||
err_cnt += CheckForPkg(CheckPkg, dbdir);
|
||||
} else if (AllInstalled) {
|
||||
if (!(isdir(dbdir) || islinktodir(dbdir)))
|
||||
if (!isdir(dbdir))
|
||||
return 1;
|
||||
|
||||
if (File2Pkg) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: str.c,v 1.43 2003/09/02 07:35:04 jlam Exp $ */
|
||||
/* $NetBSD: str.c,v 1.44 2003/09/08 22:11:14 jlam Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: str.c,v 1.43 2003/09/02 07:35:04 jlam Exp $");
|
||||
__RCSID("$NetBSD: str.c,v 1.44 2003/09/08 22:11:14 jlam Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -644,7 +644,7 @@ add_to_list_fn(const char *pkg, void *vp)
|
|||
char fn[FILENAME_MAX];
|
||||
|
||||
snprintf(fn, sizeof(fn), "%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
|
||||
if (!isfile(fn)) { /* might as well use sanity_check() */
|
||||
if (!(isdir(fn) || islinktodir(fn))) {
|
||||
lpp = alloc_lpkg(pkg);
|
||||
TAILQ_INSERT_TAIL(pkgs, lpp, lp_link);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue