From: Peter Palfrader Date: Thu, 16 Aug 2018 08:01:01 +0000 (+0200) Subject: setup-all-dchroots: move all main code to after function declarations X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=b0a49d0c8c18d1f3436b89c5ff5d17419e2e39f0;p=mirror%2Fdsa-puppet.git setup-all-dchroots: move all main code to after function declarations --- diff --git a/modules/schroot/files/setup-all-dchroots b/modules/schroot/files/setup-all-dchroots index df7d66a4e..1031b5e63 100755 --- a/modules/schroot/files/setup-all-dchroots +++ b/modules/schroot/files/setup-all-dchroots @@ -31,6 +31,42 @@ DPKGARCH=$(dpkg --print-architecture) UNAMEARCH=$(uname -m) +get_suites() { + case "$1" in + amd64|i386|armel|armhf) + echo "sid buster stretch jessie" + ;; + *) + echo "sid buster stretch" + ;; + esac +} + +do_one() { + local a="$1"; shift + local s="$1"; shift + + case "$MODE" in + buildd) + mkdir -p /srv/buildd/unpack + if ! $SILENT setup-dchroot $extraargs -f -a "$a" $extra -D -d '/srv/buildd/unpack' -K "$s" + then + return 1 + fi + ;; + porterbox) + if ! $SILENT setup-dchroot $extraargs -f -a "$a" $extra "$s" + then + return 1 + fi + ;; + *) + echo >&2 "Invalid mode $MODE" + exit 1 + esac + return 0 +} + usage() { cat << EOF @@ -85,16 +121,6 @@ else SILENT="chronic" fi -get_suites() { - case "$1" in - amd64|i386|armel|armhf) - echo "sid buster stretch jessie" - ;; - *) - echo "sid buster stretch" - ;; - esac -} extra="" @@ -127,31 +153,6 @@ esac err=0 -do_one() { - local a="$1"; shift - local s="$1"; shift - - case "$MODE" in - buildd) - mkdir -p /srv/buildd/unpack - if ! $SILENT setup-dchroot $extraargs -f -a "$a" $extra -D -d '/srv/buildd/unpack' -K "$s" - then - return 1 - fi - ;; - porterbox) - if ! $SILENT setup-dchroot $extraargs -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