From 3628175efcce4af76c4cc067813469f9db65897f Mon Sep 17 00:00:00 2001 From: "Anderson, Craig (ca846m)" Date: Tue, 6 Apr 2021 13:23:27 -0700 Subject: [PATCH] Syntax expansion bugfix for linting suggestion Fix to use '$$' instead of '$' for proper variable expansion. Add check to fail build if list is empty. Change-Id: Ia86f789e49538fff02c56f63079aef4eb3f01b5d --- image-builder/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/image-builder/Makefile b/image-builder/Makefile index 7998a3f..2579528 100644 --- a/image-builder/Makefile +++ b/image-builder/Makefile @@ -113,7 +113,11 @@ ifeq ($(IMAGE_TYPE), iso) else # Assemble all images based on configs defined in each subdirectory # Trailing / allows proper function with symlinks - iterDirs="$(find $(QCOW_BUNDLE)/ -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)" + iterDirs="$$(find $(QCOW_BUNDLE)/ -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)" + if [[ -z $$iterDirs ]]; then + echo "Could not find any qcow images defined for bundle - exiting." + exit 1 + fi for subdir in $$iterDirs; do # QCOW configs export osconfig_params="$(QCOW_BUNDLE)/$$subdir/osconfig-vars.yaml" @@ -137,8 +141,12 @@ ifneq ($(QCOW_BUNDLE_DIRS), ) else # Assemble all images based on configs defined in each $(IMAGE_TYPE)* subdirectory # Trailing / allows proper function with symlinks - bundleDirs="$(find $(WORKDIR)/ -maxdepth 1 -mindepth 1 -name "qcow-bundle*" -type d -exec basename {} \;)" + bundleDirs="$$(find $(WORKDIR)/ -maxdepth 1 -mindepth 1 -name "qcow-bundle*" -type d -exec basename {} \;)" endif + if [[ -z $$bundleDirs ]]; then + echo "Could not find any qcow bundle directories - exiting." + exit 1 + fi for bundledir in $$bundleDirs; do export QCOW_BUNDLE="$(WORKDIR)/$$bundledir" sudo -E make cut_image