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/rc.elogind | 59 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 11 deletions(-) (limited to 'deps/elogind/rc.elogind') diff --git a/deps/elogind/rc.elogind b/deps/elogind/rc.elogind index b1adcaa..e5e7324 100644 --- a/deps/elogind/rc.elogind +++ b/deps/elogind/rc.elogind @@ -1,9 +1,12 @@ # # /etc/rc.d/rc.elogind # Initializes the elogind service on Slackware. +# There is no need to explicitly start a daemon; this will be taken +# care of automatically by dbus when that starts. # # Author: # Eric Hameleers 2016 +# Widya Walesa 2020 # # Description: # We use elogind (standalone subset extracted from systemd) instead of @@ -13,17 +16,51 @@ # Slackware has a tmpfs mounted on /run (see rc.S). # -# The systemd/elogind state directory: -mkdir -p /run/systemd -chmod 0755 /run/systemd +start_elogind() { + if [ -x /lib@LIBDIRSUFFIX@/elogind/elogind ]; then + if [ ! -d /run/user ]; then + mkdir -p /run/user + fi + if [ ! -d /run/systemd ]; then + mkdir -p /run/elogind /sys/fs/cgroup/elogind + ( cd /run; rm -rf systemd; ln -sf elogind systemd; ) + ( cd /sys/fs/cgroup; rm -rf systemd; ln -sf elogind systemd; ) + fi + if pgrep -l -F /run/elogind.pid 2>/dev/null | grep -q elogind; then + echo "Elogind is already running" + else + echo -n "Starting elogind: " + rm -f /run/elogind.pid + /lib@LIBDIRSUFFIX@/elogind/elogind --daemon + echo "/lib@LIBDIRSUFFIX@/elogind/elogind --daemon" + fi + fi +} -# Toplevel directory for runtime user session data: -mkdir -p /run/user -chmod 1777 /run/user +stop_elogind() { + if pgrep -l -F /run/elogind.pid 2>/dev/null | grep -q elogind; then + echo -n "Stopping elogind: " + pkill -F /run/elogind.pid 2>/dev/null + echo "DONE" + else + echo "Elogind is not running" + fi +} + +case "$1" in + start) + start_elogind + ;; + stop) + stop_elogind + ;; + restart) + stop_elogind + sleep 1 + start_elogind + ;; + *) + echo "Usage: $0 start|stop|restart" +esac -# 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 -- cgit v1.2.3