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

yast / yast-bootloader / 6034542486

31 Aug 2023 07:50AM UTC coverage: 87.597%. First build
6034542486

Pull #686

github

schubi2
version changed; added changes entry
Pull Request #686: Systemd boot feature

735 of 735 new or added lines in 15 files covered. (100.0%)

3171 of 3620 relevant lines covered (87.6%)

12.98 hits per line

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

92.75
/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
3✔
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"
4✔
58

59
        super
4✔
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
        if Yast::Stage.initial && # while new installation only (currently)
1✔
132
            secure_boot_widget?
133
          w << SecureBootWidget.new
×
134
        end
135

136
        w.map do |widget|
1✔
137
          MarginBox(horizontal_margin, 0, Left(widget))
×
138
        end
139
      end
140

141
      def horizontal_margin
1✔
142
        @horizontal_margin ||= Yast::UI.TextMode ? 1 : 1.5
×
143
      end
144

145
      def secure_boot_widget?
1✔
146
        Systeminfo.secure_boot_available?(systemdboot.name)
×
147
      end
148
    end
149

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

156
        _("Boot&loader Options")
1✔
157
      end
158

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