#!/bin/sh
# This is ~/bin/do_chroot
# It mounts the Sharp MM10 / and /boot and chroots:
echo "mounting /dev/sharp/mm3 on /mnt/gentoo32 for 32-bit gentoo chroot build"
mount -t ext3 /dev/sharp/mm3 /mnt/gentoo32
echo "  mounting /dev/sharp/mm1 on /mnt/gentoo32/boot..."
mount -t ext3 /dev/sharp/mm1 /mnt/gentoo32/boot
echo "  mounting /proc and /dev..."
#mount -o bind /dev /mnt/gentoo32/dev
#mount -o bind /dev/pts /mnt/gentoo32/dev/pts
#mount -o bind /dev/shm /mnt/gentoo32/dev/shm
mount -o bind /proc /mnt/gentoo32/proc
#mount -o bind /proc/bus/usb /mnt/gentoo32/proc/bus/usb
mount -o bind /sys /mnt/gentoo32/sys
echo "  mounting nfs shares in portage tree..."
mount /mnt/gentoo32/usr/portage/packages
mount /mnt/gentoo32/usr/portage/distfiles
cd /mnt/gentoo32
echo "chrooting into /mnt/gentoo32..."
linux32 chroot /mnt/gentoo32 /bin/bash
echo "exiting chroot in /mnt/gentoo32..."
echo "un-mounting all..."
umount /mnt/gentoo32/usr/portage/distfiles
umount /mnt/gentoo32/usr/portage/packages
umount /mnt/gentoo32/sys
#umount /mnt/gentoo32/proc/bus/usb
umount /mnt/gentoo32/proc
#umount /mnt/gentoo32/dev/pts
#umount /mnt/gentoo32/dev/shm
#umount /mnt/gentoo32/dev
umount /mnt/gentoo32/boot
sleep 5
cd
umount /mnt/gentoo32
