Class: Yast::ModeClass
- Inherits:
-
Module
- Object
- Module
- Yast::ModeClass
- Defined in:
- library/general/src/modules/Mode.rb
Overview
There are three modes combined here:
- Installation
- UI
- Test
See the boolean methods linked in the below tables for the meaning of the modes.
A related concept is the installation Stage.
Installation mode
It is the most complex one. Its values are used in the installation control files.
It has these mutually exclusive values and corresponding boolean queries:
#mode value | boolean shortcut | ||
---|---|---|---|
normal | #normal | ||
installation | #installation | ||
live_installation | #live_installation | ||
autoinstallation | #autoinst (short!) | #auto | |
autoupgrade | #autoupgrade | ||
autoinst_config | #config | ||
update | #update | ||
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 |
Instance Method Summary collapse
-
#auto ⇒ Object
Doing auto-installation or auto-upgrade with AutoYaST.
-
#autoinst ⇒ Object
Doing auto-installation with AutoYaST.
-
#autoupgrade ⇒ Object
Doing auto-upgrade.
-
#commandline ⇒ Object
We're running in command line interface, not in GUI or ncurses TUI.
-
#config ⇒ Object
Configuration for #autoinst, usually in the running system.
-
#Depeche ⇒ Object
Depeche Mode.
-
#Initialize ⇒ Object
Initialize everything from command-line of y2base.
-
#installation ⇒ Object
We're doing a fresh installation, not an #update.
-
#live_installation ⇒ Object
We're doing a fresh installation from live CD/DVD.
- #main ⇒ Object
-
#mode ⇒ Object
Returns the current mode name.
-
#normal ⇒ Object
The default installation mode.
-
#repair ⇒ Object
Repair mode.
-
#screen_shot ⇒ Object
Formerly used to help take screenshots for the manuals.
-
#SetMode(new_mode) ⇒ Object
Setter for #mode.
-
#SetTest(new_test_mode) ⇒ Object
Setter for #testMode.
-
#SetUI(new_ui) ⇒ Object
Setter for #ui.
-
#test ⇒ Object
Synonym of #testsuite.
-
#testMode ⇒ Object
test mode definitions.
-
#testsuite ⇒ Object
Returns whether running in testsuite.
-
#ui ⇒ Object
Returns the current UI mode.
-
#update ⇒ Object
We're doing a distribution upgrade (wrongly called an "update").
Instance Method Details
#auto ⇒ Object
Doing auto-installation or auto-upgrade with AutoYaST.
284 285 286 |
# File 'library/general/src/modules/Mode.rb', line 284 def auto autoinst || autoupgrade end |
#autoinst ⇒ Object
Doing auto-installation with AutoYaST. This is different from the #config part of AY. #installation is also true.
272 273 274 |
# File 'library/general/src/modules/Mode.rb', line 272 def autoinst mode == "autoinstallation" end |
#autoupgrade ⇒ Object
Doing auto-upgrade. #update is also true. #autoinst is false even though AY is running, which is consistent with #installation being exclusive with #update.
279 280 281 |
# File 'library/general/src/modules/Mode.rb', line 279 def autoupgrade mode == "autoupgrade" end |
#commandline ⇒ Object
this is set in the CommandLine library, not in the core, and defaults to false.
We're running in command line interface, not in GUI or ncurses TUI.
325 326 327 |
# File 'library/general/src/modules/Mode.rb', line 325 def commandline ui == "commandline" end |
#config ⇒ Object
also true during the installation when cloning the just installed system.
Configuration for #autoinst, usually in the running system.
292 293 294 |
# File 'library/general/src/modules/Mode.rb', line 292 def config mode == "autoinst_config" end |
#Depeche ⇒ Object
Depeche Mode. If you are a Heavy Metal fan, too bad!
254 255 256 |
# File 'library/general/src/modules/Mode.rb', line 254 def Depeche true end |
#Initialize ⇒ Object
#ui aka #commandline is not initialized. Probably a bug.
Initialize everything from command-line of y2base.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'library/general/src/modules/Mode.rb', line 106 def Initialize @_mode = "normal" @_test = "none" arg_count = Builtins.size(WFM.Args) arg_no = 0 while Ops.less_than(arg_no, arg_count) # parsing for main mode case WFM.Args(arg_no) when "initial", "continue", "firstboot" @_mode = "installation" # parsing for test mode when "test", "demo" @_test = "test" Builtins.y2warning("***** Test mode enabled *****") when "screenshots" @_test = "screenshot" Builtins.y2warning("***** Screen shot mode enabled *****") end arg_no = Ops.add(arg_no, 1) end # only use the /etc/install.inf agent when file is present # and installation is being processed # FIXME: remove the part below and let it be set in clients if @_mode == "installation" && SCR.Read(path(".target.size"), "/etc/install.inf") != -1 autoinst = !SCR.Read(path(".etc.install_inf.AutoYaST")).nil? @_mode = "autoinstallation" if autoinst repair = !SCR.Read(path(".etc.install_inf.Repair")).nil? @_mode = "repair" if repair update = !SCR.Read(path(".etc.install_inf.Upgrade")).nil? @_mode = "update" if update autoupgrade = !SCR.Read(path(".etc.install_inf.AutoUpgrade")).nil? @_mode = "autoupgrade" if autoupgrade end nil end |
#installation ⇒ Object
We're doing a fresh installation, not an #update. Also true for the firstboot stage.
237 238 239 240 |
# File 'library/general/src/modules/Mode.rb', line 237 def installation mode == "installation" || mode == "autoinstallation" || mode == "live_installation" end |
#live_installation ⇒ Object
We're doing a fresh installation from live CD/DVD. #installation is also true.
244 245 246 |
# File 'library/general/src/modules/Mode.rb', line 244 def live_installation mode == "live_installation" end |
#main ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'library/general/src/modules/Mode.rb', line 87 def main textdomain "base" # Current mode @_mode = nil # Current testing mode @_test = nil # We do one automatic check whether _test should be set to testsuite. @test_autochecked = false # Current UI mode @_ui = "dialog" end |
#mode ⇒ Object
Returns the current mode name. It's one of "installation", "normal", "update", "repair", "autoinstallation", "autoinst_config"
154 155 156 157 158 |
# File 'library/general/src/modules/Mode.rb', line 154 def mode Initialize() if @_mode.nil? @_mode end |
#normal ⇒ Object
The default installation mode. That is, no installation is taking place. We are configuring a system whose installation has concluded.
260 261 262 |
# File 'library/general/src/modules/Mode.rb', line 260 def normal mode == "normal" end |
#repair ⇒ Object
Repair mode. Probably obsolete since the feature was dropped.
265 266 267 |
# File 'library/general/src/modules/Mode.rb', line 265 def repair mode == "repair" end |
#screen_shot ⇒ Object
Formerly used to help take screenshots for the manuals. Obsolete since 2006.
307 308 309 |
# File 'library/general/src/modules/Mode.rb', line 307 def screen_shot testMode == "screenshot" end |
#SetMode(new_mode) ⇒ Object
Setter for #mode.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'library/general/src/modules/Mode.rb', line 161 def SetMode(new_mode) Initialize() if @_mode.nil? if !Builtins.contains( [ "installation", "update", "normal", "repair", "autoinstallation", "autoinst_config", "live_installation", "autoupgrade" ], new_mode ) Builtins.y2error("Unknown mode %1", new_mode) end Builtins.y2milestone("setting mode to %1", new_mode) @_mode = new_mode nil end |
#SetTest(new_test_mode) ⇒ Object
Setter for #testMode
203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'library/general/src/modules/Mode.rb', line 203 def SetTest(new_test_mode) Initialize() if @_test.nil? if !Builtins.contains( ["none", "test", "demo", "screenshot", "testsuite"], new_test_mode ) Builtins.y2error("Unknown test mode %1", new_test_mode) end @_test = new_test_mode nil end |
#SetUI(new_ui) ⇒ Object
Setter for #ui.
226 227 228 229 230 231 |
# File 'library/general/src/modules/Mode.rb', line 226 def SetUI(new_ui) Builtins.y2error("Unknown UI mode %1", new_ui) if !Builtins.contains(["commandline", "dialog", "none"], new_ui) @_ui = new_ui nil end |
#test ⇒ Object
Synonym of #testsuite. (Formerly (2006) this was a different thing, an obsolete "dry-run" AKA "demo" mode. But the current usage means "#testsuite")
301 302 303 |
# File 'library/general/src/modules/Mode.rb', line 301 def test testMode == "test" || testMode == "screenshot" || testMode == "testsuite" end |
#testMode ⇒ Object
test mode definitions
188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'library/general/src/modules/Mode.rb', line 188 def testMode Initialize() if @_test.nil? if !@test_autochecked # bnc#243624#c13: Y2ALLGLOBAL is set by yast2-testsuite/skel/runtest.sh if !Builtins.getenv("Y2MODETEST").nil? || !Builtins.getenv("Y2ALLGLOBAL").nil? @_test = "testsuite" end @test_autochecked = true end @_test end |
#testsuite ⇒ Object
Returns whether running in testsuite. Set by legacy test framework yast2-testsuite, used to work around non existent stubbing. Avoid!
314 315 316 |
# File 'library/general/src/modules/Mode.rb', line 314 def testsuite testMode == "testsuite" end |
#ui ⇒ Object
Returns the current UI mode. It's one of "commandline", "dialog", "none"
221 222 223 |
# File 'library/general/src/modules/Mode.rb', line 221 def ui @_ui end |
#update ⇒ Object
We're doing a distribution upgrade (wrongly called an "update").
249 250 251 |
# File 'library/general/src/modules/Mode.rb', line 249 def update mode == "update" || mode == "autoupgrade" end |