+# the shell really doesn't like having stdin/out closed
+# that's why we use /dev/pty/m0 and m1 as replacement
+# for /dev/console if there's no serial console available
+dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null && {
+ M0=/dev/console
+ M1=/dev/console
+}
+
+exec <$M0 >$M1 2>&0
+
+{
+ echo "- preinit -"
+ [ -e /etc/preinit.arch ] && . /etc/preinit.arch
+ set_state preinit
+
+ echo "$HOTPLUG" > /proc/sys/kernel/hotplug
+
+ eval ${FAILSAFE:+failsafe}
+ lock -w /tmp/.failsafe
+
+ mount_root
+
+ echo "- init -"
+} | tee /tmp/preinit.log