#!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
# Stop udevd, we'll miss a few events while we run init, but we catch up
for proc in /proc/[0-9]*; do
[ -x $proc/exe ] || continue
[ "$(readlink $proc/exe)" != /sbin/udevd ] || kill ${proc#/proc/}
done
# ignore any failed event because the init script will trigger again all events
rm -rf /dev/.udev/queue/
# Move the real filesystem's /dev to beneath our tmpfs, then move it all
# to the real filesystem
mkdir -m 0700 -p /dev/.static/
mkdir /dev/.static/dev/
mount -n -o bind $rootmnt/dev /dev/.static/dev
mount -n -o move /dev $rootmnt/dev