YaST2 Developers Documentation: Base

Base

modules/InstExtensionImage.ycp
Functionality for downloading and merging extending images for the inst-sys

This module has an unstable interface.

This module provides functions that download inst-sys extension images (localization, fonts, ...) and merge them to the current int-sys. This enables inst-sys to be modular even for already running YaST. See FATE #302955: 'Split translations out of installation system'. This module is strictly installation-only!

Imports

  • Directory
  • FileUtils
  • Linuxrc
  • Stage
  • String
  • URL

Global Functions

Local Functions

local MergeURLsParams (string base_url, string url_with_modifs) -> string

Merges two different URLs, repspectively their parameters to one string with parameters. See the example.

Parameters:
base_url
url_with_modifs
Return value:
merged params
Example

   MergeURLsParams (
     "http://server.net/dir/?param1=x¶m2=y",
     "http://server.net/dir/?param2=z¶m3=a",
   // param2 from the first URL has been replaced by tho one from the second URL
   ) -> "param1=x¶m2=z¶m3=a"
local CutLastDirOrFile (string url) -> string

Removes the last url item.

Parameters:
url
Example

   CutLastDirOrFile ("http://server/some/dir/") -> "http://server/some/"
   CutLastDirOrFile ("http://server/some/dir")  -> "http://server/some/"
local MergeURLs (string url_base, string url_with_modifs) -> string

Merges two URLs into one and removes parameters from both. If the second URL is strictly relative, e.g., "boot/i386/root", it is merged with the first one, otherwise the second one is returned (with params cut).

Parameters:
url_base
url_with_modifs
Return value:
merged URL
Example

   MergeURLs (
     "nfs://server.name/11-repo/?device=eth0&xxx=zzz",
     "boot/i386/root?device=eth1&aaa=bbb"
   ) -> "nfs://server.name/11-repo/boot/i386/"
   MergeURLs (
     "nfs://server.name/11-repo/?device=eth0&xxx=zzz",
     "nfs://server2.net/boot/i386/root?device=eth1&aaa=bbb"
   ) -> "nfs://server2.net/boot/i386/"
local LazyInit () -> void

Every global function should call LazyInit in the beginning.

global OldDownloadAndIntegrateExtension (string extension) -> boolean

Downloads extension archive (file system image) and integrates it to the current system. Extension name (param) is relative to the 'InstsysURL' defined in '/etc/install.inf', but no "../" are processed/merged. See the example.

Attention: This modue is 'silent', it doesn't open up any progress dialog when downloading the image. Keep in mind that downloading might take some time and that user should be informed by a busy pop-up.

Parameters:
extension
Return value:
if successful
Example

   // Let's assume that:
   // InstsysURL: http://example.org/SUSE/boot/ppc/root
   //
   UI::OpenDialog (`Label (_("Downloading ABC extension...")));
   DownloadAndIntegrateExtension ("some_dir/filename.squashfs");
   UI::CloseDialog();
   //
   // Downloads and integrates
   // http://example.org/SUSE/boot/ppc/some_dir/filename.squashfs
   
global OldDesintegrateExtension (string extension) -> boolean

Reverse function to DownloadAndIntegrateExtension(). The only difference is that it doesn't upload the image from where it has been downloaded. It just umounts the image and removes it.

Parameters:
extension
Return value:
if successful
See
DownloadAndIntegrateExtension()
global OldDisintegrateAllExtensions () -> boolean

Tries to disintegrate (umount, remove) all already used extensions. Nevertheless extensions already in use cannot be disintegrated.

Return value:
whether successfull (almost always false)