feat: automatic repo version selection via YAML configuration
You can now define your custom repos with the `%FEDORA_VERSION%` variable, to automatically use the correct repo version, so that you never have to maintain their custom URLs again in the future.
This commit is contained in:
4
build.sh
4
build.sh
@@ -12,11 +12,15 @@ get_yaml_string() {
|
|||||||
yq -- "$1" "$RECIPE_FILE"
|
yq -- "$1" "$RECIPE_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Read configuration variables.
|
||||||
|
fedora_version="$(get_yaml_string '.fedora-version')"
|
||||||
|
|
||||||
# Add custom repos.
|
# Add custom repos.
|
||||||
get_yaml_array repos '.extrarepos[]'
|
get_yaml_array repos '.extrarepos[]'
|
||||||
if [[ ${#repos[@]} -gt 0 ]]; then
|
if [[ ${#repos[@]} -gt 0 ]]; then
|
||||||
echo "-- Adding repos defined in recipe.yml --"
|
echo "-- Adding repos defined in recipe.yml --"
|
||||||
for repo in "${repos[@]}"; do
|
for repo in "${repos[@]}"; do
|
||||||
|
repo="${repo//%FEDORA_VERSION%/${fedora_version}}"
|
||||||
wget "$repo" -P /etc/yum.repos.d/
|
wget "$repo" -P /etc/yum.repos.d/
|
||||||
done
|
done
|
||||||
echo "---"
|
echo "---"
|
||||||
|
|||||||
@@ -26,9 +26,12 @@ scripts:
|
|||||||
|
|
||||||
# A list of urls of ".repo" files that should be added to your system.
|
# A list of urls of ".repo" files that should be added to your system.
|
||||||
# This is the proper way to add custom COPR repos to your image.
|
# This is the proper way to add custom COPR repos to your image.
|
||||||
|
# Tip: Use `%FEDORA_VERSION%` instead of static Fedora version numbers, so that
|
||||||
|
# your repos automatically use the Fedora version defined in `fedora-version`,
|
||||||
|
# which greatly simplifies future maintenance of your custom recipe.
|
||||||
extrarepos:
|
extrarepos:
|
||||||
# example:
|
# Example (which also demonstrates version number expansion):
|
||||||
# - https://copr.fedorainfracloud.org/coprs/atim/starship/repo/fedora-38/atim-starship-fedora-38.repo
|
# - https://copr.fedorainfracloud.org/coprs/atim/starship/repo/fedora-%FEDORA_VERSION%/atim-starship-fedora-%FEDORA_VERSION%.repo
|
||||||
|
|
||||||
# These RPMs will be removed from the system image. This step happens during
|
# These RPMs will be removed from the system image. This step happens during
|
||||||
# image build, before installing custom RPMs (from the "rpm-install" category).
|
# image build, before installing custom RPMs (from the "rpm-install" category).
|
||||||
|
|||||||
Reference in New Issue
Block a user