diff options
author | Raphaël Hertzog <hertzog@debian.org> | 2020-03-18 09:37:22 +0100 |
---|---|---|
committer | Raphaël Hertzog <hertzog@debian.org> | 2020-03-18 09:37:22 +0100 |
commit | bdffaebe12c3012b9eda7ab57551fdfe53a2e412 (patch) | |
tree | 6de5ef57dd210343d210e5af27591e7ea49f10ce /functions | |
parent | fb0790cc4379280084cc9a4469a515e243f45b9b (diff) | |
download | vyos-live-build-bdffaebe12c3012b9eda7ab57551fdfe53a2e412.tar.gz vyos-live-build-bdffaebe12c3012b9eda7ab57551fdfe53a2e412.zip |
Minor cleanups in Require_stagefiles
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/stagefile.sh | 14 |
1 files changed, 5 insertions, 9 deletions
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}" |