• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yast / yast-installation / 8705582428

16 Apr 2024 12:27PM UTC coverage: 40.913% (-0.2%) from 41.105%
8705582428

Pull #1114

github

shundhammer
Version bump and change log
Pull Request #1114: WIP: Handle autoinst AND autoupgrade (bsc#1222153)

0 of 1 new or added line in 1 file covered. (0.0%)

95 existing lines in 13 files now uncovered.

4489 of 10972 relevant lines covered (40.91%)

6.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/include/installation/inst_inc_all.rb
1
# ------------------------------------------------------------------------------
2
# Copyright (c) 2006-2012 Novell, Inc. All Rights Reserved.
3
#
4
#
5
# This program is free software; you can redistribute it and/or modify it under
6
# the terms of version 2 of the GNU General Public License as published by the
7
# Free Software Foundation.
8
#
9
# This program is distributed in the hope that it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License along with
14
# this program; if not, contact Novell, Inc.
15
#
16
# To contact Novell about this file by physical or electronic mail, you may find
17
# current contact information at www.novell.com.
18
# ------------------------------------------------------------------------------
19

20
# File: include/installation/inst_inc_all.ycp
21
# Module: System installation
22
# Summary: Miscelaneous functions
23
# Authors: Lukas Ocilka <locilka@suse.cz>
24
#
25
# $Id$
26
#
27

28
require "y2storage"
×
29

30
module Yast
×
31
  module InstallationInstIncAllInclude
×
32
    def initialize_installation_inst_inc_all(_include_target)
×
33
      Yast.import "UI"
×
34

35
      textdomain "installation"
×
36

37
      Yast.import "ProductControl"
×
38
      Yast.import "Label"
×
39
      Yast.import "Linuxrc"
×
40
      Yast.import "Wizard"
×
41
      Yast.import "Arch"
×
42
      Yast.import "Report"
×
43
      Yast.import "Installation"
×
44
      Yast.import "Stage"
×
45
      Yast.import "Mode"
×
46
    end
×
47

48
    def SetInitializingUI
×
49
      # dialog content - busy message
50
      ui_message = ""
×
51
      # help for the dialog - busy message
52
      ui_help = _("<p>Initializing the installation...</p>")
×
53

54
      # another texts for second stage
55
      if Stage.cont
×
56
        # dialog content - busy message
57
        ui_message = _("Preparing the 1st system configuration...")
×
58
        # help for the dialog - busy message
59
        ui_help = _("<p>Please wait...</p>")
×
60
      end
×
61

62
      Wizard.SetContents(
×
63
        # dialog caption
64
        _("Initializing..."),
×
65
        Label(ui_message),
×
66
        ui_help,
×
67
        false,
×
68
        false
×
69
      )
×
70

71
      # gh#86 No control file found
72
      if ProductControl.current_control_file.nil?
×
73
        Yast.import "InstError"
×
74
        InstError.ShowErrorPopupWithLogs(
×
75
          # TRANSLATORS: Error message
76
          _("No installation control file has been found,\nthe installer cannot continue.")
×
77
        )
×
78
      end
×
79

80
      nil
×
81
    end
×
82

83
    def SetUIContent
×
84
      # Wizard::OpenNextBackStepsDialog();
85
      SetInitializingUI()
×
86

87
      nil
×
88
    end
×
89

90
    def SetGlobalInstallationFeatures
×
91
      # FATE #304395: Disabling (or handling) screensaver during installation
92
      # Disabling screen-saver on startup
93
      if WFM.Read(path(".local.size"), "/usr/bin/xset") != -1
×
94
        Builtins.y2milestone("Disabling Energy Star (DPMS) features")
×
95
        # DPMS off values, disable DPMS, disable screen-saver
96
        WFM.Execute(
×
97
          path(".local.bash"),
×
98
          "/usr/bin/xset dpms 0 0 0; /usr/bin/xset -dpms; /usr/bin/xset s 0 0; /usr/bin/xset s off"
×
99
        )
×
100
      end
×
101

102
      nil
×
103
    end
×
104

105
    def FinishInstallation(ret)
×
106
      Builtins.y2milestone("Finishing the installation...")
×
107

108
      if [:reboot, :restart_yast, :restart_same_step, :abort].include?(ret)
×
109
        # TRANSLATORS: busy message
110
        UI.OpenDialog(Label(_("Writing YaST configuration..."))) # #2
×
111
      else
×
112
        # FATE #304395: Disabling (or handling) screensaver during installation
113
        # Enabling screen-saver on exit
114
        if WFM.Read(path(".local.size"), "/usr/bin/xset") != -1
×
115
          Builtins.y2milestone("Enabling Energy Star (DPMS) features")
×
116
          # default DPMS values, enable DPMS, enable screen-saver
117
          WFM.Execute(
×
118
            path(".local.bash"),
×
119
            "/usr/bin/xset dpms 1200 1800 2400; /usr/bin/xset +dpms; /usr/bin/xset s on; " \
×
120
            "/usr/bin/xset s default;"
×
121
          )
×
122
        end
×
123

124
        # TRANSLATORS: busy message
125
        UI.OpenDialog(Label(_("Finishing the installation..."))) # #2
×
126
      end
×
127

128
      UI.CloseDialog # #2
×
129

130
      nil
×
131
    end
×
132

133
    # Sets autoinstallation behavior.
134
    def SetAutoinstHandling
×
135
      return if !Mode.autoinst
×
136

137
      reportMap = {
×
138
        "errors"         => { "timeout" => 0 },
×
139
        "warnings"       => { "timeout" => 10 },
×
140
        "yesno_messages" => { "timeout" => 10 }
×
141
      }
×
142
      Report.Import(reportMap)
×
143

144
      Report.DisplayErrors(true, 0)
×
145
      Report.DisplayWarnings(true, 10)
×
146
      Report.DisplayMessages(true, 10)
×
147

148
      nil
×
149
    end
×
150

151
    # Sets autoupgrade behavior
152
    def SetAutoupgHandling
×
153
      # if profile is defined, first read it, then probe hardware
154
      autoinstall = SCR.Read(path(".etc.install_inf.AutoYaST"))
×
155
      if !autoinstall.nil? && Ops.is_string?(autoinstall) &&
×
156
          Convert.to_string(autoinstall) != ""
×
157
        ProductControl.DisableModule("system_analysis")
×
158
        ProductControl.DisableModule("update_partition_auto")
×
159
      end
×
160

161
      nil
×
162
    end
×
163

164
    def ShowTextFallbackMessage
×
165
      if (Installation.text_fallback || Installation.no_x11) &&
×
166
          Installation.x11_setup_needed && Arch.x11_setup_needed &&
×
167
          !Installation.shown_text_mode_warning
×
168
        x11_msg = ""
×
169
        if (Installation.no_x11 || Installation.text_fallback) && Stage.initial
×
170
          # Somehow the graphical frontend failed and we're running in
171
          # text mode. Inform the user about this fact.
172
          x11_msg = Builtins.sformat(
×
173
            _(
×
174
              "Your computer does not fulfill all requirements for\n" \
×
175
              "a graphical installation. There is either less than %1 MB\n" \
×
176
              "memory or the X server could not be started.\n" \
×
177
              "\n" \
×
178
              "As fallback, the text front-end of YaST2 will guide you\n" \
×
179
              "through the installation. This front-end offers the\n" \
×
180
              "same functionality as the graphical one, but the screens\n" \
×
181
              "differ from those in the manual.\n"
×
182
            ),
×
183
            "96"
×
184
          )
×
185
        elsif (Installation.no_x11 || Installation.text_fallback) && Stage.cont
×
186
          # The script YaST2 wants to inform about a problem with the
187
          # option no_x11 but it's broken.
188
          # else if (Installation::no_x11 ())
189

190
          # Somehow the graphical frontend failed and we're running in
191
          # text mode. Inform the user about this fact.
192
          x11_msg = _(
×
193
            "The graphical interface could not be started.\n" \
×
194
            "\n" \
×
195
            "Either the required packages were not installed (minimal installation) \n" \
×
196
            "or the graphics card is not properly supported.\n" \
×
197
            "\n" \
×
198
            "As fallback, the text front-end of YaST2 will guide you\n" \
×
199
            "through the installation. This front-end offers the\n" \
×
200
            "same functionality as the graphical one, but the screens\n" \
×
201
            "differ from those in the manual.\n"
×
202
          )
×
203
        end
×
204

205
        if x11_msg == ""
×
206
          Builtins.y2error(
×
207
            "There should be a more detailed message displayed here,\n" \
×
208
            "but something went wrong, that's why it is only in the log"
×
209
          )
×
210
        else
×
211
          Report.Message(x11_msg)
×
212
        end
×
213

214
        # show this warning only once
215
        Installation.shown_text_mode_warning = true
×
216
      end
×
217

218
      nil
×
219
    end
×
220

221
    # Re-translate static part of wizard dialog and other predefined messages
222
    # after language change
223
    def retranslateWizardDialog
×
224
      Builtins.y2milestone("Retranslating messages")
×
225

226
      # Make sure the labels for default function keys are retranslated, too.
227
      # Using Label::DefaultFunctionKeyMap() from Label module.
228
      UI.SetFunctionKeys(Label.DefaultFunctionKeyMap)
×
229

230
      # Activate language changes on static part of wizard dialog
231
      ProductControl.RetranslateWizardSteps
×
232
      Wizard.RetranslateButtons
×
233
      Wizard.SetFocusToNextButton
×
234
      nil
×
235
    end
×
236

237
    def SetDiskActivationModule
×
238
      # Connect all the discovered NVMe-over-Fabrics subsystems (jse#PED-318)
239
      connect_nbft if Linuxrc.InstallInf("UseNBFT") == "1"
×
240
      # update the workflow according to current situation
241
      # disable disks activation if not needed
242
      iscsi = Linuxrc.InstallInf("WithiSCSI") == "1"
×
243
      fcoe = Linuxrc.InstallInf("WithFCoE") == "1"
×
244
      no_disk = !::Y2Storage::StorageManager.instance.devices_for_installation?
×
245

246
      if !((Arch.s390 && !Arch.is_zkvm) || iscsi || fcoe || no_disk)
×
247
        Builtins.y2milestone("Disabling disk activation module")
×
248
        ProductControl.DisableModule("disks_activate")
×
249
      end
×
250

251
      nil
×
252
    end
×
253

254
    # Convenience method for discovering and connecting all NVMe over Fabrics subsystems
255
    def connect_nbft
×
256
      require "yast2/execute"
×
257

UNCOV
258
      Yast::Execute.locally!("nvme", "connect-nbft")
×
259
    rescue Cheetah::ExecutionFailed
×
260
      Builtins.y2error("Error connecting NBFT")
×
261
    end
×
262
  end
×
263
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc