Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 723522 - sys-auth/elogind does not support runit
Summary: sys-auth/elogind does not support runit
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Andreas Sturmlechner
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2020-05-17 23:50 UTC by Alex Efros
Modified: 2021-06-08 17:24 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
elogind-243.7.ebuild.patch (elogind-243.7.ebuild.patch,1.55 KB, patch)
2020-05-17 23:50 UTC, Alex Efros
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Efros 2020-05-17 23:50:59 UTC
Created attachment 639904 [details, diff]
elogind-243.7.ebuild.patch

I don't use openrc and boot system using runit instead.
But openrc is hardcoded in elogind ebuild, which makes it broken on my system.

It's easy enough to fix this, here is the patch for ebuild:


--- elogind-243.7.ebuild.orig	2020-04-19 14:39:50.000000000 +0300
+++ elogind-243.7.ebuild	2020-05-18 02:38:32.389491073 +0300
@@ -19,7 +19,7 @@
 
 LICENSE="CC0-1.0 LGPL-2.1+ public-domain"
 SLOT="0"
-IUSE="+acl debug doc +pam +policykit selinux"
+IUSE="+acl debug doc +pam +policykit runit selinux"
 
 BDEPEND="
 	app-text/docbook-xml-dtd:4.2
@@ -64,12 +64,10 @@
 }
 
 src_configure() {
-	local rccgroupmode="$(grep rc_cgroup_mode ${EPREFIX}/etc/rc.conf | cut -d '"' -f 2)"
 	local cgroupmode="legacy"
-
-	if [[ "xhybrid" = "x${rccgroupmode}" ]] ; then
+	if grep -q '^\S\+ /sys/fs/cgroup/unified cgroup2 ' /proc/mounts ; then
 		cgroupmode="hybrid"
-	elif [[ "xunified" = "x${rccgroupmode}" ]] ; then
+	elif grep -q '^\S\+ /sys/fs/cgroup cgroup2 ' /proc/mounts ; then
 		cgroupmode="unified"
 	fi
 
@@ -85,7 +83,9 @@
 		-Dbashcompletiondir="${EPREFIX}/usr/share/bash-completion/completions"
 		-Dman=auto
 		-Dsmack=true
-		-Dcgroup-controller=openrc
+		$(use runit && echo -Dpoweroff-path=/sbin/elogind-poweroff)
+		$(use runit && echo -Dreboot-path=/sbin/elogind-reboot)
+		-Dcgroup-controller=$(usex runit none openrc)
 		-Ddefault-hierarchy=${cgroupmode}
 		-Ddefault-kill-user-processes=false
 		-Dacl=$(usex acl true false)
@@ -108,6 +108,12 @@
 
 	sed -e "s/@libdir@/$(get_libdir)/" "${FILESDIR}"/${PN}.conf.in > ${PN}.conf || die
 	newconfd ${PN}.conf ${PN}
+
+	if use runit; then
+		exeinto /sbin
+		printf '#!/bin/sh\nexec /sbin/runit-init 0\n' | newexe - elogind-poweroff
+		printf '#!/bin/sh\nexec /sbin/runit-init 6\n' | newexe - elogind-reboot
+	fi
 }
 
 pkg_postinst() {
Comment 1 Piotr Karbowski (RETIRED) gentoo-dev 2021-01-06 15:38:33 UTC
Currently Gentoo supports only OpenRC and Systemd. No other init scripts are really provided and runit is not as-is enough to really boot with it.

Your patch check the build machine /sys, which is something that we cannot do -- you can build it and install on another system.
Comment 2 Alex Efros 2021-01-06 17:25:50 UTC
(In reply to Piotr Karbowski from comment #1)
> Currently Gentoo supports only OpenRC and Systemd. No other init scripts are
> really provided and runit is not as-is enough to really boot with it.

Well, I've a package in my overlay which provides /etc/runit/{1,2,3} used to boot several servers and workstations for more than a decade so far, so runit perfectly works with Gentoo if needed, without any bits from OpenRC or Systemd.

> Your patch check the build machine /sys, which is something that we cannot
> do -- you can build it and install on another system.

Makes sense, but how to do this right way?
Comment 3 Piotr Karbowski (RETIRED) gentoo-dev 2021-01-06 17:41:11 UTC
As I understand you want to change cgroups type without having openrc around and set custom shutdown scripts.

Nothing stops you from still keeping /etc/rc.conf around with the cgroups mode there, and perhaps you can wrap the default command that elogind runs and call runit there? This way you maintain yourself the stub of openrc system while running runit.
Comment 4 Alex Efros 2021-02-18 15:41:31 UTC
(In reply to Piotr Karbowski from comment #3)
> Your patch check the build machine /sys, which is something that we cannot
> do -- you can build it and install on another system.
[...] 
> Nothing stops you from still keeping /etc/rc.conf around with the cgroups
> mode there, and perhaps you can wrap the default command that elogind runs
> and call runit there?

BTW, how is checking build machine /sys differ from checking build machine's /etc/rc.conf from the point of installing on another system?