Class: Yast::InstFunctionsClass

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

Instance Method Summary collapse

Instance Method Details

#feature_ignored?(feature_name) ⇒ Boolean

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



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

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

#ignored_featuresArray

Returns list of ignored features defined via Linuxrc commandline



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

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.grep(/^ignored?features?=/i)

  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

#mainObject



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

def main
  textdomain "installation"

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

#reset_ignored_featuresObject

Resets the stored ignored features Used for easier testing



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

def reset_ignored_features
  @ignored_features = nil
end

#second_stage_required?Boolean 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.



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

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

#self_update_explicitly_enabled?Boolean

Determine whether the installer update has been explicitly enabled by linuxrc or by the AY profile.

return [Boolean] true if enabled explicitly; false otherwise



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'src/modules/InstFunctions.rb', line 137

def self_update_explicitly_enabled?
  # Linuxrc always export SelfUpdate with the default value even if not has
  # been set by the user. For that reason we need to check the cmdline for
  # knowing whether the user has requested the self update explicitly.
  if self_update_in_cmdline?
    log.info("Self update was enabled explicitly by linuxrc cmdline")
    return true
  end

  return false unless Mode.auto

  in_profile = !!AutoinstGeneral.self_update
  log.info("Self update was enabled explicitly by the AY profile") if in_profile
  in_profile
end