#!/bin/sh
# Last checkpoint before /init execs run-init (switch_root). Logged to
# /boot/dekroot.log so a failed switch_root can be told apart from a failed
# mountroot.

B=/dev/sda2
mkdir -p /tmp/dlog3
if mount -o rw "$B" /tmp/dlog3 2>/dev/null; then
    {
        echo "--- init-bottom (about to run-init) ---"
        echo "rootmnt entries: $(ls /root 2>/dev/null | tr '\n' ' ')"
        echo "run-init present: $(ls -l /root/bin/run-init 2>&1)"
    } >> /tmp/dlog3/dekroot.log
    umount /tmp/dlog3 2>/dev/null
fi
echo "deklog: init-bottom reached, about to exec run-init" > /dev/kmsg
