Now that OpenRC has sysinit and shutdown runlevels, we've stripped pretty much all hardcoded stuff out now. The exception is a lot of reliance on sysvinit being present on Linux. Of course, there are multiple choices of init replacements these days, so punting the remaining sysvinit bits to the sysvinit package makes a lot of sense. I'll be attaching an ebuild and files to try and handle this.
Created attachment 171552 [details] halt init script
Created attachment 171553 [details, diff] Ebuild patch Moves reboot.sh and shutdown.sh out of init.d - they don't belong there. Add's halt to the shutdown runlevel if the halt script does not already exist. I personally don't like this step, but it maintains the status-quo with existing functionality.
Created attachment 171618 [details, diff] Use inittab to call final halt and reboot An alternative to the above would be to get inittab to call the final halt/reboot commands. This should (although not tested) work along with baselayout-1 and removes the need to add anything to a runlevel.
(In reply to comment #1) > Created an attachment (id=171552) [edit] > halt init script > +pkg_preinst() { + # First time installs add halt to the shutdown runlevel + if [ ! -e "${ROOT}"/etc/init.d/halt ]; then + einfo "Auto adding halt init script to the shutdown runlevel" + ln -sf /etc/init.d/halt "${ROOT}"/etc/runlevels/shutdown + fi + } Isn't this code likely to fail, as there already is an /etc/init.d/halt in baselayout and older openrc versions? So first there need to be a blocker against these versions :/ But due to blocker resolution I guess we cannot be sure if the file is there before or not. The check definitely needs to be changed.
(In reply to comment #4) > Isn't this code likely to fail, as there already is an /etc/init.d/halt in > baselayout and older openrc versions? No. It has /etc/init.d/halt.sh, so the check is good. Only the GIT version of OpenRC had the halt script and GIT users should know what they're doing. But it could be an argument to prefer the inittab approach, which I prefer right now.
The ebuild and init.d/halt aren't happening. The inittab ones will, but as two batches: 1. +l0s:0:wait:/sbin/halt -dhip +l6r:6:wait:/sbin/reboot -dk Should break absolutely nothing in baselayout1. 2. +# Run the sulogin shell in single user +s0:S:wait:/sbin/rc single +s1:S:wait:/sbin/sulogin Potential for breakage with BL1 unknown.
Gentoo is targetting this for the 0.4.0 release since this is a drastic change from the 0.3.0 and doesn't just warrant a -rX bump since it will require a significant amount of patching.
Cardoe: the bits in #1 should go into sysvinit already. #2 needs testing and then going into a seperate sysvinit revision probably.
Roy: There is a problem with the sulogin bits: +# Run the sulogin shell in single user +s0:S:wait:/sbin/rc single +s1:S:wait:/sbin/sulogin Specifically, inittab specifies that the first field is unique, and the change from the patch collides with the serial consoles. What value do you think we should use for Gentoo and you are going to use for other platforms?
InCVS: sysvinit-2.86-r11 with l0s and l6r lines.
How about "p0" and "p1", which stands for "power" - as those lines affect power state, it is somewhat intuitive.
To clarify (my earlier comment was really vague,) it seems better organized to have shutdown, halt and reboot commands in the "p" (power-state) runlevels. And then have rc single and sulogin branch off of the "lx" runlevel names, like this: # l0s:S:wait:/sbin/rc single l0l:S:wait:/sbin/sulogin # commands that affect power state ps:0:wait:/sbin/rc shutdown ph:0:wait:/sbin/halt -dhip pr:6:wait:/sbin/reboot -dk I don't know if that will work but it seems less weird. If someone is trying to figure this out, consider that arrangement. It doesn't really matter but I thought I'd suggest it.
How should the inittab changes for single-runlevel be done? A Revision bump, where the new version RDEPEND-blocks old baselayout/openrc versions? And all older openrc/baselayout does block the new one? I doubt this will work? It is required to run after emerging baselayout-2 (is this check correct?). # Ready for baselayout2/openrc-0.4.0, commented pending bug 246502 #has_version =sys-apps/baselayout-2* && sed -i -e '/^#BL2#/s,^#BL2#,,g' inittab
Roy: could you please nominate some specific non-conflicting names for the single-user runlevels so that we can have them live in the inittab?
I just ended up keeping them as-is. Serial is not enabled by default and those can be renamed if used.
(In reply to comment #14) > Roy: could you please nominate some specific non-conflicting names for the > single-user runlevels so that we can have them live in the inittab? > Seeing as inittab allows 4 chars for the id, how about su? su0:S:wait:/sbin/rc single su1:S:wait:/sbin/sulogin
This is done in sys-apps/sysvinit-2.86-r12. Marking fixed.
> # Do not uncomment yet. Pending bug 246502 > su0:S:wait:/sbin/rc single > su1:S:wait:/sbin/sulogin That's scary; I'm assuming the comment should be ignored and removed?
heh. Screw up on my part. This has been removed.