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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'src/clients/bootloader_auto.rb', line 19
def main
Yast.import "UI"
textdomain "bootloader"
Builtins.y2milestone("----------------------------------------")
Builtins.y2milestone("bootloader auto started")
Yast.import "Bootloader"
Yast.import "BootCommon"
Yast.import "Initrd"
Yast.import "Progress"
Yast.import "Mode"
Yast.include self, "bootloader/routines/autoinstall.rb"
Yast.include self, "bootloader/routines/wizards.rb"
@progress_orig = Progress.set(false)
@ret = nil
@func = ""
@param = {}
if Ops.greater_than(Builtins.size(WFM.Args), 0) &&
Ops.is_string?(WFM.Args(0))
@func = Convert.to_string(WFM.Args(0))
if Ops.greater_than(Builtins.size(WFM.Args), 1) &&
Ops.is_map?(WFM.Args(1))
@param = Convert.to_map(WFM.Args(1))
end
end
Builtins.y2debug("func=%1", @func)
Builtins.y2debug("param=%1", @param)
if @func == "Import"
data = AI2Export(@param)
if data
@ret = Bootloader.Import(data)
if Stage.initial
BootCommon.DetectDisks
Builtins.y2debug("autoyast: Proposing - fix")
Bootloader.Propose
Builtins.y2debug("autoyast: Proposing done")
end
else
@ret = false
end
elsif @func == "Summary"
@ret = Ops.add(
Ops.add(
"<UL>",
Builtins.mergestring(Builtins.maplist(Bootloader.Summary) do |l|
Ops.add("<LI>", l)
end, "\n")
),
"</UL>"
)
elsif @func == "GetModified"
@ret = BootCommon.changed
elsif @func == "SetModified"
BootCommon.changed = true
@ret = true
elsif @func == "Reset"
Bootloader.Reset
@ret = {}
elsif @func == "Change"
@ret = BootloaderAutoSequence()
return deep_copy(@ret)
elsif @func == "Export"
@ret = Export2AI(
Convert.convert(
Bootloader.Export,
:from => "map",
:to => "map <string, any>"
)
)
elsif @func == "Write"
@ret = Bootloader.Write
elsif @func == "Read"
Initrd.Read
@ret = Bootloader.Read
else
Builtins.y2error("unknown function: %1", @func)
@ret = false
end
Progress.set(@progress_orig)
Builtins.y2debug("ret=%1", @ret)
Builtins.y2milestone("bootloader_auto finished")
Builtins.y2milestone("----------------------------------------")
deep_copy(@ret)
end
|