Switch to non-PID1 init

This commit is contained in:
Neale Pickett 2023-12-20 14:24:48 -07:00
parent deb70725bb
commit 7f8a16da8a
6 changed files with 23 additions and 10 deletions

View File

@ -1,5 +1,5 @@
FROM alpine FROM alpine
RUN apk update RUN apk add --no-cache alpine-conf doas runit openssh-server
RUN apk add alpine-conf doas runit openssh-server
COPY etc/ /etc/ COPY etc/ /etc/
CMD [ "/sbin/runit" ] COPY /sbin /sbin/
CMD [ "/sbin/toolbox-init" ]

View File

@ -40,6 +40,16 @@ Once set up,
you should be able to ssh in for most of your needs. you should be able to ssh in for most of your needs.
Startup scripts
---------------
The system uses [runit](http://smarden.org/runit/).
If you drop an executable in `/etc/service/*/run`,
runit will run it.
Be sure to `lbu commit` if you're making startup scripts.
Podman vs Docker Podman vs Docker
---------------- ----------------

View File

@ -0,0 +1,3 @@
-/etc/apk/protected_paths.d/toolbox.list
-/etc/service/*/supervise
-/etc/service/*/log/supervise

View File

@ -1,3 +0,0 @@
#! /bin/sh
exec /sbin/runsvdir /etc/service

View File

@ -1,3 +0,0 @@
#! /bin/sh
echo "*** Goodbye."

View File

@ -1,5 +1,8 @@
#! /bin/sh #! /bin/sh
exec > /var/log/boot.log
exec 2>&1
error () { error () {
printf '\033[31mFLAGRANT SYSTEM ERROR\033[0m - %s' "$*" >> /etc/motd printf '\033[31mFLAGRANT SYSTEM ERROR\033[0m - %s' "$*" >> /etc/motd
} }
@ -13,8 +16,11 @@ apkovl=/mnt/toolbox/lbu/$(hostname).apkovl.tar.gz
if [ -f $apkovl ]; then if [ -f $apkovl ]; then
tar xf $apkovl || error "restoring system: untar $apkovl failed" tar xf $apkovl || error "restoring system: untar $apkovl failed"
else else
echo "$apkovl missing, skipping restore" echo "$apkovl missing; run 'lbu commit' to create it"
fi fi
echo "*** Updating packages" echo "*** Updating packages"
apk fix apk fix
echo "*** Handing off to runsvdir"
exec /sbin/runsvdir /etc/service