From 8f0aa9cec99f97cf49ed3dbb2dcdd5d36017dd4e Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 13 Aug 2023 17:29:11 +0300 Subject: [PATCH] chore: export more vars as readonly --- build.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index cbb0292..4c8339a 100644 --- a/build.sh +++ b/build.sh @@ -14,13 +14,16 @@ get_yaml_array() { } export -f get_yaml_array # this makes the function available to all modules -# Automatically determine which Fedora version we're building. -export FEDORA_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/lib/os-release)" +# Declare dynamically generated variables as read-only and exported +declare -rx IMAGE_NAME BASE_IMAGE FEDORA_VERSION # Read configuration variables. BASE_IMAGE="$(yq '.base-image' "$RECIPE_FILE")" IMAGE_NAME="$(yq '.name' "$RECIPE_FILE")" +# Automatically determine which Fedora version we're building. +FEDORA_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/lib/os-release)" + # Welcome. echo "Building $IMAGE_NAME from Fedora $FEDORA_VERSION ($BASE_IMAGE)."