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

yast / yast-bootloader / 14854565708

06 May 2025 07:59AM UTC coverage: 87.379% (-0.04%) from 87.417%
14854565708

Pull #716

github

web-flow
Merge f1f4ee92d into d2595d11d
Pull Request #716: Unifying Bootloader Options for systemd-boot and grub2-bls

92 of 119 new or added lines in 10 files covered. (77.31%)

7 existing lines in 1 file now uncovered.

3434 of 3930 relevant lines covered (87.38%)

12.97 hits per line

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

69.57
/src/lib/bootloader/bls_widgets.rb
1
# frozen_string_literal: true
2

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

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

11
module Bootloader
1✔
12
  module BlsWidget
1✔
13
    # Represents bootloader timeout value
14
    class TimeoutWidget < CWM::CustomWidget
1✔
15
      def initialize
1✔
16
        textdomain "bootloader"
11✔
17

18
        super()
11✔
19

20
        @minimum = 0
11✔
21
        @maximum = 600
11✔
22
        @default = 10
11✔
23
      end
24

25
      attr_reader :minimum, :maximum, :default
1✔
26

27
      def contents
1✔
28
        CheckBoxFrame(
2✔
29
          Id(:cont_boot),
30
          _("Automatically boot the default entry after a timeout"),
31
          false,
32
          HBox(
33
            IntField(Id(:seconds), _("&Timeout in Seconds"), @minimum, @maximum,
34
              default_value),
35
            HStretch()
36
          )
37
        )
38
      end
39

40
      def help
1✔
41
        _("<p>Continue boot process after defined seconds.</p>" \
1✔
42
          "<p><b>Timeout in Seconds</b>\n" \
43
          "specifies the time the boot loader will wait until the default kernel is loaded.</p>\n")
44
      end
45

46
      def init
1✔
NEW
47
        current_bl = ::Bootloader::BootloaderFactory.current
×
NEW
48
        if current_bl.respond_to?(:timeout)
×
NEW
49
          timeout = current_bl.timeout
×
NEW
50
        elsif current_bl.respond_to?(:grub_default) && current_bl.grub_default.respond_to?(:timeout)
×
NEW
51
          timeout = current_bl.grub_default.timeout
×
52
        else
NEW
53
          log.error("Bootloader #{current_bl} does not support timeout")
×
NEW
54
          disable
×
NEW
55
          return
×
56
        end
NEW
57
        Yast::UI.ChangeWidget(Id(:cont_boot), :Value, timeout >= 0)
×
NEW
58
        Yast::UI.ChangeWidget(Id(:seconds), :Value,
×
NEW
59
          timeout < 0 ? default_value : timeout)
×
60
      end
61

62
      def store
1✔
63
        current_bl = ::Bootloader::BootloaderFactory.current
1✔
64
        cont_boot = Yast::UI.QueryWidget(Id(:cont_boot), :Value)
1✔
65
        value = cont_boot ? Yast::UI.QueryWidget(Id(:seconds), :Value) : -1
1✔
66
        if current_bl.respond_to?(:timeout)
1✔
67
          current_bl.timeout = value
1✔
NEW
68
        elsif current_bl.respond_to?(:grub_default) && current_bl.grub_default.respond_to?(:timeout)
×
NEW
69
          current_bl.grub_default.timeout = value
×
70
        else
NEW
71
          log.error("Bootloader #{current_bl} does not support timeout")
×
72
        end
73
      end
74

75
    private
1✔
76

77
      def default_value
1✔
78
        # set default
79
        ret = Yast::ProductFeatures.GetIntegerFeature("globals",
2✔
80
          "boot_timeout").to_i
81
        ret = @default if ret <= 0
2✔
82
        ret
2✔
83
      end
84
    end
85
  end
86
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