Skip to content

Commit

Permalink
Make better grub2 install summary
Browse files Browse the repository at this point in the history
Make better grub2 install summary as much information as we used to have
for legacy grub.
  • Loading branch information
WenhuaChang committed Jan 4, 2013
1 parent 48ed0d2 commit 0088001
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions src/modules/BootGRUB2.ycp
Expand Up @@ -176,6 +176,63 @@ global define void Propose () {
//}
}

/** FATE#303643 Enable one-click changes in bootloader proposal
*
*
*/
string urlLocationSummary()
{
y2milestone("Prepare url summary for GRUB");
string ret = "";
string line = "";
list<string> locations = [];
line = "<ul>\n<li>";
if (BootCommon::globals["boot_mbr"]:"" == "true")
line = line +
_("Boot from MBR is enabled (<a href=\"disable_boot_mbr\">disable</a>") + ")</li>\n";
else
line = line +
_("Boot from MBR is disabled (<a href=\"enable_boot_mbr\">enable</a>") + ")</li>\n";
locations = add(locations, line);
line ="<li>";

boolean set_boot_boot = false;
if ((BootCommon::globals["boot_boot"]:"" == "true") &&
(BootStorage::BootPartitionDevice != BootStorage::RootPartitionDevice))
{
set_boot_boot = true;
line = line +
_("Boot from /boot partition is enabled (<a href=\"disable_boot_boot\">disable</a>") + ")</li></ul>";
}
else if ((BootCommon::globals["boot_boot"]:"" == "false") &&
(BootStorage::BootPartitionDevice != BootStorage::RootPartitionDevice))
{
set_boot_boot = true;
line = line +
_("Boot from /boot partition is disabled (<a href=\"enable_boot_boot\">enable</a>") + ")</li></ul>";
}
if (line != "<li>")
{
locations = add(locations, line);
line ="<li>";
}
if ((BootCommon::globals["boot_root"]:"" == "true") && (!set_boot_boot))
line = line +
_("Boot from \"/\" partition is enabled (<a href=\"disable_boot_root\">disable</a>") + ")</li></ul>";
else if ((BootCommon::globals["boot_root"]:"" == "false") && (!set_boot_boot))
line = line +
_("Boot from \"/\" partition is disabled (<a href=\"enable_boot_root\">enable</a>") + ")</li></ul>";
if (!set_boot_boot)
locations = add(locations, line);

if (size(locations) > 0) {
// FIXME: should we translate all devices to names and add MBR suffixes?
ret = sformat (_("Change Location: %1"), mergestring (locations, " "));
}

return ret;
}


/**
* Display bootloader summary
Expand All @@ -202,6 +259,16 @@ global define list<string> Summary () {
result = add (result, sformat (_("Status Location: %1"), mergestring (locations, ", ")));
}

// it is necessary different summary for autoyast and installation
// other mode than autoyast on running system
if (!Mode::config())
{
result = add(result, urlLocationSummary());
}

string order_sum = BootCommon::DiskOrderSummary ();
if (order_sum != nil)
result = add (result, order_sum);
return result;
}

Expand Down

0 comments on commit 0088001

Please sign in to comment.