| From bd66af2ac7bb6d9294ac8055a55462ba7c4f9c9b Mon Sep 17 00:00:00 2001 |
| From: Ross Burton <ross.burton@intel.com> |
| Date: Wed, 19 Sep 2018 14:44:40 +0100 |
| Subject: [PATCH] Allow the environment to override where gnupg looks for its |
| own files. Useful in native builds. |
| |
| Upstream-Status: Inappropriate [OE-specific] |
| Signed-off-by: Ross Burton <ross.burton@intel.com> |
| |
| --- |
| common/homedir.c | 16 ++++++++-------- |
| 1 file changed, 8 insertions(+), 8 deletions(-) |
| |
| diff --git a/common/homedir.c b/common/homedir.c |
| index 4b6e46e..58989b4 100644 |
| --- a/common/homedir.c |
| +++ b/common/homedir.c |
| @@ -763,7 +763,7 @@ gnupg_socketdir (void) |
| if (!name) |
| { |
| unsigned int dummy; |
| - name = _gnupg_socketdir_internal (0, &dummy); |
| + name = getenv("GNUPG_SOCKETDIR") ?: _gnupg_socketdir_internal (0, &dummy); |
| } |
| |
| return name; |
| @@ -789,7 +789,7 @@ gnupg_sysconfdir (void) |
| } |
| return name; |
| #else /*!HAVE_W32_SYSTEM*/ |
| - return GNUPG_SYSCONFDIR; |
| + return getenv("GNUPG_SYSCONFDIR") ?: GNUPG_SYSCONFDIR; |
| #endif /*!HAVE_W32_SYSTEM*/ |
| } |
| |
| @@ -818,7 +818,7 @@ gnupg_bindir (void) |
| else |
| return rdir; |
| #else /*!HAVE_W32_SYSTEM*/ |
| - return GNUPG_BINDIR; |
| + return getenv("GNUPG_BINDIR") ?: GNUPG_BINDIR; |
| #endif /*!HAVE_W32_SYSTEM*/ |
| } |
| |
| @@ -831,7 +831,7 @@ gnupg_libexecdir (void) |
| #ifdef HAVE_W32_SYSTEM |
| return gnupg_bindir (); |
| #else /*!HAVE_W32_SYSTEM*/ |
| - return GNUPG_LIBEXECDIR; |
| + return getenv("GNUPG_LIBEXECDIR") ?: GNUPG_LIBEXECDIR; |
| #endif /*!HAVE_W32_SYSTEM*/ |
| } |
| |
| @@ -845,7 +845,7 @@ gnupg_libdir (void) |
| name = xstrconcat (w32_rootdir (), DIRSEP_S "lib" DIRSEP_S "gnupg", NULL); |
| return name; |
| #else /*!HAVE_W32_SYSTEM*/ |
| - return GNUPG_LIBDIR; |
| + return getenv("GNUPG_LIBDIR") ?: GNUPG_LIBDIR; |
| #endif /*!HAVE_W32_SYSTEM*/ |
| } |
| |
| @@ -859,7 +859,7 @@ gnupg_datadir (void) |
| name = xstrconcat (w32_rootdir (), DIRSEP_S "share" DIRSEP_S "gnupg", NULL); |
| return name; |
| #else /*!HAVE_W32_SYSTEM*/ |
| - return GNUPG_DATADIR; |
| + return getenv("GNUPG_DATADIR") ?: GNUPG_DATADIR; |
| #endif /*!HAVE_W32_SYSTEM*/ |
| } |
| |
| @@ -875,7 +875,7 @@ gnupg_localedir (void) |
| NULL); |
| return name; |
| #else /*!HAVE_W32_SYSTEM*/ |
| - return LOCALEDIR; |
| + return getenv("LOCALEDIR") ?: LOCALEDIR; |
| #endif /*!HAVE_W32_SYSTEM*/ |
| } |
| |
| @@ -943,7 +943,7 @@ gnupg_cachedir (void) |
| } |
| return dir; |
| #else /*!HAVE_W32_SYSTEM*/ |
| - return GNUPG_LOCALSTATEDIR "/cache/" PACKAGE_NAME; |
| + return getenv("GNUPG_LOCALSTATEDIR") ?: GNUPG_LOCALSTATEDIR "/cache/" PACKAGE_NAME; |
| #endif /*!HAVE_W32_SYSTEM*/ |
| } |
| |