mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
Use the sinit conventions for init
This should make it easier to switch out `init` for other versions, although the `getty` config still needs to be removed. - use `/bin/rc.init` for start - use `rc.shutdown` for stop - make `rc.init` run other code. - merge `containers` and `containerd` startup code Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
063d82c687
commit
08e211df44
@ -12,3 +12,4 @@ WORKDIR /
|
||||
COPY --from=mirror /out/ /
|
||||
COPY init /
|
||||
COPY etc etc/
|
||||
COPY bin bin/
|
||||
|
@ -110,3 +110,10 @@ mount --make-rshared /var
|
||||
|
||||
# make / rshared
|
||||
mount --make-rshared /
|
||||
|
||||
# execute other init processes
|
||||
INITS="$(find /etc/init.d -type f | sort)"
|
||||
for f in $INITS
|
||||
do
|
||||
$f &
|
||||
done
|
13
pkg/init/bin/rc.shutdown
Executable file
13
pkg/init/bin/rc.shutdown
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$1" = "reboot" ] && exec /sbin/reboot
|
||||
|
||||
# poweroff
|
||||
|
||||
/usr/sbin/killall5 -15
|
||||
/bin/sleep 5
|
||||
/usr/sbin/killall5 -9
|
||||
/sbin/swapoff -a
|
||||
/bin/echo "Unmounting filesystems"
|
||||
/bin/umount -a -r
|
||||
/sbin/poweroff -f
|
@ -1,5 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# set global ulimits TODO move to /etc/limits.conf
|
||||
ulimit -n 1048576
|
||||
ulimit -p unlimited
|
||||
|
||||
# bring up containerd
|
||||
printf "\nStarting containerd\n"
|
||||
/usr/bin/containerd &
|
||||
|
||||
# wait for socket to be there
|
||||
while [ ! -S /run/containerd/containerd.sock ]
|
||||
do
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
# start onboot containers, run to completion
|
||||
|
||||
if [ -d /containers/onboot ]
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# bring up containerd
|
||||
ulimit -n 1048576
|
||||
ulimit -p unlimited
|
||||
|
||||
printf "\nStarting containerd\n"
|
||||
mkdir -p /var/log
|
||||
exec /usr/bin/containerd
|
@ -1,15 +1,9 @@
|
||||
# /etc/inittab
|
||||
|
||||
::sysinit:/etc/init.d/rcS
|
||||
::once:/etc/init.d/containerd
|
||||
::once:/etc/init.d/containers
|
||||
::sysinit:/bin/rc.init
|
||||
|
||||
# Stuff to do for the 3-finger salute
|
||||
::ctrlaltdel:/sbin/reboot
|
||||
::ctrlaltdel:/bin/rc.shutdown reboot
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::shutdown:/usr/sbin/killall5 -15
|
||||
::shutdown:/bin/sleep 5
|
||||
::shutdown:/usr/sbin/killall5 -9
|
||||
::shutdown:/bin/echo "Unmounting filesystems"
|
||||
::shutdown:/bin/umount -a -r
|
||||
# Stuff to do on shutdown
|
||||
::shutdown:/bin/rc.shutdown poweroff
|
||||
|
Loading…
Reference in New Issue
Block a user