Class: Yast::ArchClass
- Inherits:
-
Module
- Object
- Module
- Yast::ArchClass
- Defined in:
- ../../library/general/src/modules/Arch.rb
Instance Method Summary (collapse)
-
- (Object) alpha
true for all alpha architectures.
-
- (String) arch_short
Returns general architecture type (one of sparc, mips, ppc, s390, i386, alpha, ia64, x86_64).
-
- (String) architecture
Returns full architecture type (one of i386, sparc, sparc64, mips, mips64, ppc, ppc64, alpha, s390_32, s390_64, ia64, x86_64).
-
- (Object) board_chrp
true for all “CHRP” ppc boards.
-
- (Object) board_compatible
************************************************************ general system board types (initialized in constructor).
-
- (Object) board_iseries
true for all “iSeries” ppc boards.
-
- (Object) board_mac
true for all PPC “MacRISC” boards.
-
- (Object) board_mac_new
true for all “NewWorld” PowerMacs.
-
- (Object) board_mac_old
true for all “OldWorld” powermacs.
-
- (Object) board_pegasos
true for all “Pegasos” and “Efika” ppc boards.
-
- (Object) board_prep
true for all “PReP” ppc boards.
-
- (Object) board_wintel
true for all “Windows/Intel” compliant boards (x86 based).
-
- (Object) has_pcmcia
true if the system supports PCMCIA But modern notebook computers do not have it.
-
- (Object) has_smp
true if running on multiprocessor board.
-
- (Object) i386
true for all x86 compatible architectures.
-
- (Object) ia64
true for all IA64 (itanium) architectures.
-
- (Object) is_kvm
true if KVM is running.
-
- (Object) is_laptop
true if the system runs on laptop.
- - (Object) is_uml deprecated Deprecated.
-
- (Object) is_xen
true if Xen kernel is running (dom0 or domU).
-
- (Object) is_xen0
true if dom0 Xen kernel is running.
-
- (Object) is_xenU
true if domU Xen kernel is running.
- - (Object) main
-
- (Object) mips
true for all mips architectures (32 or 64 bit).
-
- (Object) mips32
true for all 32bit mips architectures.
-
- (Object) mips64
true for all 64bit mips architectures.
-
- (Object) ppc
true for all ppc architectures (32 or 64 bit).
-
- (Object) ppc32
true for all 32bit ppc architectures.
-
- (Object) ppc64
true for all 64bit ppc architectures.
-
- (Object) s390
true for all S/390 architectures (32 or 64 bit).
-
- (Object) s390_32
true for all 32bit S/390 architectures.
-
- (Object) s390_64
true for all 64bit S/390 architectures.
-
- (Object) setSMP(is_smp)
Set “Arch::has_smp ()”.
-
- (Object) sparc
true for all sparc architectures (32 or 64 bit).
-
- (Object) sparc32
true for all 32bit sparc architectures.
-
- (Object) sparc64
true for all 64bit sparc architectures.
-
- (Object) x11_setup_needed
run X11 configuration after inital boot this is false in case of: installation on iSeries, installation on S390.
-
- (Object) x86_64
true for all x86-64 (AMD Hammer) architectures.
Instance Method Details
- (Object) alpha
true for all alpha architectures
146 147 148 |
# File '../../library/general/src/modules/Arch.rb', line 146 def alpha architecture == "alpha" end |
- (String) arch_short
Returns general architecture type (one of sparc, mips, ppc, s390, i386, alpha, ia64, x86_64)
184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File '../../library/general/src/modules/Arch.rb', line 184 def arch_short if sparc return "sparc" elsif mips return "mips" elsif ppc return "ppc" elsif s390 return "s390" else return architecture end end |
- (String) architecture
Returns full architecture type (one of i386, sparc, sparc64, mips, mips64, ppc, ppc64, alpha, s390_32, s390_64, ia64, x86_64)
68 69 70 71 72 73 74 75 |
# File '../../library/general/src/modules/Arch.rb', line 68 def architecture if @_architecture.nil? @_architecture = Convert.to_string( SCR.Read(path(".probe.architecture")) ) end @_architecture end |
- (Object) board_chrp
true for all “CHRP” ppc boards
315 316 317 |
# File '../../library/general/src/modules/Arch.rb', line 315 def board_chrp ppc && board_compatible == "CHRP" end |
- (Object) board_compatible
************************************************************ general system board types (initialized in constructor)
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 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 |
# File '../../library/general/src/modules/Arch.rb', line 201 def board_compatible if @_board_compatible.nil? @_checkgeneration = "" systemProbe = Convert.convert( SCR.Read(path(".probe.system")), from: "any", to: "list <map>" ) systemProbe = [] if systemProbe.nil? Builtins.foreach(systemProbe) do |systemEntry| checksys = Ops.get_string(systemEntry, "system", "") @_checkgeneration = Ops.get_string(systemEntry, "generation", "") @_board_compatible = checksys if checksys != "" end Builtins.y2milestone("_board_compatible '%1' \n", @_board_compatible) @_board_compatible = "wintel" if i386 || x86_64 # hwinfo expects CHRP/PReP/iSeries/MacRISC* in /proc/cpuinfo # there is no standard for the board identification # Cell and Maple based boards have no CHRP in /proc/cpuinfo # Pegasos and Cell do have CHRP in /proc/cpuinfo, but Pegasos2 should no be handled as CHRP # Efika is handled like Pegasos for the time being # Treat PowerNV as CHRP. It is harmless for now. Patch for hwinfo is sent but it is better to be safe @_board_compatible = "CHRP" if @_board_compatible == "PowerNV" if ppc && (@_board_compatible.nil? || @_board_compatible == "CHRP") device_type = Convert.to_map( SCR.Execute( path(".target.bash_output"), "echo -n `cat /proc/device-tree/device_type`", {} ) ) model = Convert.to_map( SCR.Execute( path(".target.bash_output"), "echo -n `cat /proc/device-tree/model`", {} ) ) board = Ops.get_string(model, "stdout", "") Builtins.y2milestone( "model %1 , device_type %2\n", model, device_type ) compatible = Convert.to_map( SCR.Execute( path(".target.bash_output"), "echo -n `cat /proc/device-tree/compatible`", {} ) ) # catch remaining IBM boards if Builtins.issubstring( Ops.get_string(device_type, "stdout", ""), "chrp" ) || Builtins.issubstring( Ops.get_string(compatible, "stdout", ""), "ibm,powernv" ) @_board_compatible = "CHRP" end # Maple has its own way of pretenting OF1275 compliance if board == "Momentum,Maple-D" || board == "Momentum,Maple-L" || board == "Momentum,Maple" @_board_compatible = "CHRP" end # Pegasos has CHRP in /proc/cpuinfo and 'chrp' in /proc/device-tree/device_type if board == "Pegasos2" || Builtins.issubstring( Builtins.tolower(Ops.get_string(device_type, "stdout", "")), "pegasos2" ) @_board_compatible = "Pegasos" end # Efika has CHRP in /proc/cpuinfo and 'efika' in /proc/device-tree/device_type if Builtins.issubstring(Builtins.tolower(board), "efika") || Builtins.issubstring( Builtins.tolower(Ops.get_string(device_type, "stdout", "")), "efika" ) @_board_compatible = "Pegasos" end end # avoid future re-probing if probing failed # also avoid passing nil outside the module if fun_ref(method(:board_compatible), "string ()").nil? @_board_compatible = "" end end @_board_compatible end |
- (Object) board_iseries
true for all “iSeries” ppc boards
320 321 322 |
# File '../../library/general/src/modules/Arch.rb', line 320 def board_iseries ppc && board_compatible == "iSeries" end |
- (Object) board_mac
true for all PPC “MacRISC” boards
295 296 297 298 299 300 |
# File '../../library/general/src/modules/Arch.rb', line 295 def board_mac ppc && (board_compatible == "MacRISC" || board_compatible == "MacRISC2" || board_compatible == "MacRISC3" || board_compatible == "MacRISC4") end |
- (Object) board_mac_new
true for all “NewWorld” PowerMacs
303 304 305 306 |
# File '../../library/general/src/modules/Arch.rb', line 303 def board_mac_new # board_mac calls board_compatible which initializes _checkgeneration board_mac && @_checkgeneration == "NewWorld" end |
- (Object) board_mac_old
true for all “OldWorld” powermacs
309 310 311 312 |
# File '../../library/general/src/modules/Arch.rb', line 309 def board_mac_old # board_mac calls board_compatible which initializes _checkgeneration board_mac && @_checkgeneration == "OldWorld" end |
- (Object) board_pegasos
true for all “Pegasos” and “Efika” ppc boards
330 331 332 |
# File '../../library/general/src/modules/Arch.rb', line 330 def board_pegasos ppc && board_compatible == "Pegasos" end |
- (Object) board_prep
true for all “PReP” ppc boards
325 326 327 |
# File '../../library/general/src/modules/Arch.rb', line 325 def board_prep ppc && board_compatible == "PReP" end |
- (Object) board_wintel
true for all “Windows/Intel” compliant boards (x86 based)
335 336 337 |
# File '../../library/general/src/modules/Arch.rb', line 335 def board_wintel board_compatible == "wintel" end |
- (Object) has_pcmcia
true if the system supports PCMCIA But modern notebook computers do not have it. See also Bugzilla #151813#c10
346 347 348 349 350 351 |
# File '../../library/general/src/modules/Arch.rb', line 346 def has_pcmcia if @_has_pcmcia.nil? @_has_pcmcia = Convert.to_boolean(SCR.Read(path(".probe.has_pcmcia"))) end @_has_pcmcia end |
- (Object) has_smp
true if running on multiprocessor board. This only reflects the board, not the actual number of CPUs or the running kernel!
483 484 485 486 487 488 489 490 491 492 |
# File '../../library/general/src/modules/Arch.rb', line 483 def has_smp if @_has_smp.nil? @_has_smp = Convert.to_boolean(SCR.Read(path(".probe.has_smp"))) end if alpha # get smp for alpha from /etc/install.inf setSMP(SCR.Read(path(".etc.install_inf.SMP")) == "1") end @_has_smp end |
- (Object) i386
true for all x86 compatible architectures
78 79 80 |
# File '../../library/general/src/modules/Arch.rb', line 78 def i386 architecture == "i386" end |
- (Object) ia64
true for all IA64 (itanium) architectures
172 173 174 |
# File '../../library/general/src/modules/Arch.rb', line 172 def ia64 architecture == "ia64" end |
- (Object) is_kvm
true if KVM is running
454 455 456 457 458 459 460 461 462 463 464 |
# File '../../library/general/src/modules/Arch.rb', line 454 def is_kvm if @_is_kvm.nil? # KVM hypervisor has /dev/kvm file stat = Convert.to_map(SCR.Read(path(".target.stat"), "/dev/kvm")) Builtins.y2milestone("stat /dev/kvm: %1", stat) @_is_kvm = Ops.greater_than(Builtins.size(stat), 0) end @_is_kvm end |
- (Object) is_laptop
true if the system runs on laptop
356 357 358 359 360 361 362 363 364 365 366 367 |
# File '../../library/general/src/modules/Arch.rb', line 356 def is_laptop if @_is_laptop.nil? system = Convert.convert( SCR.Read(path(".probe.system")), from: "any", to: "list <map>" ) formfactor = Ops.get_string(system, [0, "formfactor"], "") @_is_laptop = formfactor == "laptop" end @_is_laptop end |
- (Object) is_uml
true if UML
375 376 377 378 379 380 |
# File '../../library/general/src/modules/Arch.rb', line 375 def is_uml if @_is_uml.nil? @_is_uml = Convert.to_boolean(SCR.Read(path(".probe.is_uml"))) end @_is_uml end |
- (Object) is_xen
true if Xen kernel is running (dom0 or domU)
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File '../../library/general/src/modules/Arch.rb', line 386 def is_xen if @_is_xen.nil? # XEN kernel has /proc/xen directory stat = Convert.to_map(SCR.Read(path(".target.stat"), "/proc/xen")) Builtins.y2milestone("stat /proc/xen: %1", stat) @_is_xen = Ops.greater_than(Builtins.size(stat), 0) if @_is_xen Builtins.y2milestone("/proc/xen exists") # check also the running kernel # a FV machine has also /proc/xen, but the kernel is kernel-default out = Convert.to_map( SCR.Execute(path(".target.bash_output"), "uname -r", {}) ) kernel_ver = Ops.get_string(out, "stdout", "") l = Builtins.splitstring(kernel_ver, "\n") kernel_ver = Ops.get(l, 0, "") Builtins.y2milestone("Kernel version: %1", kernel_ver) if !Builtins.regexpmatch(kernel_ver, "-xen$") && !Builtins.regexpmatch(kernel_ver, "-xenpae$") # kernel default is running @_is_xen = false end Builtins.y2milestone("kernel-xen is running: %1", @_is_xen) end end @_is_xen end |
- (Object) is_xen0
true if dom0 Xen kernel is running
425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File '../../library/general/src/modules/Arch.rb', line 425 def is_xen0 if @_is_xen0.nil? # dom0 Xen kernel has /proc/xen/xsd_port file stat = Convert.to_map( SCR.Read(path(".target.stat"), "/proc/xen/xsd_port") ) Builtins.y2milestone("stat /proc/xen/xsd_port: %1", stat) @_is_xen0 = Ops.greater_than(Builtins.size(stat), 0) end @_is_xen0 end |
- (Object) is_xenU
true if domU Xen kernel is running
444 445 446 |
# File '../../library/general/src/modules/Arch.rb', line 444 def is_xenU is_xen && !is_xen0 end |
- (Object) main
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 |
# File '../../library/general/src/modules/Arch.rb', line 35 def main # local variables @_architecture = nil @_board_compatible = nil @_checkgeneration = "" @_has_pcmcia = nil @_is_laptop = nil @_is_uml = nil @_has_smp = nil # Xen domain (dom0 or domU) @_is_xen = nil # Xen dom0 @_is_xen0 = nil # KVM @_is_kvm = nil end |
- (Object) mips
true for all mips architectures (32 or 64 bit)
120 121 122 |
# File '../../library/general/src/modules/Arch.rb', line 120 def mips mips32 || mips64 end |
- (Object) mips32
true for all 32bit mips architectures
106 107 108 |
# File '../../library/general/src/modules/Arch.rb', line 106 def mips32 architecture == "mips" end |
- (Object) mips64
true for all 64bit mips architectures
113 114 115 |
# File '../../library/general/src/modules/Arch.rb', line 113 def mips64 architecture == "mips64" end |
- (Object) ppc
true for all ppc architectures (32 or 64 bit)
141 142 143 |
# File '../../library/general/src/modules/Arch.rb', line 141 def ppc ppc32 || ppc64 end |
- (Object) ppc32
true for all 32bit ppc architectures
127 128 129 |
# File '../../library/general/src/modules/Arch.rb', line 127 def ppc32 architecture == "ppc" end |
- (Object) ppc64
true for all 64bit ppc architectures
134 135 136 |
# File '../../library/general/src/modules/Arch.rb', line 134 def ppc64 architecture == "ppc64" end |
- (Object) s390
true for all S/390 architectures (32 or 64 bit)
167 168 169 |
# File '../../library/general/src/modules/Arch.rb', line 167 def s390 s390_32 || s390_64 end |
- (Object) s390_32
true for all 32bit S/390 architectures
153 154 155 |
# File '../../library/general/src/modules/Arch.rb', line 153 def s390_32 architecture == "s390_32" end |
- (Object) s390_64
true for all 64bit S/390 architectures
160 161 162 |
# File '../../library/general/src/modules/Arch.rb', line 160 def s390_64 architecture == "s390_64" end |
- (Object) setSMP(is_smp)
Set “Arch::has_smp ()”. Since Alpha doesn't reliably probe smp, 'has_smp' must be set later with this function.
473 474 475 476 477 |
# File '../../library/general/src/modules/Arch.rb', line 473 def setSMP(is_smp) @_has_smp = is_smp nil end |
- (Object) sparc
true for all sparc architectures (32 or 64 bit)
99 100 101 |
# File '../../library/general/src/modules/Arch.rb', line 99 def sparc sparc32 || sparc64 end |
- (Object) sparc32
true for all 32bit sparc architectures
85 86 87 |
# File '../../library/general/src/modules/Arch.rb', line 85 def sparc32 architecture == "sparc" end |
- (Object) sparc64
true for all 64bit sparc architectures
92 93 94 |
# File '../../library/general/src/modules/Arch.rb', line 92 def sparc64 architecture == "sparc64" end |
- (Object) x11_setup_needed
run X11 configuration after inital boot this is false in case of: installation on iSeries, installation on S390
501 502 503 504 505 |
# File '../../library/general/src/modules/Arch.rb', line 501 def x11_setup_needed # disable X11 setup after initial boot return false if board_iseries || s390 || mips true end |
- (Object) x86_64
true for all x86-64 (AMD Hammer) architectures
177 178 179 |
# File '../../library/general/src/modules/Arch.rb', line 177 def x86_64 architecture == "x86_64" end |