Class: Yast::InstFunctionsClass

Inherits:
Module
  • Object
show all
Defined in:
../../src/modules/InstFunctions.rb

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) feature_ignored?(feature_name)

Returns whether feature was set to be ignored, see ignored_features()

Parameters:

  • feature_name (String)

Returns:

  • (Boolean)

    whether it's ignored



92
93
94
95
96
97
98
99
100
# File '../../src/modules/InstFunctions.rb', line 92

def feature_ignored?(feature_name)
  if feature_name.nil?
    Builtins.y2warning("Undefined feature to check")
    return false
  end

  feature = polish(feature_name)
  ignored_features.include?(feature)
end

- (Array) ignored_features

Returns list of ignored features defined via Linuxrc commandline

Returns:

  • (Array)

    ignored features



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File '../../src/modules/InstFunctions.rb', line 55

def ignored_features
  return @ignored_features if @ignored_features

  # Features defined as individual entries in install.inf
  features_keys = Linuxrc.keys.select do |key|
    polish(key) =~ /^ignored?features?$/
  end

  unparsed_features = features_keys.map do |key|
    polish(Linuxrc.InstallInf(key))
  end

  # Features mentioned in 'Cmdline' entry, it might not be defined (bnc#861465)
  cmdline = polish(Linuxrc.InstallInf("Cmdline") || "").split
  cmdline_features = cmdline.select do |cmd|
    cmd =~ /^ignored?features?=/i
  end

  cmdline_features.collect! do |feature|
    feature.gsub(/^ignored?features?=(.*)/i, '\1')
  end

  # Both are supported together
  ignored_features = unparsed_features + cmdline_features
  @ignored_features = ignored_features.map { |f| f.split(",") }.flatten.uniq
end

- (Object) main



33
34
35
36
37
38
39
40
41
# File '../../src/modules/InstFunctions.rb', line 33

def main
  textdomain "installation"

  Yast.import "Linuxrc"
  Yast.import "AutoinstConfig"
  Yast.import "Stage"
  Yast.import "Mode"
  Yast.import "ProductControl"
end

- (Object) reset_ignored_features

Resets the stored ignored features Used for easier testing



84
85
86
# File '../../src/modules/InstFunctions.rb', line 84

def reset_ignored_features
  @ignored_features = nil
end

- (Boolean) second_stage_required? Also known as: second_stage_required

Determines if the second stage should be executed

Checks Mode, AutoinstConfig and ProductControl to decide if it's needed.

Returns:

  • (Boolean)

    'true' if it's needed; 'false' otherwise.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File '../../src/modules/InstFunctions.rb', line 108

def second_stage_required?
  return false unless Stage.initial

  # the current one is 'initial'
  if (Mode.autoinst || Mode.autoupgrade) && !AutoinstConfig.second_stage
    run_second_stage = false
    Builtins.y2milestone("Autoyast: second stage is disabled")
  else
    # after reboot/kexec it would be 'continue'
    stage_to_check = "continue"

    # for matching the control file
    mode_to_check = Mode.mode

    Builtins.y2milestone(
      "Checking RunRequired (%1, %2)",
      stage_to_check,
      mode_to_check
    )
    run_second_stage = ProductControl.RunRequired(stage_to_check, mode_to_check)
  end

  run_second_stage
end