Awful
[openitg.git] / startchroot.sh
1 #!/bin/sh
2
3 if [ ! "x`whoami`" = "xroot" ]; then
4 echo "$0: you must be root to setup the chroot environment"
5 exit 1;
6 fi
7
8 if [ ! -d "$1" ]; then
9 echo "Usage: startchroot.sh path-to-chroot"
10 exit 1;
11 fi
12
13 mount -o bind /proc $1/proc && mount -o bind /sys $1/sys && mount -o bind `pwd` $1/root/openitg-dev && echo "To enter the chroot, run 'sudo chroot $1'" && exit 0;
14
15 cat <<!
16 Error mounting one of the mounts. You should manually run:
17
18 mount -o bind /proc $1/proc
19 mount -o bind /sys $1/sys
20 mount -o bind `pwd` $1/root/openitg-dev
21
22 And check if any fail, then run:
23
24 sudo chroot $1
25 !
26 exit 1;
27