Table of Contents
YaST2 is a modular system for Linux installation and system administration. The design goals include:
Flexibility
Extensibility
Maintainability
Network transparency
support administration of remote hosts or virtual machines on mainframes, machines without CD/DVD drives, rack-mounted machines
User interface independence
must run in graphical and text-only environments and serial consoles
Cover the whole range from novice users to expert system administrators
To achieve the above design goals, YaST2 is split up into a number of components for each individual task:
There is the core engine and to run scripts written in YCP (YaST2's own scripting language), Perl or (in future releases) other scripting languages.
The engine and scripts together form a YaST2 Module for the user.
Even though in most scenarios there is only one single machine, it is important to distinguish between the installation source machine and the installation target machine:
The installation source machine is the machine that holds the installation media - usually CDs or DVDs - and a mini-Linux called "inst-sys" that is copied from one of those installation media to that machine's RAM disk to have a basic operating system to work with on a "bare metal" machine (a machine that doesn't have an operating system installed yet). Most of that inst-sys is read-only, there is only limited disk space for temporary files, and since everything runs from a RAM disk the writable part of it is very volatile.
The installation target on the other hand is the machine that is to be installed or administered. That may be the same machine as the installation source machine (in fact, this is very common for PC installation or administration tasks), but it might as well be two distinct machines - a virtual machine on a mainframe computer or a remote rack-mounted machine without any display adapter or CD/DVD drives.
All communication with the installation target is handled via the System Configuration Repository (SCR) to guarantee the network abstraction design goal. This is much easier said than done, however: YaST2 module developers always have to keep in mind that it is strictly forbidden to access system files (or any other system resources, for that matter) directly, even if there may be very convenient CPAN Perl modules to do that. Rather, SCR is to be used instead - always. Otherwise everything might run fine if installation source and target are the same machine, but break horribly if they are not.
SCR in itself is also modularized: All calls are handled by "agents" that each
know how to handle a particular configuration "path" like "/etc/fstab"
or
"/etc/passwd"
. That may be a simple file, but it may also be a directory
hierarchy like "probe" - this particular agent handles all kinds of hardware
probing, from mouse and display adapters to storage device controllers (like
SCSI or IDE controllers), disks attached to each individual controller or
partitions on those disks. Paths are denoted like ".etc.fstab" for SCR. YCP
even has a special data type "path" for just this case (a special kind of
string with some special operations).
SCR agents handle no more than three calls:
SCR::Read()
SCR::Write()
SCR::Execute()
The first argument is always the path to handle, but there may be any number of additional parameters, depending on the agent.
While Read() and Write() are obvious, Execute() may not be: This is intended for some kinds of agents that actually run a program on the installation target. In particular, the ".target.bash" agent does that - it runs a "bash" shell on the target machine and accepts a shell command as an argument. This is the tool of choice for tasks such as creating backup copies of configuration files or running any special command on the target machine - and again, the distinction between installation source and installation target machine becomes very important: You want run these commands on the (possibly remote) target machine, not on the machine that happens to hold the installation media.
SCR agents can easily added when needed. There are frameworks available to write SCR agents in C++, in Perl, or as Bash shell scripts as well as several ready-made parsers for different file formats like the ".ini" file parser that can handle files with "key = value" pairs or the "anyagent" that generalizes that concept even more using regular expressions. Those parsers return YCP lists and maps ready for further processing.
Typically, a YaST2 module for a specific installation or administration task includes a set of YCP or Perl scripts as well as some SCR agents to handle its particular configuration files.