3 DEBIAN_MIRROR
="http://ftp.us.debian.org/debian"
4 DEBIAN_DIST_NAME
="squeeze"
5 #DEBIAN_SARGE_BACKPORTS="deb http://archive.debian.org/debian-backports sarge-backports main contrib"
8 if [ "$UNAME_M" == "x86_64" ]; then
9 echo "Detected 64-bit: $UNAME_M"
12 echo "Detected 32-bit: $UNAME_M"
17 echo "Usage: $0 <path to source code> <chroot location>"
21 # used to check for needed files/programs
22 verify_prog_requirements
() {
23 # debootstrap is needed
24 if [ "x`which debootstrap`" = "x" ]; then
25 echo "$0: cannot continue, please install debootstrap on your system"
28 echo "debootstrap location: `which debootstrap`"
31 if [ ! "x`whoami`" = "xroot" ]; then
32 echo "$0: you must be root to setup the chroot environment"
38 # sets up debian sarge system at the given path, binds src dir to directory within chroot
42 echo "Setting up chroot at $CHROOT_DIR..."
45 debootstrap
--arch
$ARCH $DEBIAN_DIST_NAME $CHROOT_DIR $DEBIAN_MIRROR/
47 echo "$0: debootstrap failed, exiting"
51 mkdir
$CHROOT_DIR/root
/openitg-dev
54 # first time setup script (sets up debian, retrieves correct packages)
55 cat <<! >$CHROOT_DIR/root
/first_time_setup.sh
58 echo -ne
"*******************\n* You are now in the OpenITG Home Build chroot environment\n*******************\n"
59 echo "Installing necessary dev packages..."
60 # non-free and contrib for the nvidia packages
61 echo "deb http://ftp.debian.org/debian squeeze main contrib non-free" >/etc
/apt
/sources.list
63 apt-get
install build-essential
gettext automake1.9 gcc g
++ libswscale-dev libavcodec-dev libavformat-dev libxt-dev libogg-dev libpng-dev libjpeg-dev libvorbis-dev libusb-dev libglu1-mesa-dev libx11-dev libxrandr-dev liblua50-dev liblualib50-dev nvidia-glx-dev libmad0-dev libasound-dev git-core
64 echo "OpenITG HOME chroot successfully set up!"
67 chmod +x
$CHROOT_DIR/root
/first_time_setup.sh
70 cat <<! >$CHROOT_DIR/chroot_bootstrap.sh
72 mount
-o
bind /proc
$CHROOT_DIR/proc
73 mount
-o
bind /sys
$CHROOT_DIR/sys
74 mount
-o
bind $SRC_DIR $CHROOT_DIR/root
/openitg-dev
75 chroot
$CHROOT_DIR /bin
/bash
77 chmod +x
$CHROOT_DIR/chroot_bootstrap.sh
79 mount
-o
bind /proc
$CHROOT_DIR/proc
80 mount
-o
bind /sys
$CHROOT_DIR/sys
81 mount
-o
bind $SRC_DIR $CHROOT_DIR/root
/openitg-dev
82 chroot
$CHROOT_DIR /root
/first_time_setup.sh
85 if [ "x$1" = "x" ]; then
88 if [ "x$2" = "x" ]; then
92 if [ ! -d
"$1" ]; then
93 echo "$0: Source code dir not found at $1"
97 verify_prog_requirements
99 SRC_DIR
="`(cd $1; pwd)`"
100 setup_chroot
$2 $SRC_DIR