]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/porterbox/files/setup-all-dchroots
porterbox: support arm64 setup
[dsa-puppet.git] / modules / porterbox / 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 get_suites() {
35     case "$1" in
36       armhf|s390x)
37         echo "sid jessie wheezy"
38         ;;
39       ia64|s390)
40         echo "wheezy squeeze"
41         ;;
42       sparc)
43         echo "sid wheezy squeeze"
44         ;;
45       arm64)
46         echo "sid jessie"
47         ;;
48       *)
49         echo "sid jessie wheezy squeeze"
50         ;;
51     esac
52 }
53
54 archs="$DPKGARCH"
55 case "$DPKGARCH" in
56     amd64)
57         archs="$archs i386"
58         ;;
59     armhf)
60         if [ "$(uname -m)" = "aarch64" ] ; then
61             archs="$archs arm64"
62         fi
63         archs="$archs armel"
64         ;;
65     armel)
66         if [ "$(uname -m)" = "armv7l" ] && grep -w vfpv3 -q /proc/cpuinfo ; then
67             archs="$archs armhf"
68         fi
69         ;;
70     s390|s390x)
71         archs="s390 s390x"
72         ;;
73 esac
74
75 err=0
76
77 for a in $archs; do
78     for s in `get_suites "$a"`; do
79         if ! setup-dchroot -f -a "$a" "$s"; then
80             err=1
81             echo >&2
82             echo >&2 "Error: setting up $s:$a dchroot failed."
83             echo >&2
84             echo >&2
85         fi
86     done
87 done
88
89 exit $err