YaST2 Developers Documentation: Misc

Misc

Misc.ycp Purpose: miscellaneous definitions for installation

This module has an unstable interface.

Global Functions

global ReadAlternateFile (string first, string second) -> any

Parameters:
first string name of first file to try
second string name of second file to try
Return value:
content of file try to read first file, if it doesn't exist, read second files must reside below /usr/lib/YaST2 files must have ycp syntax
global hardware_name (map hardware_entry) -> string

Parameters:
hardware_entry map map of .probe entry
Return value:
vendor and device name common function to extract 'name' of hardware
global translate (map lmap, string lang) -> string

Parameters:
lmap map map of language codes and translations e.g. $[ "default" : "Defaultstring", "de" : "German....", ...]
lang string language as ISO code, either 2 chars (de) or 5 chars (de_DE)
Return value:
translation Define a macro that looks up a localized string in a language map of the form $[ "default" : "Defaultstring", "de" : "German....", ...]
global SysconfigWrite (path level, list<list> values) -> boolean

SysconfigWrite()

Parameters:
level
values
global SplitOptions (string options, map optmap) -> map

MergeOptions Merges "opt1=val1 opt2=val2 ..." and $["opta":"vala", ..."] to $["opt1":"val1", "opt2":"val2", "opta":"vala", ...] as needed by modules.conf agent

Parameters:
options string module options, e.g. "opt1=val1 opt2=val2 ..."
optmap map possible old options $["opta":"vala", ...]
global SysconfigRead (path sysconfig_path, string defaultv) -> string

SysconfigRead()

Try an SCR::Read(...) and return the result if successful. On failure return the the second parameter (default value)

Parameters:
sysconfig_path Sysconfig SCR path.
defaultv Default value
Return value:
Success --> Result of SCR::Read
Failure --> Default value
global CustomSysconfigRead (string key, string defval, string location) -> string

Try to read value from sysconfig file and return the result if successful. Function reads from arbitrary sysconfig file, for which the agent doesn't exist: e.g. from different partition like /mnt/etc/sysconfig/file.

Parameters:
key Key of the value we want to read from sysconfig file.
defval
location Full path to target sysconfig file.
Return value:
Success --> Result of SCR::Read
Failure --> Default value
Example
 Misc::CustomSysconfigRead ("INSTALLED_LANGUAGES", "", Installation::destdir + "/etc/sysconfig/language");