Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

78 lines (64 sloc) 1.335 kb
#!/bin/sh
# echo "Starting shell from md boot"
# exec sh
/sbin/mount_tmpfs tmpfs /tmp
/sbin/mount_tmpfs tmpfs /var
mkdir /var/tmp
mkdir /var/run
rescue_shell() {
echo "Starting recovery shell!"
exec sh
exit 0
}
# Start udevd
/sbin/udevd
for rcs in /etc/rc.*; do
if [ -x $rcs ]; then
. $rcs
fi
done
echo "Mounting new root"
IFS=':'
REAL_ROOT=`sysctl -n vfs.real_root`
if [ "$?" -ne "0" ]; then
echo "Kernel does not have vfs.real_root sysctl. Please update your" \
"kernel if you intend to use initrd"
rescue_shell
fi
set -- $REAL_ROOT
TYPE=$1
unset IFS
if [ "$TYPE" = "local" ]; then
FSTYPE=$2
MOUNTFROM=$3
# Make sure MOUNTFROM begins with /dev/
substr="${MOUNTFROM##/dev/}"
if [ "$substr" = "$MOUNTFROM" ]; then
MOUNTFROM="/dev/$MOUNTFROM"
fi
echo "executing /sbin/mount -t $FSTYPE $4 $MOUNTFROM /new_root"
/sbin/mount -o ro -t $FSTYPE $4 $MOUNTFROM /new_root
if [ "$?" -ne "0" ]; then
rescue_shell
fi
else
if [ -x "/etc/rcmount_${TYPE}" ]; then
. /etc/rcmount_${TYPE} $@
if [ "$?" -ne "0" ]; then
rescue_shell
fi
else
rescue_shell
fi
fi
# Stop udevd
read UDEVD_PID < /var/run/udevd.pid
kill $UDEVD_PID
# Clean up
rm -rf /var/*
rm -rf /tmp/*
/sbin/umount /var
/sbin/umount /tmp
echo "Mounting devfs on new root"
#/sbin/mount_devfs /new_root/dev
/sbin/mount_null /dev /new_root/dev
Jump to Line
Something went wrong with that request. Please try again.