]> git.pld-linux.org Git - packages/NetworkManager.git/blame_incremental - systemd-fallback.patch
up to 1.32.6
[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.28.0/src/core/nm-session-monitor.c.orig 2020-11-17 22:24:23.000000000 +0100
13+++ NetworkManager-1.28.0/src/core/nm-session-monitor.c 2020-12-07 17:27:16.046393625 +0100
14@@ -18,6 +18,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@@ -52,13 +53,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@@ -136,7 +135,6 @@ st_sd_finalize(NMSessionMonitor *monitor
37
38 /*****************************************************************************/
39
40-#if SESSION_TRACKING_CONSOLEKIT
41 typedef struct {
42 gboolean active;
43 } CkSession;
44@@ -269,7 +267,6 @@ ck_finalize(NMSessionMonitor *monitor)
45 nm_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@@ -295,14 +292,15 @@ nm_session_monitor_session_exists(NMSess
53 g_return_val_if_fail(NM_IS_SESSION_MONITOR(self), FALSE);
54
55 #if SESSION_TRACKING_XLOGIND
56+ if (sd_booted() > 0) {
57 if (st_sd_session_exists(self, uid, active))
58 return TRUE;
59+ } else
60 #endif
61-
62-#if SESSION_TRACKING_CONSOLEKIT
63+ {
64 if (ck_session_exists(self, uid, active))
65 return TRUE;
66-#endif
67+ }
68
69 return FALSE;
70 }
71@@ -313,26 +311,28 @@ static void
72 nm_session_monitor_init(NMSessionMonitor *monitor)
73 {
74 #if SESSION_TRACKING_XLOGIND
75+ if (sd_booted() > 0) {
76 st_sd_init(monitor);
77 _LOGD("using " LOGIND_NAME " session tracking");
78+ } else
79 #endif
80
81-#if SESSION_TRACKING_CONSOLEKIT
82+ {
83 ck_init(monitor);
84 _LOGD("using ConsoleKit session tracking");
85-#endif
86+ }
87 }
88
89 static void
90 finalize(GObject *object)
91 {
92 #if SESSION_TRACKING_XLOGIND
93+ if (sd_booted() > 0)
94 st_sd_finalize(NM_SESSION_MONITOR(object));
95+ else
96 #endif
97
98-#if SESSION_TRACKING_CONSOLEKIT
99 ck_finalize(NM_SESSION_MONITOR(object));
100-#endif
101
102 G_OBJECT_CLASS(nm_session_monitor_parent_class)->finalize(object);
103 }
104--- NetworkManager-1.28.0/src/core/nm-sleep-monitor.c.orig 2020-11-17 22:24:23.000000000 +0100
105+++ NetworkManager-1.28.0/src/core/nm-sleep-monitor.c 2020-12-07 21:18:39.301181579 +0100
106@@ -11,6 +11,10 @@
107 #include <sys/stat.h>
108 #include <gio/gunixfdlist.h>
109
110+#ifdef SUSPEND_RESUME_SYSTEMD
111+# include <systemd/sd-daemon.h>
112+#endif
113+
114 #include "libnm-core-intern/nm-core-internal.h"
115 #include "NetworkManagerUtils.h"
116
117@@ -24,9 +28,9 @@
118
119 #elif defined(SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_ELOGIND)
120
121- #define SUSPEND_DBUS_NAME "org.freedesktop.login1"
122- #define SUSPEND_DBUS_PATH "/org/freedesktop/login1"
123- #define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
124+ #define SD_SUSPEND_DBUS_NAME "org.freedesktop.login1"
125+ #define SD_SUSPEND_DBUS_PATH "/org/freedesktop/login1"
126+ #define SD_SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
127 #define USE_UPOWER 0
128 #if defined(SUSPEND_RESUME_SYSTEMD)
129 #define _NMLOG_PREFIX_NAME "sleep-monitor-sd"
130@@ -36,6 +40,17 @@
131
132 #elif defined(SUSPEND_RESUME_CONSOLEKIT)
133
134+ #define USE_UPOWER 0
135+ #define _NMLOG_PREFIX_NAME "sleep-monitor-ck"
136+
137+#else
138+
139+#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
140+
141+#endif
142+
143+#if defined (SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_CONSOLEKIT)
144+
145 /* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd
146 * uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit
147 */
148@@ -43,12 +58,6 @@
149 #define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit"
150 #define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager"
151 #define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager"
152- #define USE_UPOWER 0
153- #define _NMLOG_PREFIX_NAME "sleep-monitor-ck"
154-
155-#else
156-
157- #error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
158
159 #endif
160
161@@ -329,6 +338,20 @@ nm_sleep_monitor_init(NMSleepMonitor *se
162 {
163 self->inhibit_fd = -1;
164 self->cancellable = g_cancellable_new();
165+#ifdef SUSPEND_RESUME_SYSTEMD
166+ if (sd_booted() > 0)
167+ g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM,
168+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
169+ | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
170+ NULL,
171+ SD_SUSPEND_DBUS_NAME,
172+ SD_SUSPEND_DBUS_PATH,
173+ SD_SUSPEND_DBUS_INTERFACE,
174+ self->cancellable,
175+ (GAsyncReadyCallback) on_proxy_acquired,
176+ self);
177+ else
178+#endif
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,
This page took 0.031957 seconds and 4 git commands to generate.