#!/bin/bash ## ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git ## # Copyright (c) 2013 Peter Palfrader # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. DPKGARCH=$(dpkg --print-architecture) UNAMEARCH=$(uname -m) if [ "${1:-}" = "buildd" ]; then MODE=buildd if ! [ -d /srv/buildd/ ]; then echo >&2 "Error: /srv/buildd does not exist or is not a directory." exit 1 fi else MODE=porterbox fi get_suites() { case "$1" in ia64|s390|sparc) echo "wheezy" ;; arm64|ppc64el) echo "sid stretch jessie" ;; amd64|i386) echo "sid stretch jessie wheezy squeeze" ;; kfreebsd-*) echo "sid jessie wheezy" ;; mips64el) echo "sid" ;; ppc64) echo "sid" ;; *) echo "sid stretch jessie wheezy" ;; esac } extra="" case `hostname` in pizzetti) archs="ppc64" extra="$extra -m http://ftp.de.debian.org/debian-ports" extra="$extra -k /root/debian-ports-archive-2015.gpg" extra="$extra -I debian-ports-archive-keyring" ;; *) archs="$DPKGARCH" case "$DPKGARCH" in amd64) archs="$archs i386" ;; arm64) archs="$archs armhf armel" ;; armhf) if [ "$(uname -m)" = "aarch64" ] ; then archs="$archs arm64" fi archs="$archs armel" ;; armel) if [ "$(uname -m)" = "armv7l" ] && grep -w vfpv3 -q /proc/cpuinfo ; then archs="$archs armhf" fi ;; mips64el) archs="$archs mipsel" ;; mipsel) if grep -w "Loongson-3" -q /proc/cpuinfo ; then archs="$archs mips64el" fi ;; s390|s390x) archs="s390 s390x" ;; esac ;; esac err=0 do_one() { local a="$1"; shift local s="$1"; shift case "$MODE" in buildd) mkdir -p /srv/buildd/unpack if ! chronic setup-dchroot -f -a "$a" $extra -D -d '/srv/buildd/unpack' -K "$s" then return 1 fi ;; porterbox) if ! chronic setup-dchroot -f -a "$a" $extra "$s" then return 1 fi ;; *) echo >&2 "Invalid mode $MODE" exit 1 esac return 0 } for a in $archs; do for s in `get_suites "$a"`; do if ! do_one "$a" "$s"; then err=1 echo >&2 echo >&2 "Error: setting up $s:$a dchroot failed." echo >&2 echo >&2 fi done done exit $err