From bdffaebe12c3012b9eda7ab57551fdfe53a2e412 Mon Sep 17 00:00:00 2001 From: Raphaƫl Hertzog Date: Wed, 18 Mar 2020 09:37:22 +0100 Subject: Minor cleanups in Require_stagefiles --- functions/stagefile.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'functions') diff --git a/functions/stagefile.sh b/functions/stagefile.sh index e0b4c51bb..40a1e2518 100755 --- a/functions/stagefile.sh +++ b/functions/stagefile.sh @@ -67,26 +67,22 @@ Remove_stagefile () Require_stagefiles () { if [ $# -eq 0 ]; then - Echo_warning "Bad `Require_stagefile` usage, no params were supplied" + Echo_warning "Bad 'Require_stagefiles' usage, no params were supplied" return 0 fi local FILE local MISSING="" - local MISSING_MULTIPLE=false + local MISSING_COUNT=0 for FILE in ${@}; do if [ ! -f ".build/${FILE}" ]; then - if [ -n "${MISSING}" ]; then - MISSING_MULTIPLE=true - fi + MISSING_COUNT=$(( $MISSING_COUNT + 1 )) MISSING="${MISSING:+$MISSING }${FILE}" fi done - if [ -z "${MISSING}" ]; then + if [ $MISSING_COUNT -eq 0 ]; then return 0 - fi - - if ! $MISSING_MULTIPLE; then + elif [ $MISSING_COUNT -eq 1 ]; 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" "${MISSING}" -- cgit v1.2.3