aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-03-15 10:03:42 +0000
committerMike Frysinger <vapier@gentoo.org>2009-03-15 10:03:42 +0000
commit0b418864b7939c19568764c2fb5928615eb9b456 (patch)
tree4c798145f2bcaef1ea9cba4edad98064ab07ac14
parentdiscover HZ dynamically from elf notes on the stack #245393 (diff)
downloadportage-utils-0b418864b7939c19568764c2fb5928615eb9b456.tar.gz
portage-utils-0b418864b7939c19568764c2fb5928615eb9b456.tar.bz2
portage-utils-0b418864b7939c19568764c2fb5928615eb9b456.zip
allow people to override default vdb path with Q_VDB env var #257251
-rw-r--r--main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.c b/main.c
index c715831..addc103 100644
--- a/main.c
+++ b/main.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2008 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.c,v 1.159 2008/12/07 03:43:07 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.c,v 1.160 2009/03/15 10:03:42 vapier Exp $
*
* Copyright 2005-2008 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2008 Mike Frysinger - <vapier@gentoo.org>
@@ -55,7 +55,7 @@ char reinitialize = 0;
char reinitialize_metacache = 0;
char portdir[_Q_PATH_MAX] = "/usr/portage";
char portarch[20] = "";
-char portvdb[] = "var/db/pkg";
+char portvdb[_Q_PATH_MAX] = "var/db/pkg";
char portcachedir[] = "metadata/cache";
char portroot[_Q_PATH_MAX] = "/";
char config_protect[_Q_PATH_MAX] = "/etc/";
@@ -496,6 +496,12 @@ void initialize_portage_env(void)
{"ROOT", 4, _Q_STR, portroot, sizeof(portroot)}
};
+ s = getenv("Q_VDB"); /* #257251 */
+ if (s) {
+ strncpy(portvdb, s, sizeof(portvdb));
+ portvdb[sizeof(portvdb) - 1] = '\0';
+ }
+
if ((p = strchr(portroot, '/')) != NULL)
if (strlen(p) != 1)
strncat(portroot, "/", sizeof(portroot));