diff --git a/doc/boot_arguments.md b/doc/boot_arguments.md index cc66b2c612..6ad35681a3 100644 --- a/doc/boot_arguments.md +++ b/doc/boot_arguments.md @@ -15,6 +15,22 @@ See [URL handling in the installer](https://github.com/yast/yast-installation/blob/master/doc/url.md) to find more details about the supported URLs. +## Custom Installation URL Configuration + +You can override the default `installation_url` set in the product files [here](https://github.com/openSUSE/agama/tree/master/products.d) by passing the `agama.install_url` parameter as a boot option in the bootloader. +This is particularly useful for any pre-production testing in openQA. + +**Note:** Setting this variable will impact all products. + +### Example Usage + +To specify a custom installation URLs, pass following as a parameter to kernel in the bootloader. +You can specify multiple URLs by separating them with commas. + +``` +agama.install_url=https://myrepo,https://myrepo2 +``` + ## Changing configuration values Instead of loading a full configuration file, you might be interested in adjusting just a few diff --git a/service/lib/agama/software/product_builder.rb b/service/lib/agama/software/product_builder.rb index 465e2107fd..d679f39dba 100644 --- a/service/lib/agama/software/product_builder.rb +++ b/service/lib/agama/software/product_builder.rb @@ -19,24 +19,29 @@ # To contact SUSE LLC about this file by physical or electronic mail, you may # find current contact information at www.suse.com. +require "agama/cmdline_args" require "agama/software/product" +require "logger" module Agama module Software # Builds products from the information of a config file. class ProductBuilder # @param config [Agama::Config] - def initialize(config) + def initialize(config, logger: Logger.new($stdout)) @config = config + @logger = logger end # Builds the products. # # @return [Array] def build + cmdline_args = CmdlineArgs.read_from("/proc/cmdline") + @logger.info cmdline_args config.products.map do |id, attrs| data = product_data_from_config(id) - create_product(id, data, attrs) + create_product(id, data, attrs, cmdline_args) end end @@ -45,23 +50,46 @@ def build # @return [Agama::Config] attr_reader :config - def create_product(id, data, attrs) + def create_product(id, data, attrs, cmdline_args) + product = initialize_product(id, data, attrs) + set_repositories(product, data, cmdline_args) + set_software(product, data) + set_translations(product, attrs) + product + end + + def initialize_product(id, data, attrs) Agama::Software::Product.new(id).tap do |product| product.display_name = attrs["name"] product.description = attrs["description"] product.name = data[:name] product.version = data[:version] + end + end + + def set_repositories(product, data, cmdline_args) + install_url = cmdline_args.data["install_url"] + if install_url + @logger.info "agama.install_url is set to #{install_url}" + product.repositories = install_url.split(",") + else product.repositories = data[:repositories] - product.labels = data[:labels] - product.mandatory_packages = data[:mandatory_packages] - product.optional_packages = data[:optional_packages] - product.mandatory_patterns = data[:mandatory_patterns] - product.optional_patterns = data[:optional_patterns] - product.user_patterns = data[:user_patterns] - product.translations = attrs["translations"] || {} end end + def set_software(product, data) + product.labels = data[:labels] + product.mandatory_packages = data[:mandatory_packages] + product.optional_packages = data[:optional_packages] + product.mandatory_patterns = data[:mandatory_patterns] + product.optional_patterns = data[:optional_patterns] + product.user_patterns = data[:user_patterns] + end + + def set_translations(product, attrs) + product.translations = attrs["translations"] || {} + end + # Data from config, filtering by arch. # # @param id [String] diff --git a/service/package/rubygem-agama-yast.changes b/service/package/rubygem-agama-yast.changes index d8d690db2a..ac41cda055 100644 --- a/service/package/rubygem-agama-yast.changes +++ b/service/package/rubygem-agama-yast.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Aug 19 15:13:46 UTC 2024 - Lubos Kocman + +- Allow overriding of install repos which is needed by openQA +- Override urls by using agama.install_url=https://.. boot param + ------------------------------------------------------------------- Mon Aug 12 11:44:15 UTC 2024 - Josef Reidinger