Table of Contents
To be able to create a YaST-module it is necessary to have understood how the extensive YaST-world is structured, which components there are, what they do and how they do it. Therefore prior to going into closer detail we'll step back from the blackboard and have a look at the big picture first. By doing so you will have the opportunity to get an overview of the ample terrain YaST is living on. While you don't have to understand each and every byte YaST consists of, having seen the whole issue will ease your understanding of the details we will come across.
YaST has been invented to have an extensible and fairly standardized means to install and manage SuSE Linux™ on a system. Basically YaST serves three main purposes:
Installation of SuSE Linux™ on a system
Configuration of the installed system
Administration of the installed system
To provide a solution to the resulting demands that has a lifetime extensible well into the future this solution had to be flexible and maintainable. Consequently some key concepts determined the design of YaST. In particular it was the strict separation of:
The user interface
The functional code doing the job
The data representing the current state of the system
Furthermore YaST has some very specific attributes that make it unique for the user as well as for those people who are developing it or contributing to it. The following sections outline some of the features of the YaST installer that should be seen as a guiding line for module development.
Managing a SuSE Linux™ system requires direct low-level access to the system which generally means reading and writing configuration data. Of course this could be done manually by a knowledgeable person using a conventional editor. A more comfortable and in most cases safer way is to use YaST. Consequently YaST must be able to handle this configuration data on the system level. By handling the original data YaST activities take into account manual editing that might also occur. Thus nobody is forced to use YaST exclusively for configuration tasks.
In YaST the access to system configuration data is realized by means of a special component (or layer if you prefer), the System Configuration Repository (SCR) (see below and Chapter 5, SCR Details). The SCR component basically consists of a number of so-called agents that have been created to accomplish a specific kind of access. For example there is an agent to run shell-commands and there is another one that reads and writes ASCII-files of a specific format. Additionally there are agents that provide access to the system hardware e.g. by taking hold on the proc-file-system.
All these agents are gathered together under a common hood, the SCR-API that can be used from within the YaST-modules in a consistent way. In summary the SCR provides kind of a view on all kinds of data, either YaST2 internal data, original system config files or hardware data.
YaST implies lots of artificial intelligence to provide reasonable suggestions for the various tasks. During installation the target system is thoroughly analyzed with respect to its hardware components and in most cases YaST succeeds in suggesting a proper configuration for them.
These suggestions are presented in an overview dialog that shows the main characteristics of the system to be installed and how YaST would handle them. If you are satisfied with these automatically generated settings you can simply accept them. If not, each of the system configuration categories can be “activated” to be changed manually. This is where the workflows come into their own.
If you decide to change a specific configuration category this is usually being done in a workflow. Workflows are used to lead you through the steps neccessary to accomplish a specific task. The steps are generally small to avoid an information “overflow”. At the end of the sequence the task has been accomplished and the changes are made permanent in the system.
As was stated above, you are not forced to do it this way. You could as well edit configuration files by hand but YaST can offer as much help as possible for this. Sometimes a workflow has multiple branches for “novice” and “expert” modes. The novice mode fills in the default values and tries to determine as much as possible automatically. The expert mode offers full control and allows to enter even unreasonable values.
By providing pre-configured workflows and configuration data, it is possible to automate almost arbitrary configuration tasks with YaST. From adding a user, to installing a completely configured SuSE Linux™ on specific hardware, nearly everything is possible.
Every workflow is assembled from rather small steps, implemented by means of YaST modules written in a YaST-specific scripting language, the YaST Control Language (YCP). These YaST-modules are then called in a predefined sequence to complete a specific task.
In fact it is possible to even write modules in bash and perl as long as the module need not have a user interface, i.e. it is not interactive. Such non-interactive modules typically handle specific problems like controlling a particular piece of hardware and can be called from within YCP-modules. This building block approach makes constructing complex workflows easy and maintainable.
The YCP language is also used to control the user interface (UI) presented on screen. The UI displays the information already known by the system and retrieves the information entered by the user.
There are two modes of operation:
Text mode for console-based service
In text mode the user interface is presented in the NCurses environment that provides windowing capabilities and entry forms on a text-based console. Mouse support is neither possible nor necessary here because all dialogs can be operated using only the keyboard.
Graphics mode for X11-based service
In graphics mode the well-known Qt-system is used to present the dialogs in a graphical way using a running X11-server. Operating these dialogs follows the common habits of graphical user interfaces.
It is important to notice here that both methods principally use the same YaST-specific YCP-API to build the dialogs. While there are some (rare) cases where the YCP-code has to distinguish these modes, the dialogs are usually programed for both worlds in in one single source with the same code.
In summary YaST provides the following features, some of them having already been mentioned above:
System access
YaST provides thorough probing of the system hardware and presents the information gathered thereby via the SCR-API. The SCR is also the means for reading and writing configuration files.
Reasonable Suggestions
Based on the system analysis and predefined configuration data, YaST is able to provide reasonable suggestions for almost any configuration task.
Workflows
Management of particular configuration categories is usually realized in form of workflows that split up the whole task into small steps.
Modules and YCP
The steps constituting a workflow are usually realized as YaST-modules that are written in the YaST Control Language (YCP)
User interface
The user interface of YaST is realized by means of a specific API from within the YCP-modules. This API supports a text-based console-mode as well as a graphical X11-mode.
Internationalisation
YaST provides support for various languages.
Multi-platform support
YaST provides support for various platforms like Intel™ (x86), Apple™, IBM™ (s390) etc.