diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-03-15 10:03:42 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-03-15 10:03:42 +0000 |
commit | 0b418864b7939c19568764c2fb5928615eb9b456 (patch) | |
tree | 4c798145f2bcaef1ea9cba4edad98064ab07ac14 | |
parent | discover HZ dynamically from elf notes on the stack #245393 (diff) | |
download | portage-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.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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)); |