summaryrefslogtreecommitdiffstats
path: root/deps/elogind
diff options
context:
space:
mode:
Diffstat (limited to 'deps/elogind')
-rw-r--r--deps/elogind/.url2
-rwxr-xr-xdeps/elogind/doinst.sh41
-rwxr-xr-xdeps/elogind/elogind.SlackBuild171
-rw-r--r--deps/elogind/patches/elogind-219.12-runtime.patch46
-rw-r--r--deps/elogind/patches/elogind-219.12-session.patch45
-rw-r--r--deps/elogind/patches/elogind-docs.patch19
-rw-r--r--deps/elogind/patches/elogind-lrt.patch10
-rw-r--r--deps/elogind/patches/elogind-polkit.patch121
-rw-r--r--deps/elogind/rc.elogind29
-rw-r--r--deps/elogind/slack-desc19
10 files changed, 503 insertions, 0 deletions
diff --git a/deps/elogind/.url b/deps/elogind/.url
new file mode 100644
index 0000000..444f958
--- /dev/null
+++ b/deps/elogind/.url
@@ -0,0 +1,2 @@
+https://github.com/wingo/elogind/archive/v219.12.tar.gz
+https://github.com/wingo/elogind/archive/master.zip
diff --git a/deps/elogind/doinst.sh b/deps/elogind/doinst.sh
new file mode 100755
index 0000000..75adb23
--- /dev/null
+++ b/deps/elogind/doinst.sh
@@ -0,0 +1,41 @@
+# Handle the incoming configuration files:
+config() {
+ for infile in $1; do
+ NEW="$infile"
+ OLD="`dirname $NEW`/`basename $NEW .new`"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+ done
+}
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname ${NEW})/$(basename ${NEW} .new)"
+ if [ -e ${OLD} ]; then
+ cp -a ${OLD} ${NEW}.incoming
+ cat ${NEW} > ${NEW}.incoming
+ mv ${NEW}.incoming ${NEW}
+ fi
+ config ${NEW}
+}
+
+#
+# Preserve permissions while moving into place:
+preserve_perms etc/rc.d/rc.elogind.new
+
+#
+# Update rc.local so that elogind will be functional after boot:
+if ! grep "rc.elogind" etc/rc.d/rc.local 1>/dev/null 2>/dev/null ; then
+ cat <<_EOM_ >> etc/rc.d/rc.local
+
+if [ -x /etc/rc.d/rc.elogind ]; then
+ # Create runtime for elogind (standalone logind extracted from systemd):
+ /etc/rc.d/rc.elogind
+fi
+_EOM_
+fi
diff --git a/deps/elogind/elogind.SlackBuild b/deps/elogind/elogind.SlackBuild
new file mode 100755
index 0000000..b9d2d70
--- /dev/null
+++ b/deps/elogind/elogind.SlackBuild
@@ -0,0 +1,171 @@
+#!/bin/sh
+# Copyright 2016 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2016, 2017 Eric Hameleers, Eindhoven, NL
+# All rights reserved.
+#
+# Permission to use, copy, modify, and 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.
+#
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+# -----------------------------------------------------------------------------
+
+
+PKGNAM=elogind
+VERSION=${VERSION:-219.14}
+BUILD=${BUILD:-2}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+# 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 [ -e $CWD/machine.conf ]; then
+ . $CWD/machine.conf ]
+elif [ -e /etc/slackbuild/machine.conf ]; then
+ . /etc/slackbuild/machine.conf ]
+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
+fi
+
+case "$ARCH" in
+ arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
+ *) TARGET=$ARCH-slackware-linux ;;
+esac
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.gz || exit 1
+cd $PKGNAM-$VERSION || exit 1
+
+# 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
+# Merge a pull request for an upstream fix:
+cat $CWD/patches/elogind-polkit.patch | patch -p1 --verbose || exit 1
+
+# Make sure ownerships and permissions are sane:
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# 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
+
+# Build and install:
+make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+# Strip binaries:
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | \
+ grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+# Compress and link manpages, if any:
+if [ -d $PKG/usr/man ]; then
+ ( cd $PKG/usr/man
+ for manpagedir in $(find . -type d -name "man*") ; do
+ ( cd $manpagedir
+ for eachpage in $( find . -type l -maxdepth 1) ; do
+ ln -s $( readlink $eachpage ).gz $eachpage.gz
+ rm $eachpage
+ done
+ gzip -9 *.?
+ )
+ done
+ )
+fi
+
+# Add a rc script; Slackware does not support this out of the box:
+mkdir -p $PKG/etc/rc.d
+install -m 0755 $CWD/rc.elogind $PKG/etc/rc.d/rc.elogind.new
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a \
+ CODING_STYLE LICENSE* NEWS README TODO \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+
+# Add a description and post-install script:
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+# Create the package:
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/deps/elogind/patches/elogind-219.12-runtime.patch b/deps/elogind/patches/elogind-219.12-runtime.patch
new file mode 100644
index 0000000..985dc57
--- /dev/null
+++ b/deps/elogind/patches/elogind-219.12-runtime.patch
@@ -0,0 +1,46 @@
+Taken from Gentoo:
+https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-auth/elogind/files/elogind-219.12-runtime.patch
+
+From 276746896985c438d317fcae414e9c83a6dd3d76 Mon Sep 17 00:00:00 2001
+From: Sven Eden <yamakuzure@gmx.net>
+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/deps/elogind/patches/elogind-219.12-session.patch b/deps/elogind/patches/elogind-219.12-session.patch
new file mode 100644
index 0000000..82cbebd
--- /dev/null
+++ b/deps/elogind/patches/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/deps/elogind/patches/elogind-docs.patch b/deps/elogind/patches/elogind-docs.patch
new file mode 100644
index 0000000..4763be2
--- /dev/null
+++ b/deps/elogind/patches/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/deps/elogind/patches/elogind-lrt.patch b/deps/elogind/patches/elogind-lrt.patch
new file mode 100644
index 0000000..19055fa
--- /dev/null
+++ b/deps/elogind/patches/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/deps/elogind/patches/elogind-polkit.patch b/deps/elogind/patches/elogind-polkit.patch
new file mode 100644
index 0000000..4d91b98
--- /dev/null
+++ b/deps/elogind/patches/elogind-polkit.patch
@@ -0,0 +1,121 @@
+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#471.
+Closes #3.
+
+diff -uar a/src/login/org.freedesktop.login1.conf b/src/login/org.freedesktop.login1.conf
+--- 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/deps/elogind/rc.elogind b/deps/elogind/rc.elogind
new file mode 100644
index 0000000..b1adcaa
--- /dev/null
+++ b/deps/elogind/rc.elogind
@@ -0,0 +1,29 @@
+#
+# /etc/rc.d/rc.elogind
+# Initializes the elogind service on Slackware.
+#
+# Author:
+# Eric Hameleers <alien@slackware.com> 2016
+#
+# Description:
+# We use elogind (standalone subset extracted from systemd) instead of
+# systemd itself; so we need to initialize a systemd-like state.
+#
+# Note:
+# Slackware has a tmpfs mounted on /run (see rc.S).
+#
+
+# The systemd/elogind state directory:
+mkdir -p /run/systemd
+chmod 0755 /run/systemd
+
+# Toplevel directory for runtime user session data:
+mkdir -p /run/user
+chmod 1777 /run/user
+
+# Elogind uses cgroups to organize processes like mapping PIDs to sessions.
+# Elogind's cgroup hierarchy isn't associated with any resource controller
+# ("subsystem") so we must create it manually:
+mkdir -p /sys/fs/cgroup/elogind
+mount -t cgroup -o none,name=elogind elogind /sys/fs/cgroup/elogind
+
diff --git a/deps/elogind/slack-desc b/deps/elogind/slack-desc
new file mode 100644
index 0000000..81db522
--- /dev/null
+++ b/deps/elogind/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+elogind: elogind (logind extracted from systemd)
+elogind:
+elogind: elogind is the systemd project's logind, extracted to a standalone
+elogind: package.
+elogind:
+elogind:
+elogind:
+elogind:
+elogind:
+elogind: Homepage: https://github.com/wingo/elogind
+elogind: