]>
Commit | Line | Data |
---|---|---|
99089a17 JB |
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 @@ | |
ffec268f MB |
4 | # output |
5 | session_tracking= | |
6 | if test "$use_systemd_logind" = "yes" -o "$use_systemd_logind" = "auto"; then | |
c26388c7 JP |
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])]) | |
ffec268f | 9 | else |
c26388c7 | 10 | have_systemd_logind=no |
d7d26b92 | 11 | fi |
99089a17 JB |
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 | |
b761b8be | 16 | |
b95ce425 | 17 | #if SESSION_TRACKING_SYSTEMD |
ffec268f MB |
18 | +#include <systemd/sd-daemon.h> |
19 | #include <systemd/sd-login.h> | |
99089a17 | 20 | #define LOGIND_NAME "systemd-logind" |
ffec268f | 21 | #endif |
99089a17 | 22 | @@ -65,13 +66,11 @@ struct _NMSessionMonitor { |
ffec268f MB |
23 | } sd; |
24 | #endif | |
25 | ||
b95ce425 | 26 | -#if SESSION_TRACKING_CONSOLEKIT |
ffec268f MB |
27 | struct { |
28 | GFileMonitor *monitor; | |
29 | GHashTable *cache; | |
30 | time_t timestamp; | |
31 | } ck; | |
32 | -#endif | |
b761b8be ŁK |
33 | }; |
34 | ||
35 | struct _NMSessionMonitorClass { | |
99089a17 | 36 | @@ -144,7 +143,6 @@ st_sd_finalize (NMSessionMonitor *monito |
b761b8be | 37 | |
38118a47 | 38 | /*****************************************************************************/ |
b761b8be | 39 | |
b95ce425 | 40 | -#if SESSION_TRACKING_CONSOLEKIT |
ffec268f MB |
41 | typedef struct { |
42 | gboolean active; | |
43 | } CkSession; | |
99089a17 | 44 | @@ -278,7 +276,6 @@ ck_finalize (NMSessionMonitor *monitor) |
ffec268f MB |
45 | g_clear_pointer (&monitor->ck.cache, g_hash_table_unref); |
46 | g_clear_object (&monitor->ck.monitor); | |
b761b8be | 47 | } |
ffec268f | 48 | -#endif /* SESSION_TRACKING_CONSOLEKIT */ |
b761b8be | 49 | |
38118a47 | 50 | /*****************************************************************************/ |
b761b8be | 51 | |
99089a17 | 52 | @@ -350,13 +347,16 @@ nm_session_monitor_session_exists (NMSes |
ffec268f | 53 | g_return_val_if_fail (NM_IS_SESSION_MONITOR (self), FALSE); |
8f9f9f5f | 54 | |
b95ce425 | 55 | #if SESSION_TRACKING_XLOGIND |
ffec268f MB |
56 | - if (st_sd_session_exists (self, uid, active)) |
57 | - return TRUE; | |
8f9f9f5f | 58 | + if (sd_booted () > 0) { |
ffec268f MB |
59 | + if (st_sd_session_exists (self, uid, active)) |
60 | + return TRUE; | |
b761b8be | 61 | + } else { |
ffec268f MB |
62 | #endif |
63 | - | |
b95ce425 | 64 | -#if SESSION_TRACKING_CONSOLEKIT |
ffec268f MB |
65 | if (ck_session_exists (self, uid, active)) |
66 | return TRUE; | |
b761b8be | 67 | + |
b95ce425 | 68 | +#if SESSION_TRACKING_XLOGIND |
b761b8be | 69 | + } |
ffec268f | 70 | #endif |
b761b8be | 71 | |
ffec268f | 72 | return FALSE; |
99089a17 | 73 | @@ -368,26 +368,28 @@ static void |
ffec268f | 74 | nm_session_monitor_init (NMSessionMonitor *monitor) |
b761b8be | 75 | { |
b95ce425 | 76 | #if SESSION_TRACKING_XLOGIND |
8f9f9f5f | 77 | + if (sd_booted () > 0) { |
f6935939 | 78 | st_sd_init (monitor); |
99089a17 | 79 | _LOGD ("using "LOGIND_NAME" session tracking"); |
f6935939 | 80 | + } else |
ffec268f | 81 | #endif |
8f9f9f5f | 82 | |
b95ce425 | 83 | -#if SESSION_TRACKING_CONSOLEKIT |
f6935939 | 84 | + { |
ffec268f | 85 | ck_init (monitor); |
f6935939 JB |
86 | _LOGD ("using ConsoleKit session tracking"); |
87 | -#endif | |
b761b8be ŁK |
88 | + } |
89 | } | |
90 | ||
f6935939 | 91 | static void |
38118a47 | 92 | finalize (GObject *object) |
b761b8be | 93 | { |
b95ce425 | 94 | #if SESSION_TRACKING_XLOGIND |
38118a47 JB |
95 | + if (sd_booted () > 0) |
96 | st_sd_finalize (NM_SESSION_MONITOR (object)); | |
97 | + else | |
ffec268f | 98 | #endif |
99089a17 | 99 | |
b95ce425 | 100 | -#if SESSION_TRACKING_CONSOLEKIT |
ffec268f | 101 | ck_finalize (NM_SESSION_MONITOR (object)); |
38118a47 | 102 | -#endif |
d7d26b92 | 103 | |
38118a47 JB |
104 | G_OBJECT_CLASS (nm_session_monitor_parent_class)->finalize (object); |
105 | } | |
99089a17 JB |
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 | |
13a8788c | 108 | @@ -26,6 +26,10 @@ |
ffec268f MB |
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 | ||
99089a17 | 119 | @@ -40,9 +44,9 @@ |
ffec268f | 120 | |
99089a17 | 121 | #elif defined (SUSPEND_RESUME_SYSTEMD) || defined (SUSPEND_RESUME_ELOGIND) |
ffec268f | 122 | |
13a8788c JB |
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 | |
99089a17 | 130 | #if defined (SUSPEND_RESUME_SYSTEMD) |
13a8788c | 131 | #define _NMLOG_PREFIX_NAME "sleep-monitor-sd" |
99089a17 | 132 | @@ -52,6 +56,17 @@ |
13a8788c JB |
133 | |
134 | #elif defined(SUSPEND_RESUME_CONSOLEKIT) | |
99089a17 | 135 | |
13a8788c JB |
136 | +#define USE_UPOWER 0 |
137 | +#define _NMLOG_PREFIX_NAME "sleep-monitor-ck" | |
138 | + | |
139 | +#else | |
140 | + | |
99089a17 | 141 | +#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER |
13a8788c JB |
142 | + |
143 | +#endif | |
144 | + | |
145 | +#if defined (SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_CONSOLEKIT) | |
99089a17 | 146 | + |
ffec268f MB |
147 | /* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd |
148 | * uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit | |
99089a17 JB |
149 | */ |
150 | @@ -59,12 +74,6 @@ | |
13a8788c JB |
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" | |
ffec268f | 156 | - |
13a8788c JB |
157 | -#else |
158 | - | |
99089a17 | 159 | -#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER |
13a8788c JB |
160 | |
161 | #endif | |
162 | ||
99089a17 | 163 | @@ -347,6 +356,17 @@ nm_sleep_monitor_init (NMSleepMonitor *s |
d7d26b92 | 164 | { |
ffec268f | 165 | self->inhibit_fd = -1; |
13a8788c | 166 | self->cancellable = g_cancellable_new (); |
ffec268f | 167 | +#ifdef SUSPEND_RESUME_SYSTEMD |
13a8788c | 168 | + if (sd_booted () > 0) |
ffec268f 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, | |
13a8788c JB |
173 | + SD_SUSPEND_DBUS_NAME, SD_SUSPEND_DBUS_PATH, SD_SUSPEND_DBUS_INTERFACE, |
174 | + self->cancellable, | |
ffec268f | 175 | + (GAsyncReadyCallback) on_proxy_acquired, self); |
13a8788c | 176 | + else |
ffec268f | 177 | +#endif |
13a8788c JB |
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, |