8 if [ -z "$family" ]; then
9 echo "You need to provide a distribution family ('debian', 'ubuntu'); prefix with 'nd+' to enable the NeuroDebian repository."
13 if [ -z "$dist" ]; then
14 echo "You need to provide a distribution codename (e.g. 'lenny', 'squeeze')."
19 . /etc/neurodebian/cmdsettings.sh
22 opts="--distribution $dist --debootstrap debootstrap --aptcache $aptcache"
24 if echo $family | grep -q ubuntu; then
25 # Use ubuntu's keyring since otherwise debootstrap would fail
26 opts+=" --debootstrapopts --keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg"
29 mkdir -p ${cowbuilderroot}/cow
31 for a in i386 amd64; do
32 echo "Building $a base path..."
33 cow="${cowbuilderroot}/cow/${family}-${dist}-${a}.cow"
34 if [ -d "$cow" ]; then
35 echo "${cow} exists. Ignoring arch."
38 if [ "${family:0:3}" = "nd+" ]; then
39 echo "Including NeuroDebian repository..."
40 # If it has updates -- enable them
41 if wget -q -O/dev/null $mirror/dists/$dist-updates; then
42 updates_apt="deb $mirror $dist-updates $components |"
43 updates_apt+="#deb-src $mirror $dist-updates $components |"
47 cowbuilder --create --basepath ${cow} $opts \
48 --components "$components" \
50 --debootstrapopts --arch=$a \
51 --othermirror "${updates_apt}deb http://neuro.debian.net/debian $dist main contrib non-free"
52 # deploy our key manually since archive with package is not yet
53 # available at this point
54 mkdir -p ${cow}/etc/apt/trusted.gpg.d
55 cp --preserve=mode {,${cow}}/etc/apt/trusted.gpg.d/neurodebian-archive-keyring.gpg
56 # Old ubuntus might not have capability to read from that key yet,
57 # so we would need to manually add it
58 if [ $dist = 'karmic' ] || [ $dist = 'hardy' ]; then
59 chroot ${cow} bash -c "apt-get install -y --force-yes gnupg \
60 && /usr/bin/apt-key add /etc/apt/trusted.gpg.d/neurodebian-archive-keyring.gpg \
61 && /usr/bin/apt-get update"
64 cowbuilder --create --basepath ${cow} $opts \
65 --components "$components" \
67 --debootstrapopts --arch=$a