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

yast / yast-bootloader / 5442718396

pending completion
5442718396

Pull #686

github

web-flow
Merge f3e4e66c0 into e4f3f8b02
Pull Request #686: Systemd boot feature

766 of 766 new or added lines in 14 files covered. (100.0%)

3175 of 3645 relevant lines covered (87.11%)

12.75 hits per line

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

98.53
/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
4✔
16
      end
17
    end
18

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

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

26
        super()
6✔
27

28
        @minimum = -1
6✔
29
        @maximum = 600
6✔
30
      end
31

32
      attr_reader :minimum, :maximum
1✔
33

34
      def label
1✔
35
        _("&Timeout in Seconds")
1✔
36
      end
37

38
      def help
1✔
39
        _("<p><b>Timeout in Seconds</b>\n" \
1✔
40
          "specifies the time the boot loader will wait until the default kernel is loaded.</p>\n")
41
      end
42

43
      def init
1✔
44
        self.value = systemdboot.menue_timeout.to_i
1✔
45
      end
46

47
      def store
1✔
48
        systemdboot.menue_timeout = value.to_s
×
49
      end
50
    end
51

52
    # Represents switcher for secure boot on EFI
53
    class SecureBootWidget < CWM::CheckBox
1✔
54
      include SystemdBootHelper
1✔
55

56
      def initialize
1✔
57
        textdomain "bootloader"
5✔
58

59
        super
5✔
60
      end
61

62
      def label
1✔
63
        _("&Secure Boot Support")
1✔
64
      end
65

66
      def help
1✔
67
        _(
1✔
68
          "<p><b>Secure Boot Support</b> if checked enables Secure Boot support.<br>" \
69
          "This does not turn on secure booting. " \
70
          "It only sets up the boot loader in a way that supports secure booting. " \
71
          "You still have to enable Secure Boot in the UEFI Firmware.</p> "
72
        )
73
      end
74

75
      def init
1✔
76
        self.value = systemdboot.secure_boot
1✔
77
      end
78

79
      def store
1✔
80
        systemdboot.secure_boot = value
1✔
81
      end
82
    end
83

84
    # represents Tab with kernel related configuration
85
    class KernelTab < CWM::Tab
1✔
86
      def label
1✔
87
        textdomain "bootloader"
1✔
88

89
        _("&Kernel Parameters")
1✔
90
      end
91

92
      def contents
1✔
93
        VBox(
1✔
94
          VSpacing(1),
95
          HBox(
96
            HSpacing(1),
97
            HStretch()
98
          ),
99
          VStretch()
100
        )
101
      end
102
    end
103

104
    # Represent tab with options related to stage1 location and bootloader type
105
    class BootCodeTab < CWM::Tab
1✔
106
      include SystemdBootHelper
1✔
107

108
      def label
1✔
109
        textdomain "bootloader"
1✔
110

111
        _("Boot Co&de Options")
1✔
112
      end
113

114
      def contents
1✔
115
        VBox(
1✔
116
          VSpacing(1),
117
          HBox(
118
            HSpacing(1),
119
            Left(LoaderTypeWidget.new)
120
          ),
121
          VSpacing(1),
122
          *widgets,
123
          VStretch()
124
        )
125
      end
126

127
    private
1✔
128

129
      def widgets
1✔
130
        w = []
1✔
131
        w << SecureBootWidget.new if secure_boot_widget?
1✔
132

133
        w.map do |widget|
1✔
134
          MarginBox(horizontal_margin, 0, Left(widget))
1✔
135
        end
136
      end
137

138
      def horizontal_margin
1✔
139
        @horizontal_margin ||= Yast::UI.TextMode ? 1 : 1.5
1✔
140
      end
141

142
      def secure_boot_widget?
1✔
143
        Systeminfo.secure_boot_available?(systemdboot.name)
1✔
144
      end
145
    end
146

147
    # Represents bootloader specific options like its timeout,
148
    # default section or password protection
149
    class BootloaderTab < CWM::Tab
1✔
150
      def label
1✔
151
        textdomain "bootloader"
1✔
152

153
        _("Boot&loader Options")
1✔
154
      end
155

156
      def contents
1✔
157
        VBox(
1✔
158
          VSpacing(2),
159
          HBox(
160
            HSpacing(1),
161
            TimeoutWidget.new,
162
            HSpacing(1)
163
          ),
164
          VStretch()
165
        )
166
      end
167
    end
168
  end
169
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