Class: Yast::AutoinstGeneralClass
- Inherits:
-
Module
- Object
- Module
- Yast::AutoinstGeneralClass
- Defined in:
- ../../src/modules/AutoinstGeneral.rb
Instance Method Summary (collapse)
-
- (Object) AutoinstGeneral
Constructor.
-
- (Hash) Export
Export Configuration.
-
- (Boolean) GetModified
Functions which returns if the settings were modified.
-
- (Object) Import(settings)
Import Configuration.
- - (Object) main
-
- (Object) NtpSync
NTP syncing.
-
- (Object) SetModified
Function sets internal variable, which indicates, that any settings were modified, to “true”.
-
- (void) SetMultipathing
set multipathing.
-
- (void) SetSignatureHandling
set the sigature handling.
-
- (String) Summary
Summary of configuration.
-
- (Boolean) Write
Write General Configuration.
Instance Method Details
- (Object) AutoinstGeneral
Constructor
472 473 474 475 476 477 478 479 480 481 |
# File '../../src/modules/AutoinstGeneral.rb', line 472 def AutoinstGeneral if Stage.cont # FIXME: wrong position for this if Ops.get_map(Profile.current, "general", {}) != {} Import(Ops.get_map(Profile.current, "general", {})) end SetSignatureHandling() end nil end |
- (Hash) Export
Export Configuration
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File '../../src/modules/AutoinstGeneral.rb', line 194 def Export general = {} Ops.set(general, "mode", @mode) Ops.set(general, "signature-handling", @signature_handling) Ops.set(general, "ask-list", @askList) Ops.set(general, "proposals", @proposals) Ops.set(general, "storage", @storage) if Yast::Arch.s390 if Yast::Mode.installation # Taking the selected value (selected by user or AutoYaST) general["cio_ignore"] = @cio_ignore else # Trying to evalute the state from the installed system. # Disabled if there are no active devices defined. (Call # "cio_ignore -L", stored in /boot/zipl/active_devices.txt) active_device_file = File.join(Yast::Installation.destdir, "/boot/zipl/active_devices.txt") general["cio_ignore"] = File.exist?(active_device_file) && File.stat(active_device_file).size > 0 end end deep_copy(general) end |
- (Boolean) GetModified
Functions which returns if the settings were modified
77 78 79 |
# File '../../src/modules/AutoinstGeneral.rb', line 77 def GetModified @modified end |
- (Object) Import(settings)
Import Configuration
177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File '../../src/modules/AutoinstGeneral.rb', line 177 def Import(settings) settings = deep_copy(settings) SetModified() Builtins.y2milestone("General import: %1", settings) @mode = Ops.get_map(settings, "mode", {}) @cio_ignore = Ops.get_boolean(settings, "cio_ignore", true) @signature_handling = Ops.get_map(settings, "signature-handling", {}) @askList = Ops.get_list(settings, "ask-list", []) @proposals = Ops.get_list(settings, "proposals", []) @storage = Ops.get_map(settings, "storage", {}) true end |
- (Object) main
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File '../../src/modules/AutoinstGeneral.rb', line 13 def main Yast.import "Pkg" textdomain "autoinst" Yast.import "Stage" Yast.import "AutoInstall" Yast.import "AutoinstConfig" Yast.import "Summary" Yast.import "Keyboard" Yast.import "Language" Yast.import "Timezone" Yast.import "Misc" Yast.import "Profile" Yast.import "ProductFeatures" Yast.import "Storage" Yast.import "SignatureCheckCallbacks" Yast.import "Report" Yast.import "Arch" # All shared data are in yast2.rpm to break cyclic dependencies Yast.import "AutoinstData" # # Show proposal and ask user for confirmation to go on with auto-installation # Similar to interactive mode, without letting use change settings # Interactive mode implies confirmation as well.. # @Confirm = true # Running autoyast second_stage @second_stage = true # # Mode Settings # @mode = {} @signature_handling = {} @askList = [] # global list<string> proposals = ["bootloader_proposal", "software_proposal", "country_simple_proposal", "timezone_proposal", "users_proposal", "runlevel_proposal", "hwinfo_proposal", "deploying_proposal"]; @proposals = [] @storage = {} # S390 @cio_ignore = true # default value of settings modified @modified = false AutoinstGeneral() end |
- (Object) NtpSync
NTP syncing
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
# File '../../src/modules/AutoinstGeneral.rb', line 414 def NtpSync ntp_server = @mode["ntp_sync_time_before_installation"] if ntp_server Builtins.y2milestone("NTP syncing with #{ntp_server}") Popup.ShowFeedback( _("Syncing time..."), # TRANSLATORS: %s is the name of the ntp server _("Syncing time with %s.") % ntp_server ) ret = SCR.Execute(path(".target.bash"), "/usr/sbin/sntp -t 2 -s #{ntp_server}") if ret > 0 Report.Error(_("Time syncing failed.")) else ret = SCR.Execute(path(".target.bash"), "/sbin/hwclock --systohc") if ret > 0 Report.Error(_("Cannot update system time.")) end end Popup.ClearFeedback end end |
- (Object) SetModified
Function sets internal variable, which indicates, that any settings were modified, to “true”
69 70 71 72 73 |
# File '../../src/modules/AutoinstGeneral.rb', line 69 def SetModified @modified = true nil end |
- (void) SetMultipathing
This method returns an undefined value.
set multipathing
407 408 409 410 411 |
# File '../../src/modules/AutoinstGeneral.rb', line 407 def SetMultipathing val = @storage.fetch("start_multipath",false) Builtins.y2milestone("SetMultipathing val:%1", val) Storage.SetMultipathStartup(val) end |
- (void) SetSignatureHandling
This method returns an undefined value.
set the sigature handling
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
# File '../../src/modules/AutoinstGeneral.rb', line 223 def SetSignatureHandling # this will break compatibility a bit. A XML file without signature handling can # block the installation now because we have the popups back Pkg.CallbackAcceptUnsignedFile( fun_ref( SignatureCheckCallbacks.method(:AcceptUnsignedFile), "boolean (string, integer)" ) ) Pkg.CallbackAcceptFileWithoutChecksum( fun_ref( SignatureCheckCallbacks.method(:AcceptFileWithoutChecksum), "boolean (string)" ) ) Pkg.CallbackAcceptVerificationFailed( fun_ref( SignatureCheckCallbacks.method(:AcceptVerificationFailed), "boolean (string, map <string, any>, integer)" ) ) Pkg.CallbackTrustedKeyAdded( fun_ref( SignatureCheckCallbacks.method(:TrustedKeyAdded), "void (map <string, any>)" ) ) Pkg.CallbackAcceptUnknownGpgKey( fun_ref( SignatureCheckCallbacks.method(:AcceptUnknownGpgKey), "boolean (string, string, integer)" ) ) Pkg.CallbackImportGpgKey( fun_ref( SignatureCheckCallbacks.method(:ImportGpgKey), "boolean (map <string, any>, integer)" ) ) Pkg.CallbackAcceptWrongDigest( fun_ref( SignatureCheckCallbacks.method(:AcceptWrongDigest), "boolean (string, string, string)" ) ) Pkg.CallbackAcceptUnknownDigest( fun_ref( SignatureCheckCallbacks.method(:AcceptUnknownDigest), "boolean (string, string)" ) ) Pkg.CallbackTrustedKeyRemoved( fun_ref( SignatureCheckCallbacks.method(:TrustedKeyRemoved), "void (map <string, any>)" ) ) Pkg.CallbackPkgGpgCheck( fun_ref(AutoInstall.method(:pkg_gpg_check), "string (map)" )) if Builtins.haskey(@signature_handling, "accept_unsigned_file") Pkg.CallbackAcceptUnsignedFile( Ops.get_boolean(@signature_handling, "accept_unsigned_file", false) ? fun_ref( AutoInstall.method(:callbackTrue_boolean_string_integer), "boolean (string, integer)" ) : fun_ref( AutoInstall.method(:callbackFalse_boolean_string_integer), "boolean (string, integer)" ) ) end if Builtins.haskey(@signature_handling, "accept_file_without_checksum") Pkg.CallbackAcceptFileWithoutChecksum( Ops.get_boolean( @signature_handling, "accept_file_without_checksum", false ) ? fun_ref( AutoInstall.method(:callbackTrue_boolean_string), "boolean (string)" ) : fun_ref( AutoInstall.method(:callbackFalse_boolean_string), "boolean (string)" ) ) end if Builtins.haskey(@signature_handling, "accept_verification_failed") Pkg.CallbackAcceptVerificationFailed( Ops.get_boolean( @signature_handling, "accept_verification_failed", false ) ? fun_ref( AutoInstall.method(:callbackTrue_boolean_string_map_integer), "boolean (string, map <string, any>, integer)" ) : fun_ref( AutoInstall.method(:callbackFalse_boolean_string_map_integer), "boolean (string, map <string, any>, integer)" ) ) end if Builtins.haskey(@signature_handling, "trusted_key_added") Pkg.CallbackTrustedKeyAdded( fun_ref( AutoInstall.method(:callback_void_map), "void (map <string, any>)" ) ) end if Builtins.haskey(@signature_handling, "trusted_key_removed") Pkg.CallbackTrustedKeyRemoved( fun_ref( AutoInstall.method(:callback_void_map), "void (map <string, any>)" ) ) end if Builtins.haskey(@signature_handling, "accept_unknown_gpg_key") Pkg.CallbackAcceptUnknownGpgKey( Ops.get_boolean(@signature_handling, "accept_unknown_gpg_key", false) ? fun_ref( AutoInstall.method(:callbackTrue_boolean_string_string_integer), "boolean (string, string, integer)" ) : fun_ref( AutoInstall.method(:callbackFalse_boolean_string_string_integer), "boolean (string, string, integer)" ) ) end if Builtins.haskey(@signature_handling, "import_gpg_key") Pkg.CallbackImportGpgKey( Ops.get_boolean(@signature_handling, "import_gpg_key", false) ? fun_ref( AutoInstall.method(:callbackTrue_boolean_map_integer), "boolean (map <string, any>, integer)" ) : fun_ref( AutoInstall.method(:callbackFalse_boolean_map_integer), "boolean (map <string, any>, integer)" ) ) end if Builtins.haskey(@signature_handling, "accept_wrong_digest") Pkg.CallbackAcceptWrongDigest( Ops.get_boolean(@signature_handling, "accept_wrong_digest", false) ? fun_ref( AutoInstall.method(:callbackTrue_boolean_string_string_string), "boolean (string, string, string)" ) : fun_ref( AutoInstall.method(:callbackFalse_boolean_string_string_string), "boolean (string, string, string)" ) ) end if Builtins.haskey(@signature_handling, "accept_unknown_digest") Pkg.CallbackAcceptWrongDigest( Ops.get_boolean(@signature_handling, "accept_unknown_digest", false) ? fun_ref( AutoInstall.method(:callbackTrue_boolean_string_string_string), "boolean (string, string, string)" ) : fun_ref( AutoInstall.method(:callbackFalse_boolean_string_string_string), "boolean (string, string, string)" ) ) end nil end |
- (String) Summary
Summary of configuration
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File '../../src/modules/AutoinstGeneral.rb', line 83 def Summary #string language_name = ""; #string keyboard_name = ""; summary = "" summary = Summary.AddHeader(summary, _("Confirm installation?")) summary = Summary.AddLine( summary, Ops.get_boolean(@mode, "confirm", true) ? _("Yes") : _("No") ) summary = Summary.AddHeader(summary, _("Second Stage of AutoYaST")) summary = Summary.AddLine( summary, Ops.get_boolean(@mode, "second_stage", true) ? _("Yes") : _("No") ) summary = Summary.AddHeader( summary, _("Halting the machine after stage one") ) summary = Summary.AddLine( summary, Ops.get_boolean(@mode, "halt", false) ? _("Yes") : _("No") ) if Ops.get_boolean(@mode, "final_halt", false) == true summary = Summary.AddHeader( summary, _("Halting the machine after stage two") ) summary = Summary.AddLine(summary, _("Yes")) end if Ops.get_boolean(@mode, "final_reboot", false) == true summary = Summary.AddHeader( summary, _("Reboot the machine after stage two") ) summary = Summary.AddLine(summary, _("Yes")) end summary = Summary.AddHeader(summary, _("Signature Handling")) summary = Summary.AddLine( summary, Ops.get_boolean(@signature_handling, "accept_unsigned_file", false) ? _("Accepting unsigned files") : _("Not accepting unsigned files") ) summary = Summary.AddLine( summary, Ops.get_boolean( @signature_handling, "accept_file_without_checksum", false ) ? _("Accepting files without a checksum") : _("Not accepting files without a checksum") ) summary = Summary.AddLine( summary, Ops.get_boolean( @signature_handling, "accept_verification_failed", false ) ? _("Accepting failed verifications") : _("Not accepting failed verifications") ) summary = Summary.AddLine( summary, Ops.get_boolean(@signature_handling, "accept_unknown_gpg_key", false) ? _("Accepting unknown GPG keys") : _("Not accepting unknown GPG Keys") ) summary = Summary.AddLine( summary, Ops.get_boolean(@signature_handling, "import_gpg_key", false) ? _("Importing new GPG keys") : _("Not importing new GPG Keys") ) # summary = Summary::AddHeader(summary, _("Proposals")); # foreach(string p, proposals, ``{ # summary = Summary::AddLine(summary, p); # }); summary end |
- (Boolean) Write
Write General Configuration
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File '../../src/modules/AutoinstGeneral.rb', line 438 def Write AutoinstConfig.Confirm = Ops.get_boolean(@mode, "confirm", true) AutoinstConfig.cio_ignore = @cio_ignore AutoinstConfig.second_stage = @mode["second_stage"] if @mode.has_key?("second_stage") if Builtins.haskey(@mode, "forceboot") ProductFeatures.SetBooleanFeature( "globals", "kexec_reboot", !Ops.get_boolean(@mode, "forceboot", false) ) end AutoinstConfig.Halt = Ops.get_boolean(@mode, "halt", false) AutoinstConfig.RebootMsg = Ops.get_boolean(@mode, "rebootmsg", false) AutoinstConfig.setProposalList(@proposals) # see bug #597723. Some machines can't boot with the new alignment that parted uses # `align_cylinder == old behavior # `align_optimal == new behavior if @storage.has_key?("partition_alignment") val = @storage.fetch("partition_alignment",:align_optimal) Storage.SetPartitionAlignment(val) Builtins.y2milestone( "alignment set to %1", val ) end SetMultipathing() SetSignatureHandling() NtpSync() nil end |