Create directory for output list file if it doesn't exist 96/113096/1
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>
Thu, 24 Sep 2020 10:09:22 +0000 (12:09 +0200)
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>
Thu, 24 Sep 2020 10:09:22 +0000 (12:09 +0200)
Should the output list file directory passed as second param
not exist the script would fail.

Change-Id: I4586df54b42eba2ace49f6aaf03b68042354b44a
Issue-ID: OOM-2578
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
build/creating_data/docker-images-collector.sh

index 8789350..a9129c8 100755 (executable)
@@ -82,6 +82,11 @@ if [ ! -f "${PROJECT_DIR}/../Makefile" ]; then
 elif [ -z "${LIST}" ]; then
     mkdir -p ${LISTS_DIR}
     LIST="${LISTS_DIR}/${PROJECT}_docker_images.list"
+else
+    # $2 is not empty - ensure LIST path exists
+    LIST_DIR="$(dirname ${LIST})"
+    mkdir -p "${LIST_DIR}"
+    MSG="${LIST_DIR} didn't exist, created\n"
 fi
 
 if [ -e "${LIST}" ]; then