Dynamically read path to use for /system-update

This allows `fwupdoffline` to work in installations that don't use
`/var/lib/fwupd`.
This commit is contained in:
Mario Limonciello 2019-04-30 10:01:19 -05:00
parent acfa4ef012
commit e1b4b20978
3 changed files with 4 additions and 3 deletions

View File

@ -1,7 +1,7 @@
[Unit]
Description=Updates device firmware whilst offline
Documentation=man:fwupdmgr
ConditionPathExists=/var/lib/fwupd/pending.db
ConditionPathExists=@localstatedir@/lib/fwupd/pending.db
DefaultDependencies=false
Requires=sysinit.target dbus.socket
After=sysinit.target system-update-pre.target dbus.socket systemd-journald.socket

View File

@ -141,6 +141,7 @@ main (int argc, char *argv[])
gint vercmp;
guint cnt = 0;
g_autofree gchar *link = NULL;
g_autofree gchar *target = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR_PKG);
g_autoptr(FuHistory) history = NULL;
g_autoptr(FwupdClient) client = NULL;
g_autoptr(GError) error = NULL;
@ -157,7 +158,7 @@ main (int argc, char *argv[])
link = g_file_read_link (FU_OFFLINE_TRIGGER_FILENAME, NULL);
if (link == NULL)
return EXIT_SUCCESS;
if (g_strcmp0 (link, "/var/lib/fwupd") != 0)
if (g_strcmp0 (link, target) != 0)
return EXIT_SUCCESS;
/* do this first to avoid a loop if this tool segfaults */

View File

@ -863,9 +863,9 @@ fu_plugin_runner_offline_invalidate (GError **error)
static gboolean
fu_plugin_runner_offline_setup (GError **error)
{
const gchar *symlink_target = "/var/lib/fwupd";
gint rc;
g_autofree gchar *filename = NULL;
g_autofree gchar *symlink_target = fu_common_get_path (FU_PATH_KIND_LOCALSTATEDIR_PKG);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);