From 057b45a45f12465bb271f39f273236b457873997 Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 13 Aug 2023 15:19:55 +0300 Subject: [PATCH] refactor: remove get yml string, add configdir var --- build.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index e02f61e..2894e81 100644 --- a/build.sh +++ b/build.sh @@ -3,7 +3,8 @@ # Tell build process to exit if there are any errors. set -oue pipefail -RECIPE_FILE="/usr/share/ublue-os/startingpoint/${RECIPE}" +CONFIG_DIRECTORY="/usr/share/ublue-os/startingpoint/" +RECIPE_FILE="$CONFIG_DIRECTORY/$RECIPE" MODULE_DIRECTORY="/tmp/modules/" # https://mikefarah.gitbook.io/yq/usage/tips-and-tricks#yq-in-a-bash-loop @@ -11,16 +12,12 @@ get_yaml_array() { readarray "$1" < <(yq -o=j -I=0 "$2" "$RECIPE_FILE" ) } -get_yaml_string() { - yq -- "${1}" "${RECIPE_FILE}" -} - # Automatically determine which Fedora version we're building. FEDORA_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/lib/os-release)" # Read configuration variables. -BASE_IMAGE="$(get_yaml_string '.base-image')" -IMAGE_NAME="$(get_yaml_string '.name')" +BASE_IMAGE="$(yq '.base-image' "$RECIPE_FILE")" +IMAGE_NAME="$(yq '.name' "$RECIPE_FILE")" # Welcome. echo "Building $IMAGE_NAME from Fedora $FEDORA_VERSION ($BASE_IMAGE)."