summaryrefslogtreecommitdiff
path: root/system/gettys-openrc
diff options
context:
space:
mode:
authorLaurent Bercot <ska-adelie@skarnet.org>2019-05-28 16:49:42 +0000
committerLaurent Bercot <ska-adelie@skarnet.org>2019-05-28 16:49:42 +0000
commit0b82d071e1d6c87e54e38b8ff5ecd3fb1c5a0c6e (patch)
tree857bb98173718d5ac1ab9fae804cf11677547c55 /system/gettys-openrc
parent2f010c77dd84a08136edf3b38dd5974c6f0b750b (diff)
downloadpackages-0b82d071e1d6c87e54e38b8ff5ecd3fb1c5a0c6e.tar.gz
packages-0b82d071e1d6c87e54e38b8ff5ecd3fb1c5a0c6e.tar.bz2
packages-0b82d071e1d6c87e54e38b8ff5ecd3fb1c5a0c6e.tar.xz
packages-0b82d071e1d6c87e54e38b8ff5ecd3fb1c5a0c6e.zip
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.
Diffstat (limited to 'system/gettys-openrc')
-rw-r--r--system/gettys-openrc/APKBUILD13
-rw-r--r--system/gettys-openrc/gettys.initd40
2 files changed, 38 insertions, 15 deletions
diff --git a/system/gettys-openrc/APKBUILD b/system/gettys-openrc/APKBUILD
index 31a646011..bacb96d11 100644
--- a/system/gettys-openrc/APKBUILD
+++ b/system/gettys-openrc/APKBUILD
@@ -1,23 +1,24 @@
# Contributor: Laurent Bercot <ska-adelie@skarnet.org>
# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
pkgname=gettys-openrc
-pkgver=0.0.1.0
-pkgrel=3
+pkgver=0.0.2.0
+pkgrel=0
pkgdesc="Dynamic getty services"
url="https://adelielinux.org/"
arch="noarch"
options="!check" # No test suite.
license="NCSA"
-depends="sysvinit execline"
+depends="execline s6"
source="gettys.confd gettys.initd"
package() {
- mkdir -p "$pkgdir"/etc/conf.d "$pkgdir"/etc/init.d "$pkgdir"/etc/runlevels/sysinit
+ mkdir -p "$pkgdir"/etc/conf.d "$pkgdir"/etc/init.d "$pkgdir"/etc/runlevels/default "$pkgdir"/etc/runlevels/nonetwork
cp -f "$srcdir"/gettys.confd "$pkgdir"/etc/conf.d/gettys
cp -f "$srcdir"/gettys.initd "$pkgdir"/etc/init.d/gettys
chmod 0755 "$pkgdir"/etc/init.d/gettys
- ln -sf ../../init.d/gettys "$pkgdir"/etc/runlevels/sysinit
+ ln -sf ../../init.d/gettys "$pkgdir"/etc/runlevels/default/
+ ln -sf ../../init.d/gettys "$pkgdir"/etc/runlevels/nonetwork/
}
sha512sums="50039958291cd546c51ce5a30d319f5c5cf7d310fb3cd9f7ad1632fa4bc55775cdac740f76886ff5869a2cfa3f345e760672cebf7727c7ca2514358bcc17e531 gettys.confd
-3b4c212bba04c2a100b2e48cbbcdf561f77cb1f4e0565b8d6304315e8edce54ec7891dafc7e82fe9d30a8fad7249e8f0e337f71c4ad8ec50cc140a4e5130648f gettys.initd"
+ad086549334cf2ff49bf95eb7d89aed8497a7533487aa4770d0fed884baab648c5da5f4db7ba8b7613d2dc5eea5d165a484ee7029fe660e97791f954aff171b3 gettys.initd"
diff --git a/system/gettys-openrc/gettys.initd b/system/gettys-openrc/gettys.initd
index cf74b0e8a..5181d9af2 100644
--- a/system/gettys-openrc/gettys.initd
+++ b/system/gettys-openrc/gettys.initd
@@ -14,25 +14,47 @@ makeservice() {
if test -z "$baud" ; then
baud=38400
fi
- mkdir -p -m 0755 "/run/early-services/getty-$tty"
+ mkdir -p -m 0755 "/var/lib/s6/services/getty-$tty"
{
echo '#!/bin/execlineb -P'
echo
echo "/sbin/agetty $options -- $baud $tty linux"
- } > "/run/early-services/getty-$tty/run"
- chmod 0755 "/run/early-services/getty-$tty/run"
+ } > "/var/lib/s6/services/getty-$tty/run"
+ chmod 0755 "/var/lib/s6/services/getty-$tty/run"
}
-start()
-{
+nomatchname() {
+ for j in $GETTYS ; do
+ if test "$j" = "$1" ; then
+ return 1
+ fi
+ done
+ return 0
+}
+
+start() {
set -e
- mkdir -m 0755 -p /run/early-services
+ ebegin "Applying getty configuration"
. /etc/conf.d/gettys
+
+ todel=""
+ for i in `ls -1 /var/lib/s6/services | grep ^getty-` ; do
+ if nomatchname "${i##getty-}" ; then
+ rm -f "/run/service/$i"
+ todel="$todel $i"
+ fi
+ done
+
for i in $GETTYS ; do
if test -c /dev/"$i" ; then
- ebegin "Creating getty service for $i"
- makeservice "$i"
- eend $?
+ makeservice "$i"
+ ln -nsf "/var/lib/s6/services/getty-$i" "/run/service/getty-$i"
fi
done
+
+ s6-svscanctl -an /run/service
+ if test -n "$todel" ; then
+ ( sleep 1 && rm -rf $todel ) &
+ fi
+ eend $?
}