From 8ec2a2aa842e3c088506128a5a7cd1f3042e38ad Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Fri, 20 Jan 2017 22:39:51 +0100 Subject: sys-auth/elogind: Fix permissions on /run/systemd, create at runtime Fix HOMEPAGE, SRC_URI Package-Manager: portage-2.3.0 --- sys-auth/elogind/elogind-219.12-r5.ebuild | 101 +++++++++++++++++++++ .../elogind/files/elogind-219.12-runtime.patch | 43 +++++++++ sys-auth/elogind/files/elogind.init | 2 +- 3 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 sys-auth/elogind/elogind-219.12-r5.ebuild create mode 100644 sys-auth/elogind/files/elogind-219.12-runtime.patch diff --git a/sys-auth/elogind/elogind-219.12-r5.ebuild b/sys-auth/elogind/elogind-219.12-r5.ebuild new file mode 100644 index 000000000000..e3e26fc0408e --- /dev/null +++ b/sys-auth/elogind/elogind-219.12-r5.ebuild @@ -0,0 +1,101 @@ +# 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/elogind/elogind" +SRC_URI="https://github.com/elogind/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-apps/util-linux + sys-libs/libcap + 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 + !sys-auth/systemd +" +DEPEND="${COMMON_DEPEND} + app-text/docbook-xml-dtd:4.2 + app-text/docbook-xml-dtd:4.5 + app-text/docbook-xsl-stylesheets + dev-util/gperf + dev-util/intltool + sys-devel/libtool + virtual/pkgconfig +" +PDEPEND="policykit? ( sys-auth/polkit )" + +PATCHES=( + "${FILESDIR}/${PN}-docs.patch" + "${FILESDIR}/${PN}-lrt.patch" + "${FILESDIR}/${P}-session.patch" + "${FILESDIR}/${P}-login1-perms.patch" + "${FILESDIR}/${P}-gperf.patch" + "${FILESDIR}/${P}-glibc.patch" # bug 605744 + "${FILESDIR}/${P}-runtime.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-runtime.patch b/sys-auth/elogind/files/elogind-219.12-runtime.patch new file mode 100644 index 000000000000..f14806c3164d --- /dev/null +++ b/sys-auth/elogind/files/elogind-219.12-runtime.patch @@ -0,0 +1,43 @@ +From 276746896985c438d317fcae414e9c83a6dd3d76 Mon Sep 17 00:00:00 2001 +From: Sven Eden +Date: Fri, 20 Jan 2017 17:14:35 +0100 +Subject: [PATCH] Create /run/systemd as needed + +* src/login/logind.c (main): Also create /run/systemd at startup. +* Create /run/systemd/machines, so that the login monitor works. +* Fail if any of the needed directories could not be created. +* But do not fail if any of the needed directories exist. +--- + src/login/logind.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +diff --git a/src/login/logind.c b/src/login/logind.c +index 1ab50ec..07a77b1 100644 +--- a/src/login/logind.c ++++ b/src/login/logind.c +@@ -1131,10 +1131,21 @@ int main(int argc, char *argv[]) { + * existence of /run/systemd/seats/ to determine whether + * logind is available, so please always make sure this check + * stays in. */ +- mkdir_label("/run/systemd/seats", 0755); +- mkdir_label("/run/systemd/users", 0755); +- mkdir_label("/run/systemd/sessions", 0755); +- mkdir_label("/run/systemd/machines", 0755); ++ r = mkdir_label("/run/systemd", 0755); ++ if ( (r < 0) && (-EEXIST != r) ) ++ return log_error_errno(r, "Failed to create /run/systemd : %m"); ++ r = mkdir_label("/run/systemd/seats", 0755); ++ if ( r < 0 && (-EEXIST != r) ) ++ return log_error_errno(r, "Failed to create /run/systemd/seats : %m"); ++ r = mkdir_label("/run/systemd/users", 0755); ++ if ( r < 0 && (-EEXIST != r) ) ++ return log_error_errno(r, "Failed to create /run/systemd/users : %m"); ++ r = mkdir_label("/run/systemd/sessions", 0755); ++ if ( r < 0 && (-EEXIST != r) ) ++ return log_error_errno(r, "Failed to create /run/systemd/sessions : %m"); ++ r = mkdir_label("/run/systemd/machines", 0755); ++ if ( r < 0 && (-EEXIST != r) ) ++ return log_error_errno(r, "Failed to create /run/systemd/machines : %m"); + + m = manager_new(); + if (!m) { diff --git a/sys-auth/elogind/files/elogind.init b/sys-auth/elogind/files/elogind.init index af7c82e1851f..04ce34ab4c7b 100644 --- a/sys-auth/elogind/files/elogind.init +++ b/sys-auth/elogind/files/elogind.init @@ -16,7 +16,7 @@ start() { # elogind needs a /run/systemd directory if [[ ! -e /run/systemd ]]; then mkdir -p /run/systemd - chmod 644 /run/systemd + chmod 755 /run/systemd fi start-stop-daemon --start --quiet --background \ -- cgit v1.2.3-65-gdbad