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

yast / yast-bootloader / 8094915328

29 Feb 2024 10:59AM UTC coverage: 87.363% (-0.2%) from 87.586%
8094915328

push

github

web-flow
Feature: Do not timeout boot menue in systemd-boot. (bsc#1216366) (#695)

* Feature: Do not timeout boot menue in systemd-boot. (bsc#1216366)

14 of 25 new or added lines in 2 files covered. (56.0%)

3180 of 3640 relevant lines covered (87.36%)

12.97 hits per line

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

86.08
/src/lib/bootloader/systemdboot_widgets.rb
1
# frozen_string_literal: true
2

3
require "yast"
1✔
4
require "bootloader/generic_widgets"
1✔
5
require "bootloader/systeminfo"
1✔
6

7
Yast.import "UI"
1✔
8
Yast.import "Arch"
1✔
9

10
module Bootloader
1✔
11
  module SystemdBootWidget
1✔
12
    # Adds to generic widget systemd-boot specific helpers
13
    module SystemdBootHelper
1✔
14
      def systemdboot
1✔
15
        BootloaderFactory.current
5✔
16
      end
17
    end
18

19
    # Represents bootloader timeout value
20
    class TimeoutWidget < CWM::CustomWidget
1✔
21
      include SystemdBootHelper
1✔
22

23
      def initialize
1✔
24
        textdomain "bootloader"
11✔
25

26
        super()
11✔
27

28
        @minimum = 0
11✔
29
        @maximum = 600
11✔
30
        @default = 10
11✔
31
      end
32

33
      attr_reader :minimum, :maximum, :default
1✔
34

35
      def contents
1✔
36
        CheckBoxFrame(
2✔
37
          Id(:cont_boot),
38
          _("Automatically boot the default entry after a timeout"),
39
          false,
40
          HBox(
41
            IntField(Id(:seconds), _("&Timeout in Seconds"), @minimum, @maximum,
42
              systemdboot.menue_timeout.to_i),
43
            HStretch()
44
          )
45
        )
46
      end
47

48
      def help
1✔
49
        _("<p>Continue boot process after defined seconds.</p>" \
1✔
50
          "<p><b>Timeout in Seconds</b>\n" \
51
          "specifies the time the boot loader will wait until the default kernel is loaded.</p>\n")
52
      end
53

54
      def init
1✔
NEW
55
        Yast::UI.ChangeWidget(Id(:cont_boot), :Value, systemdboot.menue_timeout >= 0)
×
NEW
56
        systemdboot.menue_timeout = default_value if systemdboot.menue_timeout < 0
×
NEW
57
        Yast::UI.ChangeWidget(Id(:seconds), :Value, systemdboot.menue_timeout)
×
58
      end
59

60
      def store
1✔
61
        if Yast::UI.QueryWidget(Id(:cont_boot), :Value)
1✔
NEW
62
          systemdboot.menue_timeout = Yast::UI.QueryWidget(Id(:seconds), :Value)
×
63
        else
64
          systemdboot.menue_timeout = -1
1✔
65
        end
66
      end
67

68
    private
1✔
69

70
      def default_value
1✔
71
        # set default
NEW
72
        ret = Yast::ProductFeatures.GetIntegerFeature("globals",
×
73
          "boot_timeout").to_i
NEW
74
        ret = @default if ret <= 0
×
NEW
75
        ret
×
76
      end
77
    end
78

79
    # Represents switcher for secure boot on EFI
80
    class SecureBootWidget < CWM::CheckBox
1✔
81
      include SystemdBootHelper
1✔
82

83
      def initialize
1✔
84
        textdomain "bootloader"
4✔
85

86
        super
4✔
87
      end
88

89
      def label
1✔
90
        _("&Secure Boot Support")
1✔
91
      end
92

93
      def help
1✔
94
        _(
1✔
95
          "<p><b>Secure Boot Support</b> if checked enables Secure Boot support.<br>" \
96
          "This does not turn on secure booting. " \
97
          "It only sets up the boot loader in a way that supports secure booting. " \
98
          "You still have to enable Secure Boot in the UEFI Firmware.</p> "
99
        )
100
      end
101

102
      def init
1✔
103
        self.value = systemdboot.secure_boot
1✔
104
      end
105

106
      def store
1✔
107
        systemdboot.secure_boot = value
1✔
108
      end
109
    end
110

111
    # represents Tab with kernel related configuration
112
    class KernelTab < CWM::Tab
1✔
113
      def label
1✔
114
        textdomain "bootloader"
1✔
115

116
        _("&Kernel Parameters")
1✔
117
      end
118

119
      def contents
1✔
120
        VBox(
1✔
121
          VSpacing(1),
122
          HBox(
123
            HSpacing(1),
124
            HStretch()
125
          ),
126
          VStretch()
127
        )
128
      end
129
    end
130

131
    # Represent tab with options related to stage1 location and bootloader type
132
    class BootCodeTab < CWM::Tab
1✔
133
      include SystemdBootHelper
1✔
134

135
      def label
1✔
136
        textdomain "bootloader"
1✔
137

138
        _("Boot Co&de Options")
1✔
139
      end
140

141
      def contents
1✔
142
        VBox(
1✔
143
          VSpacing(1),
144
          HBox(
145
            HSpacing(1),
146
            Left(LoaderTypeWidget.new)
147
          ),
148
          VSpacing(1),
149
          *widgets,
150
          VStretch()
151
        )
152
      end
153

154
    private
1✔
155

156
      def widgets
1✔
157
        w = []
1✔
158
        if Yast::Stage.initial && # while new installation only (currently)
1✔
159
            secure_boot_widget?
160
          w << SecureBootWidget.new
×
161
        end
162

163
        w.map do |widget|
1✔
164
          MarginBox(horizontal_margin, 0, Left(widget))
×
165
        end
166
      end
167

168
      def horizontal_margin
1✔
169
        @horizontal_margin ||= Yast::UI.TextMode ? 1 : 1.5
×
170
      end
171

172
      def secure_boot_widget?
1✔
173
        Systeminfo.secure_boot_available?(systemdboot.name)
×
174
      end
175
    end
176

177
    # Represents bootloader specific options like its timeout,
178
    # default section or password protection
179
    class BootloaderTab < CWM::Tab
1✔
180
      def label
1✔
181
        textdomain "bootloader"
1✔
182

183
        _("Boot&loader Options")
1✔
184
      end
185

186
      def contents
1✔
187
        VBox(
1✔
188
          VSpacing(2),
189
          HBox(
190
            HSpacing(1),
191
            TimeoutWidget.new,
192
            HSpacing(1)
193
          ),
194
          VStretch()
195
        )
196
      end
197
    end
198
  end
199
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

© 2026 Coveralls, Inc