X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fschroot%2Ffiles%2Fsetup-all-dchroots;h=f70de6576c72aa499c7c773e587b31c759c15682;hb=58e31feb4bc56e87ef61c4c92cc1a091ad02d76a;hp=652d08b6538caa48c4ca3ededdace8ea3d9466f7;hpb=c5e660a55fca2dea5359be4884693ccf2d0746cc;p=mirror%2Fdsa-puppet.git diff --git a/modules/schroot/files/setup-all-dchroots b/modules/schroot/files/setup-all-dchroots index 652d08b65..f70de6576 100755 --- a/modules/schroot/files/setup-all-dchroots +++ b/modules/schroot/files/setup-all-dchroots @@ -28,65 +28,17 @@ # 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 - armhf|s390x) - echo "sid jessie wheezy" - ;; - ia64|s390) - echo "wheezy" - ;; - sparc) - echo "sid wheezy" - ;; - arm64|ppc64el) - echo "sid jessie" - ;; - amd64|i386) - echo "sid jessie wheezy squeeze" + amd64|i386|armel|armhf) + echo "sid bullseye buster stretch jessie" ;; *) - echo "sid jessie wheezy" + echo "sid bullseye buster stretch" ;; esac } -archs="$DPKGARCH" -case "$DPKGARCH" in - amd64) - archs="$archs i386" - ;; - 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 - ;; - s390|s390x) - archs="s390 s390x" - ;; -esac - -err=0 - do_one() { local a="$1"; shift local s="$1"; shift @@ -94,13 +46,13 @@ do_one() { case "$MODE" in buildd) mkdir -p /srv/buildd/unpack - if ! chronic setup-dchroot -f -a "$a" -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" "$s" + if ! $SILENT setup-dchroot $EXTRAARGS -f -a "$a" "$s" then return 1 fi @@ -112,8 +64,117 @@ do_one() { return 0 } +usage() +{ +cat << EOF +usage: $0 [] [buildd] + +OPTIONS: + -a limit to ARCH + -c write config only + -h this help + -s limit to SUITE +EOF +} + +########## +# "main" +########## + + +# parse options +########## +EXTRAARGS="" +limitarch="" +limitsuite="" +while getopts "cha:s:" OPTION +do + case $OPTION in + a) + limitarch="$OPTARG" + ;; + c) + EXTRAARGS="$EXTRAARGS -c" + ;; + h) + usage + exit 0 + ;; + s) + limitsuite="$OPTARG" + ;; + *) + 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 dpkg architecture +########## +DPKGARCH=$(dpkg --print-architecture) +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 + [ "$limitarch" != "" ] && [ "$limitarch" != "$a" ] && continue for s in `get_suites "$a"`; do + [ "$limitsuite" != "" ] && [ "$limitsuite" != "$s" ] && continue if ! do_one "$a" "$s"; then err=1 echo >&2