feat: add function for reading individual YAML strings

The recipe file is now also moved to a separate variable, and we use `--` to ensure that yq never misinterprets any custom arguments as `-flags`.
This commit is contained in:
Arcitec
2023-05-09 18:36:27 +02:00
committed by Eino Rauhala
parent bf19fa5eca
commit 33ab88f794

View File

@@ -4,8 +4,12 @@
set -oue pipefail set -oue pipefail
# Helper functions. # Helper functions.
RECIPE_FILE="/usr/etc/ublue-recipe.yml"
get_yaml_array() { get_yaml_array() {
mapfile -t "$1" < <(yq "$2" < /usr/etc/ublue-recipe.yml) mapfile -t "$1" < <(yq -- "$2" "$RECIPE_FILE")
}
get_yaml_string() {
yq -- "$1" "$RECIPE_FILE"
} }
# Add custom repos. # Add custom repos.