From 9376ffb2a288fd4bcb718daccca70afae003d001 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 2 Jun 2023 10:03:02 -0700 Subject: [PATCH] Fix a few edge cases in "apply-templates.sh" When a version doesn't exist but needs to, we need to actually create the directory. It also gives us a cleaner build (especially in the face of leftover files) if we purge the directory beforehand so that we know the end result is "canonical". --- apply-templates.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apply-templates.sh b/apply-templates.sh index bd72b0c8..3d1091c4 100755 --- a/apply-templates.sh +++ b/apply-templates.sh @@ -32,9 +32,12 @@ generated_warning() { for version; do export version - if jq -e '.[env.version] | not' versions.json > /dev/null; then - echo "deleting $version ..." + if [ -d "$version" ]; then rm -rf "$version" + fi + + if jq -e '.[env.version] | not' versions.json > /dev/null; then + echo "skipping $version ..." continue fi @@ -43,6 +46,8 @@ for version; do echo "processing $version/$variant ..." + mkdir -p "$version/$variant" + { generated_warning gawk -f "$jqt" "Dockerfile-$variant.template" @@ -56,6 +61,8 @@ for version; do echo "processing $version/$variant/management ..." + mkdir -p "$version/$variant/management" + { generated_warning gawk -f "$jqt" Dockerfile-management.template