]> git.donarmstrong.com Git - neurodebian.git/blob - tools/nd_adddist
RF+NF: deploy neurodebian apt key for nd+ cows
[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 mkdir -p ${cowbuilderroot}/cow
25
26 for a in i386 amd64; do
27   echo "Building $a base path..."
28   cow="${cowbuilderroot}/cow/${family}-${dist}-${a}.cow"
29   if [ -d "$cow" ]; then
30     echo "${cow} exists. Ignoring arch."
31     continue
32   fi
33   if [ "${family:0:3}" = "nd+" ]; then
34   echo "Including NeuroDebian repository..."
35     cowbuilder --create --basepath ${cow} $opts \
36                --components "$components" \
37                --mirror "$mirror" \
38                --debootstrapopts --arch --debootstrapopts $a \
39                --othermirror "deb http://neuro.debian.net/debian $dist main contrib non-free"
40         # deploy our key manually since archive with package is not yet
41         # available at this point
42         cp --preserve=mode {,${cow}}/etc/apt/trusted.gpg.d/neurodebian-archive-keyring.gpg
43   else
44     cowbuilder --create --basepath ${cow} $opts \
45                --components "$components" \
46                --mirror "$mirror" \
47                --debootstrapopts --arch --debootstrapopts $a
48   fi
49 done