3 : ${DATA_DIR=`dirname $0`/data}
5 : ${DIST_RELEASE=squeeze}
6 : ${CONF_DIR:=/etc/schroot/chroot.d}
7 : ${CHROOT_DIR:=/srv/chroot}
8 : ${ALTERNATIVE_EDITOR:=/usr/bin/vim.basic}
10 #Automatically generated variables
11 CHROOTNAME=$DIST_RELEASE-$ARCH
12 CHNAME=building_$CHROOTNAME
13 TEMP_CHROOT_CONF=$CONF_DIR/$CHNAME.conf
14 FINAL_CHROOT_CONF=$CHROOTNAME.conf
18 COMP_FILENAME=$CHROOTNAME.tar.gz
19 COMP_FILEPATH=$ROOT/$COMP_FILENAME
22 if [ $USER != 'root' ]
24 echo "This script requires root permissions to run"
28 if [ -f $TEMP_CHROOT_CONF ]
30 echo "The configuration file name for the temporary chroot"
31 echo " $TEMP_CHROOT_CONF"
32 echo "already exists."
33 echo "Remove it or change the CHNAME value in the script."
39 echo "The data directory"
41 echo "does not exist."
42 echo "Please, set the DATA_DIR environment variable so that it points to the"
43 echo "data directory."
53 #Install tools for building chroots
54 apt-get install -y schroot debootstrap
56 shopt -s expand_aliases
57 alias in_chroot='schroot -c $CHNAME -d / '
58 alias subst_variables='sed \
59 -e "s/\${ARCH}/$ARCH/" \
60 -e "s*\${CHDIR}*$CHDIR*" \
61 -e "s/\${CHNAME}/$CHNAME/" \
62 -e "s/\${CHROOTNAME}/$CHROOTNAME/" \
63 -e "s*\${CHROOT_DIR}*$CHROOT_DIR*" \
64 -e "s/\${COMP_FILENAME}/$COMP_FILENAME/" \
65 -e "s/\${DIST_RELEASE}/$DIST_RELEASE/"'
67 #Generate chroot configurations
68 cat $DATA_DIR/temp.schroot.conf.in | subst_variables > $TEMP_CHROOT_CONF
69 cat $DATA_DIR/final.schroot.conf.in | subst_variables > $FINAL_CHROOT_CONF
71 #Install the base system
72 debootstrap --arch $ARCH $DIST_RELEASE $CHDIR
74 APT_INSTALL="apt-get install -y --no-install-recommends"
76 echo "deb http://backports.debian.org/debian-backports" \
77 "$DIST_RELEASE-backports main contrib non-free" \
78 > $CHDIR/etc/apt/sources.list.d/backports.list
80 #Install all the packages
84 #Install selected packages from backports
86 apt-get -y --no-install-recommends -t squeeze-backports install \
91 $APT_INSTALL python-setuptools build-essential python-dev sudo automake \
92 fakeroot rsync locales less
94 echo "en_US.UTF-8 UTF-8" >> $CHDIR/etc/locale.gen
100 $APT_INSTALL lvm2 ssh bridge-utils iproute iputils-arping \
101 ndisc6 python python-pyopenssl openssl \
102 python-pyparsing python-simplejson \
103 python-pyinotify python-pycurl python-yaml python-mock \
107 $APT_INSTALL python-paramiko qemu-utils
110 easy_install affinity bitarray ipaddr
115 libghc6-parallel-dev libghc6-deepseq-dev \
119 $APT_INSTALL cabal-install
125 $APT_INSTALL libpcre3-dev
128 cabal install --global \
133 attoparsec==0.10.1.1\
134 quickcheck==2.5.1.1 \
136 monadcatchio-transformers==0.2.2.0 \
139 case-insensitive==0.3 \
148 #Python development tools
150 $APT_INSTALL pandoc python-epydoc graphviz
153 easy_install sphinx==1.1.3 \
155 logilab-astng==0.23.1 \
160 #Haskell development tools
162 cabal install --global \
168 test-framework==0.6.1 \
169 test-framework-hunit==0.2.7 \
170 test-framework-quickcheck2==0.2.12.3
173 cabal install --global shelltestrunner
177 update-alternatives --set editor $ALTERNATIVE_EDITOR
180 echo "Creating compressed schroot image..."
182 tar czf $COMP_FILEPATH ./*
187 rm -f $TEMP_CHROOT_CONF