Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3bf9c2f
commit 3660591
Showing
2 changed files
with
103 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,132 +1,3 @@ | ||
# encoding: utf-8 | ||
require "bootloader/bootloader_auto_client" | ||
|
||
# File: | ||
# bootloader_auto.ycp | ||
# | ||
# Module: | ||
# Bootloader installation and configuration | ||
# | ||
# Summary: | ||
# Bootloader autoinstallation preparation | ||
# | ||
# Authors: | ||
# Jiri Srain <jsrain@suse.cz> | ||
# | ||
# $Id$ | ||
# | ||
module Yast | ||
class BootloaderAutoClient < Client | ||
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 = {} | ||
|
||
# Check arguments | ||
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) | ||
# moved here from inst_autosetup* | ||
if Stage.initial | ||
BootCommon.DetectDisks | ||
Builtins.y2debug("autoyast: Proposing - fix") | ||
Bootloader.Propose | ||
Builtins.y2debug("autoyast: Proposing done") | ||
end | ||
else | ||
@ret = false | ||
end | ||
# Create a summary | ||
# return string | ||
elsif @func == "Summary" | ||
@ret = Ops.add( | ||
Ops.add( | ||
"<UL>", | ||
Builtins.mergestring(Builtins.maplist(Bootloader.Summary) do |l| | ||
Ops.add("<LI>", l) | ||
end, "\n") | ||
), | ||
"</UL>" | ||
) | ||
# did configuration changed | ||
# return boolean | ||
elsif @func == "GetModified" | ||
@ret = BootCommon.changed | ||
# set configuration as changed | ||
# return boolean | ||
elsif @func == "SetModified" | ||
BootCommon.changed = true | ||
@ret = true | ||
# Reset configuration | ||
# return map or list | ||
elsif @func == "Reset" | ||
Bootloader.Reset | ||
@ret = {} | ||
# Change configuration | ||
# return symbol (i.e. `finish || `accept || `next || `cancel || `abort) | ||
elsif @func == "Change" | ||
@ret = BootloaderAutoSequence() | ||
return deep_copy(@ret) | ||
# Return configuration data | ||
# return map or list | ||
elsif @func == "Export" | ||
@ret = Export2AI( | ||
Convert.convert( | ||
Bootloader.Export, | ||
:from => "map", | ||
:to => "map <string, any>" | ||
) | ||
) | ||
# Write configuration data | ||
# return boolean | ||
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) | ||
|
||
# EOF | ||
end | ||
end | ||
end | ||
|
||
Yast::BootloaderAutoClient.new.main | ||
::Bootloader::BootloaderAutoClient.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# encoding: utf-8 | ||
|
||
# File: | ||
# bootloader_auto.ycp | ||
# | ||
# Module: | ||
# Bootloader installation and configuration | ||
# | ||
# Summary: | ||
# Bootloader autoinstallation preparation | ||
# | ||
# Authors: | ||
# Jiri Srain <jsrain@suse.cz> | ||
# | ||
# $Id$ | ||
# | ||
|
||
require "installation/auto_client" | ||
|
||
module Bootloader | ||
class BootloaderAutoClient < ::Installation::AutoClient | ||
include Yast::I18n | ||
include Yast::Logger | ||
|
||
def initialize | ||
Yast.import "UI" | ||
textdomain "bootloader" | ||
|
||
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" | ||
end | ||
|
||
def run | ||
progress_orig = Yast::Progress.set(false) | ||
super | ||
Yast::Progress.set(@progress_orig) | ||
end | ||
|
||
def import(data) | ||
data = AI2Export(data) | ||
if data | ||
ret = Yast::Bootloader.Import(data) | ||
# moved here from inst_autosetup* | ||
if Yast::Stage.initial | ||
Yast::BootCommon.DetectDisks | ||
Yast::Bootloader.Propose | ||
end | ||
else | ||
ret = false | ||
end | ||
|
||
ret | ||
end | ||
|
||
def summary | ||
formatted_summary = Yast::Bootloader.Summary.map { |l| "<LI>#{l}</LI>" } | ||
|
||
"<UL>" + formatted_summary.join("\n") + "</UL>" | ||
end | ||
|
||
def modified? | ||
BootCommon.changed | ||
end | ||
|
||
def modified | ||
BootCommon.changed = true | ||
end | ||
|
||
def reset | ||
Bootloader.Reset | ||
|
||
{} | ||
end | ||
|
||
def change | ||
BootloaderAutoSequence() | ||
end | ||
|
||
def export | ||
Export2AI(Yast::Bootloader.Export) | ||
end | ||
|
||
def write | ||
Yast::Bootloader.Write | ||
end | ||
|
||
def read | ||
Yast::Initrd.Read | ||
Yast::Bootloader.Read | ||
end | ||
end | ||
end | ||
|
||
Yast::BootloaderAutoClient.new.main | ||
|