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=3> boolean shortcut </th></tr> <tr><td> normal </td> <td colspan=3> #normal </td></tr> <tr><td> installation </td> <td rowspan=3> #installation </td></tr> <tr><td> live_installation </td><td colspan=2> #live_installation </td></tr> <tr><td> autoinstallation </td> <td colspan=1> #autoinst (short!) </td><td rowspan=2>#auto</td></tr> <tr><td> autoupgrade </td> <td colspan=2> #autoupgrade </td></tr> <tr><td> autoinst_config </td> <td colspan=3> #config </td></tr> <tr><td> update </td> <td rowspan=2> #update </td></tr> <tr><td> repair (obsolete) </td><td colspan=3> #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) auto
Doing auto-installation or auto-upgrade with AutoYaST.
-
- (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) auto
Doing auto-installation or auto-upgrade with AutoYaST.
288 289 290 |
# File '../../library/general/src/modules/Mode.rb', line 288 def auto autoinst || autoupgrade end |
- (Object) autoinst
Doing auto-installation with AutoYaST. This is different from the #config part of AY. #installation is also true.
276 277 278 |
# File '../../library/general/src/modules/Mode.rb', line 276 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.
283 284 285 |
# File '../../library/general/src/modules/Mode.rb', line 283 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.
329 330 331 |
# File '../../library/general/src/modules/Mode.rb', line 329 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.
296 297 298 |
# File '../../library/general/src/modules/Mode.rb', line 296 def config mode == "autoinst_config" end |
- (Object) Depeche
Depeche Mode. If you are a Heavy Metal fan, too bad!
258 259 260 |
# File '../../library/general/src/modules/Mode.rb', line 258 def Depeche true end |
- (Object) Initialize
#ui aka #commandline is not initialized. Probably a bug.
Initialize everything from command-line of y2base.
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 149 150 |
# File '../../library/general/src/modules/Mode.rb', line 108 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.
241 242 243 244 |
# File '../../library/general/src/modules/Mode.rb', line 241 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.
248 249 250 |
# File '../../library/general/src/modules/Mode.rb', line 248 def live_installation mode == "live_installation" end |
- (Object) main
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# 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”
156 157 158 159 160 |
# File '../../library/general/src/modules/Mode.rb', line 156 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.
264 265 266 |
# File '../../library/general/src/modules/Mode.rb', line 264 def normal mode == "normal" end |
- (Object) repair
Repair mode. Probably obsolete since the feature was dropped.
269 270 271 |
# File '../../library/general/src/modules/Mode.rb', line 269 def repair mode == "repair" end |
- (Object) screen_shot
Formerly used to help take screenshots for the manuals. Obsolete since 2006.
311 312 313 |
# File '../../library/general/src/modules/Mode.rb', line 311 def screen_shot testMode == "screenshot" end |
- (Object) SetMode(new_mode)
Setter for #mode.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File '../../library/general/src/modules/Mode.rb', line 163 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
205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File '../../library/general/src/modules/Mode.rb', line 205 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.
228 229 230 231 232 233 234 235 |
# File '../../library/general/src/modules/Mode.rb', line 228 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”)
305 306 307 |
# File '../../library/general/src/modules/Mode.rb', line 305 def test testMode == "test" || testMode == "screenshot" || testMode == "testsuite" end |
- (Object) testMode
test mode definitions
190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File '../../library/general/src/modules/Mode.rb', line 190 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!
318 319 320 |
# File '../../library/general/src/modules/Mode.rb', line 318 def testsuite testMode == "testsuite" end |
- (Object) ui
Returns the current UI mode. It's one of “commandline”, “dialog”, “none”
223 224 225 |
# File '../../library/general/src/modules/Mode.rb', line 223 def ui @_ui end |
- (Object) update
We're doing a distribution upgrade (wrongly called an “update”).
253 254 255 |
# File '../../library/general/src/modules/Mode.rb', line 253 def update mode == "update" || mode == "autoupgrade" end |