summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-05-23 12:49:39 +0200
committerErich Eckner <git@eckner.net>2017-05-23 12:51:15 +0200
commitde52c10969201aed0bb6688e8cbb389f463e30dc (patch)
tree09f18fd0b0f1e977950a10e19853da448df16f53
parentac219a775d25a3bc43c9440c0914d07872f0eff7 (diff)
downloadbuilder-de52c10969201aed0bb6688e8cbb389f463e30dc.tar.xz
bin/build-packages: set more useful default for -n
-rwxr-xr-xbin/build-packages12
1 files changed, 10 insertions, 2 deletions
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