From de52c10969201aed0bb6688e8cbb389f463e30dc Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 23 May 2017 12:49:39 +0200 Subject: bin/build-packages: set more useful default for -n --- bin/build-packages | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bin/build-packages') diff --git a/bin/build-packages b/bin/build-packages index f10f036..435d096 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -18,7 +18,7 @@ usage() { >&2 echo ' -h|--help: Show this help and exit.' >&2 echo ' -n count: Build $count packages (if available), then exit.' >&2 echo ' $count=0 is interpreted as infinity.' - >&2 echo ' The default is $count=1.' + >&2 echo ' The default is $count=1 or 0 iff -t or -x is given.' >&2 echo ' -t seconds: Do not request new assignment(s) $seconds seconds after start.' >&2 echo ' -x: If package build fails, do not request new assignment(s).' [ -z "$1" ] && exit 1 || exit $1 @@ -31,7 +31,7 @@ eval set -- "$( echo usage )" -count=1 +unset count exit_after_failure=false timeout=0 @@ -71,6 +71,14 @@ if [ $# -ne 0 ]; then usage fi +if [ -z "${count}" ]; then + if [ ${timeout} -ne 0 ] || ${exit_after_failure}; then + count=-1 + else + count=1 + fi +fi + if [ ${timeout} -ne 0 ]; then timeout=$[${timeout}+$(date +%s)] fi -- cgit v1.2.3-70-g09d2