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 if echo $family | grep -q debian; then
30 # Use debian keyring since otherwise debootstrap would fail (on Ubuntu)
31 opts+=" --debootstrapopts --keyring=/usr/share/keyrings/debian-archive-keyring.gpg"
34 mkdir -p ${cowbuilderroot}/cow
36 for a in i386 amd64; do
37 echo "Building $a base path..."
38 cow="${cowbuilderroot}/cow/${family}-${dist}-${a}.cow"
39 if [ -d "$cow" ]; then
40 echo "${cow} exists. Ignoring arch."
43 if [ "${family:0:3}" = "nd+" ]; then
44 echo "Including NeuroDebian repository..."
45 # If it has updates -- enable them
46 if wget -q -O/dev/null $mirror/dists/$dist-updates; then
47 updates_apt="deb $mirror $dist-updates $components |"
48 updates_apt+="#deb-src $mirror $dist-updates $components |"
52 cowbuilder --create --basepath ${cow} $opts \
53 --components "$components" \
55 --debootstrapopts --arch=$a \
56 --othermirror "${updates_apt}deb http://neuro.debian.net/debian $dist main contrib non-free | deb http://neuro.debian.net/debian data main contrib non-free"
57 # deploy our key manually since archive with package is not yet
58 # available at this point
59 mkdir -p ${cow}/etc/apt/trusted.gpg.d
60 cp --preserve=mode {,${cow}}/etc/apt/trusted.gpg.d/neurodebian-archive-keyring.gpg
61 # Old ubuntus might not have capability to read from that key yet,
62 # so we would need to manually add it
63 if [ $dist = 'karmic' ] || [ $dist = 'hardy' ]; then
64 chroot ${cow} bash -c "apt-get install -y --force-yes gnupg \
65 && /usr/bin/apt-key add /etc/apt/trusted.gpg.d/neurodebian-archive-keyring.gpg \
66 && /usr/bin/apt-get update"
69 cowbuilder --create --basepath ${cow} $opts \
70 --components "$components" \
72 --debootstrapopts --arch=$a