summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-03-14 04:37:56 +0000
committerLyndon Brown <jnqnfe@gmail.com>2020-03-17 22:59:34 +0000
commitfe0d2358b9777703effad9b29a1f54eeb65477f9 (patch)
treeb9b5256f71b3002985ed5a47d2c9b1b19c56092e
parent3bed138fda9b013c22cf9df685624d04e022bd95 (diff)
downloadvyos-live-build-fe0d2358b9777703effad9b29a1f54eeb65477f9.tar.gz
vyos-live-build-fe0d2358b9777703effad9b29a1f54eeb65477f9.zip
stagefiles: only list missing stages
-rwxr-xr-xfunctions/stagefile.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/functions/stagefile.sh b/functions/stagefile.sh
index 85e318600..6249e9cf9 100755
--- a/functions/stagefile.sh
+++ b/functions/stagefile.sh
@@ -72,20 +72,24 @@ Require_stagefile ()
fi
local FILE
- local MISSING=false
+ local MISSING=""
+ local MISSING_MULTIPLE=false
for FILE in ${@}; do
if [ ! -f ".build/${FILE}" ]; then
- MISSING=true
+ if [ -n "${MISSING}" ]; then
+ MISSING_MULTIPLE=true
+ fi
+ MISSING="${MISSING:+$MISSING }${FILE}"
fi
done
- if ! $MISSING; then
+ if [ -z "${MISSING}" ]; then
return 0
fi
- if [ $# -eq 1 ]; then
- Echo_error "the following stage is required to be completed first: %s" "${FILE}"
+ if ! $MISSING_MULTIPLE; then
+ Echo_error "the following stage is required to be done first: %s" "${MISSING}"
else
- Echo_error "the following stages are required to be completed first: %s" "$(echo ${@})"
+ Echo_error "the following stages are required to be completed first: %s" "${MISSING}"
fi
exit 1