summaryrefslogtreecommitdiff
path: root/pcr-testing/udisks2-elogind/udisks-enable-elogind.patch
blob: 2cf61925879bb1af409eb3937fb3a5ac321cbd63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--- a/configure.ac	2017-02-14 18:38:41.000000000 -0500
+++ b/configure.ac	2017-05-09 10:38:43.187459993 -0500
@@ -170,6 +170,17 @@
 AC_SUBST(LIBSYSTEMD_LOGIN_CFLAGS)
 AC_SUBST(LIBSYSTEMD_LOGIN_LIBS)
 
+PKG_CHECK_MODULES(LIBELOGIND, [libelogind >= 219],
+                  [have_libelogind=yes],
+                  [have_libelogins=no])
+AM_CONDITIONAL(HAVE_LIBELOGIND, test x$have_libelogind = xyes)
+if test "x$have_libelogind" = "xyes"; then
+  AC_DEFINE([HAVE_LIBELOGIND], 1, [Define to 1 if libelogind is available])
+fi
+AC_SUBST(HAVE_LIBELOGIND)
+AC_SUBST(LIBELOGIND_CFLAGS)
+AC_SUBST(LIBELOGIND_LIBS)
+
 # udevdir
 AC_ARG_WITH([udevdir],
             AS_HELP_STRING([--with-udevdir=DIR], [Directory for udev]),
@@ -600,6 +611,7 @@
         udevdir:                    ${udevdir}
         systemdsystemunitdir:       ${systemdsystemunitdir}
         using libsystemd-login:     ${have_libsystemd_login}
+        using libelogind:           ${have_libelogind}
         use /media for mounting:    ${fhs_media}
         acl support:                ${have_acl}
         libblockdev_part support:   ${have_libblockdev_part}

--- a/src/Makefile.am	2017-02-14 18:38:44.000000000 -0500
+++ b/src/Makefile.am	2017-05-09 10:41:47.087452500 -0500
@@ -100,6 +100,7 @@
 	$(POLKIT_GOBJECT_1_CFLAGS)                                             \
 	$(ACL_CFLAGS)                                                          \
 	$(LIBSYSTEMD_LOGIN_CFLAGS)                                             \
+	$(LIBELOGIND_CFLAGS)                                                   \
 	$(PART_CFLAGS)                                                         \
 	$(NULL)
 
@@ -112,6 +113,7 @@
 	$(POLKIT_GOBJECT_1_LIBS)                                               \
 	$(ACL_LIBS)                                                            \
 	$(LIBSYSTEMD_LOGIN_LIBS)                                               \
+	$(LIBELOGIND_LIBS)                                                     \
 	$(PART_LDFLAGS)                                                        \
 	$(top_builddir)/udisks/libudisks2.la                                   \
 	$(NULL)

--- a/src/udisksdaemonutil.c	2017-02-14 18:38:44.000000000 -0500
+++ b/src/udisksdaemonutil.c	2017-05-09 10:43:26.650781771 -0500
@@ -45,6 +45,16 @@
 #include <systemd/sd-daemon.h>
 #include <systemd/sd-login.h>
 
+#endif
+
+#if defined(HAVE_ELOGIND) && !defined(HAVE_LIBSYSTEMD_LOGIN)
+#include <elogind/sd-login.h>
+/* re-use HAVE_LIBSYSTEMD_LOGIN to not clutter the source file */
+#define HAVE_LIBSYSTEMD_LOGIN 1
+#endif
+ 
+#if defined(HAVE_LIBSYSTEMD_LOGIN)
+
 #define LOGIND_AVAILABLE() (access("/run/systemd/seats/", F_OK) >= 0)
 #endif