System Services (Runlevel) (formerly known as Runlevel Editor)

YaST2 Developers Documentation: System Services (Runlevel) (formerly known as Runlevel Editor) |

functions files intro |  |
# System Services (Runlevel) (formerly known as Runlevel Editor) | `RunlevelEd.ycp`
Data for configuration of services, input and output functions.
Martin Vidner <mvidner@suse.cz> Petr Blahos <pblahos@suse.cz> Martin Lazar <mlazar@suse.cz>
# Imports CommandLine Progress Report Service Summary # Includes runlevel/toposort.ycp # Structures service # Global Variables current default runlevels service_list services x11_selected # Global Functions CheckPortmap () ClearServices () DotRequires () Export () FilterAlreadyDoneServices (list<string> svcs, list<string> rls, boolean enable, boolean init_time, boolean run_time) GetModified () Import (map s) ProposalSummary () Read () ServiceDependencies (string service, boolean enable) ServiceInstall (string service, list<string> rls) ServiceRemove (string service, list<string> rls) SetModified () StartContainsImplicitly (list<string> rls, string rl) Summary () Write () getRunlevelDescr (string rl) isDirty () isDisabled (map service) # Local Variables default_orig dependencies_disabled requires sprint_buffer system_requires what_provides what_requires # Local Functions ImplicitlySubset (list<string> rls_a, list<string> rls_b) addRequires (string service, list<string> req_facilities) buildRequires () reverse (list l) sprint (string s) subset (list a, list b)
`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 default runlevel is in the list of runlevels 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 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 GetModified () -> boolean`
  Returns true if the settings were modified Return value:
  | settings were modified
`global SetModified () -> void`
Function sets an internal variable indicating that any settings were modified to "true". Used for autoinst cloning.
`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
`global ServiceInstall (string service, list<string> rls) -> integer`
  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
`global ServiceRemove (string service, list<string> rls) -> integer`
  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

YaST2 Developers Documentation |