Skip to content

Commit

Permalink
more fixes found during testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 29, 2016
1 parent 6d5123a commit 7dde3f8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
34 changes: 17 additions & 17 deletions src/lib/bootloader/grub2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def initialize
# Read settings from disk
# @param [Boolean] reread boolean true to force reread settings from system
def read(reread: false)
BootStorage.device_map.propose if BootStorage.device_map.empty?
Yast::BootStorage.device_map.propose if Yast::BootStorage.device_map.empty?
@stage1.read

super
Expand All @@ -42,7 +42,7 @@ def write

# TODO: own class handling PBMR
boot_devices = @stage1.model.devices
boot_discs = boot_devices.map { |d| Storage.GetDisk(Storage.GetTargetMap, d) }
boot_discs = boot_devices.map { |d| Yast::Storage.GetDisk(Yast::Storage.GetTargetMap, d) }
boot_discs.uniq!
gpt_disks = boot_discs.select { |d| d["label"] == "gpt" }
gpt_disks_devices = gpt_disks.map { |d| d["device"] }
Expand Down Expand Up @@ -77,7 +77,7 @@ def propose
# @return a list of summary lines
def summary
result = [
Builtins.sformat(
Yast::Builtins.sformat(
_("Boot Loader Type: %1"),
"GRUB2"
)
Expand All @@ -94,7 +94,7 @@ def summary
# other mode than autoyast on running system
# both ppc and s390 have special devices for stage1 so it do not make sense
# allow change of location to MBR or boot partition (bnc#879107)
result << url_location_summary if !Arch.ppc && !Arch.s390 && !Mode.config
result << url_location_summary if !Yast::Arch.ppc && !Yast::Arch.s390 && !Yast::Mode.config

order_sum = disk_order_summary
result << order_sum if order_sum
Expand All @@ -111,7 +111,7 @@ def name
def disk_order_summary
return "" if Yast::Arch.s390

order = BootStorage.DisksOrder
order = Yast::BootStorage.DisksOrder
return "" if order.size < 2

Yast::Builtins.sformat(
Expand All @@ -125,27 +125,27 @@ def locations
locations = []
already_mentioned = []

if BootStorage.BootPartitionDevice != BootStorage.RootPartitionDevice
if Yast::BootStorage.BootPartitionDevice != Yast::BootStorage.RootPartitionDevice
if @stage1.boot_partition?
locations << BootStorage.BootPartitionDevice + " (\"/boot\")"
already_mentioned << BootStorage.BootPartitionDevice
locations << Yast::BootStorage.BootPartitionDevice + " (\"/boot\")"
already_mentioned << Yast::BootStorage.BootPartitionDevice
end
else
if @stage1.root_partition?
locations << BootStorage.RootPartitionDevice + " (\"/\")"
already_mentioned << BootStorage.RootPartitionDevice
locations << Yast::BootStorage.RootPartitionDevice + " (\"/\")"
already_mentioned << Yast::BootStorage.RootPartitionDevice
end
end
if @stage1.extended_partition?
# TRANSLATORS: extended is here for extended partition. Keep translation short.
locations << BootStorage.ExtendedPartitionDevice + _(" (extended)")
already_mentioned << BootStorage.ExtendedPartitionDevice
locations << Yast::BootStorage.ExtendedPartitionDevice + _(" (extended)")
already_mentioned << Yast::BootStorage.ExtendedPartitionDevice
end
if @stage1.mbr?
# TRANSLATORS: MBR is acronym for Master Boot Record, if nothing locally specific
# is used in your language, then keep it as it is.
locations << BootStorage.mbr_disk + _(" (MBR)")
already_mentioned << BootStorage.mbr_disk
locations << Yast::BootStorage.mbr_disk + _(" (MBR)")
already_mentioned << Yast::BootStorage.mbr_disk
end
locations << @stage1.custom_devices if !@stage1.custom_devices.empty?

Expand All @@ -166,7 +166,7 @@ def mbr_line

def partition_line
# check for separated boot partition, use root otherwise
if BootStorage.BootPartitionDevice != BootStorage.RootPartitionDevice
if Yast::BootStorage.BootPartitionDevice != Yast::BootStorage.RootPartitionDevice
if @stage1.boot_partition?
_(
"Install bootcode into /boot partition (<a href=\"disable_boot_boot\">do not install</a>)"
Expand Down Expand Up @@ -200,7 +200,7 @@ def url_location_summary
line << "</li>\n"

# do not allow to switch on boot from partition that do not support it
if BootStorage.can_boot_from_partition
if Yast::BootStorage.can_boot_from_partition
line << "<li>"
line << partition_line
line << "</li>"
Expand All @@ -210,7 +210,7 @@ def url_location_summary
# no location chosen, so warn user that it is problem unless he is sure
msg = _("Warning: No location for bootloader stage1 selected." \
"Unless you know what you are doing please select above location.")
line << "<li>" << HTML.Colorize(msg, "red") << "</li>"
line << "<li>" << Yast::HTML.Colorize(msg, "red") << "</li>"
end

line << "</ul>"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/bootloader/grub2_widgets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def contents
private

def indented_widget(widget)
widgets << MarginBox(1, 0.5, Left(widget))
MarginBox(1, 0.5, Left(widget))
end

def loader_location_widget?
Expand Down
4 changes: 2 additions & 2 deletions src/lib/bootloader/stage1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def initialize
end

def read
@model.read
@model.load
end

def write
@model.write
@model.save
end

def include?(dev)
Expand Down
1 change: 1 addition & 0 deletions src/modules/BootStorage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def gpt_boot_disk?
return false unless current_bl.respond_to?(:stage1)

targets = current_bl.stage1.model.devices
target_map = Yast::Storage.GetTargetMap
boot_discs = targets.map { |d| Yast::Storage.GetDisk(target_map, d) }
boot_discs.any? { |d| d["label"] == "gpt" }
end
Expand Down

0 comments on commit 7dde3f8

Please sign in to comment.