• 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

74.29
/src/lib/bootloader/bls.rb
1
# frozen_string_literal: true
2

3
require "fileutils"
1✔
4
require "yast"
1✔
5
require "bootloader/sysconfig"
1✔
6
require "bootloader/cpu_mitigations"
1✔
7
require "cfa/grub2/default"
1✔
8

9
Yast.import "Report"
1✔
10

11
module Bootloader
1✔
12
  # Represents bls compatile system calls which can be used
13
  # e.g. by grub2-bls and systemd-boot
14
  class Bls
1✔
15
    include Yast::Logger
1✔
16
    extend Yast::I18n
1✔
17

18
    SDBOOTUTIL = "/usr/bin/sdbootutil"
1✔
19

20
    def initialize
1✔
21
      textdomain "bootloader"
×
22
    end
23

24
    def self.create_menu_entries
1✔
25
      Yast::Execute.on_target!(SDBOOTUTIL, "--verbose", "add-all-kernels")
1✔
26
    rescue Cheetah::ExecutionFailed => e
27
      Yast::Report.Error(
×
28
        format(_(
29
                 "Cannot create boot menu entry:\n" \
30
                 "Command `%{command}`.\n" \
31
                 "Error output: %{stderr}"
32
               ), command: e.commands.inspect, stderr: e.stderr)
33
      )
34
    end
35

36
    def self.install_bootloader
1✔
37
      Yast::Execute.on_target!(SDBOOTUTIL, "--verbose",
1✔
38
        "install")
39
    rescue Cheetah::ExecutionFailed => e
40
      Yast::Report.Error(
×
41
      format(_(
42
               "Cannot install bootloader:\n" \
43
               "Command `%{command}`.\n" \
44
               "Error output: %{stderr}"
45
             ), command: e.commands.inspect, stderr: e.stderr)
46
    )
47
    end
48

49
    def self.write_menu_timeout(timeout)
1✔
50
      Yast::Execute.on_target!(SDBOOTUTIL, "set-timeout", "--", timeout)
1✔
51
    rescue Cheetah::ExecutionFailed => e
52
      Yast::Report.Error(
×
53
      format(_(
54
               "Cannot write boot menu timeout:\n" \
55
               "Command `%{command}`.\n" \
56
               "Error output: %{stderr}"
57
             ), command: e.commands.inspect, stderr: e.stderr)
58
    )
59
    end
60

61
    def self.menu_timeout
1✔
62
      begin
63
        output = Yast::Execute.on_target!(SDBOOTUTIL, "get-timeout", stdout: :capture).to_i
1✔
64
      rescue Cheetah::ExecutionFailed => e
65
        Yast::Report.Error(
×
66
          format(_(
67
                   "Cannot read boot menu timeout:\n" \
68
                   "Command `%{command}`.\n" \
69
                   "Error output: %{stderr}"
70
                 ), command: e.commands.inspect, stderr: e.stderr)
71
        )
NEW
72
        output = -2 # -1 will be returned from sdbootutil for menu-force
×
73
      end
74
      output
1✔
75
    end
76

77
    def self.write_default_menu(default)
1✔
78
      Yast::Execute.on_target!(SDBOOTUTIL, "set-default", default)
1✔
79
    rescue Cheetah::ExecutionFailed => e
80
      Yast::Report.Error(
×
81
      format(_(
82
               "Cannot write default boot menu entry:\n" \
83
               "Command `%{command}`.\n" \
84
               "Error output: %{stderr}"
85
             ), command: e.commands.inspect, stderr: e.stderr)
86
    )
87
    end
88

89
    def self.default_menu
1✔
90
      begin
91
        output = Yast::Execute.on_target!(SDBOOTUTIL, "get-default", stdout: :capture)
1✔
92
      rescue Cheetah::ExecutionFailed => e
93
        Yast::Report.Error(
×
94
          format(_(
95
                   "Cannot read default menu:\n" \
96
                   "Command `%{command}`.\n" \
97
                   "Error output: %{stderr}"
98
                 ), command: e.commands.inspect, stderr: e.stderr)
99
        )
100
        output = ""
×
101
      end
102
      output
1✔
103
    end
104
  end
105
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