]> git.pld-linux.org Git - packages/NetworkManager.git/blame_incremental - systemd-fallback.patch
up to 1.22.10
[packages/NetworkManager.git] / systemd-fallback.patch
... / ...
CommitLineData
1--- NetworkManager-1.8.0/configure.ac.orig 2017-05-27 22:30:22.001467624 +0200
2+++ NetworkManager-1.8.0/configure.ac 2017-05-27 22:57:15.061449204 +0200
3@@ -447,7 +447,7 @@
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
11 fi
12--- NetworkManager-1.8.0/src/nm-session-monitor.c.orig 2017-05-10 10:59:08.000000000 +0200
13+++ NetworkManager-1.8.0/src/nm-session-monitor.c 2017-05-27 23:07:26.988108884 +0200
14@@ -33,6 +33,7 @@
15 #endif
16
17 #if SESSION_TRACKING_SYSTEMD
18+#include <systemd/sd-daemon.h>
19 #include <systemd/sd-login.h>
20 #define LOGIND_NAME "systemd-logind"
21 #endif
22@@ -65,13 +66,11 @@ struct _NMSessionMonitor {
23 } sd;
24 #endif
25
26-#if SESSION_TRACKING_CONSOLEKIT
27 struct {
28 GFileMonitor *monitor;
29 GHashTable *cache;
30 time_t timestamp;
31 } ck;
32-#endif
33 };
34
35 struct _NMSessionMonitorClass {
36@@ -144,7 +143,6 @@ st_sd_finalize (NMSessionMonitor *monito
37
38 /*****************************************************************************/
39
40-#if SESSION_TRACKING_CONSOLEKIT
41 typedef struct {
42 gboolean active;
43 } CkSession;
44@@ -278,7 +276,6 @@ ck_finalize (NMSessionMonitor *monitor)
45 g_clear_pointer (&monitor->ck.cache, g_hash_table_unref);
46 g_clear_object (&monitor->ck.monitor);
47 }
48-#endif /* SESSION_TRACKING_CONSOLEKIT */
49
50 /*****************************************************************************/
51
52@@ -350,13 +347,16 @@ nm_session_monitor_session_exists (NMSes
53 g_return_val_if_fail (NM_IS_SESSION_MONITOR (self), FALSE);
54
55 #if SESSION_TRACKING_XLOGIND
56- if (st_sd_session_exists (self, uid, active))
57- return TRUE;
58+ if (sd_booted () > 0) {
59+ if (st_sd_session_exists (self, uid, active))
60+ return TRUE;
61+ } else {
62 #endif
63-
64-#if SESSION_TRACKING_CONSOLEKIT
65 if (ck_session_exists (self, uid, active))
66 return TRUE;
67+
68+#if SESSION_TRACKING_XLOGIND
69+ }
70 #endif
71
72 return FALSE;
73@@ -368,26 +368,28 @@ static void
74 nm_session_monitor_init (NMSessionMonitor *monitor)
75 {
76 #if SESSION_TRACKING_XLOGIND
77+ if (sd_booted () > 0) {
78 st_sd_init (monitor);
79 _LOGD ("using "LOGIND_NAME" session tracking");
80+ } else
81 #endif
82
83-#if SESSION_TRACKING_CONSOLEKIT
84+ {
85 ck_init (monitor);
86 _LOGD ("using ConsoleKit session tracking");
87-#endif
88+ }
89 }
90
91 static void
92 finalize (GObject *object)
93 {
94 #if SESSION_TRACKING_XLOGIND
95+ if (sd_booted () > 0)
96 st_sd_finalize (NM_SESSION_MONITOR (object));
97+ else
98 #endif
99
100-#if SESSION_TRACKING_CONSOLEKIT
101 ck_finalize (NM_SESSION_MONITOR (object));
102-#endif
103
104 G_OBJECT_CLASS (nm_session_monitor_parent_class)->finalize (object);
105 }
106--- NetworkManager-1.8.0/src/nm-sleep-monitor.c.orig 2017-05-10 10:59:08.000000000 +0200
107+++ NetworkManager-1.8.0/src/nm-sleep-monitor.c 2017-05-27 23:22:47.011431711 +0200
108@@ -26,6 +26,10 @@
109 #include <sys/stat.h>
110 #include <gio/gunixfdlist.h>
111
112+#ifdef SUSPEND_RESUME_SYSTEMD
113+# include <systemd/sd-daemon.h>
114+#endif
115+
116 #include "nm-core-internal.h"
117 #include "NetworkManagerUtils.h"
118
119@@ -40,9 +44,9 @@
120
121 #elif defined (SUSPEND_RESUME_SYSTEMD) || defined (SUSPEND_RESUME_ELOGIND)
122
123-#define SUSPEND_DBUS_NAME "org.freedesktop.login1"
124-#define SUSPEND_DBUS_PATH "/org/freedesktop/login1"
125-#define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
126+#define SD_SUSPEND_DBUS_NAME "org.freedesktop.login1"
127+#define SD_SUSPEND_DBUS_PATH "/org/freedesktop/login1"
128+#define SD_SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
129 #define USE_UPOWER 0
130 #if defined (SUSPEND_RESUME_SYSTEMD)
131 #define _NMLOG_PREFIX_NAME "sleep-monitor-sd"
132@@ -52,6 +56,17 @@
133
134 #elif defined(SUSPEND_RESUME_CONSOLEKIT)
135
136+#define USE_UPOWER 0
137+#define _NMLOG_PREFIX_NAME "sleep-monitor-ck"
138+
139+#else
140+
141+#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
142+
143+#endif
144+
145+#if defined (SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_CONSOLEKIT)
146+
147 /* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd
148 * uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit
149 */
150@@ -59,12 +74,6 @@
151 #define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit"
152 #define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager"
153 #define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager"
154-#define USE_UPOWER 0
155-#define _NMLOG_PREFIX_NAME "sleep-monitor-ck"
156-
157-#else
158-
159-#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
160
161 #endif
162
163@@ -347,6 +356,17 @@ nm_sleep_monitor_init (NMSleepMonitor *s
164 {
165 self->inhibit_fd = -1;
166 self->cancellable = g_cancellable_new ();
167+#ifdef SUSPEND_RESUME_SYSTEMD
168+ if (sd_booted () > 0)
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,
173+ SD_SUSPEND_DBUS_NAME, SD_SUSPEND_DBUS_PATH, SD_SUSPEND_DBUS_INTERFACE,
174+ self->cancellable,
175+ (GAsyncReadyCallback) on_proxy_acquired, self);
176+ else
177+#endif
178 g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
179 G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START |
180 G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
This page took 0.024886 seconds and 4 git commands to generate.