X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fschroot%2Ffiles%2Fsetup-all-dchroots;h=58d0eca44c505188b69880027a2153838b536c67;hb=25c2c4e1e742e042acd116cd1926f8d9f13673fb;hp=92e5e59a9bb526f9ab4ba4aee5e62b598f5d3e9b;hpb=bb6f9f0d6630835690b6a13335b4b2fd70643542;p=mirror%2Fdsa-puppet.git diff --git a/modules/schroot/files/setup-all-dchroots b/modules/schroot/files/setup-all-dchroots index 92e5e59a9..58d0eca44 100755 --- a/modules/schroot/files/setup-all-dchroots +++ b/modules/schroot/files/setup-all-dchroots @@ -31,82 +31,17 @@ 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 amd64|i386|armel|armhf) - echo "sid stretch jessie wheezy" - ;; - kfreebsd-*) - echo "sid jessie" + echo "sid buster stretch jessie" ;; - mips64el) - echo "sid stretch" - ;; - powerpc) - echo "sid jessie" - ;; - ppc64) - echo "sid" - ;; - ia64) - ;; *) - echo "sid stretch jessie" + echo "sid buster stretch" ;; 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-2017.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) - archs="$archs mips64el" - ;; - esac - ;; -esac - -err=0 - do_one() { local a="$1"; shift local s="$1"; shift @@ -114,13 +49,13 @@ do_one() { case "$MODE" in buildd) mkdir -p /srv/buildd/unpack - if ! chronic setup-dchroot -f -a "$a" $extra -D -d '/srv/buildd/unpack' -K "$s" + if ! $SILENT setup-dchroot $EXTRAARGS -f -a "$a" -D -d '/srv/buildd/unpack' -K "$s" then return 1 fi ;; porterbox) - if ! chronic setup-dchroot -f -a "$a" $extra "$s" + if ! $SILENT setup-dchroot $EXTRAARGS -f -a "$a" "$s" then return 1 fi @@ -132,6 +67,103 @@ do_one() { return 0 } +usage() +{ +cat << EOF +usage: $0 [] [buildd] + +OPTIONS: + -c write config only + -h this help +EOF +} + +########## +# "main" +########## + + +# parse options +########## +EXTRAARGS="" +while getopts "cu" OPTION +do + case $OPTION in + c) + EXTRAARGS="$EXTRAARGS -c" + ;; + h) + usage + exit 0 + ;; + *) + usage >&2 + exit 1 + ;; + esac +done +shift $(($OPTIND - 1)) + +# parse arguments +########## +if [ "$#" -gt 1 ]; then + usage >&2 + exit 1 +elif [ "$#" = 1 ]; then + 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 + usage >&2 + exit 1 + fi +else + MODE=porterbox +fi + +# figure out whether to be verbose or not +########## +if [ -t 0 ] ; then + SILENT="" +else + SILENT="chronic" +fi + + +# get list of archs based on DPKGARCH +########## +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) + archs="$archs mips64el" + ;; +esac + +err=0 + for a in $archs; do for s in `get_suites "$a"`; do if ! do_one "$a" "$s"; then