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

yast / yast-bootloader / 12048550996

27 Nov 2024 10:37AM UTC coverage: 87.484% (+0.1%) from 87.378%
12048550996

Pull #708

github

schubi2
cleanup
Pull Request #708: Supporting Grub2-BLS

210 of 240 new or added lines in 13 files covered. (87.5%)

88 existing lines in 7 files now uncovered.

3362 of 3843 relevant lines covered (87.48%)

13.0 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✔
NEW
21
      textdomain "bootloader"
×
22
    end
23

24
    def self.create_menu_entries
1✔
25
      Yast::Execute.on_target!(SDBOOTUTIL, "--verbose", "add-all-kernels")
7✔
26
    rescue Cheetah::ExecutionFailed => e
NEW
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",
7✔
38
        "install")
39
    rescue Cheetah::ExecutionFailed => e
NEW
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)
7✔
51
    rescue Cheetah::ExecutionFailed => e
NEW
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
6✔
64
      rescue Cheetah::ExecutionFailed => e
NEW
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 = -1
×
73
      end
74
      output
6✔
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
NEW
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)
7✔
92
      rescue Cheetah::ExecutionFailed => e
NEW
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
        )
NEW
100
        output = ""
×
101
      end
102
      output
7✔
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

© 2025 Coveralls, Inc