#!/bin/sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

#/bin/mount -t proc /proc /proc
echo "Mounting image filesystem..."
/bin/mount -t ext2 /dev/hda3 /mnt
echo "Creating root filesystem..."
/bin/zcat /mnt/costroot.img > /dev/ram0

/bin/umount /mnt

echo "Mounting proc filesystem"
/bin/mount -t proc /proc proc
echo "Mounting RAM filesystem"
/bin/mount -t ext2 /dev/ram0 /sysroot
cd /sysroot
/sbin/pivot_root . initrd
exec /usr/sbin/chroot . /bin/sh -c '/bin/umount /initrd/proc; exec /sbin/init <dev/console >dev/console 2>&1' 
