/
auto_client.rb
88 lines (69 loc) · 1.8 KB
/
auto_client.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# frozen_string_literal: true
require "yast"
require "installation/auto_client"
require "bootloader/bootloader_factory"
require "bootloader/autoyast_converter"
require "bootloader/exceptions"
require "bootloader/main_dialog"
require "bootloader/autoinst_profile/bootloader_section"
Yast.import "Bootloader"
Yast.import "BootStorage"
Yast.import "Initrd"
Yast.import "Progress"
Yast.import "PackagesProposal"
module Bootloader
# Autoyast client for bootloader
class AutoClient < ::Installation::AutoClient
include Yast::I18n
class << self
attr_accessor :changed
end
def run
progress_orig = Yast::Progress.set(false)
ret = super
Yast::Progress.set(progress_orig)
ret
end
def import(data)
return true unless Yast::Bootloader.Import(data)
Yast::PackagesProposal.AddResolvables("yast2-bootloader",
:package, BootloaderFactory.current.packages)
true
end
def summary
formatted_summary = Yast::Bootloader.Summary.map { |l| "<LI>#{l}</LI>" }
"<UL>#{formatted_summary.join("\n")}</UL>"
end
def modified?
self.class.changed
end
def modified
self.class.changed = true
end
def reset
Yast::Bootloader.Reset
end
def change
::Bootloader::MainDialog.new.run_auto
end
# Return configuration data
#
# Some of the sections are useless as they're ignored during import.
# (for example, entries are generated by Grub2 itself).
#
# More details can be found in the original pull request at
# https://github.com/yast/yast-bootloader/pull/272
#
# return map or list
def export
Yast::Bootloader.Export
end
def write
Yast::Bootloader.Write
end
def read
Yast::Initrd.Read
Yast::Bootloader.Read
end
end
end