SPS · log · files · refs · tags · releases · people · languages · GitHub · file
lib/mkiso/live-init
#!/bin/sh
# Compatibility wrapper. mkiso normally installs busybox or systemd as
# /sbin/init (an ELF). If this script is still PID 1, hand off to a real
# init. Do not exec a console here; that killed PID 1 on the old live TTY.
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
if [ -x /usr/lib/systemd/systemd ]; then
exec /usr/lib/systemd/systemd "$@"
fi
if [ -x /lib/systemd/systemd ]; then
exec /lib/systemd/systemd "$@"
fi
if [ -x /sbin/openrc-init ]; then
exec /sbin/openrc-init "$@"
fi
if [ -x /bin/busybox ]; then
exec /bin/busybox init
fi
# Last resort: stay PID 1 and spawn shells as children.
while :
do
[ -c /dev/tty1 ] && setsid /bin/sh -c 'exec /bin/sh <>/dev/tty1 >&0 2>&1' &
[ -c /dev/ttyS0 ] && setsid /bin/sh -c 'exec /bin/sh <>/dev/ttyS0 >&0 2>&1' &
wait
sleep 1
done