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