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() {
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.
(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?
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.
(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?