YaST/Tutorials/Simple YaST Module/Starting Up
From openSUSE
Contents |
Starting Up
The next step is to begin actual development.
Creating a New YaST Module
The fastest way to create a new YaST module is to use the powerful y2tool script that, among many other things, can generate the directory structure for a new module and fills it with standard project files from a template. This tool is a part of yast2-devtools package.
To view all available options for y2tool, enter the command:
/usr/bin/y2tool --help
You should get something similar to this list
create-new-package gettextdomains pot-spellcheck y2autoconf create-spec check_icons rny2rnc y2automake devtools-migration checkin-stable showy2log y2compile for-proofread check-textdomain svnall y2makeall generateYCPWrappers check_ycp tagversion y2makepot get-lib kill-leftover-stuff version
We want to create a new YaST module (package), so the most suitable option seems to be the create-new-package option. To view all suboptions for it, enter the command
/usr/bin/y2tool create-new-package
This is what you should get
Usage:
create-new-package [-dsv] <skeleton> <name> <maintainer> <email>
-v verbose
-d debug
-s list of available skeletons
skeleton - the one which should be used (config, trans, ...)
name - of the component. A package name will be constructed
like yast2-skeleton-name
maintainer - his name
email - maintainer's, of course :-)
This command will create a new standard configuration module called sshd with John The Fish as the author:
/usr/bin/y2tool create-new-package -v config sshd "John The Fish" "john@thesmallfish.net"
You will get this structure of directories:
sshd
agents - SCR Agents
doc - Auto-generated documentation
package - Special directory for building RPM package with a .changes file
src - Project source files
testsuite - Project automatic testsuites
You can download the just created package here.
Checking the Progress
We have just created a new YaST sshd configuration module but how to start and run this module? The answer is pretty easy...
Installing Project on the System
This is the way how to install the current state of the project into the system:
- Enter the directory with source files:
cd sshd - Check whether needed packages are installed and call YaST scripts needed for creating Makefiles:
make -f Makefile.cvs - Check syntax, comments of functions, create generated documentation, compile *.ycp modules into their binary form *.ybc:
make - Install all into particular directories, you have to become 'root' for that:
sudo make install
IMPORTANT: If there are any problems, it drops out a warning or an error message. Missing development package must be installed, syntax error must be fixed.
Once you have installed it for the first time, you only need to call sudo make install if you do some changes in the source code.
Running the Application
If there were no errors during the previous steps, you can simply run this command to open up your new YaST SSHD Configuration Tool:
sudo /sbin/yast2 sshd
or just
/sbin/yast2 sshd
After that, YaST opens up a Read dialog with a progress bar and after the configuration is read, it automatically switches to the Configuration dialog which looks like this one:
Watching YaST Logs
NOTE: It is very useful to watch the log files while developing and testing any YaST module or its part. You can do it as root with this command in some terminal: /usr/bin/tail -F /var/log/YaST2/y2log


