summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/gettys-openrc/APKBUILD13
-rw-r--r--system/gettys-openrc/gettys.initd40
-rw-r--r--system/s6-linux-init/APKBUILD116
-rw-r--r--system/s6-linux-init/rc.init9
-rw-r--r--system/s6-linux-init/rc.shutdown3
-rw-r--r--system/s6-linux-init/reboot.sh21
-rw-r--r--system/s6-linux-init/runlevel5
-rw-r--r--system/s6-linux-init/s6-linux-init-common.post-upgrade5
-rw-r--r--system/s6-linux-init/s6-linux-init-common.pre-deinstall5
-rw-r--r--system/s6-linux-init/s6-linux-init.post-install25
-rw-r--r--system/s6-linux-init/s6-linux-init.post-upgrade5
-rw-r--r--system/s6-linux-init/s6-linux-init.pre-deinstall5
-rw-r--r--system/s6/APKBUILD12
-rw-r--r--system/s6/s6-svscanboot84
-rw-r--r--system/s6/s6.post-upgrade8
-rw-r--r--system/sysvinit/APKBUILD29
-rw-r--r--system/sysvinit/inittab-2.8820
-rw-r--r--system/sysvinit/s6-svscanboot15
-rw-r--r--system/sysvinit/sysvinit.post-install25
-rw-r--r--system/utmps/APKBUILD20
-rw-r--r--system/utmps/utmpd.run2
-rw-r--r--system/utmps/wtmpd.run2
22 files changed, 335 insertions, 134 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 $?
}
diff --git a/system/s6-linux-init/APKBUILD b/system/s6-linux-init/APKBUILD
new file mode 100644
index 000000000..70f8bbefa
--- /dev/null
+++ b/system/s6-linux-init/APKBUILD
@@ -0,0 +1,116 @@
+# Contributor: Laurent Bercot <ska-adelie@skarnet.org>
+# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
+pkgname=s6-linux-init
+pkgver=1.0.1.0
+pkgrel=0
+pkgdesc="A s6-based init system"
+url="https://skarnet.org/software/$pkgname/"
+arch="all"
+options="!check" # No test suite.
+license="ISC"
+_skalibs_version=2.8.1.0
+depends="execline s6 s6-linux-init-common"
+makedepends="skalibs-dev>=$_skalibs_version execline-dev s6-dev utmps-dev"
+subpackages="$pkgname-common:common:noarch $pkgname-libs $pkgname-dev $pkgname-libs-dev:libsdev $pkgname-doc"
+source="https://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz rc.init runlevel rc.shutdown reboot.sh"
+install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-deinstall"
+provides="/sbin/init=0"
+
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --enable-shared \
+ --enable-static \
+ --enable-allstatic \
+ --enable-static-libc \
+ --libdir=/usr/lib \
+ --libexecdir="/lib/$pkgname" \
+ --with-dynlib=/lib \
+ --enable-utmps
+ make
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+
+ for i in rc.init runlevel rc.shutdown ; do
+ cp -f "$srcdir/$i" "$pkgdir/etc/s6-linux-init/skel/"
+ chmod 0755 "$pkgdir/etc/s6-linux-init/skel/$i"
+ done
+
+ # static binaries don't work under fakeroot, so build a dynamic one just for us
+ touch src/init/s6-linux-init-maker.o
+ make s6-linux-init-maker LDFLAGS_NOSHARED=""
+
+ ./s6-linux-init-maker \
+ -u catchlog \
+ -1 \
+ -L \
+ -p "/usr/bin:/usr/sbin:/bin:/sbin" \
+ -m 022 \
+ -s /run/kernel_env \
+ -f "$pkgdir/etc/s6-linux-init/skel" \
+ -U "" \
+ "$pkgdir/etc/s6-linux-init/current"
+ mkdir -p -m 0755 "$pkgdir/sbin" "$pkgdir/etc/runlevels/empty" "$pkgdir/etc/sysctl.d"
+ echo 'kernel.ctrl-alt-del = 0' > "$pkgdir/etc/sysctl.d/ctrlaltdel.conf"
+ for i in init halt poweroff reboot shutdown telinit ; do
+ ln -sf "../etc/s6-linux-init/current/bin/$i" "$pkgdir/sbin/$i"
+ done
+}
+
+
+common() {
+ pkgdesc="Files for an s6 supervision tree, common to s6-linux-init and sysvinit"
+ depends="execline s6"
+ runimg="$pkgdir/etc/s6-linux-init/current/run-image"
+ subrunimg="$subpkgdir/etc/s6-linux-init/current/run-image"
+ install="$subpkgname.post-upgrade $subpkgname.pre-deinstall"
+ mkdir -p -m 0755 "$subrunimg/service/.s6-svscan" "$subrunimg/service/s6-svscan-log" "$subpkgdir/usr/share/s6-linux-init-common"
+ mv "$runimg/uncaught-logs" "$subrunimg/"
+ mv "$runimg/service/s6-svscan-log" "$subrunimg/service/"
+ mkdir -m 0755 "$runimg/service/s6-svscan-log"
+ mv "$subrunimg/service/s6-svscan-log/run" "$runimg/service/s6-svscan-log/"
+ cp -f "$srcdir/reboot.sh" "$subpkgdir/usr/share/s6-linux-init-common/"
+}
+
+
+libs() {
+ pkgdesc="$pkgdesc (shared libraries)"
+ depends="skalibs-libs>=$_skalibs_version"
+ mkdir -p "$subpkgdir/lib"
+ mv "$pkgdir"/lib/*.so.* "$subpkgdir/lib/"
+}
+
+
+dev() {
+ pkgdesc="$pkgdesc (development files)"
+ depends="skalibs-dev>=$_skalibs_version"
+ mkdir -p "$subpkgdir/usr"
+ mv "$pkgdir/usr/lib" "$pkgdir/usr/include" "$subpkgdir/usr/"
+}
+
+
+libsdev() {
+ pkgdesc="$pkgdesc (development files for dynamic linking)"
+ depends="$pkgname-dev"
+ mkdir -p "$subpkgdir/lib"
+ mv "$pkgdir"/lib/*.so "$subpkgdir/lib/"
+}
+
+
+doc() {
+ pkgdesc="$pkgdesc (documentation)"
+ depends=
+ install_if="docs $pkgname=$pkgver-r$pkgrel"
+ mkdir -p "$subpkgdir/usr/share/doc"
+ cp -a "$builddir/doc" "$subpkgdir/usr/share/doc/$pkgname"
+}
+
+sha512sums="0b40601b25f88464b5ff63b7eddf6ffa30eb868d2d9652f3d6a608b8f508e46712214d6e674f74136e57dd4504eb71ef585c725ba1a6566cfc0a025e70cfadc9 s6-linux-init-1.0.1.0.tar.gz
+756b0cbbe5dabb4631380c3c7ea199cc213224b2e36e50a2d012a61948170078b78bf49b85d886319fecf59843087f937d3d804723b2553ac9f94d088a2f0fd8 rc.init
+e73c3c32b118831074288d23fadace2158a2b15d5a13ffa73290b92a9e39c2a21c73d3b0eabea29bcbaa5f6381611fd8d0aaa6aa691ec7de91b8ef6ae404b6da runlevel
+7bb050248a5c2ab6a56c50c35f87cde724f97ff9882f5e60b0f0f2f14bd93c1df7d99fedc3d81c8519cf1a1ed90e03f1cbb9bf891c7b3618aa9a5f5738d262f4 rc.shutdown
+de702d3a221993cd3192dae4544842402dfbe362bcc4105f3071df15eb0aa6c218bf401bbf221298ee063f6545fe909fd54abf1d1e9222e13bcdc9a29f9a2b19 reboot.sh"
diff --git a/system/s6-linux-init/rc.init b/system/s6-linux-init/rc.init
new file mode 100644
index 000000000..f96ed4d5e
--- /dev/null
+++ b/system/s6-linux-init/rc.init
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+rl="$1"
+shift
+
+/sbin/openrc sysinit
+/sbin/openrc boot
+
+exec /etc/s6-linux-init/current/scripts/runlevel "$rl"
diff --git a/system/s6-linux-init/rc.shutdown b/system/s6-linux-init/rc.shutdown
new file mode 100644
index 000000000..6fa64f6bc
--- /dev/null
+++ b/system/s6-linux-init/rc.shutdown
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+
+exec /sbin/openrc empty
diff --git a/system/s6-linux-init/reboot.sh b/system/s6-linux-init/reboot.sh
new file mode 100644
index 000000000..d0d87aeb6
--- /dev/null
+++ b/system/s6-linux-init/reboot.sh
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+# This script performs a "poor man's reboot" when the
+# init infrastructures are not there to do a proper one.
+# This is the case when the user *just* switched between
+# sysvinit and s6-linux-init, and needs to shut down the
+# old system but the shutdown binaries are the ones from
+# the new system.
+#
+# Always launch it from a console tty (tty1, ... tty6),
+# never from a network terminal or an xterm.
+
+trap "" INT HUP TERM
+mkdir -p -m 0755 /etc/runlevels/empty2
+/sbin/openrc empty2
+rmdir /etc/runlevels/empty2
+sync
+/etc/init.d/killprocs start
+/etc/init.d/savecache start
+/etc/init.d/mount-ro start
+/sbin/reboot -f
diff --git a/system/s6-linux-init/runlevel b/system/s6-linux-init/runlevel
new file mode 100644
index 000000000..f34018ea2
--- /dev/null
+++ b/system/s6-linux-init/runlevel
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+
+test "$#" -gt 0 || { echo 'runlevel: fatal: too few arguments' 1>&2 ; exit 100 ; }
+
+exec /sbin/openrc "$1"
diff --git a/system/s6-linux-init/s6-linux-init-common.post-upgrade b/system/s6-linux-init/s6-linux-init-common.post-upgrade
new file mode 100644
index 000000000..335559a3c
--- /dev/null
+++ b/system/s6-linux-init/s6-linux-init-common.post-upgrade
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+
+# apk does not handle fifos correctly.
+
+exec rm -f /etc/s6-linux-init/current/run-image/service/s6-svscan-log/fifo.apk-new
diff --git a/system/s6-linux-init/s6-linux-init-common.pre-deinstall b/system/s6-linux-init/s6-linux-init-common.pre-deinstall
new file mode 100644
index 000000000..691e2cca0
--- /dev/null
+++ b/system/s6-linux-init/s6-linux-init-common.pre-deinstall
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+
+# apk does not handle fifos correctly.
+
+exec rm -f /etc/s6-linux-init/current/run-image/service/s6-svscan-log/fifo
diff --git a/system/s6-linux-init/s6-linux-init.post-install b/system/s6-linux-init/s6-linux-init.post-install
new file mode 100644
index 000000000..8e24f6d42
--- /dev/null
+++ b/system/s6-linux-init/s6-linux-init.post-install
@@ -0,0 +1,25 @@
+#!/bin/sh -e
+
+newv="$1"
+oldv="$2"
+
+cat <<EOF
+
+*
+* You installed the s6-linux-init package. If it's your first installation,
+* please ignore this message. But if you just removed the sysvinit
+* package in order to use s6-linux-init instead, please read on.
+*
+* In order to complete the switch, you need to reboot your machine. But
+* beware: just for this time, the usual shutdown commands won't work,
+* because they are designed to work with s6-linux-init but you are still
+* running sysvinit until you reboot. So, for your next reboot (and
+* only this one), the command you will need to run (as root, FROM A
+* CONSOLE TTY - not an xterm, not a network connection) is:
+*
+* /bin/sh /usr/share/s6-linux-init-common/reboot.sh
+*
+* Please save your work and perform that reboot as soon as you can.
+*
+
+EOF
diff --git a/system/s6-linux-init/s6-linux-init.post-upgrade b/system/s6-linux-init/s6-linux-init.post-upgrade
new file mode 100644
index 000000000..322de1e6b
--- /dev/null
+++ b/system/s6-linux-init/s6-linux-init.post-upgrade
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+
+# apk does not handle fifos correctly.
+
+exec rm -f /etc/s6-linux-init/current/run-image/service/s6-linux-init-shutdownd/fifo.apk-new
diff --git a/system/s6-linux-init/s6-linux-init.pre-deinstall b/system/s6-linux-init/s6-linux-init.pre-deinstall
new file mode 100644
index 000000000..bc72c70a0
--- /dev/null
+++ b/system/s6-linux-init/s6-linux-init.pre-deinstall
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+
+# apk does not handle fifos correctly.
+
+exec rm -f /etc/s6-linux-init/current/run-image/service/s6-linux-init-shutdownd/fifo
diff --git a/system/s6/APKBUILD b/system/s6/APKBUILD
index bb4bd50b3..ad5f1f28f 100644
--- a/system/s6/APKBUILD
+++ b/system/s6/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
pkgname=s6
pkgver=2.8.0.1
-pkgrel=0
+pkgrel=1
pkgdesc="skarnet.org's small & secure supervision software suite"
url="https://skarnet.org/software/$pkgname/"
arch="all"
@@ -14,8 +14,7 @@ makedepends="skalibs-dev>=$_skalibs_version execline-dev"
install="$pkgname.post-upgrade"
subpackages="$pkgname-libs $pkgname-dev $pkgname-libs-dev:libsdev $pkgname-doc"
triggers="$pkgname.trigger=/run/service"
-source="https://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz
- s6-svscanboot"
+source="https://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz"
build() {
cd "$builddir"
@@ -33,9 +32,7 @@ build() {
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
- cp -f "$srcdir/s6-svscanboot" "$pkgdir/lib/s6/s6-svscanboot"
- mkdir -p -m 0755 "$pkgdir/etc/s6/early-services" "$pkgdir/var/lib/s6/services"
- chmod 0755 "$pkgdir/lib/s6/s6-svscanboot"
+ mkdir -p -m 0755 "$pkgdir/var/lib/s6/services"
}
@@ -71,5 +68,4 @@ doc() {
cp -a "$builddir/doc" "$subpkgdir/usr/share/doc/$pkgname"
}
-sha512sums="03478aed129c1e50b34e0b75d7ff50bd84f62eadee862b6227c4313153d47776e7cbeae728d63209773b91931a2abc8372bb7db4953762807d0ed3d305efd23f s6-2.8.0.1.tar.gz
-9c29bc9eee6d5ab502a5a86bb043ebd21e085022efc506a330ae5ab0eadf7038d0a3dc8e025d78d9610cf7ec0ca031887f755486c4cb4e571090ea3a9c1806ac s6-svscanboot"
+sha512sums="03478aed129c1e50b34e0b75d7ff50bd84f62eadee862b6227c4313153d47776e7cbeae728d63209773b91931a2abc8372bb7db4953762807d0ed3d305efd23f s6-2.8.0.1.tar.gz"
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
diff --git a/system/s6/s6.post-upgrade b/system/s6/s6.post-upgrade
index 0b69f49e7..26d289c27 100644
--- a/system/s6/s6.post-upgrade
+++ b/system/s6/s6.post-upgrade
@@ -1,8 +1,13 @@
#!/bin/sh -e
+newv="$1"
+oldv="$2"
+
rm -f /etc/runlevels/default/s6
-cat <<EOF
+if test `apk version -t "$oldv" 2.8` = "<" ; then
+
+ cat <<EOF
*
* The s6 package has been upgraded. To complete the upgrade, you need to
@@ -16,3 +21,4 @@ cat <<EOF
*
EOF
+fi
diff --git a/system/sysvinit/APKBUILD b/system/sysvinit/APKBUILD
index d282e1e01..b95525084 100644
--- a/system/sysvinit/APKBUILD
+++ b/system/sysvinit/APKBUILD
@@ -2,21 +2,22 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=sysvinit
pkgver=2.88
-pkgrel=5
+pkgrel=6
pkgdesc="System V-style init programs"
url="https://savannah.nongnu.org/projects/sysvinit"
arch="all"
license="GPL-2.0+"
-depends="s6"
+depends="s6-linux-init-common"
makedepends="linux-headers utmps-dev"
-install="sysvinit.post-upgrade"
+install="sysvinit.post-upgrade sysvinit.post-install"
options="!check"
-provides="/sbin/init"
+provides="/sbin/init=0"
subpackages="$pkgname-doc"
source="https://download.savannah.nongnu.org/releases/sysvinit/sysvinit-${pkgver}dsf.tar.bz2
inittab-2.88
sysvinit-2.88-posix-header.patch
utmpx.patch
+ s6-svscanboot
"
builddir="$srcdir/sysvinit-${pkgver}dsf"
@@ -49,14 +50,30 @@ build() {
make -C src
}
+_install_s6_stuff()
+{
+ svcimg="$pkgdir/etc/s6-linux-init/current/run-image/service"
+ mkdir -p -m 0755 "$pkgdir/sbin" "$svcimg/.s6-svscan" "$svcimg/s6-svscan-log"
+ { echo '#!/bin/execlineb -P' ; echo 'false' ; } > "$svcimg/.s6-svscan/crash"
+ chmod 0755 "$svcimg/.s6-svscan/crash"
+ { echo '#!/bin/execlineb -P' ; echo 's6-svc -X -- /run/service/s6-svscan-log' ; } > "$svcimg/.s6-svscan/finish"
+ chmod 0755 "$svcimg/.s6-svscan/finish"
+ { echo '#!/bin/execlineb -P' ; echo 'redirfd -rnb 0 fifo' ; echo 's6-setuidgid catchlog' ; echo 's6-log -bd3 -- t /run/uncaught-logs' ; } > "$svcimg/s6-svscan-log/run"
+ chmod 0755 "$svcimg/s6-svscan-log/run"
+ install -D -m 0755 "$srcdir"/s6-svscanboot "$pkgdir/sbin/s6-svscanboot"
+}
+
package() {
cd "$builddir"
make -C src install ROOT="$pkgdir"
rm "$pkgdir"/usr/bin/lastb || true
install -D -m644 "$srcdir"/inittab-2.88 "$pkgdir"/etc/inittab
+ _install_s6_stuff
}
+
sha512sums="0bd8eeb124e84fdfa8e621b05f796804ee69a9076b65f5115826bfa814ac1d5d28d31a5c22ebe77c86a93b2288edf4891adc0afaecc4de656c4ecda8a83807bf sysvinit-2.88dsf.tar.bz2
-52d301225bf0cb0c4d124d205cf3a1e1f4eca21a69179da4882359f79606562354fddf887da8203129bede1d073efa9cdd8fe84a327b51229248b22240b9d5dd inittab-2.88
+87668b49690091a227c0384fd2400f1006d24c27cc27a25efa7eba56839ccb1eead00b58ce4b654eab9c0208d68aa2cbb888fd5f2990905845aa9688442a69a0 inittab-2.88
27dfe089660a291cbcba06d8564bad11f7fd7c96629e72c2b005562689dc7d8bb479c760e980590906e98423b991ae0acd048713d3bc372174d55ed894abeb3f sysvinit-2.88-posix-header.patch
-3605f88ac3faf7d12bf2269ca5d8625850d53e8583b573ab280fa17066c8e4e5217a0d17b94e47ea67a153ad3b88b433471a77544bd085f01f7d9d353ac16aae utmpx.patch"
+3605f88ac3faf7d12bf2269ca5d8625850d53e8583b573ab280fa17066c8e4e5217a0d17b94e47ea67a153ad3b88b433471a77544bd085f01f7d9d353ac16aae utmpx.patch
+30fc01b99350d9cb9e2d430f32c357fce571864e618f25fc2c82199f0ae36f3d81316b175af37ff779c0ef26780452877ff0355b3ea47e2ef4eadc823d085e98 s6-svscanboot"
diff --git a/system/sysvinit/inittab-2.88 b/system/sysvinit/inittab-2.88
index e96205a06..f170042cf 100644
--- a/system/sysvinit/inittab-2.88
+++ b/system/sysvinit/inittab-2.88
@@ -16,30 +16,36 @@
# Default runlevel.
id:3:initdefault:
-# System initialization, mount local filesystems, etc.
+# Early system initialization.
si::sysinit:/sbin/openrc sysinit
-# Further system initialization, brings up the boot runlevel.
+# Further system initialization.
+# The distinction between sysinit and boot is totally arbitrary.
+# With the current OpenRC, sysinit does almost nothing and boot
+# does almost everything.
rc::bootwait:/sbin/openrc boot
+# Start the s6 supervision tree.
+s6:12345:respawn:/sbin/s6-svscanboot
+
+# Wait for the supervision tree to be operational before launching services.
+s6n:12345:wait:/bin/sh -c 'until test -s /run/s6_ready ; do sleep 1 ; done'
+
l0:0:wait:/sbin/openrc shutdown
-l0s:0:wait:/sbin/halt -hnp
+l0s:0:wait:/sbin/poweroff -df
l1:1:wait:/sbin/openrc single
l2:2:wait:/sbin/openrc nonetwork
l3:3:wait:/sbin/openrc default
l4:4:wait:/sbin/openrc default
l5:5:wait:/sbin/openrc default
l6:6:wait:/sbin/openrc reboot
-l6r:6:wait:/sbin/reboot -fin
+l6r:6:wait:/sbin/reboot -df
#z6:6:respawn:/sbin/sulogin
# new-style single-user
su0:S:wait:/sbin/openrc single
su1:S:wait:/sbin/sulogin
-# We now delegate all "respawn" services, including terminals, to s6.
-s6:12345:respawn:/lib/s6/s6-svscanboot
-
# What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -r now
diff --git a/system/sysvinit/s6-svscanboot b/system/sysvinit/s6-svscanboot
new file mode 100644
index 000000000..8c134b485
--- /dev/null
+++ b/system/sysvinit/s6-svscanboot
@@ -0,0 +1,15 @@
+#!/bin/execlineb -P
+
+define RUNIMG /etc/s6-linux-init/current/run-image
+export PATH /usr/bin:/usr/sbin:/bin:/sbin
+umask 022
+redirfd -r 0 /dev/null
+if
+{
+ elglob -0 files ${RUNIMG}/*
+ cp -a $files /run/
+}
+redirfd -w 3 /run/s6_ready
+redirfd -wnb 1 /run/service/s6-svscan-log/fifo
+fdmove -c 2 1
+s6-svscan -St0 -d3 /run/service
diff --git a/system/sysvinit/sysvinit.post-install b/system/sysvinit/sysvinit.post-install
new file mode 100644
index 000000000..4548041d9
--- /dev/null
+++ b/system/sysvinit/sysvinit.post-install
@@ -0,0 +1,25 @@
+#!/bin/sh -e
+
+newv="$1"
+oldv="$2"
+
+cat <<EOF
+
+*
+* You installed the sysvinit package. If it's your first installation,
+* please ignore this message. But if you just removed the s6-linux-init
+* package in order to use sysvinit instead, please read on.
+*
+* In order to complete the switch, you need to reboot your machine. But
+* beware: just for this time, the usual shutdown commands won't work,
+* because they are designed to work with sysvinit but you are still
+* running s6-linux-init until you reboot. So, for your next reboot (and
+* only this one), the command you will need to run (as root, FROM A
+* CONSOLE TTY - not an xterm, not a network connection) is:
+*
+* /bin/sh /usr/share/s6-linux-init-common/reboot.sh
+*
+* Please save your work and perform that reboot as soon as you can.
+*
+
+EOF
diff --git a/system/utmps/APKBUILD b/system/utmps/APKBUILD
index 9ce4c0dda..78d3a176e 100644
--- a/system/utmps/APKBUILD
+++ b/system/utmps/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
pkgname=utmps
pkgver=0.0.2.1
-pkgrel=0
+pkgrel=1
pkgdesc="A secure utmp/wtmp implementation"
url="https://skarnet.org/software/$pkgname/"
arch="all"
@@ -33,12 +33,14 @@ build() {
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
- mkdir -p -m 0755 "$pkgdir/etc/s6/early-services/utmpd" "$pkgdir/etc/s6/early-services/wtmpd"
- cp -f "$srcdir/utmpd.run" "$pkgdir/etc/s6/early-services/utmpd/run"
- echo 3 > "$pkgdir/etc/s6/early-services/utmpd/notification-fd"
- cp -f "$srcdir/wtmpd.run" "$pkgdir/etc/s6/early-services/wtmpd/run"
- echo 3 > "$pkgdir/etc/s6/early-services/wtmpd/notification-fd"
- chmod 0755 "$pkgdir/etc/s6/early-services/utmpd/run" "$pkgdir/etc/s6/early-services/wtmpd/run"
+ runimage="$pkgdir/etc/s6-linux-init/current/run-image"
+ mkdir -p -m 0755 "$runimage/utmps" "$runimage/service/utmpd" "$runimage/service/wtmpd"
+ chown utmp:utmp "$runimage/utmps"
+ cp -f "$srcdir/utmpd.run" "$runimage/service/utmpd/run"
+ echo 3 > "$runimage/service/utmpd/notification-fd"
+ cp -f "$srcdir/wtmpd.run" "$runimage/service/wtmpd/run"
+ echo 3 > "$runimage/service/wtmpd/notification-fd"
+ chmod 0755 "$runimage/service/utmpd/run" "$runimage/service/wtmpd/run"
}
@@ -75,5 +77,5 @@ doc() {
}
sha512sums="e0ead9dc4085ce778f22831eec0f79ad251c6f5cb83afa6e52a9ab47a4a0037695e70c2ff0624da8b406a8e3c79f0c8653600bc541fad90c4e21d241c53c27aa utmps-0.0.2.1.tar.gz
-525d43e3eced30c564e5390fc715b6caa1ae2b6515a9e3bf01263ff3fb9379bd6908ed302d0d50b6568ac36ed44d272dcc44a683f9ae34d586d8ad17023ed6b1 utmpd.run
-93e4fae527ada9381e0b0a7ad5de9079e8d88959abd74fa5c0710c30c6153832abb010b57ddf83055ca34c032e7e5c9c1eedceb2f122a11ab20837ab66dcf5e2 wtmpd.run"
+0ec30284c64c6ea9f25142c5f4a643bd48b137fe85781b650104f5137ffa4dfc35ca7be3e41e3acd3403ebe1d8c5378073afa4e2f3607d3d794fcd9f98ed51c4 utmpd.run
+cba4f2ec3b8f5becf3ae57eecf584745d783046ee6cf5d116322421ad5ffd074d2955da22d31d2b5b1d05f906378aae92f221d2ac95ac21b54a361fbdc0566e7 wtmpd.run"
diff --git a/system/utmps/utmpd.run b/system/utmps/utmpd.run
index 5d66c183c..47bc824a2 100644
--- a/system/utmps/utmpd.run
+++ b/system/utmps/utmpd.run
@@ -1,8 +1,6 @@
#!/bin/execlineb -P
fdmove -c 2 1
-if { mkdir -p -m 0755 /run/utmps }
-if { chown utmp:utmp /run/utmps }
s6-setuidgid utmp
cd /run/utmps
fdmove 1 3
diff --git a/system/utmps/wtmpd.run b/system/utmps/wtmpd.run
index fa78806c9..ab5a40641 100644
--- a/system/utmps/wtmpd.run
+++ b/system/utmps/wtmpd.run
@@ -1,8 +1,6 @@
#!/bin/execlineb -P
fdmove -c 2 1
-if { mkdir -p -m 0755 /run/utmps }
-if { chown utmp:utmp /run/utmps }
s6-setuidgid utmp
cd /run/utmps
fdmove 1 3