YaST2 Developers Documentation: AddOnProduct

AddOnProduct

AddOnProduct.ycp
This module provides integration of the add-on products
  • Jiri Srain
  • Lukas Ocilka

This module has an unstable interface.

Imports

  • Directory
  • FileUtils
  • FileUtils
  • Icon
  • InstShowInfo
  • Label
  • Language
  • Mode
  • Mode
  • PackageCallbacks
  • PackagesProposal
  • Popup
  • ProductControl
  • ProductFeatures
  • ProductLicense
  • Report
  • Stage
  • String
  • URL
  • Wizard
  • WorkflowManager
  • XML

Structures

Global Variables

Global Functions

Local Variables

Local Functions

local src_cache_id -> integer

ID for cache in the inst-sys

local system_proposals_prepared -> boolean

System proposals have already been prepared for merging?

local system_workflows_prepared -> boolean

System workflows have already been prepared for merging?

global add_on_products -> list<map<string,any> >

List of all selected repositories

Structure add_on_products = [

   $[
     "media" : 4, // ID of the source
     "product_dir" : "/",
     "product" : "openSUSE version XX.Y",
     "autoyast_product" : "'PRODUCT' tag for AutoYaST Export",
   ],
   ...
 ]
global src_id -> integer

ID of currently added repository for the add-on product

global last_ret -> symbol

return value of last step in the product adding workflow

local source_file_cache -> map <string, string>

Structure $["src_id|media|filename" : "/path/to/the/file"]


   
global GetCachedFileFromSource (integer src_id, integer media, string filename, string sod, boolean optional) -> string

Downloads a requested file, caches it and returns path to that cached file. If a file is alerady cached, just returns the path to a cached file. Parameter 'sod' defines whether a file is 'signed' (file + file.asc) or 'digested' (file digest mentioned in signed content file).

Parameters:
src_id
media
filename
sod
optional
Return value:
path to a cached file
Example

   // content file is usually signed with content.asc
   AddOnProduct::GetCachedFileFromSource (8, 1, "/content", "signed", false);
   // the other files are usually digested in content file
   AddOnProduct::GetCachedFileFromSource (8, 1, "/images/images.xml", "digested", true);
local GetMode () -> string

Returns the current add-on installation mode.

Return value:
current mode
See
SetMode()
local SetMode (string new_mode) -> void

Sets internal add-on installation mode to either "installation" or "update". Mode is used later when deciding which part of the installation.xml to use.

Parameters:
new_mode
See
GetMode();
global AddOnMode (integer source_id) -> string

Returns whether add-on product got as parameter (source id) replaces some already installed add-on or whether it is a new installation. Repositories and target have to be initialized.

Parameters:
source_id
global GetAbsoluteURL (string base_url, string url) -> string

Returns an absolute URL from base + relative url. Relative URL needs to start with 'reulrl://' othewise it is not considered being relative and it's returned as it is (just the relative_url parameter).

Parameters:
base_url
url
Return value:
absolute_url
Example

   AddOnProduct::GetAbsoluteURL (
     "http://www.example.org/some%20dir/another%20dir",
     "relurl://../AnotherProduct/"
   ) -> "http://www.example.org/some%20dir/AnotherProduct/"
   AddOnProduct::GetAbsoluteURL (
     "username:password@ftp://www.example.org/dir/",
     "relurl://./Product_CD1/"
   ) -> "username:password@ftp://www.example.org/dir/Product_CD1/"
global UpdateInstSys (string filename) -> boolean

Adapts the inst-sys from the tarball

Parameters:
filename string the filename with the tarball to use to the update
Return value:
true on success
global RereadAllSCRAgents () -> void

New add-on product might add also new agents. Functions Rereads all available agents.

See
bugzilla #239055, #245508
local CleanY2Update () -> void

Remove the /y2update directory from the system

global AcceptedLicenseAndInfoFile (integer src_id) -> boolean

Show /media.1/info.txt file in a pop-up message if such file exists. Show license if such exists and return whether users accepts it. Returns 'nil' when did not succed.

Parameters:
src_id
Return value:
whether the license has been accepted
local addons_requesting_registration -> list <integer>

Contains list of repository IDs that request registration

global ProcessRegistration () -> boolean

Returns whether registration is requested by at least one of used Add-On products.

Return value:
if requested
global RemoveRegistrationFlag (integer src_id) -> void

Add-On product might have been added into products requesting registration. This pruduct has been removed (during configuring list of add-on products).

Parameters:
src_id
global PrepareForRegistration (integer src_id) -> void

Checks whether the content file of the add-on has a flag REGISTERPRODUCT set to "true" or "yes". If it has, product is added into list of pruducts that need registration. Cached content file is used if possible.

Parameters:
src_id
global RegisterAddOnProduct (integer src_id) -> void

Calls registration client if needed.

Parameters:
src_id
global DoInstall () -> symbol

Do installation of the add-on product within an installed system srcid is got via AddOnProduct::src_id

Return value:
the result symbol from wizard sequencer
local patterns_preselected_by_addon -> map <integer, list <string> >

Every Add-On can preselect some patterns. Only patterns that are not selected/installed yet will be used.

Structure $[

   src_id : [
     "pattern_1", "pattern_2", "pattern_6"
   ]
 ]
local HandleProductPATTERNS (integer srcid) -> void

Function checks whether the product content file contains PATTERNS tag and pre-selects patterns listed there.

Parameters:
srcid
global Integrate (integer srcid) -> boolean

Integrate the add-on product to the installation workflow, including preparations for 2nd stage and inst-sys update

Parameters:
srcid integer the ID of the repository
Return value:
true on success
global Disintegrate (integer srcid) -> void

Opposite to Integrate()

Parameters:
srcid integer the ID of the repository
global ReIntegrateFromScratch () -> boolean

Some product(s) were removed, reintegrating their control files from scratch.

global SetPreselectedAddOnProductsType (string type) -> void

Sets an add_on_products file type ("plain" or "xml")

Parameters:
type
See
FATE #303675
local ParsePlainAddOnProductsFile (string parse_file, string base_url) -> list <map>

Reads temporary add_on_products file, parses supported products, merges base URL if products use relative URL and returns list of maps defining additional products to add.

Structure

  [
    // product defined with URL and additional path (typically "/")
    $["url":(string) url, "path":(string) path]
    // additional list of products to install
    // media URL can contain several products at once
    $["url":(string) url, "path":(string) path, "install_products":(list <string>) pti]
  ]
Parameters:
parse_file
base_url
Return value:
of products to add
See
FATE #303675
global AddPreselectedAddOnProducts (string filelist) -> boolean

Auto-integrate add-on products in specified file (usually add_on_products file)

Structure

 Format of /add_on_products.xml file on media root:
 &lt;?xml version="1.0"?>
 <add_on_products xmlns="http://www.suse.com/1.0/yast2ns"
	xmlns:config="http://www.suse.com/1.0/configns">
	<product_items config:type="list">
		<product_item>
			&lt;!-- Product name visible in UI when offered to user (optional item) -->
			<name>Add-on Name to Display</name>
			&lt;!-- Product URL (mandatory item) -->
			<url>http://product.repository/url/</url>
			&lt;!-- Product path, default is "/" (optional item) -->
			<path>/relative/product/path</path>
			&lt;!--
				List of products to install from media, by default all products
				from media are installed (optional item)
			-->
			<install_products config:type="list">
				&lt;!--
					Product to install - matching the metadata product 'name'
					(mandatory to fully define 'install_products')
				-->
				<product>Product-ID-From-Repository</product>
				<product>...</product>
			</install_products>
			&lt;!--
				If set to 'true', user is asked whether to install this product,
				default is 'false' (optional)
			-->
			<ask_user config:type="boolean">true</ask_user>
			&lt;!--
				Connected to 'ask_user', sets the default status of product,
				default is 'false' (optional)
			-->
			<selected config:type="boolean">true</selected>
		</product_item>
		<product_item>
			...
		</product_item>
	</product_items>
 </add_on_products>
Parameters:
filelist string a file containing a list of add-on products to integrate
Return value:
true on exit
See
FATE #303675: Support several add-ons on standard medium
global Export () -> map

Returns map describing all used add-ons.

Structure This is an XML file created from exported map:

 <add-on>
   <add_on_products config:type="list">
     <listentry>
       <media_url>ftp://server.name/.../</media_url>
       <product>NEEDS_TO_MATCH_"PRODUCT"_TAG_FROM_content_FILE!</product>
       <product_dir>/</product_dir>
     </listentry>
     ...
   </add_on_products>
 </add-on>
Return value:
global TmpExportFilename () -> string

Returns the path where Add-Ons configuration is stored during the fist stage installation. This path reffers to the installed system.

See
bugzilla #187558
global ReadTmpExportFilename () -> boolean

Reads the Add-Ons configuration stored on disk during the first stage installation.

See
bugzilla #187558