Module: Yast::InstallationInstIncFirstInclude

Defined in:
src/include/installation/inst_inc_first.rb

Constant Summary collapse

ZYPP_DATA =
["/var/lib/zypp/cache", "/var/lib/zypp/db"].freeze

Instance Method Summary collapse

Instance Method Details

#HandleSecondStageRequiredObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'src/include/installation/inst_inc_first.rb', line 175

def HandleSecondStageRequired
  # file name
  run_yast_at_boot = "#{Installation.destdir}/#{Installation.run_yast_at_boot}"

  if InstFunctions.second_stage_required?
    Builtins.y2milestone("Running the second stage is required")
    WFM.Write(path(".local.string"), run_yast_at_boot, "")
    WriteSecondStageRequired(true)
  else
    Builtins.y2milestone("It is not required to run the second stage")
    WFM.Execute(path(".local.remove"), run_yast_at_boot)
    WriteSecondStageRequired(false)
  end
  nil
end

#InitFirstStageInstallationSystemObject



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'src/include/installation/inst_inc_first.rb', line 135

def InitFirstStageInstallationSystem
  # in the initial stage, there might be some ZYPP data from the
  # previously failed installation
  # @see bugzilla #267763
  if Stage.initial
    ZYPP_DATA.each do |zypp_data_item|
      next unless FileUtils.Exists(zypp_data_item)

      Builtins.y2warning(
        "Directory '%1' exists, removing...",
        String.Quote(zypp_data_item)
      )
      result = WFM.Execute(path(".local.bash_output"),
        "/usr/bin/rm -rf #{zypp_data_item.shellescape}")
      Builtins.y2milestone("Result: #{result.inspect}")
    end
  end

  nil
end

#initialize_installation_inst_inc_first(include_target) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'src/include/installation/inst_inc_first.rb', line 32

def initialize_installation_inst_inc_first(include_target)
  Yast.import "UI"

  textdomain "installation"

  Yast.import "Arch"
  Yast.import "Installation"
  Yast.import "Console"
  Yast.import "Language"
  Yast.import "ProductControl"
  Yast.import "Directory"
  Yast.import "Stage"
  Yast.import "FileUtils"
  Yast.import "String"
  Yast.import "Mode"
  Yast.import "ProductFeatures"
  Yast.import "AutoinstConfig"
  Yast.import "InstFunctions"

  Yast.include include_target, "installation/misc.rb"
end

#InitMouseObject



54
55
56
# File 'src/include/installation/inst_inc_first.rb', line 54

def InitMouse
  nil
end

#SetInitialInstallationObject

Sets inital language and other settings.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
# File 'src/include/installation/inst_inc_first.rb', line 59

def SetInitialInstallation
  SetXENExceptions()

  Builtins.y2milestone("Adjusting language settings")

  # properly set up initial language
  Installation.encoding = Console.SelectFont(Language.language)
  Installation.encoding = "UTF-8" if Ops.get_boolean(UI.GetDisplayInfo, "HasFullUtf8Support",
    true)

  unless Language.SwitchToEnglishIfNeeded(true)
    UI.SetLanguage(Language.language, Installation.encoding)
    WFM.SetLanguage(Language.language, "UTF-8")
  end

  UI.RecordMacro(Ops.add(Directory.logdir, "/macro_inst_initial.ycp"))

  Builtins.y2milestone("Adjusting first stage modules")

  show_addons = ProductFeatures.GetBooleanFeature("globals", "show_addons")
  addons_default = ProductFeatures.GetBooleanFeature(
    "globals",
    "addons_default"
  )
  # default fallback
  show_addons = true if show_addons.nil?
  addons_default = false if addons_default.nil?

  Builtins.y2milestone(
    "Control file definition for add-on, visible: %1, selected: %2",
    show_addons,
    addons_default
  )
  if show_addons
    ProductControl.EnableModule("add-on")
  else
    ProductControl.DisableModule("add-on")
  end
  Installation.add_on_selected = addons_default

  show_online_repositories = ProductFeatures.GetBooleanFeature(
    "globals",
    "show_online_repositories"
  )
  online_repositories_default = ProductFeatures.GetBooleanFeature(
    "globals",
    "online_repositories_default"
  )
  # default fallback
  show_online_repositories = false if show_online_repositories.nil?
  online_repositories_default = true if online_repositories_default.nil?

  Builtins.y2milestone(
    "Control file definition for productsources, visible: %1, selected: %2",
    show_online_repositories,
    online_repositories_default
  )
  if show_online_repositories
    ProductControl.EnableModule("productsources")
  else
    ProductControl.DisableModule("productsources")
  end
  Installation.productsources_selected = online_repositories_default

  Builtins.y2milestone("Disabling second stage modules")
  # First-stage users module will enable them again only if needed
  ProductControl.DisableModule("root")
  ProductControl.DisableModule("user")
  # bnc #401319
  ProductControl.DisableModule("user_non_interactive")
  ProductControl.DisableModule("auth")

  nil
end

#SetSystemUpdateObject

Handle starting distro upgrade from running system



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'src/include/installation/inst_inc_first.rb', line 157

def SetSystemUpdate
  if FileUtils.Exists(Installation.run_update_file)
    Mode.SetMode("update")

    Builtins.foreach(
      [
        "language", # language already selected
        "disks_activate", # disks activated before running upgrade
        "mode", # always doing update, is already preselected
        "update_partition", # no mounting
        "prepdisk" # disks already mounted, it is dummy in update anyway
      ]
    ) { |m| ProductControl.DisableModule(m) }
  end

  nil
end