From 4be17d1364615d8bb25df89187b65f7dabc167c7 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 30 May 2018 20:36:29 +0100 Subject: [PATCH] Add support for relocating various runtime paths This allows a snap package to be easily built. With much help from Mario Limonciello , many thanks. --- data/tests/{ => fwupd}/daemon.conf | 0 meson.build | 4 ++ plugins/dell/meson.build | 2 - plugins/synapticsmst/meson.build | 5 +- src/fu-common-cab.c | 5 +- src/fu-common.c | 80 ++++++++++++++++++++++++++++-- src/fu-common.h | 12 +++++ src/fu-config.c | 17 ++++--- src/fu-engine.c | 6 ++- src/fu-history.c | 3 +- src/fu-keyring-gpg.c | 9 ++-- src/fu-keyring-utils.c | 5 +- src/fu-plugin.c | 6 ++- src/fu-quirks.c | 11 ++-- src/fu-self-test.c | 6 ++- src/meson.build | 25 ++-------- 16 files changed, 143 insertions(+), 53 deletions(-) rename data/tests/{ => fwupd}/daemon.conf (100%) diff --git a/data/tests/daemon.conf b/data/tests/fwupd/daemon.conf similarity index 100% rename from data/tests/daemon.conf rename to data/tests/fwupd/daemon.conf diff --git a/meson.build b/meson.build index ef16630df..bb2d79efd 100644 --- a/meson.build +++ b/meson.build @@ -260,6 +260,10 @@ plugin_dir = join_paths(libdir, 'fwupd-plugins-3') conf.set_quoted('BINDIR', bindir) conf.set_quoted('LIBEXECDIR', libexecdir) +conf.set_quoted('DATADIR', datadir) +conf.set_quoted('LOCALSTATEDIR', localstatedir) +conf.set_quoted('SYSCONFDIR', sysconfdir) +conf.set_quoted('PLUGINDIR', plugin_dir) conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) conf.set_quoted('PACKAGE_NAME', meson.project_name()) diff --git a/plugins/dell/meson.build b/plugins/dell/meson.build index 7f4c4807c..4c037cf36 100644 --- a/plugins/dell/meson.build +++ b/plugins/dell/meson.build @@ -18,7 +18,6 @@ shared_module('fu_plugin_dell', install_dir: plugin_dir, c_args : [ cargs, - '-DLOCALSTATEDIR="' + localstatedir + '"', ], dependencies : [ plugin_deps, @@ -58,7 +57,6 @@ if get_option('tests') ], c_args : [ cargs, - '-DLOCALSTATEDIR="/tmp/fwupd-self-test/var"', ], ) test('dell-self-test', e) diff --git a/plugins/synapticsmst/meson.build b/plugins/synapticsmst/meson.build index a4190f348..1d428a3f3 100644 --- a/plugins/synapticsmst/meson.build +++ b/plugins/synapticsmst/meson.build @@ -15,7 +15,6 @@ shared_module('fu_plugin_synapticsmst', install_dir: plugin_dir, c_args : [ cargs, - '-DLOCALSTATEDIR="' + localstatedir + '"', ], dependencies : [ plugin_deps, @@ -52,8 +51,8 @@ if get_option('tests') ], c_args : [ cargs, - '-DLOCALSTATEDIR="/tmp/fwupd-self-test/var"', ], ) - test('synapticsmst-self-test', e) + test('synapticsmst-self-test', e, + env: ['FWUPD_LOCALSTATEDIR=/tmp/fwupd-self-test/var']) endif diff --git a/src/fu-common-cab.c b/src/fu-common-cab.c index 8b235499b..b5d96bf93 100644 --- a/src/fu-common-cab.c +++ b/src/fu-common-cab.c @@ -140,6 +140,7 @@ fu_common_store_from_cab_file (AsStore *store, GCabCabinet *cabinet, g_autoptr(GError) error_local = NULL; #if !AS_CHECK_VERSION(0,7,5) g_autofree gchar *cache_fn = NULL; + g_autofree gchar *cachedir = NULL; #endif /* parse file */ @@ -162,8 +163,8 @@ fu_common_store_from_cab_file (AsStore *store, GCabCabinet *cabinet, return FALSE; } #else - cache_fn = g_build_filename (LOCALSTATEDIR, "cache", "fwupd", - gcab_file_get_extract_name (cabfile), NULL); + cachedir = fu_common_get_path (FU_PATH_KIND_CACHEDIR_PKG); + cache_fn = g_build_filename (cachedir, gcab_file_get_extract_name (cabfile), NULL); if (!fu_common_mkdir_parent (cache_fn, error)) return FALSE; if (!g_file_set_contents (cache_fn, g_bytes_get_data (blob, NULL), diff --git a/src/fu-common.c b/src/fu-common.c index 718480972..700bf0335 100644 --- a/src/fu-common.c +++ b/src/fu-common.c @@ -376,6 +376,7 @@ fu_common_firmware_builder (GBytes *bytes, { gint rc = 0; g_autofree gchar *argv_str = NULL; + g_autofree gchar *localstatebuilderdir = NULL; g_autofree gchar *localstatedir = NULL; g_autofree gchar *output2_fn = NULL; g_autofree gchar *standard_error = NULL; @@ -397,7 +398,8 @@ fu_common_firmware_builder (GBytes *bytes, return NULL; /* this is shared with the plugins */ - localstatedir = g_build_filename (LOCALSTATEDIR, "lib", "fwupd", "builder", NULL); + localstatedir = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR_PKG); + localstatebuilderdir = g_build_filename (localstatedir, "builder", NULL); /* launch bubblewrap and generate firmware */ g_ptr_array_add (argv, g_strdup ("bwrap")); @@ -406,8 +408,8 @@ fu_common_firmware_builder (GBytes *bytes, fu_common_add_argv (argv, "--dir /tmp"); fu_common_add_argv (argv, "--dir /var"); fu_common_add_argv (argv, "--bind %s /tmp", tmpdir); - if (g_file_test (localstatedir, G_FILE_TEST_EXISTS)) - fu_common_add_argv (argv, "--ro-bind %s /boot", localstatedir); + if (g_file_test (localstatebuilderdir, G_FILE_TEST_EXISTS)) + fu_common_add_argv (argv, "--ro-bind %s /boot", localstatebuilderdir); fu_common_add_argv (argv, "--dev /dev"); fu_common_add_argv (argv, "--symlink usr/lib /lib"); fu_common_add_argv (argv, "--symlink usr/lib64 /lib64"); @@ -783,3 +785,75 @@ fu_common_error_array_get_best (GPtrArray *errors) FWUPD_ERROR_NOT_FOUND, "No supported devices found"); } + +/** + * fu_common_get_path: + * @path_kind: A #FuPathKind e.g. %FU_PATH_KIND_DATADIR_PKG + * + * Gets a fwupd-specific system path. These can be overridden with various + * environment variables, for instance %FWUPD_DATADIR. + * + * Returns: a system path, or %NULL if invalid + **/ +gchar * +fu_common_get_path (FuPathKind path_kind) +{ + const gchar *tmp; + g_autofree gchar *basedir = NULL; + + switch (path_kind) { + /* /var */ + case FU_PATH_KIND_LOCALSTATEDIR: + tmp = g_getenv ("FWUPD_LOCALSTATEDIR"); + if (tmp != NULL) + return g_strdup (tmp); + tmp = g_getenv ("SNAP_USER_DATA"); + if (tmp != NULL) + return g_build_filename (tmp, LOCALSTATEDIR, NULL); + return g_build_filename (LOCALSTATEDIR, NULL); + /* /etc */ + case FU_PATH_KIND_SYSCONFDIR: + tmp = g_getenv ("FWUPD_SYSCONFDIR"); + if (tmp != NULL) + return g_strdup (tmp); + tmp = g_getenv ("SNAP_USER_DATA"); + if (tmp != NULL) + return g_build_filename (tmp, SYSCONFDIR, NULL); + return g_strdup (SYSCONFDIR); + /* /usr/lib//fwupd-plugins-3 */ + case FU_PATH_KIND_PLUGINDIR_PKG: + tmp = g_getenv ("FWUPD_PLUGINDIR"); + if (tmp != NULL) + return g_strdup (tmp); + tmp = g_getenv ("SNAP"); + if (tmp != NULL) + return g_build_filename (tmp, PLUGINDIR, NULL); + return g_build_filename (PLUGINDIR, NULL); + /* /usr/share/fwupd */ + case FU_PATH_KIND_DATADIR_PKG: + tmp = g_getenv ("FWUPD_DATADIR"); + if (tmp != NULL) + return g_strdup (tmp); + tmp = g_getenv ("SNAP"); + if (tmp != NULL) + return g_build_filename (tmp, DATADIR, PACKAGE_NAME, NULL); + return g_build_filename (DATADIR, PACKAGE_NAME, NULL); + /* /etc/fwupd */ + case FU_PATH_KIND_SYSCONFDIR_PKG: + 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: + 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: + basedir = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR); + return g_build_filename (basedir, "cache", PACKAGE_NAME, NULL); + /* this shouldn't happen */ + default: + g_assert_not_reached (); + } + + return NULL; +} diff --git a/src/fu-common.h b/src/fu-common.h index 51f922fd4..a0e662169 100644 --- a/src/fu-common.h +++ b/src/fu-common.h @@ -16,6 +16,17 @@ typedef enum { FU_APP_FLAGS_LAST } FuAppFlags; +typedef enum { + FU_PATH_KIND_CACHEDIR_PKG, + FU_PATH_KIND_DATADIR_PKG, + FU_PATH_KIND_LOCALSTATEDIR, + FU_PATH_KIND_LOCALSTATEDIR_PKG, + FU_PATH_KIND_PLUGINDIR_PKG, + FU_PATH_KIND_SYSCONFDIR, + FU_PATH_KIND_SYSCONFDIR_PKG, + FU_PATH_KIND_LAST +} FuPathKind; + typedef void (*FuOutputHandler) (const gchar *line, gpointer user_data); @@ -25,6 +36,7 @@ gboolean fu_common_spawn_sync (const gchar * const *argv, GCancellable *cancellable, GError **error); +gchar *fu_common_get_path (FuPathKind path_kind); gboolean fu_common_rmtree (const gchar *directory, GError **error); GPtrArray *fu_common_get_files_recursive (const gchar *path, diff --git a/src/fu-config.c b/src/fu-config.c index 128aa7c71..02c104f0e 100644 --- a/src/fu-config.c +++ b/src/fu-config.c @@ -12,6 +12,7 @@ #include #include +#include "fu-common.h" #include "fu-config.h" #include "fwupd-common.h" @@ -41,7 +42,7 @@ fu_config_get_config_paths (void) GPtrArray *paths = g_ptr_array_new_with_free_func (g_free); const gchar *remotes_dir; const gchar *system_prefixlibdir = "/usr/lib/fwupd"; - g_autofree gchar *sysconfdir = NULL; + g_autofree gchar *configdir = NULL; /* only set by the self test program */ remotes_dir = g_getenv ("FU_SELF_TEST_REMOTES_DIR"); @@ -51,9 +52,9 @@ fu_config_get_config_paths (void) } /* use sysconfig, and then fall back to /etc */ - sysconfdir = g_build_filename (FWUPDCONFIGDIR, NULL); - if (g_file_test (sysconfdir, G_FILE_TEST_EXISTS)) - g_ptr_array_add (paths, g_steal_pointer (&sysconfdir)); + configdir = fu_common_get_path (FU_PATH_KIND_SYSCONFDIR_PKG); + if (g_file_test (configdir, G_FILE_TEST_EXISTS)) + g_ptr_array_add (paths, g_steal_pointer (&configdir)); /* add in system-wide locations */ if (g_file_test (system_prefixlibdir, G_FILE_TEST_EXISTS)) @@ -454,13 +455,16 @@ fu_config_load_from_file (FuConfig *self, const gchar *config_file, gboolean fu_config_load (FuConfig *self, GError **error) { + g_autofree gchar *datadir = NULL; + g_autofree gchar *configdir = NULL; g_autofree gchar *metainfo_path = NULL; g_autofree gchar *config_file = NULL; g_return_val_if_fail (FU_IS_CONFIG (self), FALSE); /* load the main daemon config file */ - config_file = g_build_filename (FWUPDCONFIGDIR, "daemon.conf", NULL); + configdir = fu_common_get_path (FU_PATH_KIND_SYSCONFDIR_PKG); + config_file = g_build_filename (configdir, "daemon.conf", NULL); if (g_file_test (config_file, G_FILE_TEST_EXISTS)) { if (!fu_config_load_from_file (self, config_file, error)) return FALSE; @@ -473,7 +477,8 @@ fu_config_load (FuConfig *self, GError **error) if (self->os_release == NULL) return FALSE; as_store_add_filter (self->store_remotes, AS_APP_KIND_SOURCE); - metainfo_path = g_build_filename (FWUPDDATADIR, "metainfo", NULL); + datadir = fu_common_get_path (FU_PATH_KIND_DATADIR_PKG); + metainfo_path = g_build_filename (datadir, "metainfo", NULL); if (g_file_test (metainfo_path, G_FILE_TEST_EXISTS)) { if (!as_store_load_path (self->store_remotes, metainfo_path, diff --git a/src/fu-engine.c b/src/fu-engine.c index 2ed46a609..37e53c2b1 100644 --- a/src/fu-engine.c +++ b/src/fu-engine.c @@ -2911,13 +2911,15 @@ fu_engine_load_plugins (FuEngine *self, GError **error) const gchar *fn; g_autoptr(GDir) dir = NULL; g_autoptr(AsProfileTask) ptask = NULL; + g_autofree gchar *plugin_path = NULL; /* profile */ ptask = as_profile_start_literal (self->profile, "FuEngine:load-plugins"); g_assert (ptask != NULL); /* search */ - dir = g_dir_open (PLUGINDIR, 0, error); + plugin_path = fu_common_get_path (FU_PATH_KIND_PLUGINDIR_PKG); + dir = g_dir_open (plugin_path, 0, error); if (dir == NULL) return FALSE; while ((fn = g_dir_read_name (dir)) != NULL) { @@ -2944,7 +2946,7 @@ fu_engine_load_plugins (FuEngine *self, GError **error) } /* open module */ - filename = g_build_filename (PLUGINDIR, fn, NULL); + filename = g_build_filename (plugin_path, fn, NULL); plugin = fu_plugin_new (); fu_plugin_set_name (plugin, name); fu_plugin_set_usb_context (plugin, self->usb_ctx); diff --git a/src/fu-history.c b/src/fu-history.c index e4a45ccd5..d17c7457e 100644 --- a/src/fu-history.c +++ b/src/fu-history.c @@ -13,6 +13,7 @@ #include #include +#include "fu-common.h" #include "fu-device-private.h" #include "fu-history.h" @@ -239,7 +240,7 @@ fu_history_load (FuHistory *self, GError **error) g_return_val_if_fail (self->db == NULL, FALSE); /* create directory */ - dirname = g_build_filename (LOCALSTATEDIR, "lib", "fwupd", NULL); + dirname = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR_PKG); file = g_file_new_for_path (dirname); if (!g_file_query_exists (file, NULL)) { if (!g_file_make_directory_with_parents (file, NULL, error)) diff --git a/src/fu-keyring-gpg.c b/src/fu-keyring-gpg.c index 750140e23..6593a2137 100644 --- a/src/fu-keyring-gpg.c +++ b/src/fu-keyring-gpg.c @@ -11,6 +11,7 @@ #include "fwupd-error.h" +#include "fu-common.h" #include "fu-keyring-gpg.h" struct _FuKeyringGpg @@ -83,6 +84,7 @@ fu_keyring_gpg_setup (FuKeyring *keyring, GError **error) FuKeyringGpg *self = FU_KEYRING_GPG (keyring); gpgme_error_t rc; g_autofree gchar *gpg_home = NULL; + g_autofree gchar *localstatedir = NULL; if (self->ctx != NULL) return TRUE; @@ -121,11 +123,8 @@ fu_keyring_gpg_setup (FuKeyring *keyring, GError **error) } /* set a custom home directory */ - gpg_home = g_build_filename (LOCALSTATEDIR, - "lib", - PACKAGE_NAME, - "gnupg", - NULL); + localstatedir = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR_PKG); + gpg_home = g_build_filename (localstatedir, "gnupg", NULL); if (g_mkdir_with_parents (gpg_home, 0700) < 0) { g_set_error (error, FWUPD_ERROR, diff --git a/src/fu-keyring-utils.c b/src/fu-keyring-utils.c index 804e546f1..3f2524596 100644 --- a/src/fu-keyring-utils.c +++ b/src/fu-keyring-utils.c @@ -9,6 +9,7 @@ #include "fwupd-error.h" +#include "fu-common.h" #include "fu-keyring-utils.h" #ifdef ENABLE_GPG @@ -84,6 +85,7 @@ fu_keyring_get_release_trust_flags (AsRelease *release, GBytes *blob_signature; const gchar *fn; g_autofree gchar *pki_dir = NULL; + g_autofree gchar *sysconfdir = NULL; g_autoptr(GError) error_local = NULL; g_autoptr(FuKeyring) kr = NULL; g_autoptr(FuKeyringResult) kr_result = NULL; @@ -140,7 +142,8 @@ fu_keyring_get_release_trust_flags (AsRelease *release, } /* check we were installed correctly */ - pki_dir = g_build_filename (SYSCONFDIR, "pki", "fwupd", NULL); + sysconfdir = fu_common_get_path (FU_PATH_KIND_SYSCONFDIR); + pki_dir = g_build_filename (sysconfdir, "pki", PACKAGE_NAME, NULL); if (!g_file_test (pki_dir, G_FILE_TEST_EXISTS)) { g_set_error (error, FWUPD_ERROR, diff --git a/src/fu-plugin.c b/src/fu-plugin.c index e7bf4dc3f..b72660cfe 100644 --- a/src/fu-plugin.c +++ b/src/fu-plugin.c @@ -1143,7 +1143,7 @@ fu_plugin_runner_schedule_update (FuPlugin *plugin, } /* create directory */ - dirname = g_build_filename (LOCALSTATEDIR, "lib", "fwupd", NULL); + dirname = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR_PKG); file = g_file_new_for_path (dirname); if (!g_file_query_exists (file, NULL)) { if (!g_file_make_directory_with_parents (file, NULL, error)) @@ -1507,14 +1507,16 @@ fu_plugin_get_report_metadata (FuPlugin *plugin) gchar * fu_plugin_get_config_value (FuPlugin *plugin, const gchar *key) { + g_autofree gchar *conf_dir = NULL; g_autofree gchar *conf_file = NULL; g_autofree gchar *conf_path = NULL; g_autoptr(GKeyFile) keyfile = NULL; const gchar *plugin_name; + conf_dir = fu_common_get_path (FU_PATH_KIND_SYSCONFDIR_PKG); plugin_name = fu_plugin_get_name (plugin); conf_file = g_strdup_printf ("%s.conf", plugin_name); - conf_path = g_build_filename (FWUPDCONFIGDIR, conf_file, NULL); + conf_path = g_build_filename (conf_dir, conf_file, NULL); if (!g_file_test (conf_path, G_FILE_TEST_IS_REGULAR)) return NULL; keyfile = g_key_file_new (); diff --git a/src/fu-quirks.c b/src/fu-quirks.c index 978cf93a4..c99833f64 100644 --- a/src/fu-quirks.c +++ b/src/fu-quirks.c @@ -12,6 +12,7 @@ #include #include +#include "fu-common.h" #include "fu-quirks.h" #include "fwupd-error.h" @@ -296,7 +297,8 @@ fu_quirks_add_quirks_for_path (FuQuirks *self, const gchar *path, GError **error gboolean fu_quirks_load (FuQuirks *self, GError **error) { - g_autofree gchar *localstate_fwupd = NULL; + g_autofree gchar *datadir = NULL; + g_autofree gchar *localstatedir = NULL; g_return_val_if_fail (FU_IS_QUIRKS (self), FALSE); /* ensure empty in case we're called from a monitor change */ @@ -304,12 +306,13 @@ fu_quirks_load (FuQuirks *self, GError **error) g_hash_table_remove_all (self->hash); /* system datadir */ - if (!fu_quirks_add_quirks_for_path (self, FWUPDDATADIR, error)) + datadir = fu_common_get_path (FU_PATH_KIND_DATADIR_PKG); + if (!fu_quirks_add_quirks_for_path (self, datadir, error)) return FALSE; /* something we can write when using Ostree */ - localstate_fwupd = g_build_filename (LOCALSTATEDIR, "lib", "fwupd", NULL); - if (!fu_quirks_add_quirks_for_path (self, localstate_fwupd, error)) + localstatedir = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR_PKG); + if (!fu_quirks_add_quirks_for_path (self, localstatedir, error)) return FALSE; /* success */ diff --git a/src/fu-self-test.c b/src/fu-self-test.c index 19f33f53b..d405e995c 100644 --- a/src/fu-self-test.c +++ b/src/fu-self-test.c @@ -1213,6 +1213,7 @@ fu_plugin_module_func (void) FwupdRelease *release; gboolean ret; guint cnt = 0; + g_autofree gchar *localstatedir = NULL; g_autofree gchar *mapped_file_fn = NULL; g_autofree gchar *pending_cap = NULL; g_autofree gchar *history_db = NULL; @@ -1321,7 +1322,8 @@ fu_plugin_module_func (void) g_clear_error (&error); /* delete files */ - history_db = g_build_filename (LOCALSTATEDIR, "lib", "fwupd", "pending.db", NULL); + localstatedir = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR_PKG); + history_db = g_build_filename (localstatedir, "pending.db", NULL); g_unlink (history_db); g_unlink (pending_cap); } @@ -1449,7 +1451,7 @@ fu_history_func (void) g_assert (history != NULL); /* delete the database */ - dirname = g_build_filename (LOCALSTATEDIR, "lib", "fwupd", NULL); + dirname = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR_PKG); if (!g_file_test (dirname, G_FILE_TEST_IS_DIR)) return; filename = g_build_filename (dirname, "pending.db", NULL); diff --git a/src/meson.build b/src/meson.build index 538269975..c766f2e30 100644 --- a/src/meson.build +++ b/src/meson.build @@ -53,10 +53,7 @@ libfwupdprivate = static_library( ], c_args : [ cargs, - '-DLOCALSTATEDIR="' + localstatedir + '"', '-DSYSFSFIRMWAREDIR="/sys/firmware"', - '-DFWUPDDATADIR="' + join_paths(datadir, 'fwupd') + '"', - '-DFWUPDCONFIGDIR="' + join_paths(default_sysconfdir, 'fwupd') + '"', '-DFU_OFFLINE_DESTDIR=""', ], ) @@ -88,7 +85,6 @@ fwupdmgr = executable( ], c_args : [ cargs, - '-DLOCALSTATEDIR="' + localstatedir + '"', '-DFU_OFFLINE_DESTDIR=""', ], install : true, @@ -154,12 +150,7 @@ fwupdtool = executable( ], c_args : [ cargs, - '-DLOCALSTATEDIR="' + localstatedir + '"', - '-DPLUGINDIR="' + plugin_dir + '"', '-DSYSFSFIRMWAREDIR="/sys/firmware"', - '-DSYSCONFDIR="' + default_sysconfdir + '"', - '-DFWUPDDATADIR="' + join_paths(datadir, 'fwupd') + '"', - '-DFWUPDCONFIGDIR="' + join_paths(default_sysconfdir, 'fwupd') + '"', '-DFU_OFFLINE_DESTDIR=""', ], install : true, @@ -233,12 +224,7 @@ executable( link_with : fwupd, c_args : [ cargs, - '-DLOCALSTATEDIR="' + localstatedir + '"', - '-DPLUGINDIR="' + plugin_dir + '"', '-DSYSFSFIRMWAREDIR="/sys/firmware"', - '-DSYSCONFDIR="' + default_sysconfdir + '"', - '-DFWUPDDATADIR="' + join_paths(datadir, 'fwupd') + '"', - '-DFWUPDCONFIGDIR="' + join_paths(default_sysconfdir, 'fwupd') + '"', '-DFU_OFFLINE_DESTDIR=""', ], install : true, @@ -308,17 +294,16 @@ if get_option('tests') '-DTESTDATADIR_SRC="' + testdatadir_src + '"', '-DTESTDATADIR_DST="' + testdatadir_dst + '"', '-DTESTDATADIR="' + testdatadir_src + ':' + testdatadir_dst + '"', - '-DLOCALSTATEDIR="/tmp/fwupd-self-test/var"', '-DPLUGINBUILDDIR="' + pluginbuilddir + '"', '-DFU_OFFLINE_DESTDIR="/tmp/fwupd-self-test"', - '-DPLUGINDIR="' + testdatadir_src + '"', '-DSYSFSFIRMWAREDIR="' + testdatadir_src + '"', - '-DFWUPDDATADIR="' + testdatadir_src + '"', - '-DSYSCONFDIR="' + testdatadir_src + '"', - '-DFWUPDCONFIGDIR="' + testdatadir_src + '"', ], ) - test('fu-self-test', e, is_parallel:false) + test('fu-self-test', e, is_parallel:false, + env: ['FWUPD_DATADIR=' + testdatadir_src, + 'FWUPD_SYSCONFDIR=' + testdatadir_src, + 'FWUPD_PLUGINDIR=' + testdatadir_src, + 'FWUPD_LOCALSTATEDIR=/tmp/fwupd-self-test/var']) endif if get_option('introspection')