#!/bin/sh
# Set up filesystem as root and pivot into it.

export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec < /dev/console > /dev/console 2> /dev/console

trap "echo \"Something wicked happened.  Press enter for rescue shell.\" ; read NULL ; exec sh" 0
set -e

. /lib/debian-installer/init-debug
debugshell "just booted"

echo "Setting default module loading path"
sysctl "kern.module_path=/lib/modules/`uname -r`;/boot/kernel" > /dev/null

echo "Setting up filesystem, please wait ..."
mount -o update,rw -t ufs /dev/md0 /
mount -t devfs devfs /dev
mount -t fdescfs fdescfs /dev/fd
mount /proc
ln -s /var/run/log /dev/log

# Close all open files on the initrd, and run busybox init.
debugshell "before init"
exec /bin/busybox init < /dev/console > /dev/console 2>&1
