diff --git a/libfwupdplugin/fu-common.c b/libfwupdplugin/fu-common.c index e3efa3b4d..f349ad7d3 100644 --- a/libfwupdplugin/fu-common.c +++ b/libfwupdplugin/fu-common.c @@ -1281,6 +1281,13 @@ fu_common_get_path(FuPathKind path_kind) return g_build_filename(tmp, NULL); basedir = fu_common_get_path(FU_PATH_KIND_LOCALSTATEDIR_PKG); return g_build_filename(basedir, "quirks.d", NULL); + /* /var/lib/fwupd/metadata */ + case FU_PATH_KIND_LOCALSTATEDIR_METADATA: + tmp = g_getenv("FWUPD_LOCALSTATEDIR_METADATA"); + if (tmp != NULL) + return g_build_filename(tmp, NULL); + basedir = fu_common_get_path(FU_PATH_KIND_LOCALSTATEDIR_PKG); + return g_build_filename(basedir, "metadata", NULL); /* /var/cache/fwupd */ case FU_PATH_KIND_CACHEDIR_PKG: tmp = g_getenv("CACHE_DIRECTORY"); diff --git a/libfwupdplugin/fu-common.h b/libfwupdplugin/fu-common.h index 81909f8a4..101d3fea9 100644 --- a/libfwupdplugin/fu-common.h +++ b/libfwupdplugin/fu-common.h @@ -78,6 +78,8 @@ typedef guint FuEndianType; * @FU_PATH_KIND_DATADIR_QUIRKS: The quirks data store (IE /usr/share/fwupd/quirks.d) * @FU_PATH_KIND_LOCALSTATEDIR_QUIRKS: The local state directory for quirks (IE * /var/lib/fwupd/quirks.d) + * @FU_PATH_KIND_LOCALSTATEDIR_METADATA: The local state directory for metadata (IE + * /var/lib/fwupd/metadata) * * Path types to use when dynamically determining a path at runtime **/ @@ -103,6 +105,7 @@ typedef enum { FU_PATH_KIND_FIRMWARE_SEARCH, FU_PATH_KIND_DATADIR_QUIRKS, FU_PATH_KIND_LOCALSTATEDIR_QUIRKS, + FU_PATH_KIND_LOCALSTATEDIR_METADATA, /*< private >*/ FU_PATH_KIND_LAST } FuPathKind; diff --git a/src/fu-engine.c b/src/fu-engine.c index b86ab6f53..ca9da7cf7 100644 --- a/src/fu-engine.c +++ b/src/fu-engine.c @@ -6594,6 +6594,7 @@ static gboolean fu_engine_ensure_paths_exist(GError **error) { FuPathKind path_kinds[] = {FU_PATH_KIND_LOCALSTATEDIR_QUIRKS, + FU_PATH_KIND_LOCALSTATEDIR_METADATA, FU_PATH_KIND_CACHEDIR_PKG, FU_PATH_KIND_LAST}; for (guint i = 0; path_kinds[i] != FU_PATH_KIND_LAST; i++) { diff --git a/src/fu-remote-list.c b/src/fu-remote-list.c index fb22b2415..2efcecece 100644 --- a/src/fu-remote-list.c +++ b/src/fu-remote-list.c @@ -169,7 +169,6 @@ fu_remote_list_add_for_path(FuRemoteList *self, const gchar *path, GError **erro while ((tmp = g_dir_read_name(dir)) != NULL) { g_autofree gchar *filename = g_build_filename(path_remotes, tmp, NULL); g_autoptr(FwupdRemote) remote = fwupd_remote_new(); - g_autofree gchar *localstatedir = NULL; g_autofree gchar *remotesdir = NULL; /* skip invalid files */ @@ -179,8 +178,7 @@ fu_remote_list_add_for_path(FuRemoteList *self, const gchar *path, GError **erro } /* set directory to store data */ - localstatedir = fu_common_get_path(FU_PATH_KIND_LOCALSTATEDIR_PKG); - remotesdir = g_build_filename(localstatedir, "remotes.d", NULL); + remotesdir = fu_common_get_path(FU_PATH_KIND_LOCALSTATEDIR_METADATA); fwupd_remote_set_remotes_dir(remote, remotesdir); /* load from keyfile */