Skip to content

Commit

Permalink
support elogind
Browse files Browse the repository at this point in the history
Elogind is the systemd logind standalone for non systemd linux.
  • Loading branch information
udeved authored and vojtechtrefny committed May 15, 2017
1 parent 619bf77 commit 884b630
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions configure.ac
Expand Up @@ -171,6 +171,17 @@ AC_SUBST(HAVE_LIBSYSTEMD_LOGIN)
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]),
Expand Down Expand Up @@ -601,6 +612,7 @@ echo "
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}
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.am
Expand Up @@ -100,6 +100,7 @@ libudisks_daemon_la_CFLAGS = \
$(POLKIT_GOBJECT_1_CFLAGS) \
$(ACL_CFLAGS) \
$(LIBSYSTEMD_LOGIN_CFLAGS) \
$(LIBELOGIND_CFLAGS) \
$(PART_CFLAGS) \
$(NULL)

Expand All @@ -112,6 +113,7 @@ libudisks_daemon_la_LIBADD = \
$(POLKIT_GOBJECT_1_LIBS) \
$(ACL_LIBS) \
$(LIBSYSTEMD_LOGIN_LIBS) \
$(LIBELOGIND_LIBS) \
$(PART_LDFLAGS) \
$(top_builddir)/udisks/libudisks2.la \
$(NULL)
Expand Down
8 changes: 8 additions & 0 deletions src/udisksdaemonutil.c
Expand Up @@ -44,7 +44,15 @@
#if defined(HAVE_LIBSYSTEMD_LOGIN)
#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

Expand Down

0 comments on commit 884b630

Please sign in to comment.