trivial: Move the metadata directory

This moves the cached metadata location from /var/lib/fwupd/remotes.d
to /var/lib/fwupd/metadata

The former was a bad name as it wasn't a list of remotes, and .d is the
suffix for directories the user can install files into, rather than for
binary content managed entirely by the daemon.
This commit is contained in:
Richard Hughes 2021-10-08 14:28:49 +01:00
parent 20a1b12afe
commit 1669f532be
4 changed files with 12 additions and 3 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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++) {

View File

@ -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 */