]>
Commit | Line | Data |
---|---|---|
ffec268f MB |
1 | --- NetworkManager-1.2.2/configure.ac.systemd 2016-05-17 22:29:49.567521947 +0200 |
2 | +++ NetworkManager-1.2.2/configure.ac 2016-05-17 23:14:31.594510933 +0200 | |
3 | @@ -435,7 +435,7 @@ AS_IF([test -z "$use_consolekit"], [use_ | |
4 | # output | |
5 | session_tracking= | |
6 | if test "$use_systemd_logind" = "yes" -o "$use_systemd_logind" = "auto"; then | |
7 | - PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd], [have_systemd_logind=yes], [PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login], [have_systemd_logind=yes], [have_systemd_logind=no])]) | |
8 | + PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd], [have_systemd_logind=yes], [PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-daemon libsystemd-login], [have_systemd_logind=yes], [have_systemd_logind=no])]) | |
9 | else | |
10 | have_systemd_logind=no | |
d7d26b92 | 11 | fi |
ffec268f MB |
12 | @@ -447,12 +447,13 @@ if test "$have_systemd_logind" = "yes"; |
13 | session_tracking="$session_tracking, systemd-logind" | |
14 | fi | |
15 | if test "$use_consolekit" = "yes"; then | |
16 | - AC_DEFINE([SESSION_TRACKING_CONSOLEKIT], 1, [Define to 1 if ConsoleKit is available]) | |
17 | - AC_DEFINE([CKDB_PATH], "/var/run/ConsoleKit/database", [Path to ConsoleKit database]) | |
18 | + AC_DEFINE([SESSION_TRACKING_CONSOLEKIT], 1, [Define to 1 if ConsoleKit is available]) | |
19 | session_tracking="$session_tracking, consolekit" | |
20 | fi | |
21 | session_tracking="$(printf '%s' "${session_tracking}" | sed 's/^, //')" | |
b761b8be | 22 | |
ffec268f | 23 | +AC_DEFINE([CKDB_PATH], "/var/run/ConsoleKit/database", [Path to ConsoleKit database]) |
b761b8be | 24 | + |
ffec268f MB |
25 | AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=upower|systemd|consolekit], [Build NetworkManager with specific suspend/resume support])) |
26 | if test "z$with_suspend_resume" = "z"; then | |
27 | PKG_CHECK_EXISTS([libsystemd >= 209], [have_systemd_inhibit=yes], | |
28 | --- NetworkManager-1.2.2/src/nm-session-monitor.c.systemd 2016-04-25 16:46:58.000000000 +0200 | |
29 | +++ NetworkManager-1.2.2/src/nm-session-monitor.c 2016-05-28 23:23:37.337347753 +0200 | |
30 | @@ -30,6 +30,7 @@ | |
31 | #include "NetworkManagerUtils.h" | |
b761b8be | 32 | |
ffec268f MB |
33 | #ifdef SESSION_TRACKING_SYSTEMD |
34 | +#include <systemd/sd-daemon.h> | |
35 | #include <systemd/sd-login.h> | |
36 | #endif | |
37 | ||
38 | @@ -52,13 +53,11 @@ struct _NMSessionMonitor { | |
39 | } sd; | |
40 | #endif | |
41 | ||
42 | -#ifdef SESSION_TRACKING_CONSOLEKIT | |
43 | struct { | |
44 | GFileMonitor *monitor; | |
45 | GHashTable *cache; | |
46 | time_t timestamp; | |
47 | } ck; | |
48 | -#endif | |
b761b8be ŁK |
49 | }; |
50 | ||
51 | struct _NMSessionMonitorClass { | |
ffec268f | 52 | @@ -138,7 +137,6 @@ st_sd_finalize (NMSessionMonitor *monito |
b761b8be | 53 | |
ffec268f | 54 | /********************************************************************/ |
b761b8be | 55 | |
ffec268f MB |
56 | -#ifdef SESSION_TRACKING_CONSOLEKIT |
57 | typedef struct { | |
58 | gboolean active; | |
59 | } CkSession; | |
60 | @@ -272,7 +270,6 @@ ck_finalize (NMSessionMonitor *monitor) | |
61 | g_clear_pointer (&monitor->ck.cache, g_hash_table_unref); | |
62 | g_clear_object (&monitor->ck.monitor); | |
b761b8be | 63 | } |
ffec268f | 64 | -#endif /* SESSION_TRACKING_CONSOLEKIT */ |
b761b8be | 65 | |
ffec268f | 66 | /********************************************************************/ |
b761b8be | 67 | |
ffec268f MB |
68 | @@ -383,13 +380,16 @@ nm_session_monitor_session_exists (NMSes |
69 | g_return_val_if_fail (NM_IS_SESSION_MONITOR (self), FALSE); | |
8f9f9f5f | 70 | |
ffec268f MB |
71 | #ifdef SESSION_TRACKING_SYSTEMD |
72 | - if (st_sd_session_exists (self, uid, active)) | |
73 | - return TRUE; | |
8f9f9f5f | 74 | + if (sd_booted () > 0) { |
ffec268f MB |
75 | + if (st_sd_session_exists (self, uid, active)) |
76 | + return TRUE; | |
b761b8be | 77 | + } else { |
ffec268f MB |
78 | #endif |
79 | - | |
80 | -#ifdef SESSION_TRACKING_CONSOLEKIT | |
81 | if (ck_session_exists (self, uid, active)) | |
82 | return TRUE; | |
b761b8be | 83 | + |
ffec268f | 84 | +#ifdef SESSION_TRACKING_SYSTEMD |
b761b8be | 85 | + } |
ffec268f | 86 | #endif |
b761b8be | 87 | |
ffec268f MB |
88 | return FALSE; |
89 | @@ -401,11 +401,15 @@ static void | |
90 | nm_session_monitor_init (NMSessionMonitor *monitor) | |
b761b8be | 91 | { |
ffec268f MB |
92 | #ifdef SESSION_TRACKING_SYSTEMD |
93 | - st_sd_init (monitor); | |
8f9f9f5f | 94 | + if (sd_booted () > 0) { |
ffec268f | 95 | + st_sd_init (monitor); |
b761b8be | 96 | + } else { |
ffec268f | 97 | #endif |
8f9f9f5f | 98 | |
ffec268f MB |
99 | -#ifdef SESSION_TRACKING_CONSOLEKIT |
100 | ck_init (monitor); | |
101 | + | |
102 | +#ifdef SESSION_TRACKING_SYSTEMD | |
b761b8be | 103 | + } |
ffec268f | 104 | #endif |
b761b8be ŁK |
105 | } |
106 | ||
ffec268f MB |
107 | @@ -413,11 +417,15 @@ static void |
108 | nm_session_monitor_finalize (GObject *object) | |
b761b8be | 109 | { |
ffec268f MB |
110 | #ifdef SESSION_TRACKING_SYSTEMD |
111 | - st_sd_finalize (NM_SESSION_MONITOR (object)); | |
8f9f9f5f | 112 | + if (sd_booted () > 0) { |
ffec268f | 113 | + st_sd_finalize (NM_SESSION_MONITOR (object)); |
b761b8be | 114 | + } else { |
ffec268f | 115 | #endif |
b761b8be | 116 | |
ffec268f MB |
117 | -#ifdef SESSION_TRACKING_CONSOLEKIT |
118 | ck_finalize (NM_SESSION_MONITOR (object)); | |
b761b8be | 119 | + |
ffec268f MB |
120 | +#ifdef SESSION_TRACKING_SYSTEMD |
121 | + } | |
122 | #endif | |
d7d26b92 | 123 | |
ffec268f MB |
124 | if (G_OBJECT_CLASS (nm_session_monitor_parent_class)->finalize != NULL) |
125 | --- NetworkManager-1.2.2/src/nm-sleep-monitor-systemd.c.systemd 2016-05-17 23:14:52.878336245 +0200 | |
126 | +++ NetworkManager-1.2.2/src/nm-sleep-monitor-systemd.c 2016-05-17 23:19:33.924628324 +0200 | |
127 | @@ -24,6 +24,10 @@ | |
128 | #include <sys/stat.h> | |
129 | #include <gio/gunixfdlist.h> | |
130 | ||
131 | +#ifdef SUSPEND_RESUME_SYSTEMD | |
132 | +# include <systemd/sd-daemon.h> | |
133 | +#endif | |
134 | + | |
135 | #include "nm-core-internal.h" | |
136 | #include "NetworkManagerUtils.h" | |
137 | ||
138 | @@ -33,23 +37,18 @@ | |
139 | #error either define SUSPEND_RESUME_SYSTEMD or SUSPEND_RESUME_CONSOLEKIT | |
140 | #endif | |
141 | ||
142 | -#ifdef SUSPEND_RESUME_SYSTEMD | |
143 | - | |
144 | #define SUSPEND_DBUS_NAME "org.freedesktop.login1" | |
145 | #define SUSPEND_DBUS_PATH "/org/freedesktop/login1" | |
146 | #define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager" | |
147 | ||
148 | -#else | |
149 | ||
150 | /* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd | |
151 | * uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit | |
152 | */ | |
153 | ||
154 | -#define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit" | |
155 | -#define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager" | |
156 | -#define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager" | |
157 | - | |
158 | -#endif | |
159 | +#define CK_SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit" | |
160 | +#define CK_SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager" | |
161 | +#define CK_SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager" | |
5602b216 JB |
162 | |
163 | struct _NMSleepMonitor { | |
164 | GObject parent_instance; | |
ffec268f | 165 | @@ -204,13 +203,28 @@ static void |
d7d26b92 MB |
166 | nm_sleep_monitor_init (NMSleepMonitor *self) |
167 | { | |
ffec268f | 168 | self->inhibit_fd = -1; |
8f9f9f5f MB |
169 | - g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, |
170 | - G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | | |
171 | - G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, | |
172 | - NULL, | |
ffec268f | 173 | - SUSPEND_DBUS_NAME, SUSPEND_DBUS_PATH, SUSPEND_DBUS_INTERFACE, |
8f9f9f5f MB |
174 | - NULL, |
175 | - (GAsyncReadyCallback) on_proxy_acquired, self); | |
ffec268f MB |
176 | + |
177 | +#ifdef SUSPEND_RESUME_SYSTEMD | |
d7d26b92 | 178 | + if (sd_booted () > 0) { |
8f9f9f5f MB |
179 | + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, |
180 | + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | | |
181 | + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, | |
182 | + NULL, | |
ffec268f | 183 | + SUSPEND_DBUS_NAME, SUSPEND_DBUS_PATH, SUSPEND_DBUS_INTERFACE, |
8f9f9f5f MB |
184 | + NULL, |
185 | + (GAsyncReadyCallback) on_proxy_acquired, self); | |
d7d26b92 | 186 | + } else { |
ffec268f MB |
187 | +#endif |
188 | + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, | |
189 | + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | | |
190 | + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, | |
191 | + NULL, | |
192 | + CK_SUSPEND_DBUS_NAME, CK_SUSPEND_DBUS_PATH, CK_SUSPEND_DBUS_INTERFACE, | |
193 | + NULL, | |
194 | + (GAsyncReadyCallback) on_proxy_acquired, self); | |
195 | +#ifdef SUSPEND_RESUME_SYSTEMD | |
d7d26b92 | 196 | + } |
ffec268f | 197 | +#endif |
d7d26b92 MB |
198 | } |
199 | ||
200 | static void |