Check for chroot dir and chroot if necessary.

This commit is contained in:
Bob Lantz
2013-09-11 12:00:13 -07:00
committed by Brian O'Connor
parent 226a1dc391
commit 5413d2e5a3
+9 -1
View File
@@ -33,4 +33,12 @@ if [ -d "$cgroup" ]; then
cg="-g $host"
fi
exec sudo mnexec -a $pid $cg $cmd
# Check whether host should be running in a chroot dir
rootdir="/var/run/mn/$host/root"
if [ -d $rootdir ]; then
cmd="'cd `pwd`; exec $cmd'"
cmd="chroot $rootdir bash -c $cmd"
fi
cmd="exec sudo mnexec -a $pid $cg $cmd"
eval $cmd