mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-11 16:27:59 +00:00
Add support for relocating various runtime paths
This allows a snap package to be easily built. With much help from Mario Limonciello <mario.limonciello@dell.com>, many thanks.
This commit is contained in:
parent
89239b35b6
commit
4be17d1364
@ -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())
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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),
|
||||
|
@ -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/<triplet>/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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <gio/gio.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#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,
|
||||
|
@ -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);
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <sqlite3.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#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))
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 ();
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <fnmatch.h>
|
||||
#include <string.h>
|
||||
|
||||
#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 */
|
||||
|
@ -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);
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user