YaST2: How to access hardware and configuration files
There are a number of different ways to access configuration files,
the output of external programms and the hardware from within YCP
scripts.
- Write an SCR agent in YCP using the anyagent component.
- Write an SCR agent, either in C++ or in shell
- Use the WFM builtin Shell() to call a shell
script
- Use the WFM builtins ReadString() and WriteString()
to read and write Ascii files directly
- Write a client component in C++ that calls an external program and
parses its output. Use the liby2 class ExternalProgramm for
this.
- Write a arbitrary server component in C++ and implement there the functionality
you need.
All methods have advantages and disadvantages. The upper list is
ordered in the direction in which you have to decide. For example if
something can be done with the anyagent, you should do it
this way. If not, try to write an agent in C++ or in shell. The
advantage of agents is, that they are very independent of the
configuration module(s) that use them. It is much more easy to reuse
an agent than a code sequence of a module.