Skip to content

Commit

Permalink
do not allow to install to partition with xfs (bnc#884255)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jun 27, 2014
1 parent 0d8e416 commit d1f8564
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 28 deletions.
12 changes: 9 additions & 3 deletions src/include/bootloader/grub/options.rb
Expand Up @@ -735,6 +735,14 @@ def HelpBootLoaderLocationWidget
# @return [Yast::Term] with widgets

def grubBootLoaderLocationWidget
if BootStorage.can_boot_from_partition
partition_boot = BootStorage.BootPartitionDevice == BootStorage.RootPartitionDevice ?
Left(CheckBox(Id("boot_root"), _("Boot from &Root Partition"))) :
Left(CheckBox(Id("boot_boot"), _("Boo&t from Boot Partition")))
else
partition_boot = Empty()
end

contents = VBox(
VSpacing(1),
Frame(
Expand All @@ -746,9 +754,7 @@ def grubBootLoaderLocationWidget
Left(
CheckBox(Id("boot_mbr"), _("Boot from &Master Boot Record"))
),
BootStorage.BootPartitionDevice == BootStorage.RootPartitionDevice ?
Left(CheckBox(Id("boot_root"), _("Boot from &Root Partition"))) :
Left(CheckBox(Id("boot_boot"), _("Boo&t from Boot Partition"))),
partition_boot,
BootStorage.ExtendedPartitionDevice ?
Left(
CheckBox(
Expand Down
6 changes: 6 additions & 0 deletions src/include/bootloader/grub2/misc.rb
Expand Up @@ -26,6 +26,7 @@ def initialize_bootloader_grub2_misc(include_target)
Yast.import "StorageDevices"
Yast.import "Mode"
Yast.import "BootCommon"
Yast.import "BootStorage"
Yast.import "PackageSystem"
Yast.import "Map"
Yast.import "Arch"
Expand Down Expand Up @@ -695,6 +696,11 @@ def grub_ConfigureLocation
selected_location = :mbr
end

if !BootStorage.can_boot_from_partition
Builtins.y2milestone("/boot cannot be used to install stage1")
selected_location = :mbr
end

SetBootloaderDevice(selected_location)
if !Builtins.contains(
BootStorage.getPartitionList(:boot, "grub"),
Expand Down
53 changes: 28 additions & 25 deletions src/modules/BootGRUB2.rb
Expand Up @@ -183,7 +183,6 @@ def prep_partitions
def urlLocationSummary
Builtins.y2milestone("Prepare url summary for GRUB2")
# FIXME identical code in BootGRUB module
locations = []
line = "<ul>\n<li>"
if BootCommon.globals["boot_mbr"] == "true"
line << _(
Expand All @@ -195,36 +194,40 @@ def urlLocationSummary
)
end
line << "</li>\n"
locations << line

line = "<li>"
# do not allow to switch on boot from partition that do not support it
if BootStorage.can_boot_from_partition
line << "<li>"

# check for separated boot partition, use root otherwise
if BootStorage.BootPartitionDevice != BootStorage.RootPartitionDevice
if BootCommon.globals["boot_boot"] == "true"
line << _(
"Install bootcode into /boot partition (<a href=\"disable_boot_boot\">do not install</a>)"
)
else
line << _(
"Do not install bootcode into /boot partition (<a href=\"enable_boot_boot\">install</a>)"
)
end
else
if BootCommon.globals["boot_root"] == "true"
line << _(
"Install bootcode into \"/\" partition (<a href=\"disable_boot_root\">do not install</a>)"
)
# check for separated boot partition, use root otherwise
if BootStorage.BootPartitionDevice != BootStorage.RootPartitionDevice
if BootCommon.globals["boot_boot"] == "true"
line << _(
"Install bootcode into /boot partition (<a href=\"disable_boot_boot\">do not install</a>)"
)
else
line << _(
"Do not install bootcode into /boot partition (<a href=\"enable_boot_boot\">install</a>)"
)
end
else
line << _(
"Do not install bootcode into \"/\" partition (<a href=\"enable_boot_root\">install</a>)"
)
if BootCommon.globals["boot_root"] == "true"
line << _(
"Install bootcode into \"/\" partition (<a href=\"disable_boot_root\">do not install</a>)"
)
else
line << _(
"Do not install bootcode into \"/\" partition (<a href=\"enable_boot_root\">install</a>)"
)
end
end
line << "</li>"
end
line << "</li></ul>"
locations << line

return _("Change Location: %s") % locations.join(" ")
line << "</ul>"

# TRANSLATORS: title for list of location proposals
return _("Change Location: %s") % line
end


Expand Down
17 changes: 17 additions & 0 deletions src/modules/BootStorage.rb
Expand Up @@ -1412,6 +1412,23 @@ def checkMDDevices(tm, device)
ret
end

def can_boot_from_partition
tm = Storage.GetTargetMap
partition = @BootPartitionDevice || @RootPartitionDevice

part = Storage.GetPartition(tm, partition)

if !part
Builtins.y2error("cannot find partition #{partition}")
return false
end

fs = part["used_fs"]
Builtins.y2milestone("FS for boot partition #{fs}")

# cannot install stage one to xfs as it doesn't have reserved space (bnc#884255)
return fs != :xfs
end

# FATE#305008: Failover boot configurations for md arrays with redundancy
# Function check partitions and set redundancy available if
Expand Down

0 comments on commit d1f8564

Please sign in to comment.