]> git.pld-linux.org Git - packages/NetworkManager.git/blob - systemd-fallback.patch
- updated to 1.48.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 --- NetworkManager-1.34.0/src/core/nm-session-monitor.c.orig    2022-01-13 15:49:26.000000000 +0100
13 +++ NetworkManager-1.34.0/src/core/nm-session-monitor.c 2022-01-13 20:47:31.545775434 +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.48.0/src/core/nm-power-monitor.c.orig      2024-05-31 13:23:57.000000000 +0200
105 +++ NetworkManager-1.48.0/src/core/nm-power-monitor.c   2024-06-01 08:21:35.884268446 +0200
106 @@ -11,15 +11,19 @@
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-glib-aux/nm-dbus-aux.h"
115  #include "libnm-core-intern/nm-core-internal.h"
116  #include "NetworkManagerUtils.h"
117  
118  #if defined(SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_ELOGIND)
119  
120 -#define SUSPEND_DBUS_NAME      "org.freedesktop.login1"
121 -#define SUSPEND_DBUS_PATH      "/org/freedesktop/login1"
122 -#define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
123 +#define SD_SUSPEND_DBUS_NAME      "org.freedesktop.login1"
124 +#define SD_SUSPEND_DBUS_PATH      "/org/freedesktop/login1"
125 +#define SD_SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
126  #if defined(SUSPEND_RESUME_SYSTEMD)
127  #define _NMLOG_PREFIX_NAME "power-monitor-sd"
128  #else
129 @@ -28,6 +32,10 @@
130  
131  #elif defined(SUSPEND_RESUME_CONSOLEKIT)
132  
133 +#endif
134 +
135 +#if defined (SUSPEND_RESUME_SYSTEMD) || defined (SUSPEND_RESUME_ELOGIND) || defined(SUSPEND_RESUME_CONSOLEKIT)
136
137  /* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd
138   * uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit
139   */
140 @@ -292,6 +300,20 @@ nm_power_monitor_init(NMPowerMonitor *se
141  {
142      self->inhibit_fd  = -1;
143      self->cancellable = g_cancellable_new();
144 +#ifdef SUSPEND_RESUME_SYSTEMD
145 +  if (sd_booted() > 0)
146 +    g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM,
147 +                             G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
148 +                                 | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
149 +                             NULL,
150 +                             SD_SUSPEND_DBUS_NAME,
151 +                             SD_SUSPEND_DBUS_PATH,
152 +                             SD_SUSPEND_DBUS_INTERFACE,
153 +                             self->cancellable,
154 +                             (GAsyncReadyCallback) on_proxy_acquired,
155 +                             self);
156 +  else
157 +#endif
158      g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM,
159                               G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
160                                   | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
This page took 0.053887 seconds and 4 git commands to generate.