1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
From de2b70bc7d0ca092659a0b5a4719e41444660b14 Mon Sep 17 00:00:00 2001
From: Marcin Sucharski <marcin.sucharski@protonmail.com>
Date: Sun, 24 Feb 2019 00:28:10 +0100
Subject: [PATCH] Add elogind support
---
data/meson.build | 27 ++++++++++++++++-----------
meson.build | 6 ++++++
meson_options.txt | 1 +
src/fu-util-common.c | 4 ++--
4 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/data/meson.build b/data/meson.build
index 2d7fb632a..f9377c803 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -63,17 +63,6 @@ if get_option('systemd')
endif
con2.set('dynamic_options', '\n'.join(dynamic_options))
- # replace @libexecdir@
- configure_file(
- input : 'org.freedesktop.fwupd.service.in',
- output : 'org.freedesktop.fwupd.service',
- configuration : con2,
- install: true,
- install_dir: join_paths(datadir,
- 'dbus-1',
- 'system-services'),
- )
-
# replace @bindir@
configure_file(
input : 'fwupd-offline-update.service.in',
@@ -92,3 +81,19 @@ if get_option('systemd')
install_dir: systemdunitdir,
)
endif
+
+if get_option('systemd') or get_option('elogind')
+ con2 = configuration_data()
+ con2.set('libexecdir', libexecdir)
+
+ # replace @libexecdir@
+ configure_file(
+ input : 'org.freedesktop.fwupd.service.in',
+ output : 'org.freedesktop.fwupd.service',
+ configuration : con2,
+ install: true,
+ install_dir: join_paths(datadir,
+ 'dbus-1',
+ 'system-services'),
+ )
+endif
diff --git a/meson.build b/meson.build
index f4f0af192..d645db2ae 100644
--- a/meson.build
+++ b/meson.build
@@ -270,6 +270,12 @@ endif
if get_option('systemd')
systemd = dependency('systemd', version : '>= 211')
conf.set('HAVE_SYSTEMD' , '1')
+ conf.set('HAVE_LOGIND' , '1')
+endif
+
+if get_option('elogind')
+ elogind = dependency('libelogind', version : '>= 211')
+ conf.set('HAVE_LOGIND' , '1')
endif
if get_option('consolekit')
diff --git a/meson_options.txt b/meson_options.txt
index c9b7ba675..6b0902225 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,6 +18,7 @@ option('plugin_uefi', type : 'boolean', value : true, description : 'enable UEFI
option('plugin_nvme', type : 'boolean', value : true, description : 'enable NVMe support')
option('systemd', type : 'boolean', value : true, description : 'enable systemd support')
option('systemdunitdir', type: 'string', value: '', description: 'Directory for systemd units')
+option('elogind', type : 'boolean', value : false, description : 'enable elogind support')
option('tests', type : 'boolean', value : true, description : 'enable tests')
option('udevdir', type: 'string', value: '', description: 'Directory for udev rules')
option('efi-cc', type : 'string', value : 'gcc', description : 'the compiler to use for EFI modules')
diff --git a/src/fu-util-common.c b/src/fu-util-common.c
index cdeb2ff6b..667c142fb 100644
--- a/src/fu-util-common.c
+++ b/src/fu-util-common.c
@@ -184,7 +184,7 @@ fu_util_update_shutdown (GError **error)
if (connection == NULL)
return FALSE;
-#ifdef HAVE_SYSTEMD
+#ifdef HAVE_LOGIND
/* shutdown using logind */
val = g_dbus_connection_call_sync (connection,
"org.freedesktop.login1",
@@ -229,7 +229,7 @@ fu_util_update_reboot (GError **error)
if (connection == NULL)
return FALSE;
-#ifdef HAVE_SYSTEMD
+#ifdef HAVE_LOGIND
/* reboot using logind */
val = g_dbus_connection_call_sync (connection,
"org.freedesktop.login1",
|