Created attachment 466108 [details, diff] runit-2.1.2-r1.ebuild.patch I've sent this by email to ebuild maintainer a couple of weeks ago, but didn't get any reply, so I'm sending this here. I'll attach patch to the ebuild which fixes many issues. Date: Fri, 24 Feb 2017 04:38:43 +0200 From: Alex Efros <powerman@powerman.name> To: William Hubbs <williamh@gentoo.org> Subject: question about runit-2.1.2-r1.ebuild Hi! It looks like migration procedure from runit-2.1.1 is broken. Is it was tested at all? The problem is there are two pkg_preinst(), so I suppose second one just overwrite first one, but first one looks important and should not be skipped. Another possible issue is different configurations for first install and for upgrade from runit-2.1.1: in first case /etc/service is a directory, in second case /etc/service is a symlink to /etc/runit/runsvdir/current. Also, in first install case when /etc/service is a directory there is a note in ebuild: einfo "If you need multiple runlevels, please see the documentation" einfo "for how to set them up." but runlevels are managed using /etc/runit/runsvdir/current and this won't work if /etc/service is a directory instead of symlink to /etc/runit/runsvdir/current. Finally, I propose one big change to the ebuild: move files /etc/runit/{1,2,3,ctrlaltdel} and directories for getty-* services into separate ebuild(s), with dependency on that ebuild(s) through virtual/*. This is required to provide alternative implementations for these files and services. For example, on my system I boot using runit instead of openrc, and thus my /etc/runit/1 is a real full-featured boot script. Without such virtual/* packages I've to keep runit ebuild in own overlay just to drop /etc/runit/{1,2,3,ctrlaltdel} files from it and thus avoid conflict with my own ebuild providing alternative for these files. If you like to I can proxy-maintain this ebuild or just create improved version for this ebuild once and send it to you/bugzilla. -- WBR, Alex.
I'm looking at this today. It looks like the best way forward is going to be to separate the boot scripts into their own package, so you will have runit then runit-openrc or something similar.
It looks like /etc/runit/2 and /etc/runit/ctrlaltdel can stay with runit, because they should be the same regardless of how you boot your system, But /etc/runit/1 and /etc/runit/3 will need to be able to be customized easily, along with the contents of /etc/runit/runsvdir and /etc/service.
(In reply to William Hubbs from comment #2) > It looks like /etc/runit/2 and /etc/runit/ctrlaltdel can stay with > runit, because they should be the same regardless of how you boot your > system, But /etc/runit/1 and /etc/runit/3 will need to be able to be > customized easily, along with the contents of /etc/runit/runsvdir and > /etc/service. Yes, but it's unlikely makes sense to split these files into different packages just because of this. Also, sometimes /etc/runit/2 also needs some modifications, for example here is mine: --- #!/bin/bash PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin exec 3<>/var/log/all/.log exec &>/var/log/all/.log exec env - PATH=$PATH \ runsvdir -P /etc/service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' --- It looks this way because I'm using chain of log-services: - most services write logs to their own svlogd, as usually - some config files of these svlogd for some services are configured to duplicate some lines to svlogd's STDERR - ./log/run which runs svlogd is configured to redirect svlogd's STDERR to /var/log/all/.log (which is a named PIPE file created with `mkfifo`) - there is /etc/service/log-all/ service which runs svlogd reading from /var/log/all/.log and writing logs into /var/log/all/current This way I've most interesting log lines from all services in one log file, which is usually always open with `tail -F`. (Also this log is used to implement desktop notifications for most critical events with help of another one service.) So, just like I've redirected STDERR of all svlogd of all services I've also redirected there STDERR of runsvdir itself, to see in this log messages which wasn't properly redirected in some service's ./run files.
*** Bug 632174 has been marked as a duplicate of this bug. ***
runit-2.1.2-r1 doesn't start: "start-stop-daemon: /usr/bin/runsvdir does not exist" it's because of wrong path in /etc/init.d/runsvdir: "command=/usr/bin/runsvdir" while actual path is /bin/runsvdir
I'm considering remove RDEPEND on sys-apps/openrc. Currently, openrc is used by /etc/runit/{1,3} as part of system init & shutdown. From what I understand, people use runit will do it by writing script themselves, so I'd like to move the call of openrc to a template script, and is commented by default (not shown in following diff yet). A new directory /etc/runit/rc will be created to put scripts called by runit in stage 1 & 3. See following diff for the changes to be made, and let me know if there are any problems or proposals, thanks. diff --git a/sys-process/runit/files/1-2.1.2 b/sys-process/runit/files/1-2.1.2 index 9761472ac739..e5e6fa0d92b0 100644 --- a/sys-process/runit/files/1-2.1.2 +++ b/sys-process/runit/files/1-2.1.2 @@ -3,8 +3,10 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin -RUNLEVEL=S /sbin/openrc sysinit -RUNLEVEL=S /sbin/openrc boot +for f in /etc/runit/rc/1.*; do + [[ ! -s "${f}" ]] && continue + source ${f} +done touch /etc/runit/stopit chmod 0 /etc/runit/stopit diff --git a/sys-process/runit/files/3-2.1.2 b/sys-process/runit/files/3-2.1.2 index 30e602cdae96..490f65e1c845 100644 --- a/sys-process/runit/files/3-2.1.2 +++ b/sys-process/runit/files/3-2.1.2 @@ -9,6 +9,7 @@ echo 'Waiting for services to stop...' sv -w 300 force-shutdown /etc/service/* echo 'Shutdown...' -test -x /etc/runit/reboot && LAST=6 || LAST=0 -test -x /etc/runit/reboot && RC=reboot || RC=shutdown -RUNLEVEL=$LAST /sbin/openrc $RC +for f in /etc/runit/rc/3.*; do + [[ ! -s "${f}" ]] && continue + source ${f} +done
*** Bug 575478 has been marked as a duplicate of this bug. ***
(In reply to Zhixu Liu from comment #6) I've been trying to figure out ways to decouple those scripts from openrc for a while, and the idea I came up with was to put the whole set of {1,2,3} files in a directory and then make that swappable through symlinks, like runsvchdir does. *But* that's a lot of moving parts for something that would only be used twice at most, and would've created a lot of headaches trying to swap them on a running system. I like this /etc/runit/rc/ idea better than mine. The only strong suggestion I have to add is to make it more like /etc/local.d (and the rest of runit): invoke the files standalone instead of sourcing them, and test for -x instead of -s. That would also allow to read their exit codes: 100 is interpreted specially by runit and there's also 111, and it seems to be a convention shared with other inits. I'd suggest adding a "[ $? >= 100 ] && exit $?" in the loop for that. Other than that, looks good to me.
PR submitted. The reason I choose source instead of eval is about the handling of error in rc scripts. If use eval (i.e, invoke the files standalon), it's complicated to handle the exit of rc script(s). Use source make the stage script (1 & 3) running as a single script, i.e, one can exit in the rc script(s) if needed.