#!/bin/sh
# initrd Boot RC file
# chntpw boot floppy support script
# (c) 2004 Petter N Hagen
# Some of this is ripped from "floppyfw" by Thomasez@zelow.no

/bin/busybox echo "Booting ntpasswd" 

PATH="/bin:/sbin:/usr/bin:/usr/sbin"
TERM=linux
export PATH TERM
umask 022

/bin/busybox mkdir /nyroot
/bin/busybox mount -n -t tmpfs tmpfs /nyroot
cd nyroot

# Blatantly borrowed from Rob Fowler 
# (from a mail on the busybox mailing list)
# copy over most of the filesystem

/bin/busybox echo "Copying to new filesystem."
for ii in /*
do
        case $ii in
        /lost+found|/nyroot|/proc|/dev)
                ;;
        *)
                /bin/busybox cp -dpR $ii /nyroot/.
                /bin/busybox echo -n $ii" "
        esac
done
/bin/busybox echo "Done."

/bin/busybox mkdir initrd

/bin/busybox mkdir dev
/bin/busybox mount -t devfs none dev

/bin/busybox echo -n "Pivoting.. "
/bin/busybox pivot_root . initrd

/bin/busybox echo "Done,"

cd /

/bin/busybox echo "Mounting: proc"
/bin/busybox mkdir proc
/bin/busybox mount -t proc /proc /proc

/bin/busybox --install -s

/bin/busybox echo "Ramdisk setup complete, stage separation.."

exec chroot . /bin/sh /scripts/stage2 <dev/console >dev/console 2>&1

echo ", off bottom!??!"

