#!/bin/sh

[ ! $1 ] && exit 1
[ ! -d "$1" ] && exit 2

CONTAINER="$1"  #root-filesystem-x86_64-1.2.0

 busybox mount -o bind /proc ${CONTAINER}/proc
 busybox mount -o bind /sys ${CONTAINER}/sys
 busybox mount -o bind /dev ${CONTAINER}/dev
 busybox mount -o bind /dev/pts ${CONTAINER}/dev/pts
 busybox mount -o bind /dev/shm ${CONTAINER}/dev/shm

#for internet access...
cp -f /etc/resolv.conf ${CONTAINER}/etc/resolv.conf

chroot "$CONTAINER" #root-filesystem-x86_64-1.2.0

sync
busybox umount ${CONTAINER}/dev/shm
busybox umount ${CONTAINER}/dev/pts
busybox umount ${CONTAINER}/dev
busybox umount ${CONTAINER}/sys
busybox umount ${CONTAINER}/proc
