YaST2 Developers Documentation: Runlevel Editor



functions
files
intro

Runlevel Editor

ui.ycp
Runlevel Editor user interface.
Runlevel editor user interface functions.

Imports

  • Label
  • Popup
  • RunlevelEd
  • Service
  • Wizard

Local Functions

local getRlCheckBoxes () -> term

Create term of checkboxes for runlevel selection.

Return value:
HBox full of checkboxes.

local updateRlCheckBox (map service, string rl) -> void

Changes value of a runlevel checkbox. Prevents triggering userinput by disabling notify.

Parameters:
service service
rl which runlevel

local updateRlCheckBoxes (map service) -> void

Changes values of runlevel checkboxes.

Parameters:
service service

local updateDescription (map service) -> void

Update the long description text box

Parameters:
service service

local updateRlColumns (string service_name, map service, list<string> rls) -> void

Sets runlevel columns in the table.

Parameters:
service_name which line
service service
rls which columns to update, nil == all

local updateSimpleStatusColumn (string service_name, map service) -> void

Update simple-mode status column. TODO combine runtime status too?

Parameters:
service_name which line
service service

local updateStatusColumn (string service_name, integer started) -> void

Update run-time status column.

Parameters:
service_name which line
started status or -1 (unknown yet)

local updateStatusInTable (string service_name, map service, integer started) -> void

Helper function for fetching service status in run-time.

Parameters:
service_name which line
service service
started status or -1 (unknown yet)

local GetScriptOutput (string name, string param) -> map

-------Tedd Guo: these routine is used get Output of rhel'4 service scripts----- Run init script and return also its output (stdout and stderr merged).

Parameters:
name init service name
param init script argument
Return value:
of $[ "stdout" : "...", "stderr" : "...", "exit" : int,]

local GetScriptStatus (string name, string param) -> integer

-------Tedd Guo: these routine is used get Status of rhel'4 service scripts----- For specified service, determines its status and calls a supplied function.

Parameters:
name init service name
param init script argument
Return value:
exit value

local changeService1 (map service) -> void

Changes values of runlevel checkboxes. Get the status if not known yet.

Parameters:
service

local queryRlCheckBoxes (string service_name, map service) -> map

Reads data from checkboxes and updates service and RunlevelEd::services maps.

Parameters:
service_name which service
service service
Return value:
service

local getActionReturnHelp (integer exit) -> string

Get help text for rcscript start|stop command exit value.

Parameters:
exit exit value
Return value:
help text

local getStatusReturnHelp (integer exit) -> string

Get help text for rcscript status return value according to LSB.

Parameters:
exit exit value
Return value:
help text

local getDefaultPicker (symbol mode) -> list

Returns items for default runlevel combo box. (Excludes 0, 1, 6, S and B)

Parameters:
mode if `auto, adds Unchanged. if `proposal, only 2, 3 and 5
Return value:
List of items. Default is selected.

local getInRunlevels (list<string> rll) -> string

Parameters:
rll a list of runlevels or nil, meaning "all"
Return value:
"in [these] runlevels" (translated)

local StartedText (integer started) -> string

Parameters:
started status or -1 (unknown yet)
Return value:
"Yes", "No" or "???"

local reallyAbort () -> boolean

Ask if really abort. Uses boolean changed_settings. Sets boolean do_abort_now.

Return value:
true if user really wants to abort

local servicesToTable (symbol mix) -> list

Create table items from services. For simple mode, also filter out critical services: boot ones. For Expert mode: Mixin: started, start, (short)description.

Parameters:
mix which items to mix in:
`simple:	id=name, name, bstatus,            (short)description
`complex:	id=name, name, rstatus, runlevels, (short)description
`auto:	id=name, name, dirty,   runlevels, ?(short)description
Return value:
List of items for table.

local serviceStatusIterator (boolean use_func) -> void

For each service, determines its status and calls a supplied function.

Parameters:
use_func
See:
updateStatusInTable

local updateServiceStatus (boolean use_func, string service_name) -> void

For specified service, determines its status and calls a supplied function.

Parameters:
use_func
service_name
See:
updateStatusInTable

local getHelpProgress () -> string

help text for progress

Return value:
help text

local SetService (string service_name, list<string> rls, boolean enable) -> void

Enable or disable a service in some runlevels. Set the variables and update the ui (rl columns).

Parameters:
service_name a service
rls which runlevels, nil == disable in all
enable enabling or disabling?

local CheckMissingServices (list<string> services) -> list

Check that all the services exist (in RunlevelEd::services). If not, popup a list of the missing ones and ask whether continue or not. Filter out the missing ones.

Parameters:
services a service list
Return value:
[continue?, filtered list]

local ModifyServiceDep (string service_name, list<string> rls, boolean enable, boolean init_time, boolean run_time) -> boolean

Generic function to handle enabling, disabling, starting and stoping services and their dependencies, in various runlevels. Piece of cake ;-)
Either of init_time or run_time can be specified (for complex mode) or both (for simple mode). rls: ignored for -init +run What it does: gets dependent services (in the correct order), filters ones that are already in the desired state, if there are dependencies left, pop up a confirmation dialog, check for missing dependencies, perform the action (run-time, then init-time) for the deps and the service (in this order), displaying output after each error and at the end.

Parameters:
service_name name of service
rls in which run levels, nil == all
enable on/off
init_time do enable/disable
run_time do start/stop
Return value:
success (may have been canceled because of dependencies)

local SimpleSetServiceDep (string service_name, boolean enable) -> boolean

Turns a service on or off in the simple mode, ie. resolving dependencies and for each service doing start,enable or stop,disable.

Parameters:
service_name name of service
enable
Return value:
success (may have been canceled because of dependencies)

local EnableDisableServiceDep (string service_name, list<string> rls, boolean enable) -> boolean

Used for enabling/disabling a service and services depending on it in a runlevel or a set of runlevels.

Parameters:
service_name name of service
rls in which run levels, nil == all
enable enable/disable
Return value:
success (may have been canceled because of dependencies)

local StartStopServiceDep (string service_name, boolean enable) -> boolean

Used for starting/stopping a service and services depending on it. Displays result popups.

Parameters:
service_name name of service
enable start/stop
Return value:
success (may have been canceled because of dependencies)

local startStopService (string service_name, string command) -> list

Starts/stops/checks status of a service

Parameters:
service_name service to start/stop
command "start" or "stop" or "status"
Return value:
[integer exit_status, string rich_message]

local formatLine (list<string> l, integer len) -> string

Prints list items into a string, separating them by commas and when line exceeds len characters, it does line break (\n). It adds 5 spaces before each line. Do not expect reasonable results if you set len < 0.

Parameters:
l list of strings
len minimal length of line
Return value:
formated string

local overviewText () -> string

Checks what services should run in this runlevel and do not run or what services run but should not run.

Return value:
overview text

local ModeTabs (symbol mode) -> term

Radio buttons (faking tabs) for switching modes

Parameters:
mode `simple or `complex, which one are we in
Return value:
RadioButtonGroup term

local getHelpComplex () -> string

help text services dialog

Return value:
help text

local ComplexDialog () -> symbol

Main dialog for changing services.

Return value:
for wizard sequencer

local SimpleDialog () -> symbol

Main dialog for changing services.

Return value:
for wizard sequencer

local getHelpAuto () -> string

Help text for auto-complex-screen

Return value:
help text

local addService () -> string

Add service by hand.

Return value:
new service name (already added to RunlevelEd::services) or ""

local AutoDialog () -> symbol

Main dialog for changing services.

Return value:
for wizard sequencer

local refreshTableLine2 () -> void

Sets columns 0-S (runlevels) in table so they are synchronized with checkboxes.

local LongContinueCancelHeadlinePopup (string headline, term richtext, integer hdim, integer vdim) -> boolean

Like Popup::LongText

Parameters:
headline a headline
richtext `RichText(_("<p>foo...</p>"))
hdim popup width
vdim popup height
Return value:
continue?

local setServiceDisable (string service_name) -> void

Disable the service. Changes global services.

Parameters:
service_name name of the service.

local setServiceToDefault (string service_name) -> void

DUH, in fact ENABLES the service. but the described function will be there sometime Set service to its default state upon installation. Changes global services.

Parameters:
service_name Name of service to process.

local tomap_true (list<string> l) -> map<string, boolean>

Converts a list to a map with values of true

Parameters:
l a list
Return value:
a map

local mapkeys (map m) -> list

Parameters:
m a map
Return value:
keys of the map

YaST2 Developers Documentation