3 DEBIAN_SARGE_MIRROR
="http://archive.debian.org/debian"
4 SARGE_DIST_NAME
="sarge"
5 DEBIAN_SARGE_BACKPORTS
="deb http://archive.debian.org/debian-backports sarge-backports main contrib"
8 echo "Usage: $0 <path to source code> <chroot location>"
12 # used to check for needed files/programs
13 verify_prog_requirements
() {
14 # debootstrap is needed
15 if [ "x`which debootstrap`" = "x" ]; then
16 echo "$0: cannot continue, please install debootstrap on your system"
19 echo "debootstrap location: `which debootstrap`"
22 if [ ! "x`whoami`" = "xroot" ]; then
23 echo "$0: you must be root to setup the chroot environment"
29 # sets up debian sarge system at the given path, binds src dir to directory within chroot
33 echo "Setting up chroot at $CHROOT_DIR..."
36 debootstrap
--arch i386
$SARGE_DIST_NAME $CHROOT_DIR $DEBIAN_SARGE_MIRROR/
38 echo "$0: debootstrap failed, exiting"
42 mkdir
$CHROOT_DIR/root
/openitg-dev
45 # first time setup script (sets up debian, retrieves correct packages)
46 cat <<! >$CHROOT_DIR/root
/first_time_setup.sh
49 echo -ne
"*******************\n* You are now in the OpenITG AC chroot environment\n*******************\n"
50 echo "Installing necessary dev packages..."
51 # non-free and contrib for the nvidia packages
52 echo "deb $DEBIAN_SARGE_MIRROR $SARGE_DIST_NAME main contrib non-free" >/etc
/apt
/sources.list
53 echo "$DEBIAN_SARGE_BACKPORTS" >>/etc
/apt
/sources.list
55 apt-get
install build-essential
gettext automake1.8 gcc g
++ 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 libasound2-dev git-core automake1.7 autoconf
gettext
56 echo "OpenITG AC chroot successfully set up!"
59 chmod +x
$CHROOT_DIR/root
/first_time_setup.sh
62 cat <<! >$CHROOT_DIR/chroot_bootstrap.sh
64 mount
-o
bind /proc
$CHROOT_DIR/proc
65 mount
-o
bind /sys
$CHROOT_DIR/sys
66 mount
-o
bind $SRC_DIR $CHROOT_DIR/root
/openitg-dev
67 chroot
$CHROOT_DIR /bin
/bash
69 chmod +x
$CHROOT_DIR/chroot_bootstrap.sh
71 mount
-o
bind /proc
$CHROOT_DIR/proc
72 mount
-o
bind /sys
$CHROOT_DIR/sys
73 mount
-o
bind $SRC_DIR $CHROOT_DIR/root
/openitg-dev
74 chroot
$CHROOT_DIR /root
/first_time_setup.sh
77 if [ "x$1" = "x" ]; then
80 if [ "x$2" = "x" ]; then
84 if [ ! -d
"$1" ]; then
85 echo "$0: Source code dir not found at $1"
89 verify_prog_requirements
91 SRC_DIR
="`(cd $1; pwd)`"
92 setup_chroot
$2 $SRC_DIR