From 0b82d071e1d6c87e54e38b8ff5ecd3fb1c5a0c6e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 28 May 2019 16:49:42 +0000 Subject: system/s6-linux-init: new package = new init system This commit touches lots of things at once: it is necessary in order to maintain consistency. The impacted packages are: - s6-linux-init: new package. s6-linux-init mechanism plus booting policy. s6-linux-init conflicts with sysvinit; you can have one or the other, depending on what init you want to boot on. * s6-linux-init-common: subpackage of s6-linux-init, containing files used in the s6 supervision tree in both init cases. Both s6-linux-init and sysvinit depend on s6-linux-init-common. - s6: removed s6-svscanboot, which is policy, and only used in the sysvinit case. The s6 package is pure mechanism now. - utmps: adapted to the new location of the supervision tree, and reliable files provided by s6-linux-init-common. It works as is with both init systems. - gettys-openrc: had to move its invocation from "openrc sysinit" to "openrc default", because you can't make early gettys with s6-linux-init (no control over stage 1), and you can't have a supervision tree before sysinit with sysvinit (because /run is mounted very late, in boot), so the only solution that works with both is to make gettys late services. - sysvinit: now has s6-svscanboot (starting the s6 supervision tree from inittab), and a carefully crafted inittab that should work in all cases. Getting the right order of inittab lines was NOT easy, and I now hate sysvinit even more than I did before. Note that with the current version of apk, you cannot switch from sysvinit to s6-linux-init, or vice-versa, without an error. apk says files conflict. Because it adds the new files before removing the old ones. It should still work with apk -f, because the .apk-new mechanism makes it so that there's no real collision while you're switching, but it's still ugly as fuck and needs to be fixed in apk before we make the switch available to users. --- system/s6/s6-svscanboot | 84 ------------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 system/s6/s6-svscanboot (limited to 'system/s6/s6-svscanboot') diff --git a/system/s6/s6-svscanboot b/system/s6/s6-svscanboot deleted file mode 100644 index 32eb5f290..000000000 --- a/system/s6/s6-svscanboot +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/execlineb -P - -# Basic sanity. - -export PATH /usr/bin:/usr/sbin:/bin:/sbin -umask 022 - - -# The live service directories are in /run/services -# The scandir is /run/service, containing only the catch-all logger and symlinks -# (and the s6-svscan configuration in /run/service/.s6-svscan) - -if { rm -rf /run/service /run/services } -if { mkdir -p -m 0755 /run/service/.s6-svscan /run/service/s6-svscan-log } -if -{ - redirfd -w 1 /run/service/.s6-svscan/crash - heredoc 0 "#!/bin/execlineb -P\nfalse\n" - cat -} -if -{ - redirfd -w 1 /run/service/.s6-svscan/finish - heredoc 0 "#!/bin/execlineb -P\ns6-svc -X -- \"/run/service/s6-svscan-log\"\n" - cat -} -if { cd /run/service/.s6-svscan chmod 0755 crash finish } - - -# Directory for the catch-all logger to store its logs - -if { mkdir -p -m 2700 /run/uncaught-logs } -if { chown catchlog:catchlog /run/uncaught-logs } -if { chmod 2700 /run/uncaught-logs } - - -# Copy all the early services and link them into the scandir - -if { /bin/cp -a /etc/s6/early-services /run/services } -if -{ - forbacktickx -pnd"\n" i { ls -1 -U /run/services } - importas -u i i - ln -nsf ../services/$i /run/service/$i -} - - -# Also link the early services defined in sysinit, if any - -if -{ - if -t { test -d /run/early-services } - forbacktickx -pnd"\n" i { ls -1 -U /run/early-services } - importas -u i i - ln -nsf ../early-services/$i /run/service/$i -} - - -# Create the catch-all logger servicedir directly in the scandir -# (It's too fundamental to be made configurable as an early service.) - -if { rm -f /run/service/s6-svscan-log/fifo } -if { mkfifo -m 0600 /run/service/s6-svscan-log/fifo } -if -{ - redirfd -w 1 /run/service/s6-svscan-log/run - heredoc 0 "#!/bin/execlineb -P -redirfd -w 2 /dev/console -redirfd -rnb 0 fifo -s6-setuidgid catchlog -exec -c -s6-log t /run/uncaught-logs\n" - cat -} -if { chmod 0755 /run/service/s6-svscan-log/run } - - -# All ready, exec into s6-svscan. -# By default all messages from all services will go to the catch-all logger it spawns. - -redirfd -r 0 /dev/null -redirfd -wnb 1 /run/service/s6-svscan-log/fifo -fdmove -c 2 1 -s6-svscan -St0 /run/service -- cgit v1.2.3-70-g09d2