]> git.donarmstrong.com Git - neurodebian.git/blob - tools/nd_adddist
BF: nd_adddist to use Ubuntu's keyring for Ubuntu chroots
[neurodebian.git] / tools / nd_adddist
1 #!/bin/bash
2
3 family=$1
4 dist=$2
5
6 set -e
7
8 if [ -z "$family" ]; then
9   echo "You need to provide a distribution family ('debian', 'ubuntu'); prefix with 'nd+' to enable the NeuroDebian repository."
10   exit 1
11 fi
12
13 if [ -z "$dist" ]; then
14   echo "You need to provide a distribution codename (e.g. 'lenny', 'squeeze')."
15   exit 1
16 fi
17
18
19 . /etc/neurodebian/cmdsettings.sh
20
21 # common options
22 opts="--distribution $dist --debootstrap debootstrap --aptcache $aptcache"
23
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"
27 fi
28
29 mkdir -p ${cowbuilderroot}/cow
30
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."
36     continue
37   fi
38   if [ "${family:0:3}" = "nd+" ]; then
39   echo "Including NeuroDebian repository..."
40     cowbuilder --create --basepath ${cow} $opts \
41                --components "$components" \
42                --mirror "$mirror" \
43                --debootstrapopts --arch=$a \
44                --othermirror "deb http://neuro.debian.net/debian $dist main contrib non-free"
45         # deploy our key manually since archive with package is not yet
46         # available at this point
47         cp --preserve=mode {,${cow}}/etc/apt/trusted.gpg.d/neurodebian-archive-keyring.gpg
48   else
49     cowbuilder --create --basepath ${cow} $opts \
50                --components "$components" \
51                --mirror "$mirror" \
52                --debootstrapopts --arch=$a
53   fi
54 done