Blob Blame History Raw
From 277c196369f86f65f8831a049d01fab84cee4b1f Mon Sep 17 00:00:00 2001
From: Mario Limonciello <mario.limonciello@dell.com>
Date: Mon, 26 Aug 2019 23:42:23 -0500
Subject: [PATCH] fu-common: Use environment variables for systemd managed
 directories

The systemd unit will set these, create these directories and set all
permissions.  If that has happened, use them.
---
 src/fu-common.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/fu-common.c b/src/fu-common.c
index 2b5abc9d1..684a21185 100644
--- a/src/fu-common.c
+++ b/src/fu-common.c
@@ -1025,14 +1025,23 @@ fu_common_get_path (FuPathKind path_kind)
 #endif
 	/* /etc/fwupd */
 	case FU_PATH_KIND_SYSCONFDIR_PKG:
+		tmp = g_getenv ("CONFIGURATION_DIRECTORY");
+		if (tmp != NULL)
+			return g_build_filename (tmp, NULL);
 		basedir = fu_common_get_path (FU_PATH_KIND_SYSCONFDIR);
 		return g_build_filename (basedir, PACKAGE_NAME, NULL);
 	/* /var/lib/fwupd */
 	case FU_PATH_KIND_LOCALSTATEDIR_PKG:
+		tmp = g_getenv ("STATE_DIRECTORY");
+		if (tmp != NULL)
+			return g_build_filename (tmp, NULL);
 		basedir = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR);
 		return g_build_filename (basedir, "lib", PACKAGE_NAME, NULL);
 	/* /var/cache/fwupd */
 	case FU_PATH_KIND_CACHEDIR_PKG:
+		tmp = g_getenv ("CACHE_DIRECTORY");
+		if (tmp != NULL)
+			return g_build_filename (tmp, NULL);
 		basedir = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR);
 		return g_build_filename (basedir, "cache", PACKAGE_NAME, NULL);
 	case FU_PATH_KIND_POLKIT_ACTIONS: