changeset 1066:d16175ccb3c3

core/elogind: initial import, closes #2265
author David Demelier <markand@malikania.fr>
date Mon, 02 Sep 2019 21:40:00 +0200
parents 866d3dc627a1
children b2dc37af78e5
files core/elogind/elogind.sh core/elogind/elogind.sha1 core/elogind/patch-musl.patch
diffstat 3 files changed, 135 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/elogind/elogind.sh	Mon Sep 02 21:40:00 2019 +0200
@@ -0,0 +1,80 @@
+#!/bin/busybox sh
+#
+# Copyright (c) 2019 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+# TODO: add SELINUX support.
+
+PKGNAME=elogind
+PKGVERSION=241.3
+PKGREVISION=1
+PKGLICENSE="LGPLv21+ PUBLIC-DOMAIN"
+PKGSUMMARY="user, seat and session manager"
+PKGDOWNLOAD="https://github.com/$PKGNAME/$PKGNAME/archive/v$PKGVERSION.tar.gz"
+PKGDEPENDS="acl libcap meson:build"
+PKGOPTIONS="PAM REGEX"
+PKGPROTECT="etc/elogind/logind.conf etc/pam.d/elogind-user"
+
+: ${CC:=clang}
+: ${CFLAGS:=-O2}
+: ${LDFLAGS:=}
+: ${PAM:=yes}
+: ${REGEX:=yes}
+
+if [ "$PAM" = "yes" ]; then
+	PKGDEPENDS="linux-pam $PKGDEPENDS"
+	with_pam="-D pam=true"
+else
+	with_pam="-D pam=false"
+fi
+
+if [ "$REGEX" = "yes" ]; then
+	PKGDEPENDS="libpcre2 $PKGDEPENDS"
+	with_regex="-D pcre2=true"
+else
+	with_regex="-D pcre2=false"
+fi
+
+build()
+{
+	rm -rf $PKGNAME-$PKGVERSION
+	tar xvf v$PKGVERSION.tar.gz
+	cd $PKGNAME-$PKGVERSION
+
+	patch -p0 < ../patch-musl.patch
+	CC="$CC" \
+	CFLAGS="$CFLAGS" \
+	LDFLAGS="$LDFLAGS" \
+	meson . build \
+		--prefix / \
+		--buildtype release \
+		--default-library shared \
+		-D split-usr=true \
+		-D split-bin=false \
+		-D tests=false \
+		-D docdir=share/doc/$PKGNAME \
+		$with_pam \
+		$with_regex
+
+	ninja -C build
+	DESTDIR=$DESTDIR ninja -C build install
+	sed -i -e "/^#.*/d" $DESTDIR/etc/pam.d/elogind-user
+	sed -i -e "1i#" $DESTDIR/etc/pam.d/elogind-user
+	sed -i -e "2i# /etc/pam.d/elogind-user -- PAM configuration file for elogind" $DESTDIR/etc/pam.d/elogind-user
+	sed -i -e "3i#" $DESTDIR/etc/pam.d/elogind-user
+
+	cd ..
+	rm -rf $PKGNAME-$PKGVERSION
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/elogind/elogind.sha1	Mon Sep 02 21:40:00 2019 +0200
@@ -0,0 +1,1 @@
+bc60623b90da52c958fb9ae721b0fa2424a9b8a9  v241.3.tar.gz
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/elogind/patch-musl.patch	Mon Sep 02 21:40:00 2019 +0200
@@ -0,0 +1,54 @@
+--- meson.build.orig	2019-09-02 16:59:59.363473659 +0200
++++ meson.build	2019-09-02 17:00:21.687474345 +0200
+@@ -910,51 +910,6 @@
+ nobody_user = get_option('nobody-user')
+ nobody_group = get_option('nobody-group')
+ 
+-if not meson.is_cross_build()
+-        getent_result = run_command('getent', 'passwd', '65534')
+-        if getent_result.returncode() == 0
+-                name = getent_result.stdout().split(':')[0]
+-                if name != nobody_user
+-                        warning('\n' +
+-                                'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
+-                                'Your build will result in an user table setup that is incompatible with the local system.')
+-                endif
+-        endif
+-        id_result = run_command('id', '-u', nobody_user)
+-        if id_result.returncode() == 0
+-                id = id_result.stdout().to_int()
+-                if id != 65534
+-                        warning('\n' +
+-                                'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
+-                                'Your build will result in an user table setup that is incompatible with the local system.')
+-                endif
+-        endif
+-
+-        getent_result = run_command('getent', 'group', '65534')
+-        if getent_result.returncode() == 0
+-                name = getent_result.stdout().split(':')[0]
+-                if name != nobody_group
+-                        warning('\n' +
+-                                'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
+-                                'Your build will result in an group table setup that is incompatible with the local system.')
+-                endif
+-        endif
+-        id_result = run_command('id', '-g', nobody_group)
+-        if id_result.returncode() == 0
+-                id = id_result.stdout().to_int()
+-                if id != 65534
+-                        warning('\n' +
+-                                'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
+-                                'Your build will result in an group table setup that is incompatible with the local system.')
+-                endif
+-        endif
+-endif
+-if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
+-        warning('\n' +
+-                'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
+-                'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
+-endif
+-
+ conf.set_quoted('NOBODY_USER_NAME', nobody_user)
+ conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
+ substs.set('NOBODY_USER_NAME', nobody_user)