From e41c0c99c8d498cc2f3761eb35d4f5389a6d1798 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Mon, 8 Jun 2020 21:30:18 +0200 Subject: Proposed changes for a migration from ConsoleKit2 to elogind Using elogind will enable a fully working Wayland session for KDE Plasma5. --- deps/elogind/elogind.SlackBuild | 180 +++++++++++++++++++++++----------------- 1 file changed, 103 insertions(+), 77 deletions(-) (limited to 'deps/elogind/elogind.SlackBuild') diff --git a/deps/elogind/elogind.SlackBuild b/deps/elogind/elogind.SlackBuild index b9d2d70..66e65a0 100755 --- a/deps/elogind/elogind.SlackBuild +++ b/deps/elogind/elogind.SlackBuild @@ -1,6 +1,6 @@ #!/bin/sh # Copyright 2016 Patrick J. Volkerding, Sebeka, MN, USA -# Copyright 2016, 2017 Eric Hameleers, Eindhoven, NL +# Copyright 2016, 2017, 2020 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Permission to use, copy, modify, and distribute this software for @@ -22,54 +22,52 @@ # SUCH DAMAGE. # ----------------------------------------------------------------------------- +# Thanks to Widya Walesa for script improvements. -PKGNAM=elogind -VERSION=${VERSION:-219.14} -BUILD=${BUILD:-2} +cd $(dirname $0) ; CWD=$(pwd) -CWD=$(pwd) -TMP=${TMP:-/tmp} -PKG=$TMP/package-$PKGNAM +PKGNAM=elogind +VERSION=${VERSION:-243.7} +BUILD=${BUILD:-1} + +# Automatically determine the architecture we're building on: +MARCH=$( uname -m ) +if [ -z "$ARCH" ]; then + case "$MARCH" in + i?86) export ARCH=i486 ;; + arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$MARCH ;; + esac +fi -# We do not use PAM by default: -USE_PAM=${USE_PAM:-"NO"} -[ "$USE_PAM" = "NO" -o "$USE_PAM" = "no" ] && DO_PAM="dis" || DO_PAM="en" +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi -if [ -e $CWD/machine.conf ]; then - . $CWD/machine.conf ] -elif [ -e /etc/slackbuild/machine.conf ]; then - . /etc/slackbuild/machine.conf ] +# Set CFLAGS/CXXFLAGS and LIBDIRSUFFIX: +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "armv7hl" ]; then + SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "arm" ]; then + SLKCFLAGS="-O2 -march=armv5te" + LIBDIRSUFFIX="" else - # Automatically determine the architecture we're building on: - MARCH=$( uname -m ) - if [ -z "$ARCH" ]; then - case "$MARCH" in - i?86) export ARCH=i486 ;; - arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;; - # Unless $ARCH is already set, use uname -m for all other archs: - *) export ARCH=$MARCH ;; - esac - fi - # Set CFLAGS/CXXFLAGS and LIBDIRSUFFIX: - if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" - LIBDIRSUFFIX="" - elif [ "$ARCH" = "s390" ]; then - SLKCFLAGS="-O2" - LIBDIRSUFFIX="" - elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="-O2 -fPIC" - LIBDIRSUFFIX="64" - elif [ "$ARCH" = "armv7hl" ]; then - SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16" - LIBDIRSUFFIX="" - elif [ "$ARCH" = "arm" ]; then - SLKCFLAGS="-O2 -march=armv5te" - LIBDIRSUFFIX="" - else - SLKCFLAGS="-O2" - LIBDIRSUFFIX="" - fi + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" fi case "$ARCH" in @@ -77,6 +75,9 @@ case "$ARCH" in *) TARGET=$ARCH-slackware-linux ;; esac +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PKGNAM + rm -rf $PKG mkdir -p $TMP $PKG cd $TMP @@ -84,16 +85,14 @@ rm -rf $PKGNAM-$VERSION tar xvf $CWD/$PKGNAM-$VERSION.tar.gz || exit 1 cd $PKGNAM-$VERSION || exit 1 +# Our nobody user has UIDNumber 99, not 65534: +sed -e "s/65534/99/g" -i $(grep -lr 65534 .) + # Launch elogind when called via DBus and make sure its rundir exists # (in Slackware, /run is mounted as a tmpfs): -sed -i src/login/org.freedesktop.login1.service \ - -e "s,/bin/false,/bin/bash -c \"[[ ! -d /run/systemd ]] \&\& mkdir /run/systemd;/usr/libexec/elogind/elogind\"," - -# Apply Gentoo patches: -#cat $CWD/patches/elogind-219.12-session.patch | patch -p1 --verbose || exit 1 -cat $CWD/patches/elogind-219.12-runtime.patch | patch -p1 --verbose || exit 1 -cat $CWD/patches/elogind-lrt.patch | patch -p1 --verbose || exit 1 -cat $CWD/patches/elogind-docs.patch | patch -p1 --verbose || exit 1 +sed -i src/login/org.freedesktop.login1.service.in \ + -e "s,/bin/false,/lib${LIBDIRSUFFIX}/elogind," + # Merge a pull request for an upstream fix: cat $CWD/patches/elogind-polkit.patch | patch -p1 --verbose || exit 1 @@ -105,31 +104,54 @@ find . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; +# Thanks to Widya Walesa: +# Slackware still using cgroup v1 or legacy mode. Check the outcome of: +# [ $(stat -fc %T /sys/fs/cgroup/) = "cgroup2fs" ] && echo "unified" \ +# || ( [ -e /sys/fs/cgroup/unified/ ] && echo "hybrid" || echo "legacy") + # Configure: -autoreconf -vif -intltoolize -CFLAGS="$SLKCFLAGS" \ -CXXFLAGS="$SLKCFLAGS" \ -./configure \ - --prefix=/usr \ - --libdir=/usr/lib${LIBDIRSUFFIX} \ - --libexecdir=/usr/libexec \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --mandir=/usr/man \ - --docdir=/usr/doc/$PKGNAM-$VERSION \ - --disable-seccomp \ - --disable-selinux \ - --disable-apparmor \ - --${DO_PAM}able-pam \ - --disable-smack \ - --disable-tests \ - --enable-split-usr \ - --build=$TARGET +export CFLAGS="$SLKCFLAGS" +export CXXFLAGS="$SLKCFLAGS" +meson \ + --buildtype release \ + --prefix /usr \ + --libdir /usr/lib${LIBDIRSUFFIX} \ + -Drootlibdir="/lib${LIBDIRSUFFIX}" \ + -Drootlibexecdir="/lib${LIBDIRSUFFIX}/elogind" \ + -Dudevrulesdir="/etc/udev/rules.d" \ + -Ddocdir="/usr/doc/$PKGNAM-$VERSION" \ + -Dhtmldir="/usr/doc/$PKGNAM-$VERSION/html" \ + -Dmandir="/usr/man" \ + -Dman=false \ + -Dhtml=false \ + -Dbashcompletiondir="/usr/share/bash-completion/completions" \ + -Dnobody-group=nogroup \ + -Dpam=true \ + -Dpamlibdir="/lib${LIBDIRSUFFIX}/security" \ + -Dpamconfdir="/etc/pam.d" \ + -Dacl=true \ + -Dsmack=false \ + -Dutmp=true \ + -Ddefault-hierarchy=legacy \ + -Dcgroup-controller=elogind \ + -Dhalt-path=/sbin/halt \ + -Dpoweroff-path=/sbin/poweroff \ + -Dreboot-path=/sbin/reboot \ + -Ddefault-kill-user-processes=false \ + build_elogind \ + || exit 1 # Build and install: -make || exit 1 -make install DESTDIR=$PKG || exit 1 +ninja -C build_elogind || exit 1 +DESTDIR=$PKG ninja install -C build_elogind || exit 1 + +# Create symlinks for elogind binaries to /usr/bin/: +mkdir -p $PKG/usr/bin +ln -sf /bin/elogind-inhibit $PKG/usr/bin/elogind-inhibit +ln -sf /bin/loginctl $PKG/usr/bin/loginctl + +# Make sure we do not overwrite the user's customizations: +mv -i $PKG/etc/elogind/logind.conf{,.new} # Strip binaries: find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | \ @@ -150,14 +172,18 @@ if [ -d $PKG/usr/man ]; then ) fi -# Add a rc script; Slackware does not support this out of the box: +# Add a rc script; Slackware does not yet support this out of the box. +# Preferably the rc code will get added right before starting rc.messagebus: mkdir -p $PKG/etc/rc.d -install -m 0755 $CWD/rc.elogind $PKG/etc/rc.d/rc.elogind.new +cat $CWD/rc.elogind \ + | sed -e "s/@LIBDIRSUFFIX@/${LIBDIRSUFFIX}/g" \ + > $PKG/etc/rc.d/rc.elogind.new +chmod 755 $PKG/etc/rc.d/rc.elogind.new # Add documentation: mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION cp -a \ - CODING_STYLE LICENSE* NEWS README TODO \ + LICENSE* README* TODO \ $PKG/usr/doc/$PKGNAM-$VERSION # Add a description and post-install script: -- cgit v1.2.3