summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2017-01-14 13:11:02 +0100
committerAndreas Sturmlechner <asturm@gentoo.org>2017-01-14 20:25:00 +0100
commitd0d899ac76be5a1b3be099faaefdfef273718930 (patch)
treeb0abd2af3482cb247c96e7b1018f246c6a183580
parentprofiles: Update solid-runtime comment in arm package.use.mask (diff)
downloadgentoo-d0d899ac.tar.gz
gentoo-d0d899ac.tar.bz2
gentoo-d0d899ac.zip
sys-auth/elogind: New package
systemd's logind as a standalone package. Initial ebuild by Alexey Shvetsov, improvements by Sven Eden, kensington and me. Fix build with gperf-3.1 by backporting a systemd patch. Gentoo-bug: 599474 Package-Manager: portage-2.3.0
-rw-r--r--sys-auth/elogind/Manifest1
-rw-r--r--sys-auth/elogind/elogind-219.12-r4.ebuild96
-rw-r--r--sys-auth/elogind/files/elogind-219.12-gperf.patch109
-rw-r--r--sys-auth/elogind/files/elogind-219.12-login1-perms.patch129
-rw-r--r--sys-auth/elogind/files/elogind-219.12-session.patch45
-rw-r--r--sys-auth/elogind/files/elogind-docs.patch19
-rw-r--r--sys-auth/elogind/files/elogind-lrt.patch10
-rw-r--r--sys-auth/elogind/files/elogind.conf7
-rw-r--r--sys-auth/elogind/files/elogind.init32
-rw-r--r--sys-auth/elogind/metadata.xml10
10 files changed, 458 insertions, 0 deletions
diff --git a/sys-auth/elogind/Manifest b/sys-auth/elogind/Manifest
new file mode 100644
index 000000000000..77184ebc69a5
--- /dev/null
+++ b/sys-auth/elogind/Manifest
@@ -0,0 +1 @@
+DIST elogind-219.12.tar.gz 815956 SHA256 80241494f5c794e8501ccf570ac805275ace368755780f38a18762fd06243f95 SHA512 59b18d43d761d6f4daa25b7a7dfb51b435d8b1ae67515474392f428046b3baa17412b54730745757f0c417edaf280b51bc3f1ad3570ba6d4b0410bfd1a5fdf20 WHIRLPOOL e977d772671e13ce940ca1da6dce133b70527c483e09b63ceccba133b018cdb5eca8b83f5e7dc0e3791aef1efae64cbd15c2c0f02cf50ae00dd26786a7807402
diff --git a/sys-auth/elogind/elogind-219.12-r4.ebuild b/sys-auth/elogind/elogind-219.12-r4.ebuild
new file mode 100644
index 000000000000..6911b9093940
--- /dev/null
+++ b/sys-auth/elogind/elogind-219.12-r4.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools linux-info pam udev
+
+DESCRIPTION="The systemd project's logind, extracted to a standalone package"
+HOMEPAGE="https://github.com/wingo/elogind"
+SRC_URI="https://github.com/wingo/elogind/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="CC0-1.0 LGPL-2.1+ public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="acl apparmor pam policykit +seccomp selinux"
+
+COMMON_DEPEND="
+ sys-libs/libcap
+ sys-apps/util-linux
+ virtual/libudev:=
+ acl? ( sys-apps/acl )
+ apparmor? ( sys-libs/libapparmor )
+ pam? ( virtual/pam )
+ seccomp? ( sys-libs/libseccomp )
+ selinux? ( sys-libs/libselinux )
+"
+RDEPEND="${COMMON_DEPEND}
+ sys-apps/dbus
+ policykit? ( sys-auth/polkit )
+ !sys-auth/systemd
+"
+DEPEND="${COMMON_DEPEND}
+ dev-util/gperf
+ dev-util/intltool
+ sys-devel/libtool
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-docs.patch"
+ "${FILESDIR}/${PN}-lrt.patch"
+ "${FILESDIR}/${P}-session.patch"
+ "${FILESDIR}/${P}-login1-perms.patch"
+ "${FILESDIR}/${P}-gperf.patch"
+)
+
+pkg_setup() {
+ local CONFIG_CHECK="~CGROUPS ~EPOLL ~INOTIFY_USER ~SECURITY_SMACK
+ ~SIGNALFD ~TIMERFD"
+
+ use seccomp && CONFIG_CHECK+=" ~SECCOMP"
+
+ if use kernel_linux; then
+ linux-info_pkg_setup
+ fi
+}
+
+src_prepare() {
+ default
+ eautoreconf # Makefile.am patched by "${FILESDIR}/${PN}-{docs,lrt}.patch"
+}
+
+src_configure() {
+ econf \
+ --with-pamlibdir=$(getpam_mod_dir) \
+ --with-udevrulesdir="$(get_udevdir)"/rules.d \
+ --libdir="${EPREFIX}"/$(get_libdir) \
+ --enable-smack \
+ $(use_enable acl) \
+ $(use_enable apparmor) \
+ $(use_enable pam) \
+ $(use_enable seccomp) \
+ $(use_enable selinux)
+}
+
+src_install() {
+ default
+ find "${D}" -name '*.la' -delete || die
+
+ # Build system ignores --with-rootlibdir and puts pkgconfig below
+ # /$(libdir) - Move it to /usr/$(libdir)/pkgconfig
+ mkdir -p "${ED%/}"/usr/$(get_libdir) || die
+ mv "${ED%/}"/$(get_libdir)/pkgconfig "${ED%/}"/usr/$(get_libdir)/ || die
+
+ newinitd "${FILESDIR}"/${PN}.init ${PN}
+ newconfd "${FILESDIR}"/${PN}.conf ${PN}
+}
+
+pkg_postinst() {
+ if [ "$(rc-config list default | grep elogind)" = "" ]; then
+ ewarn "To enable the elogind daemon, elogind must be"
+ ewarn "added to the default runlevel:"
+ ewarn "# rc-update add elogind default"
+ fi
+}
diff --git a/sys-auth/elogind/files/elogind-219.12-gperf.patch b/sys-auth/elogind/files/elogind-219.12-gperf.patch
new file mode 100644
index 000000000000..8342b8b3e960
--- /dev/null
+++ b/sys-auth/elogind/files/elogind-219.12-gperf.patch
@@ -0,0 +1,109 @@
+commit c9f7b4d356a453a01aa77a6bb74ca7ef49732c08
+Author: Mike Gilbert <floppymaster@gmail.com>
+Date: Tue Jan 10 02:39:05 2017 -0500
+
+ build-sys: add check for gperf lookup function signature (#5055)
+
+ gperf-3.1 generates lookup functions that take a size_t length
+ parameter instead of unsigned int. Test for this at configure time.
+
+ Fixes: https://github.com/systemd/systemd/issues/5039
+
+diff --git a/configure.ac b/configure.ac
+index 11bd46c..d58fff5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -255,6 +255,28 @@ AC_CHECK_SIZEOF(rlim_t,,[
+ #include <sys/resource.h>
+ ])
+
++GPERF_TEST="$(echo foo,bar | ${GPERF} -L ANSI-C)"
++
++AC_COMPILE_IFELSE(
++ [AC_LANG_PROGRAM([
++ #include <string.h>
++ const char * in_word_set(const char *, size_t);
++ $GPERF_TEST]
++ )],
++ [GPERF_LEN_TYPE=size_t],
++ [AC_COMPILE_IFELSE(
++ [AC_LANG_PROGRAM([
++ #include <string.h>
++ const char * in_word_set(const char *, unsigned);
++ $GPERF_TEST]
++ )],
++ [GPERF_LEN_TYPE=unsigned],
++ [AC_MSG_ERROR([** unable to determine gperf len type])]
++ )]
++)
++
++AC_DEFINE_UNQUOTED([GPERF_LEN_TYPE], [$GPERF_LEN_TYPE], [gperf len type])
++
+ # ------------------------------------------------------------------------------
+ # we use python to build the man page index
+ have_python=no
+diff --git a/src/shared/af-list.c b/src/shared/af-list.c
+index 3fac9c5..4b291d1 100644
+--- a/src/shared/af-list.c
++++ b/src/shared/af-list.c
+@@ -23,7 +23,7 @@
+ #include "af-list.h"
+ #include "macro.h"
+
+-static const struct af_name* lookup_af(register const char *str, register unsigned int len);
++static const struct af_name* lookup_af(register const char *str, register GPERF_LEN_TYPE len);
+
+ #include "af-from-name.h"
+ #include "af-to-name.h"
+diff --git a/src/shared/arphrd-list.c b/src/shared/arphrd-list.c
+index 6792d1e..2d598dc 100644
+--- a/src/shared/arphrd-list.c
++++ b/src/shared/arphrd-list.c
+@@ -23,7 +23,7 @@
+ #include "arphrd-list.h"
+ #include "macro.h"
+
+-static const struct arphrd_name* lookup_arphrd(register const char *str, register unsigned int len);
++static const struct arphrd_name* lookup_arphrd(register const char *str, register GPERF_LEN_TYPE len);
+
+ #include "arphrd-from-name.h"
+ #include "arphrd-to-name.h"
+diff --git a/src/shared/cap-list.c b/src/shared/cap-list.c
+index 3e773a0..d68cc78 100644
+--- a/src/shared/cap-list.c
++++ b/src/shared/cap-list.c
+@@ -26,7 +26,7 @@
+ #include "parse-util.h"
+ #include "util.h"
+
+-static const struct capability_name* lookup_capability(register const char *str, register unsigned int len);
++static const struct capability_name* lookup_capability(register const char *str, register GPERF_LEN_TYPE len);
+
+ #include "cap-from-name.h"
+ #include "cap-to-name.h"
+diff --git a/src/shared/errno-list.c b/src/shared/errno-list.c
+index 31b66ba..c6a01ee 100644
+--- a/src/shared/errno-list.c
++++ b/src/shared/errno-list.c
+@@ -23,7 +23,7 @@
+ #include "errno-list.h"
+
+ static const struct errno_name* lookup_errno(register const char *str,
+- register unsigned int len);
++ register GPERF_LEN_TYPE len);
+
+ #include "errno-to-name.h"
+ #include "errno-from-name.h"
+diff --git a/src/login/logind.h b/src/login/logind.h
+index 086fa1e..7556ee2 100644
+--- a/src/login/logind.h
++++ b/src/login/logind.h
+@@ -182,7 +182,7 @@ int manager_unit_is_active(Manager *manager, const char *unit);
+ int manager_job_is_active(Manager *manager, const char *path);
+
+ /* gperf lookup function */
+-const struct ConfigPerfItem* logind_gperf_lookup(const char *key, unsigned length);
++const struct ConfigPerfItem* logind_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
+
+ int manager_set_lid_switch_ignore(Manager *m, usec_t until);
+
diff --git a/sys-auth/elogind/files/elogind-219.12-login1-perms.patch b/sys-auth/elogind/files/elogind-219.12-login1-perms.patch
new file mode 100644
index 000000000000..eecf38ee1d26
--- /dev/null
+++ b/sys-auth/elogind/files/elogind-219.12-login1-perms.patch
@@ -0,0 +1,129 @@
+From 1ca40c077cd9a08f96a559ba51e8dba230298c4d Mon Sep 17 00:00:00 2001
+From: Michael Palimaka <kensington@gentoo.org>
+Date: Sun, 19 Jun 2016 01:56:56 +1000
+Subject: [PATCH] Update org.freedesktop.login1.conf
+
+This mirrors an upstream change opening up all of logind's bus calls to
+unprivileged users via polkit.
+
+See systemd/systemd/issues/471.
+Closes #3.
+---
+ src/login/org.freedesktop.login1.conf | 68 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 68 insertions(+)
+
+diff --git a/src/login/org.freedesktop.login1.conf b/src/login/org.freedesktop.login1.conf
+index 1318328..2e67e3d 100644
+--- a/src/login/org.freedesktop.login1.conf
++++ b/src/login/org.freedesktop.login1.conf
+@@ -90,6 +90,42 @@
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
++ send_member="LockSession"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
++ send_member="UnlockSession"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
++ send_member="LockSessions"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
++ send_member="UnlockSessions"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
++ send_member="KillSession"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
++ send_member="KillUser"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
++ send_member="TerminateSession"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
++ send_member="TerminateUser"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
++ send_member="TerminateSeat"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
+ send_member="PowerOff"/>
+
+ <allow send_destination="org.freedesktop.login1"
+@@ -130,6 +166,10 @@
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
++ send_member="SetWallMessage"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Manager"
+ send_member="AttachDevice"/>
+
+ <allow send_destination="org.freedesktop.login1"
+@@ -138,6 +178,10 @@
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Seat"
++ send_member="Terminate"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Seat"
+ send_member="ActivateSession"/>
+
+ <allow send_destination="org.freedesktop.login1"
+@@ -154,14 +198,30 @@
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
++ send_member="Terminate"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Session"
+ send_member="Activate"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
++ send_member="Lock"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Session"
++ send_member="Unlock"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Session"
+ send_member="SetIdleHint"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
++ send_member="Kill"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.Session"
+ send_member="TakeControl"/>
+
+ <allow send_destination="org.freedesktop.login1"
+@@ -180,6 +240,14 @@
+ send_interface="org.freedesktop.login1.Session"
+ send_member="PauseDeviceComplete"/>
+
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.User"
++ send_member="Terminate"/>
++
++ <allow send_destination="org.freedesktop.login1"
++ send_interface="org.freedesktop.login1.User"
++ send_member="Kill"/>
++
+ <allow receive_sender="org.freedesktop.login1"/>
+ </policy>
+
diff --git a/sys-auth/elogind/files/elogind-219.12-session.patch b/sys-auth/elogind/files/elogind-219.12-session.patch
new file mode 100644
index 000000000000..82cbebdead03
--- /dev/null
+++ b/sys-auth/elogind/files/elogind-219.12-session.patch
@@ -0,0 +1,45 @@
+From b5c5dd2ad43a3bf4fa0fb21139f8d16959b5d14e Mon Sep 17 00:00:00 2001
+From: Andy Wingo <wingo@pobox.com>
+Date: Sun, 6 Mar 2016 16:56:33 +0100
+Subject: [PATCH] Fixes to user and session saving
+
+* src/login/logind-dbus.c (method_create_session): No need to save
+ session here, as session_send_create_reply will do it.
+* src/login/logind-session-dbus.c (session_send_create_reply): On the
+ other hand we do need to save the user here, so the file marks them as
+ being active.
+---
+ src/login/logind-dbus.c | 2 --
+ src/login/logind-session-dbus.c | 5 +++--
+ 2 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
+index 5e6952d..6f7e569 100644
+--- a/src/login/logind-dbus.c
++++ b/src/login/logind-dbus.c
+@@ -801,8 +801,6 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
+ if (r < 0)
+ goto fail;
+
+- session_save(session);
+-
+ return 1;
+
+ fail:
+diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
+index f71798b..337bbbb 100644
+--- a/src/login/logind-session-dbus.c
++++ b/src/login/logind-session-dbus.c
+@@ -721,9 +721,10 @@ int session_send_create_reply(Session *s, sd_bus_error *error) {
+ if (fifo_fd < 0)
+ return fifo_fd;
+
+- /* Update the session state file before we notify the client
+- * about the result. */
++ /* Update the session and user state files before we notify
++ * the client about the result. */
+ session_save(s);
++ user_save(s->user);
+
+ p = session_bus_path(s);
+ if (!p)
diff --git a/sys-auth/elogind/files/elogind-docs.patch b/sys-auth/elogind/files/elogind-docs.patch
new file mode 100644
index 000000000000..4763be2e6d7f
--- /dev/null
+++ b/sys-auth/elogind/files/elogind-docs.patch
@@ -0,0 +1,19 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -253,16 +253,6 @@
+ dist_bashcompletion_DATA =
+ dist_zshcompletion_DATA =
+
+-dist_doc_DATA = \
+- README \
+- NEWS \
+- LICENSE.LGPL2.1 \
+- LICENSE.GPL2 \
+- LICENSE.MIT \
+- src/libelogind/sd-bus/PORTING-DBUS1 \
+- src/libelogind/sd-bus/DIFFERENCES \
+- src/libelogind/sd-bus/GVARIANT-SERIALIZATION
+-
+ @INTLTOOL_POLICY_RULE@
+
+ # ------------------------------------------------------------------------------
diff --git a/sys-auth/elogind/files/elogind-lrt.patch b/sys-auth/elogind/files/elogind-lrt.patch
new file mode 100644
index 000000000000..19055fa30944
--- /dev/null
+++ b/sys-auth/elogind/files/elogind-lrt.patch
@@ -0,0 +1,10 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -778,6 +778,7 @@
+
+ libelogind_core_la_LIBADD = \
+ $(UDEV_LIBS) \
++ -lrt \
+ libelogind-internal.la
+
+ if HAVE_ACL
diff --git a/sys-auth/elogind/files/elogind.conf b/sys-auth/elogind/files/elogind.conf
new file mode 100644
index 000000000000..73d1336aec98
--- /dev/null
+++ b/sys-auth/elogind/files/elogind.conf
@@ -0,0 +1,7 @@
+# /etc/conf.d/elogind: config file for /etc/init.d/elogind
+
+# this is the elogind executable
+ELOGIND_EXEC="/usr/libexec/elogind/elogind"
+
+# this is where elogind will store its pid file
+ELOGIND_PIDFILE="/var/run/elogind.pid"
diff --git a/sys-auth/elogind/files/elogind.init b/sys-auth/elogind/files/elogind.init
new file mode 100644
index 000000000000..af7c82e1851f
--- /dev/null
+++ b/sys-auth/elogind/files/elogind.init
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need dbus
+
+ # Make sure elogind is up before xdm starts any dm
+ before xdm
+}
+
+start() {
+ ebegin "Starting elogind"
+
+ # elogind needs a /run/systemd directory
+ if [[ ! -e /run/systemd ]]; then
+ mkdir -p /run/systemd
+ chmod 644 /run/systemd
+ fi
+
+ start-stop-daemon --start --quiet --background \
+ --make-pidfile --pidfile "${ELOGIND_PIDFILE}" \
+ --exec "${ELOGIND_EXEC}"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping elogind"
+ start-stop-daemon --stop --quiet --pidfile "${ELOGIND_PIDFILE}"
+ eend $?
+}
diff --git a/sys-auth/elogind/metadata.xml b/sys-auth/elogind/metadata.xml
new file mode 100644
index 000000000000..927a21525357
--- /dev/null
+++ b/sys-auth/elogind/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>freedesktop-bugs@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="apparmor">Enable AppArmor support</flag>
+ </use>
+</pkgmetadata>