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: <table> <tr><th> #mode value </th> <th colspan=2> boolean shortcut </th></tr> <tr><td> normal </td> <td colspan=2> #normal </td></tr> <tr><td> installation </td> <td rowspan=3> #installation </td></tr> <tr><td> autoinstallation </td> <td> #autoinst (short!) </td></tr> <tr><td> live_installation </td><td> #live_installation </td></tr> <tr><td> autoinst_config </td> <td colspan=2> #config </td></tr> <tr><td> update </td> <td rowspan=2> #update </td></tr> <tr><td> autoupgrade </td> <td> #autoupgrade </td></tr> <tr><td> repair (obsolete) </td><td colspan=2> #repair </td></tr> </table>
UI mode
It has these mutually exclusive values and corresponding boolean queries: <table> <tr><th> #ui value</th> <th> boolean shortcut </th></tr> <tr><td> dialog </td> <td> (none) </td></tr> <tr><td> commandline </td> <td> #commandline </td></tr> <tr><td> none(*) </td> <td> (none) </td></tr> </table>
Apparently “none” is never used.
Test mode
It has these mutually exclusive values and corresponding boolean queries: <table> <tr><th> #testMode value</th> <th colspan=2> boolean shortcut </th> </tr> <tr><td> test </td> <td rowspan=3> #test </td></tr> <tr><td> testsuite </td> <td> #testsuite </td></tr> <tr><td> screenshot (obsolete)</td><td> #screen_shot </td></tr> </table>
Instance Method Summary (collapse)
-
- (Object) autoinst
Doing auto-installation with AutoYaST.
-
- (Object) autoupgrade
Doing auto-upgrade.
-
- (Object) commandline
We're running in command line interface, not in GUI or ncurses TUI.
-
- (Object) config
Configuration for #autoinst, usually in the running system.
-
- (Object) Depeche
Depeche Mode.
-
- (Object) Initialize
Initialize everything from command-line of y2base.
-
- (Object) installation
We're doing a fresh installation, not an #update.
-
- (Object) live_installation
We're doing a fresh installation from live CD/DVD.
- - (Object) main
-
- (Object) mode
Returns the current mode name.
-
- (Object) normal
The default installation mode.
-
- (Object) repair
Repair mode.
-
- (Object) screen_shot
Formerly used to help take screenshots for the manuals.
-
- (Object) SetMode(new_mode)
Setter for #mode.
-
- (Object) SetTest(new_test_mode)
Setter for #testMode.
-
- (Object) SetUI(new_ui)
Setter for #ui.
-
- (Object) test
Synonym of #testsuite.
-
- (Object) testMode
test mode definitions.
-
- (Object) testsuite
Returns whether running in testsuite.
-
- (Object) ui
Returns the current UI mode.
-
- (Object) update
We're doing a distribution upgrade (wrongly called an “update”).
Instance Method Details
- (Object) autoinst
Doing auto-installation with AutoYaST. This is different from the #config part of AY. #installation is also true.
277 278 279 |
# File '../../library/general/src/modules/Mode.rb', line 277 def autoinst mode == "autoinstallation" end |
- (Object) autoupgrade
Doing auto-upgrade. #update is also true. #autoinst is false even though AY is running, which is consistent with #installation being exclusive with #update.
284 285 286 |
# File '../../library/general/src/modules/Mode.rb', line 284 def autoupgrade mode == "autoupgrade" end |
- (Object) commandline
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 |
- (Object) config
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 |
- (Object) Depeche
Depeche Mode. If you are a Heavy Metal fan, too bad!
259 260 261 |
# File '../../library/general/src/modules/Mode.rb', line 259 def Depeche true end |
- (Object) Initialize
#ui aka #commandline is not initialized. Probably a bug.
Initialize everything from command-line of y2base.
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 149 150 151 |
# File '../../library/general/src/modules/Mode.rb', line 109 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 if WFM.Args(arg_no) == "initial" || WFM.Args(arg_no) == "continue" || WFM.Args(arg_no) == "firstboot" @_mode = "installation" # parsing for test mode elsif WFM.Args(arg_no) == "test" || WFM.Args(arg_no) == "demo" @_test = "test" Builtins.y2warning("***** Test mode enabled *****") elsif WFM.Args(arg_no) == "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 |
- (Object) installation
We're doing a fresh installation, not an #update. Also true for the firstboot stage.
242 243 244 245 |
# File '../../library/general/src/modules/Mode.rb', line 242 def installation mode == "installation" || mode == "autoinstallation" || mode == "live_installation" end |
- (Object) live_installation
We're doing a fresh installation from live CD/DVD. #installation is also true.
249 250 251 |
# File '../../library/general/src/modules/Mode.rb', line 249 def live_installation mode == "live_installation" end |
- (Object) main
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File '../../library/general/src/modules/Mode.rb', line 89 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 |
- (Object) mode
Returns the current mode name. It's one of “installation”, “normal”, “update”, “repair”, “autoinstallation”, “autoinst_config”
157 158 159 160 161 |
# File '../../library/general/src/modules/Mode.rb', line 157 def mode Initialize() if @_mode == nil @_mode end |
- (Object) normal
The default installation mode. That is, no installation is taking place. We are configuring a system whose installation has concluded.
265 266 267 |
# File '../../library/general/src/modules/Mode.rb', line 265 def normal mode == "normal" end |
- (Object) repair
Repair mode. Probably obsolete since the feature was dropped.
270 271 272 |
# File '../../library/general/src/modules/Mode.rb', line 270 def repair mode == "repair" end |
- (Object) screen_shot
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 |
- (Object) SetMode(new_mode)
Setter for #mode.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File '../../library/general/src/modules/Mode.rb', line 164 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 |
- (Object) SetTest(new_test_mode)
Setter for #testMode
206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File '../../library/general/src/modules/Mode.rb', line 206 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 |
- (Object) SetUI(new_ui)
Setter for #ui.
229 230 231 232 233 234 235 236 |
# File '../../library/general/src/modules/Mode.rb', line 229 def SetUI(new_ui) if !Builtins.contains(["commandline", "dialog", "none"], new_ui) Builtins.y2error("Unknown UI mode %1", new_ui) end @_ui = new_ui nil end |
- (Object) test
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 |
- (Object) testMode
test mode definitions
191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File '../../library/general/src/modules/Mode.rb', line 191 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 |
- (Object) testsuite
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 |
- (Object) ui
Returns the current UI mode. It's one of “commandline”, “dialog”, “none”
224 225 226 |
# File '../../library/general/src/modules/Mode.rb', line 224 def ui @_ui end |
- (Object) update
We're doing a distribution upgrade (wrongly called an “update”).
254 255 256 |
# File '../../library/general/src/modules/Mode.rb', line 254 def update mode == "update" || mode == "autoupgrade" end |