diff --git a/library/general/src/modules/Mode.rb b/library/general/src/modules/Mode.rb
index 6d75d8a10..3f42c7f95 100644
--- a/library/general/src/modules/Mode.rb
+++ b/library/general/src/modules/Mode.rb
@@ -35,6 +35,56 @@
require "yast"
module Yast
+ # There are three modes combined here:
+ #
+ # 1. Installation
+ # 2. UI
+ # 3. Test
+ #
+ # See the boolean methods linked in the below tables for the *meaning*
+ # of the modes.
+ #
+ # A related concept is the installation {StageClass Stage}.
+ #
+ # # *Installation* mode
+ #
+ # It is the most complex one. Its values are used in the installation
+ # {https://github.com/yast/?query=skelcd-control control files}.
+ #
+ # It has these mutually exclusive values and corresponding boolean queries:
+ #
+ # {#mode} value | boolean shortcut |
+ # normal | {#normal} |
+ # installation | {#installation} |
+ # autoinstallation | {#autoinst} (short!) |
+ # live_installation | {#live_installation} |
+ # autoinst_config | {#config} |
+ # update | {#update} |
+ # autoupgrade | {#autoupgrade} |
+ # repair (obsolete) | {#repair} |
+ #
+ #
+ # # *UI* mode
+ #
+ # It has these mutually exclusive values and corresponding boolean queries:
+ #
+ # {#ui} value | boolean shortcut |
+ # dialog | (none) |
+ # commandline | {#commandline} |
+ # none(*) | (none) |
+ #
+ #
+ # Apparently "none" is never used.
+ #
+ # # *Test* mode
+ #
+ # It has these mutually exclusive values and corresponding boolean queries:
+ #
+ # {#testMode} value | boolean shortcut |
+ # test | {#test} |
+ # testsuite | {#testsuite} |
+ # screenshot (obsolete) | {#screen_shot} |
+ #
class ModeClass < Module
def main
@@ -53,7 +103,9 @@ def main
@_ui = "dialog"
end
- # initialize everything from command-line of y2base
+ # Initialize everything from command-line of y2base.
+ #
+ # @note {#ui} aka {#commandline} is not initialized. Probably a bug.
def Initialize
@_mode = "normal"
@_test = "none"
@@ -109,6 +161,7 @@ def mode
@_mode
end
+ # Setter for {#mode}.
def SetMode(new_mode)
Initialize() if @_mode == nil
@@ -150,6 +203,7 @@ def testMode
@_test
end
+ # Setter for {#testMode}
def SetTest(new_test_mode)
Initialize() if @_test == nil
@@ -172,6 +226,7 @@ def ui
@_ui
end
+ # Setter for {#ui}.
def SetUI(new_ui)
if !Builtins.contains(["commandline", "dialog", "none"], new_ui)
Builtins.y2error("Unknown UI mode %1", new_ui)
@@ -183,73 +238,90 @@ def SetUI(new_ui)
# main mode wrappers
- # we're doing a fresh installation
+ # We're doing a fresh installation, not an {#update}.
+ # Also true for the firstboot stage.
def installation
mode == "installation" || mode == "autoinstallation" ||
mode == "live_installation"
end
- # we're doing a fresh installation from live CD/DVD
+ # We're doing a fresh installation from live CD/DVD.
+ # {#installation} is also true.
def live_installation
mode == "live_installation"
end
- # we're doing an update
+ # We're doing a distribution upgrade (wrongly called an "update").
def update
mode == "update" || mode == "autoupgrade"
end
+ # Depeche Mode. If you are a Heavy Metal fan, too bad!
def Depeche
true
end
- # normal, running system
+ # The default installation mode. That is, no installation is taking place.
+ # We are configuring a system whose installation has concluded.
def normal
mode == "normal"
end
- # start repair module
+ # Repair mode. Probably obsolete since the feature was dropped.
def repair
mode == "repair"
end
- # doing auto-installation
+ # Doing auto-installation with AutoYaST.
+ # This is different from the {#config} part of AY.
+ # {#installation} is also true.
def autoinst
mode == "autoinstallation"
end
- # doing auto-upgrade
+ # Doing auto-upgrade. {#update} is also true.
+ # {#autoinst} is false even though AY is running,
+ # which is consistent with {#installation} being exclusive with {#update}.
def autoupgrade
mode == "autoupgrade"
end
- # configuration for auto-installation, only in running system
+ # Configuration for {#autoinst}, usually in the running system.
+ #
+ # @note also true during the installation
+ # when cloning the just installed system.
def config
mode == "autoinst_config"
end
# test mode wrappers
- # Just testing.
- # See installation/Test-Scripts/doit*
+ # Synonym of {#testsuite}.
+ # (Formerly (2006) this was a different thing, an obsolete "dry-run"
+ # AKA "demo" mode. But the current usage means "{#testsuite}")
def test
testMode == "test" || testMode == "screenshot" || testMode == "testsuite"
end
- # dump screens to /tmp. Implies {#demo} .
- # See installation/Test-Scripts/yast2-screen-shots*
+ # Formerly used to help take screenshots for the manuals.
+ # Obsolete since 2006.
def screen_shot
testMode == "screenshot"
end
# Returns whether running in testsuite.
+ # Set by legacy test framework yast2-testsuite, used to work around
+ # non existent stubbing. Avoid!
def testsuite
testMode == "testsuite"
end
# UI mode wrappers
- # we're running in command line interface
+ # We're running in command line interface, not in GUI or ncurses TUI.
+ #
+ # @note this is set in the {CommandLineClass CommandLine} library,
+ # not in the core, and defaults to false.
# @return true if command-line is running
def commandline
ui == "commandline"