2.2. What the Module Should Really Do?

Project specification is a very important step in module development. The simple example shows how the project specification could be written.

2.2.1. General Project Specifications and Terms

Project specification is a very important part of every YaST Module. It shows whether it is worth the effort to develop such a YaST Module. It could also an insolvable problem before development starts or help find the best way to go in development.

YaST, in general, is divided into several layers. Some of them can run on different computers:

  • User Interface—A Graphical or textual user interface.

  • UI Handling—Handles all user's events, dialogs and dialog workflow.

  • Business Logic—Provides the global functional API and global variables (functional interface is the prefered one). Takes care about internal data handling and structure and access to SCR agents.

  • System Agents—Small programs for accessing the system files, databases, system commands, etc. They are called SCR agents.

It is quite common for bigger projects to have functions divided into several modules that can be written in YCP or Perl.

2.2.2. Tutorial Example

This example prepares to develop a YaST module for configuration of the SSH daemon. Its configuration is stored in the /etc/ssh/sshd_config file.

2.2.2.1. General Project Definition

[Important]Important

Keep in mind that this is only an example, not a real expert configuration tool. Features have been selected to keep the project extremely simple.

Chosen areas of configuration are:

  • Server behavior with the options Port, AllowTcpForwarding, X11Forwarding, and Compression

  • Login settings with the options PrintMotd and PermitRootLogin

  • Login features with the options MaxAuthTries, PasswordAuthentication, RSAAuthentication and PubkeyAuthentication

2.2.2.2. UI Dialog Workflow

This module will use only two dialogs arranged in a wizard sequence. Both dialogs will be based on the typical YaST dialog with a Back, Abort, and Next buttons and the help text in the frame on the left side of the dialog. These dialogs will be surrounded by Read dialog with a progress bar, where the current configuration is read, and Write dialog where a new configuration is written.

This is the design of the proposed workflow:

This workflow also shows that user can abort the configuration on every screen by clicking the Abort button. After this button is pressed, a pop-up dialog appears asking whether to abort the configuration. When this is confirmed, the configuration is canceled and program is terminated without saving changes.

2.2.2.3. UI Dialogs

The first dialog will contain a table of TCP ports used by the SSH daemon and its general features. The second one will contain all login settings.

Drawing of the first dialog:

The Back button will be disabled in the first dialog and the Next button will be replaced with the Accept button in the last dialog as it appears in every YaST module written strictly following the Program Text Style Guide.

Drawing of the second dialog: