]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/schroot/files/setup-all-dchroots
Create mips64el chroots on Loongson 3 buildds, II
[dsa-puppet.git] / modules / schroot / files / setup-all-dchroots
1 #!/bin/bash
2
3 ##
4 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
5 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
6 ##
7
8 # Copyright (c) 2013 Peter Palfrader
9 #
10 # Permission is hereby granted, free of charge, to any person
11 # obtaining a copy of this software and associated documentation
12 # files (the "Software"), to deal in the Software without
13 # restriction, including without limitation the rights to use,
14 # copy, modify, merge, publish, distribute, sublicense, and/or sell
15 # copies of the Software, and to permit persons to whom the
16 # Software is furnished to do so, subject to the following
17 # conditions:
18 #
19 # The above copyright notice and this permission notice shall be
20 # included in all copies or substantial portions of the Software.
21 #
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
24 # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
27 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29 # OTHER DEALINGS IN THE SOFTWARE.
30
31 DPKGARCH=$(dpkg --print-architecture)
32 UNAMEARCH=$(uname -m)
33
34 if [ "${1:-}" = "buildd" ]; then
35     MODE=buildd
36     if ! [ -d /srv/buildd/ ]; then
37         echo >&2 "Error: /srv/buildd does not exist or is not a directory."
38         exit 1
39     fi
40 else
41     MODE=porterbox
42 fi
43
44 get_suites() {
45     case "$1" in
46       ia64|s390|sparc)
47         echo "wheezy"
48         ;;
49       arm64|ppc64el)
50         echo "sid stretch jessie"
51         ;;
52       amd64|i386)
53         echo "sid stretch jessie wheezy squeeze"
54         ;;
55       kfreebsd-*)
56         echo "sid         jessie wheezy"
57         ;;
58       mips64el)
59         echo "sid"
60         ;;
61       ppc64)
62         echo "sid"
63         ;;
64       *)
65         echo "sid stretch jessie wheezy"
66         ;;
67     esac
68 }
69
70 extra=""
71
72 case `hostname` in
73     pizzetti)
74         archs="ppc64"
75         extra="$extra -m http://ftp.de.debian.org/debian-ports"
76         extra="$extra -k /root/debian-ports-archive-2015.gpg"
77         extra="$extra -I debian-ports-archive-keyring"
78         ;;
79     *)
80         archs="$DPKGARCH"
81         case "$DPKGARCH" in
82             amd64)
83                 archs="$archs i386"
84                 ;;
85             arm64)
86                 archs="$archs armhf armel"
87                 ;;
88             armhf)
89                 if [ "$(uname -m)" = "aarch64" ] ; then
90                     archs="$archs arm64"
91                 fi
92                 archs="$archs armel"
93                 ;;
94             armel)
95                 if [ "$(uname -m)" = "armv7l" ] && grep -w vfpv3 -q /proc/cpuinfo ; then
96                     archs="$archs armhf"
97                 fi
98                 ;;
99             mips64el)
100                 archs="$archs mipsel"
101                 ;;
102             mipsel)
103                 if grep -w "Loongson-3" -q /proc/cpuinfo ; then
104                     archs="$archs mips64el"
105                 fi
106                 ;;
107             s390|s390x)
108                 archs="s390 s390x"
109                 ;;
110         esac
111     ;;
112 esac
113
114 err=0
115
116 do_one() {
117     local a="$1"; shift
118     local s="$1"; shift
119
120     case "$MODE" in
121         buildd)
122             mkdir -p /srv/buildd/unpack
123             if ! chronic setup-dchroot -f -a "$a" $extra -D -d '/srv/buildd/unpack' -K "$s"
124             then
125                 return 1
126             fi
127             ;;
128         porterbox)
129             if ! chronic setup-dchroot -f -a "$a" $extra "$s"
130             then
131                 return 1
132             fi
133             ;;
134         *)
135             echo >&2 "Invalid mode $MODE"
136             exit 1
137     esac
138     return 0
139 }
140
141 for a in $archs; do
142     for s in `get_suites "$a"`; do
143         if ! do_one "$a" "$s"; then
144             err=1
145             echo >&2
146             echo >&2 "Error: setting up $s:$a dchroot failed."
147             echo >&2
148             echo >&2
149         fi
150     done
151 done
152
153 exit $err