YaST2 Developers Documentation: Runlevel Editor



functions
files
intro

Runlevel Editor

RunlevelEd.ycp
Data for configuration of services, input and output functions.

Imports

  • Progress
  • Report
  • Service
  • Summary

Includes

  • runlevel/toposort.ycp

Structures

Global Variables

Global Functions

Local Variables

Local Functions

global x11_selected -> boolean

Proposal parameter: if it changes, we repropose

local what_requires -> map<string, list<string> >

Like "requires" but in reverse direction. Used for stopping and disabling services.

local requires -> map<string, list<string> >

A graph where nodes are scripts or system facilities but not normal facilities (ie. provides are solved).

Info:

Structure service

 One service is described by such map: 
      "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?
      ]

global services -> map<string,map>

List of all services. Each item is a map described above. service

global service_list -> list

List of all service names. Filled by Read, used to get all services' status.

global default -> string

Default runlevel (after boot)

local default_orig -> string

Backup of default runlevel.

global runlevels -> list<string>

List of all runlevels available in the system.

global current -> string

Current runlevel

local what_provides -> map

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;

local system_requires -> map<string, list<string> >

System facility definitions "should" dependencies (+) are filtered by addRequires /etc/insserv.conf: system_requires["$network"] == ["network", "+pcmcia", "+hotplug"];

global Read () -> boolean

Read settings

Return value:
success

local dependencies_disabled -> boolean

If there's a dependency loop, dependency checking is disabled.

local buildRequires () -> void

Create requires from services, system_requires and what_provides.

local addRequires (string service, list<string> req_facilities) -> void

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

global ServiceDependencies (string service, boolean enable) -> list<string>

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.

local reverse (list l) -> list

Argh, not a builtin

Parameters:
l a list
Return value:
reversed list

global FilterAlreadyDoneServices (list<string> svcs, list<string> rls, boolean enable, boolean init_time, boolean run_time) -> list<string>

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

global StartContainsImplicitly (list<string> rls, string rl) -> boolean

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?

local ImplicitlySubset (list<string> rls_a, list<string> rls_b) -> boolean

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

local subset (list a, list b) -> boolean

Parameters:
a a set
b a set
Return value:
a \subseteq b

global ClearServices () -> void

Set all dirty services as clean and tries to read original "start"/"stop" for them.

global isDisabled (map service) -> boolean

Is a service disabled? Checks whether the list of runlevels it runs in is empty

Parameters:
service service to check
Return value:
true if service is disabled

global CheckPortmap () -> string

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

global CheckXInetd () -> boolean

If inetd and xinetd are enabled together, show a warning.

Return value:
are both of them enabled?

local Finetune (string name, list rl) -> boolean

Runlevel's own finetune function useing chkconfig It's easy param name name of service to adjust rl list of runlevels in which service should start return success state ------Tedd Guo 2006, 9, 25-------

Parameters:
name
rl

global Write () -> boolean

Save changed services into proper runlevels. Save also changed default runlevel.

Return value:
success

global isDirty () -> boolean

Were some settings changed?

Return value:
true if yes

global Export () -> map

Export user settings.

Return value:
user settings:
$[
    "services": $[ map of dirty services ],
    "default":  the default runlevel, if changed,
]

global Import (map s) -> boolean

Import user settings

Parameters:
s user settings
Return value:
success state
See:
Export

global getRunlevelDescr (string rl) -> string

Returns textual runlevel description. Descriptions are hard-coded in ycp script.

Parameters:
rl Runlevel to check.
Return value:
Description.

global ProposalSummary () -> string

Return value:
Html formatted summary for the installation proposal

global Summary () -> string

Return value:
Html formatted configuration summary

local sprint_buffer -> string

A buffer for sprint

local sprint (string s) -> void

String print

Parameters:
s a string to add to sprint_buffer

global DotRequires () -> string

Return value:
a graphviz graph of the service dependencies

YaST2 Developers Documentation