--- NetworkManager-1.8.0/configure.ac.orig 2017-05-27 22:30:22.001467624 +0200 +++ NetworkManager-1.8.0/configure.ac 2017-05-27 22:57:15.061449204 +0200 @@ -447,7 +447,7 @@ # output session_tracking= if test "$use_systemd_logind" = "yes" -o "$use_systemd_logind" = "auto"; then - 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])]) + 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])]) else have_systemd_logind=no fi --- NetworkManager-1.8.0/src/nm-session-monitor.c.orig 2017-05-10 10:59:08.000000000 +0200 +++ NetworkManager-1.8.0/src/nm-session-monitor.c 2017-05-27 23:07:26.988108884 +0200 @@ -33,6 +33,7 @@ #endif #if SESSION_TRACKING_SYSTEMD +#include #include #define LOGIND_NAME "systemd-logind" #endif @@ -65,13 +66,11 @@ struct _NMSessionMonitor { } sd; #endif -#if SESSION_TRACKING_CONSOLEKIT struct { GFileMonitor *monitor; GHashTable *cache; time_t timestamp; } ck; -#endif }; struct _NMSessionMonitorClass { @@ -144,7 +143,6 @@ st_sd_finalize (NMSessionMonitor *monito /*****************************************************************************/ -#if SESSION_TRACKING_CONSOLEKIT typedef struct { gboolean active; } CkSession; @@ -278,7 +276,6 @@ ck_finalize (NMSessionMonitor *monitor) g_clear_pointer (&monitor->ck.cache, g_hash_table_unref); g_clear_object (&monitor->ck.monitor); } -#endif /* SESSION_TRACKING_CONSOLEKIT */ /*****************************************************************************/ @@ -350,13 +347,16 @@ nm_session_monitor_session_exists (NMSes g_return_val_if_fail (NM_IS_SESSION_MONITOR (self), FALSE); #if SESSION_TRACKING_XLOGIND - if (st_sd_session_exists (self, uid, active)) - return TRUE; + if (sd_booted () > 0) { + if (st_sd_session_exists (self, uid, active)) + return TRUE; + } else { #endif - -#if SESSION_TRACKING_CONSOLEKIT if (ck_session_exists (self, uid, active)) return TRUE; + +#if SESSION_TRACKING_XLOGIND + } #endif return FALSE; @@ -368,26 +368,28 @@ static void nm_session_monitor_init (NMSessionMonitor *monitor) { #if SESSION_TRACKING_XLOGIND + if (sd_booted () > 0) { st_sd_init (monitor); _LOGD ("using "LOGIND_NAME" session tracking"); + } else #endif -#if SESSION_TRACKING_CONSOLEKIT + { ck_init (monitor); _LOGD ("using ConsoleKit session tracking"); -#endif + } } static void finalize (GObject *object) { #if SESSION_TRACKING_XLOGIND + if (sd_booted () > 0) st_sd_finalize (NM_SESSION_MONITOR (object)); + else #endif -#if SESSION_TRACKING_CONSOLEKIT ck_finalize (NM_SESSION_MONITOR (object)); -#endif G_OBJECT_CLASS (nm_session_monitor_parent_class)->finalize (object); } --- NetworkManager-1.8.0/src/nm-sleep-monitor.c.orig 2017-05-10 10:59:08.000000000 +0200 +++ NetworkManager-1.8.0/src/nm-sleep-monitor.c 2017-05-27 23:22:47.011431711 +0200 @@ -26,6 +26,10 @@ #include #include +#ifdef SUSPEND_RESUME_SYSTEMD +# include +#endif + #include "nm-core-internal.h" #include "NetworkManagerUtils.h" @@ -40,9 +44,9 @@ #elif defined (SUSPEND_RESUME_SYSTEMD) || defined (SUSPEND_RESUME_ELOGIND) -#define SUSPEND_DBUS_NAME "org.freedesktop.login1" -#define SUSPEND_DBUS_PATH "/org/freedesktop/login1" -#define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager" +#define SD_SUSPEND_DBUS_NAME "org.freedesktop.login1" +#define SD_SUSPEND_DBUS_PATH "/org/freedesktop/login1" +#define SD_SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager" #define USE_UPOWER 0 #if defined (SUSPEND_RESUME_SYSTEMD) #define _NMLOG_PREFIX_NAME "sleep-monitor-sd" @@ -52,6 +56,17 @@ #elif defined(SUSPEND_RESUME_CONSOLEKIT) +#define USE_UPOWER 0 +#define _NMLOG_PREFIX_NAME "sleep-monitor-ck" + +#else + +#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER + +#endif + +#if defined (SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_CONSOLEKIT) + /* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd * uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit */ @@ -59,12 +74,6 @@ #define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit" #define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager" #define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager" -#define USE_UPOWER 0 -#define _NMLOG_PREFIX_NAME "sleep-monitor-ck" - -#else - -#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER #endif @@ -347,6 +356,17 @@ nm_sleep_monitor_init (NMSleepMonitor *s { self->inhibit_fd = -1; self->cancellable = g_cancellable_new (); +#ifdef SUSPEND_RESUME_SYSTEMD + if (sd_booted () > 0) + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + SD_SUSPEND_DBUS_NAME, SD_SUSPEND_DBUS_PATH, SD_SUSPEND_DBUS_INTERFACE, + self->cancellable, + (GAsyncReadyCallback) on_proxy_acquired, self); + else +#endif g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,