#!/bin/bash 
#M got to chroot in mountpoint /mnt/gentoo
# go into chroot
#
TARGET=/mnt/gentoo
# wechseln in chroot
# Speichern der Kernel CMDLINE
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
CMDLINE=`cat /proc/cmdline`
#umount /proc
cd ${TARGET}
#exec chroot . /bin/bash --login
echo "/usr/sbin/env-update" >${TARGET}/chrootrun
echo "source /etc/profile" >>${TARGET}/chrootrun
echo "#  insert all emerges here " >>${TARGET}/chrootrun
echo "/bin/bash" >>${TARGET}/chrootrun
echo 'export PS1="(chroot) $PS1"' >>${TARGET}/.bashrc
chmod a+x ${TARGET}/chrootrun
exec chroot ${TARGET} /chrootrun
umount ${TARGET}/proc
umount ${TARGET}/dev