System Services (Runlevel) (formerly known as Runlevel Editor) |
RunlevelEd.ycp |
Data for configuration of services, input and output functions. | |
|
|
This module has an unstable interface. |
Imports
Includes
StructuresGlobal VariablesGlobal Functions
Local Variables
Local Functions |
Proposal parameter: if it changes, we repropose
Like "requires" but in reverse direction. Used for stopping and disabling services.
A graph where nodes are scripts or system facilities but not normal facilities (ie. provides are solved).
Structure service
One service is described by such map: <pre> "servicename" : $[ "defstart" : [ "2", "3", "5", ], // Default-Start comment "defstop" : [ "0", "1", "6", ], // Default-Stop comment // "should" dependencies (+) are filtered by addRequires "reqstart" : [ "$network", "portmap" ], // Required-Start comment "reqstop" : [ "$network", "portmap" ], // Required-Stop comment "shortdescription" : "text...", // Description comment "description" : "text...", // Description comment // which runlevels service is really started/stopped in // read from /etc/init.d/{rc?,boot}.d/* links // // Note that the boot process (init.d/boot.d) is considered // a "B" runlevel that is implicitly contained in the other runlevels. // Using // list st = services ["boot.local", "start"]:[] // contains (st, "3") // DON'T // results in false but that's probably not what you want. // Use // StartContainsImplicitly (st, "3") // which tests for "3" and "B". "start" : [ "3", "5", ], "stop" : [ "3", "5", ], "started" : 0, // return from rcservice status (integer) "dirty" : false, // was the entry changed? ]</pre>
List of all services. Each item is a map described above. service
List of all service names. Filled by Read, used to get all services' status.
Default runlevel (after boot)
Backup of default runlevel.
List of all runlevels available in the system.
Current runlevel
ONLY ONE SCRIPT provides a facility in this model. In SuSE packages, the only exception are sendmail and postfix both providing sendmail but they cannot be installed together anyway. atd has Provides: at, so what_provides["at"] == "atd"; Identity is not represented explicitly: ypbind has Provides: ypbind, but haskey (what_provides, "ypbind") == false;
System facility definitions "should" dependencies (+) are filtered by addRequires /etc/insserv.conf: system_requires["$network"] == ["network", "+pcmcia", "+hotplug"];
Read settings
- Return value:
-
success
If there's a dependency loop, dependency checking is disabled.
Create requires from services, system_requires and what_provides.
Resolve provides, filter out "should" dependencies (+) and add the requirements to "requires". Missing services are not detected.
- Parameters:
-
service a service req_facilities its required facilities
Resolve which services need to be enabled/disabled
- Parameters:
-
service a service enable enabling or disabling a service?
- Return value:
-
a list of services (excluding itself) required to start a service (enable) or to be stopped because they require the service (disable), ordered by their dependencies. Missing services are included, system facilities excluded.
If dependencies are disabled, returns an empty list, as if there were no dependencies.
Argh, not a builtin
- Parameters:
-
l a list
- Return value:
-
reversed list
Gets a list of dependent services and a target state they should be in. Filters out those that are already in the target state. If both init_time and run_time are on, a conjunction is needed.
- Parameters:
-
svcs dependent services rls used for init_time enable on/off: init_time enable/disable run_time start/stop
Is a service started in a runlevel, given the list of rulevels it is started in? This looks like a simple contains, but "B" implicitly expands to all runlevels. See also bug #17234.
- Parameters:
-
rls runlevels the service is started in rl which runlevel is tested
- Return value:
-
should it be running in rl?
Whether a set of runlevels is a subset of another set of runlevels. But expands "B" to the whole set
- Parameters:
-
rls_a rls_b
- Parameters:
-
a a set b a set
- Return value:
-
a \subseteq b
Set all dirty services as clean and tries to read original "start"/"stop" for them.
Is a service disabled? Checks whether the default runlevel is in the list of runlevels
- Parameters:
-
service service to check
- Return value:
-
true if service is disabled
Check for portmap. Portmap should be started if inetd, nfs, nfsserver, nis, ... is started. This checks the dependency.
- Return value:
-
name of the first enabled service that requires portmap
Save changed services into proper runlevels. Save also changed default runlevel.
- Return value:
-
success
Were some settings changed?
- Return value:
-
true if yes
Returns true if the settings were modified
- Return value:
-
settings were modified
Function sets an internal variable indicating that any settings were modified to "true". Used for autoinst cloning.
Export user settings.
- Return value:
-
user settings: $[ "services": $[ map of dirty services ], "default": the default runlevel, if changed, ]
Import user settings
- Parameters:
-
s user settings
- Return value:
-
success state
- See
-
Export
Returns textual runlevel description. Descriptions are hard-coded in ycp script.
- Parameters:
-
rl Runlevel to check.
- Return value:
-
Description.
- Return value:
-
Html formatted summary for the installation proposal
- Return value:
-
Html formatted configuration summary
A buffer for sprint
String print
- Parameters:
-
s a string to add to sprint_buffer
- Return value:
-
a graphviz graph of the service dependencies
Enable specified service, and all required services.
- Parameters:
-
service service name rls runlevels to enable in or nil for default runlevels
- Return value:
-
0 = ok, 1 = service not found
Disable specified service, and all dependence services.
- Parameters:
-
service service name rls runlevels to disable in or nil for default runlevels
- Return value:
-
0 = ok