Author: odabrunz
Date: Tue Jul 10 23:00:36 2007
New Revision: 39304
URL: http://svn.opensuse.org/viewcvs/yast?rev=39304&view=rev
Log:
- fix faulty detection of user-changes to the "/boot" and "/"
devices from yast2-storage: rewrote grub_DisksChanged() to work
properly with boot_* variables (previous fix did not work
correctly) (#247852)
- grub_DisksChanged() now returns a message summarizing all changes
for selected bootloader devices; this message is now used in the
popup that ask the user if he wants to repropose after a
partitioning change (in askLocationResetPopup()) (#247852)
- rewrote check for disk changes to work with multiple selected
bootloader locations in grub_DetectDisks() and
grub_LocationProposal() (#247852)
- the summary message for GRUB now includes a short string ("/",
"/boot", MBR) that gives the reason why each device has been
selected for bootloader stage 1 installation
- changed comment for GetBootloaderDevices()
- GRUB only: accept old-style autoyast keys "repl_mbr" "activate" and
"location" when importing an autoyast profile; "loader_device" is
ignored (which may be fixable if we can make sure a target map is
available) (#245680)
- grub:
- if autoyast profile does not specify a bootloader location,
propose one (#263305)
- if autoyast profile does not specify a key for the default keys
set by a yast-bootloader proposal, add these missing
keys/values
- enabled translation of the kernel image name from the symlink to
the real kernel file for the "failsafe" section; perl-Bootloader
can handle this now
- convert device names in the grub device map to and from the
"mount_by" device names as well (#248162)
- Changed location of EFI Bootloader Label widget in YaST2 gui (#242985)
- make installation of bootloader to the extended partition work
with new design (#246161, #259050)
- enabled extended device handling in GetBootloaderDevices as well
- make persistent device names work with boot= directive for i386
lilo (#248162)
- log conversion of old-style global keys from autoyast profile to
new-style keys
- during update, update value of "default" directive for lilo and grub
(#266534)
- do not show popup for changed MBR position when it did not
change: use correct function for MBR detection (#267276)
- fixed autoyast logging change
- Fix for removal of wrong efiboot entries (#269130)
- fix for update-mode: fix updating of kernel-image and initrd
filenames to the resolved symlinks (image-version and
initrd-version) (#268731, helps not to trigger #267582 and
#244033)
- #270202:
- grub: fix erroneously added section "Hard Disk" on systems
without a floppy drive: use new style variables for detecting
that we install stage1 to a floppy disk
- for bootloaders that still use the old style variables, check
for undefined loader_device before comparing to floppy device
Modified:
trunk/bootloader/src/clients/bootloader_finish.ycp
trunk/bootloader/src/grub/misc.ycp
trunk/bootloader/src/modules/BootCommon.ycp
trunk/bootloader/src/modules/BootELILO.ycp
trunk/bootloader/src/modules/BootGRUB.ycp
trunk/bootloader/src/modules/Bootloader.ycp
trunk/bootloader/src/routines/autoinstall.ycp
trunk/bootloader/src/routines/lilolike.ycp
trunk/bootloader/src/routines/misc.ycp
trunk/bootloader/src/routines/popups.ycp
Modified: trunk/bootloader/src/clients/bootloader_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/clients/bootloader_finish.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/clients/bootloader_finish.ycp (original)
+++ trunk/bootloader/src/clients/bootloader_finish.ycp Tue Jul 10 23:00:36 2007
@@ -142,7 +142,15 @@
// FIXME: this is the plan B solution, try to solve plan A in
// BootCommon.ycp:CreateLinuxSection() (line 435)
// resolve symlinks in kernel and initrd paths
- Bootloader::ResolveSymlinksInSections();
+
+ // In Mode::update(), the configuration is not yet read (for some
+ // unresearched reason). Therefore, for Mode::update(), there is another
+ // call of ResolveSymlinksInSections() after a Read() in
+ // Bootloader::ReadOrProposeIfNeeded() (which is called the first time
+ // Write() is reached from the call-chain that starts below:
+ // Bootloader::Update() -> Write()).
+ if (!Mode::update ())
+ Bootloader::ResolveSymlinksInSections();
if (!Mode::update ())
{
Modified: trunk/bootloader/src/grub/misc.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/misc.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/grub/misc.ycp (original)
+++ trunk/bootloader/src/grub/misc.ycp Tue Jul 10 23:00:36 2007
@@ -10,6 +10,7 @@
*
* Authors:
* Jiri Srain
+ * Olaf Dabrunz
*
* $Id$
*
@@ -26,7 +27,31 @@
// --------------------------------------------------------------
// --------------------------------------------------------------
-// updateMBR and related stuff (taken from routines/misc.ycp)
+// updateMBR and related stuff, plus InstallingToFloppy() (taken from
+// routines/misc.ycp)
+
+/**
+ * Check if installation to floppy is performed
+ * @return true if installing bootloader to floppy
+ */
+global boolean grub_InstallingToFloppy () {
+ boolean ret = false;
+ // there is no boot_floppy flag, the installation to floppy devices needs
+ // to be specified in the boot_custom flag
+ // (FIXME: which is freely editable, as soon as the generic 'selectdevice'
+ // widget allows this; also need perl-Bootloader to put the floppy device
+ // in the list of the boot_custom widget)
+ if (BootCommon::globals["boot_custom"]:nil == nil)
+ ret = false;
+ else if (BootCommon::globals["boot_custom"]:nil ==
+ StorageDevices::FloppyDevice)
+ ret = true;
+ else if (contains (BootCommon::getFloppyDevices (),
+ BootCommon::globals["boot_custom"]:nil))
+ ret = true;
+ y2milestone ("Installing to floppy: %1", ret);
+ return ret;
+}
/**
* Given a device name to which we install the bootloader (loader_device),
@@ -495,15 +520,15 @@
* with this function. The function cannot be used to set a custom boot device.
* It will always be deleted.
*
- * FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
- * decisions are automatic anyway and perl-Bootloader should be able to make
- * these decisions without help from the user or the proposal.
+ * FIXME: `mbr_md is probably unneeded; AFA we can see, this decision is
+ * automatic anyway and perl-Bootloader should be able to make it without help
+ * from the user or the proposal.
*
* @param selected_location symbol one of `boot `root `mbr `extended `mbr_md `none
*/
define void SetBootloaderDevice(symbol selected_location) {
// first, default to all off:
- foreach (string flag, ["boot_boot", "boot_root", "boot_mbr"], {
+ foreach (string flag, ["boot_boot", "boot_root", "boot_mbr", "boot_extended"], {
BootCommon::globals[flag] = sformat("%1", false);
});
// need to remove the boot_custom key to switch this value off
@@ -518,11 +543,11 @@
BootCommon::globals["boot_boot"] = sformat("%1", true);
} else if ( selected_location == `mbr ) {
BootCommon::globals["boot_mbr"] = sformat("%1", true);
-// FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
-// decisions are automatic anyway and perl-Bootloader should be able to make
-// these decisions without help from the user or the proposal.
-// } else if ( selected_location == `extended ) {
-// BootCommon::globals["boot_extended"] = sformat("%1", true);
+ } else if ( selected_location == `extended ) {
+ BootCommon::globals["boot_extended"] = sformat("%1", true);
+// FIXME: `mbr_md is probably unneeded; AFA we can see, this decision is
+// automatic anyway and perl-Bootloader should be able to make it without help
+// from the user or the proposal.
// } else if ( selected_location == `mbr_md ) {
// BootCommon::globals["boot_mbr_md"] = sformat("%1", true);
}
@@ -574,7 +599,7 @@
map dm = tm[boot_partition_disk]:$[];
list<map> partitions_on_boot_partition_disk = dm["partitions"]:[];
boolean is_logical = false;
-// string extended = nil;
+ string extended = nil;
// determine the underlying devices for the "/boot" partition (either the
// BootPartitionDevice, or the devices from which the soft-RAID device for
@@ -595,15 +620,11 @@
y2milestone ("Boot partition devices: %1", underlying_boot_partition_devices);
foreach (map p, partitions_on_boot_partition_disk, {
-// FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
-// decisions are automatic anyway and perl-Bootloader should be able to make
-// these decisions without help from the user or the proposal.
-// if (p["type"]:nil == `extended)
-// {
-// extended = (string)p["device"]:nil;
-// }
-// else if (contains (underlying_boot_partition_devices, p["device"]:"")
- if (contains (underlying_boot_partition_devices, p["device"]:"")
+ if (p["type"]:nil == `extended)
+ {
+ extended = (string)p["device"]:nil;
+ }
+ else if (contains (underlying_boot_partition_devices, p["device"]:"")
&& p["type"]:nil == `logical)
{
// If any of the underlying_boot_partition_devices can be found on
@@ -616,10 +637,7 @@
});
y2milestone ("/boot is on 1st disk: %1", boot_partition_is_on_mbr_disk);
y2milestone ("/boot is in logical partition: %1", is_logical);
-// FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
-// decisions are automatic anyway and perl-Bootloader should be able to make
-// these decisions without help from the user or the proposal.
-// y2milestone ("The extended partition: %1", extended);
+ y2milestone ("The extended partition: %1", extended);
// keep_mbr, if the MBR contains special code that needs to be kept,
// like Thinkpad boot code (and ATM only Thinkpad boot code
@@ -647,9 +665,9 @@
}
else if (size (underlying_boot_partition_devices) > 1)
{
-// FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
-// decisions are automatic anyway and perl-Bootloader should be able to make
-// these decisions without help from the user or the proposal.
+// FIXME: `mbr_md is probably unneeded; AFA we can see, this decision is
+// automatic anyway and perl-Bootloader should be able to make it without help
+// from the user or the proposal.
// In one or two places yast2-bootloader needs to find out all underlying MBR
// devices, if we install stage 1 to a soft-RAID. These places need to find out
// themselves if we have MBRs on a soft-RAID or not.
@@ -659,12 +677,9 @@
if (keep_mbr)
{
-// FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
-// decisions are automatic anyway and perl-Bootloader should be able to make
-// these decisions without help from the user or the proposal.
-// if (is_logical && extended != nil)
-// selected_location = `extended;
-// else
+ if (is_logical && extended != nil)
+ selected_location = `extended;
+ else
selected_location = `boot;
}
@@ -703,8 +718,34 @@
}
/**
- * Detect "/boot", "/" (root) and extended partition devices and MBR disk
- * device
+ * Find extended partition device (if it exists) on the same device where the
+ * BootPartitionDevice is located
+ *
+ * BootPartitionDevice must be set
+ *
+ * @return string device name of extended partition, or nil if none found
+ */
+string grub_GetExtendedPartitionDev () {
+ string ret = nil;
+
+ map tm = Storage::GetTargetMap ();
+ map dp = Storage::GetDiskPartition (BootCommon::BootPartitionDevice);
+ string disk = dp["disk"]:"";
+ map dm = tm[disk]:$[];
+ list<map> partitions = dm["partitions"]:[];
+ foreach (map p, partitions, {
+ if (p["type"]:nil == `extended)
+ {
+ ret = (string)p["device"]:nil;
+ }
+ });
+
+ return ret;
+}
+
+/**
+ * Detect "/boot", "/" (root), extended partition device and MBR disk device
+ *
* If no bootloader device has been set up yet (globals["boot_*"]), or the
* first (FIXME(!)) device is not available as a boot partition, also call
* grub_ConfigureLocation to configure globals["boot_*"] and set the
@@ -741,21 +782,8 @@
BootCommon::BootPartitionDevice
= mountdata_boot[0]:BootCommon::RootPartitionDevice;
-// FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
-// decisions are automatic anyway and perl-Bootloader should be able to make
-// these decisions without help from the user or the proposal.
-// map tm = Storage::GetTargetMap ();
-// map dp = Storage::GetDiskPartition (BootCommon::BootPartitionDevice);
-// string disk = dp["disk"]:"";
-// map dm = tm[disk]:$[];
-// list<map> partitions = dm["partitions"]:[];
-// foreach (map p, partitions, {
-// if (p["type"]:nil == `extended)
-// {
-// BootCommon::ExtendedPartitionDevice =
-// (string)p["device"]:nil;
-// }
-// });
+ // get extended partition device (if exists)
+ BootCommon::ExtendedPartitionDevice = grub_GetExtendedPartitionDev();
if (BootCommon::mbrDisk == "" || BootCommon::mbrDisk == nil)
{
@@ -763,60 +791,153 @@
BootCommon::mbrDisk = BootCommon::FindMBRDisk();
}
+ // if no bootloader devices have been set up, or any of the set up
+ // bootloader devices have become unavailable, then re-propose the
+ // bootloader location.
+ list<string> all_boot_partitions = BootCommon::getPartitionList(`boot);
list<string> bldevs = BootCommon::GetBootloaderDevices();
- if (bldevs == nil || bldevs == ["/dev/null"]
- // FIXME: check for all bldevs that they are still available
- || ! contains (BootCommon::getPartitionList (`boot), bldevs[0]:nil))
+ boolean need_location_reconfigure = false;
+
+ if ( bldevs == nil || bldevs == ["/dev/null"] )
+ need_location_reconfigure = true;
+ else {
+ foreach (string dev, bldevs, {
+ if (!contains(all_boot_partitions, dev))
+ need_location_reconfigure = true;
+ });
+ }
+
+ if ( need_location_reconfigure )
grub_ConfigureLocation ();
}
/**
- * Check whether disk settings were changed since last checking
- * @return boolean true if needs to recheck
+ * Check whether any disk settings for the disks we currently use were changed
+ * since last checking
+ * @return map map containing boolean "changed" and string "reason"
*/
-define boolean grub_DisksChanged () {
+define map grub_DisksChanged () {
+ map ret = $[
+ "changed" : false,
+ "reason" : ""
+ ];
+
if (Mode::config ())
- return false;
+ return ret;
+
map mp = Storage::GetMountPoints();
string actual_root = mp["/", 0]:"";
string actual_boot = mp["/boot", 0]:actual_root;
+ string actual_extended = grub_GetExtendedPartitionDev();
- // FIXME: improve comment
- // don't change configuration if '/' and '/boot' were not changed
- // and location is "floppy", "mbr" or "boot"
- if (actual_boot == BootCommon::BootPartitionDevice
- && actual_root == BootCommon::RootPartitionDevice
- && ! haskey( BootCommon::globals, "boot_custom")
- && (
- BootCommon::globals["boot_root"]:"false" == "true" ||
- BootCommon::globals["boot_boot"]:"false" == "true" ||
- BootCommon::globals["boot_mbr"]:"false" == "true"
-// FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
-// decisions are automatic anyway and perl-Bootloader should be able to make
-// these decisions without help from the user or the proposal.
-// BootCommon::globals["boot_extended"]:"false" == "true" ||
-// BootCommon::globals["boot_mbr_md"]:"false" == "true"
- )
- )
- {
- return false;
- }
+ if ( BootCommon::globals["boot_boot"]:"false" == "true" &&
+ actual_boot != BootCommon::BootPartitionDevice )
+ ret = $[
+ "changed" : true,
+ "reason" : (string) ret["reason"]:"" +
+ "Selected bootloader location \"/boot\" is not on " +
+ BootCommon::BootPartitionDevice +
+ " any more.\n"
+ ];
+
+ if ( BootCommon::globals["boot_root"]:"false" == "true" &&
+ actual_root != BootCommon::RootPartitionDevice )
+ ret = $[
+ "changed" : true,
+ "reason" : (string) ret["reason"]:"" +
+ "Selected bootloader location \"/\" is not on " +
+ BootCommon::RootPartitionDevice +
+ " any more.\n"
+ ];
- list all_partitions = BootCommon::getPartitionList(`boot);
+ if ( BootCommon::globals["boot_mbr"]:"false" == "true" ) {
+ string actual_mbr = BootCommon::FindMBRDisk();
- if (!contains(all_partitions, (BootCommon::GetBootloaderDevices())[0]:nil))
- {
- y2milestone ("Location should be set again");
- return true;
+ if ( actual_mbr != BootCommon::mbrDisk )
+ ret = $[
+ "changed" : true,
+ "reason" : (string) ret["reason"]:"" +
+ "Selected bootloader location MBR is not on " +
+ BootCommon::mbrDisk +
+ " any more.\n"
+ ];
+ }
+
+ if ( BootCommon::globals["boot_extended"]:"false" == "true" &&
+ actual_extended != BootCommon::ExtendedPartitionDevice )
+ ret = $[
+ "changed" : true,
+ "reason" : (string) ret["reason"]:"" +
+ "Selected bootloader location \"extended partition\" is not on " +
+ BootCommon::ExtendedPartitionDevice +
+ " any more.\n"
+ ];
+
+// FIXME: `mbr_md is probably unneeded; AFA we can see, this decision is
+// automatic anyway and perl-Bootloader should be able to make it without help
+// from the user or the proposal.
+// if ( BootCommon::globals["boot_mbr_md"]:"false" == "true" ) {
+// // FIXME: handle Md2Partitions() etc. here
+// map p_dev = Storage::GetDiskPartition (BootCommon::BootPartitionDevice);
+// string actual_mbr = p_dev["disk"]:"";
+//
+// if ( actual_mbr != BootCommon::mbrDisk )
+// ret = true; // FIXME: use new return structure
+// }
+
+ if ( BootCommon::globals["boot_custom"]:nil != nil ) {
+ list all_boot_partitions = BootCommon::getPartitionList(`boot);
+
+ if ( ! contains(all_boot_partitions, BootCommon::globals["boot_custom"]:nil) )
+ ret = $[
+ "changed" : true,
+ "reason" : (string) ret["reason"]:"" +
+ "Selected custom bootloader partition " +
+ BootCommon::globals["boot_custom"]:nil +
+ " is not available any more.\n"
+ ];
}
- return false;
+
+ if ( ret["changed"]:false )
+ y2milestone ("Location should be set again");
+
+ return ret;
}
/**
* Propose the boot loader location for grub
+ * - if no proposal has been made, collects the devices for "/", "/boot", MBR
+ * and makes a new proposal
+ * - if no device mapping exists, creates a device mapping
+ * - if the devices that were somehow (proposal, user interface) selected for
+ * bootloader installation do not match the current partitioning any more
+ * (e.g. "/boot" partition was selected but is not available anymore (and
+ * "/" did not move there), "/" was selected but has moved, etc.), then also
+ * re-collect the devices for "/", "/boot", MBR and make a new proposal
*/
define void grub_LocationProposal () {
- if (! BootCommon::was_proposed)
+ y2milestone("globals: %1", BootCommon::globals);
+ y2milestone("Mode::autoinst: %1", Mode::autoinst());
+ y2milestone("haskey( BootCommon::globals, boot_boot ): %1", haskey( BootCommon::globals, "boot_boot" ));
+ if (! BootCommon::was_proposed ||
+ // During autoinstall, the autoyast profile must contain a bootloader
+ // device specification (we currently really only support system
+ // *cloning* with autoyast...). But as a convenience, and because
+ // this kind of magic is available for empty globals and sections, we
+ // propose a bootloader location if none was specified.
+ // Note that "no bootloader device" can be specified by explicitly
+ // setting this up, e.g. by setting one or all boot_* flags to
+ // "false".
+ // FIXME: add to LILO, ELILO; POWERLILO already should have this
+ // (check again)
+ ( Mode::autoinst() &&
+ ! haskey( BootCommon::globals, "boot_boot" ) &&
+ ! haskey( BootCommon::globals, "boot_root" ) &&
+ ! haskey( BootCommon::globals, "boot_mbr" ) &&
+ ! haskey( BootCommon::globals, "boot_extended" ) &&
+// ! haskey( BootCommon::globals, "boot_mbr_md" ) &&
+ ! haskey( BootCommon::globals, "boot_custom" )
+ ))
{
grub_DetectDisks ();
BootCommon::del_parts = BootCommon::getPartitionList (`deleted);
@@ -834,6 +955,7 @@
y2milestone ("Command output: %1", out);
}
}
+ y2milestone("(2) globals: %1", BootCommon::globals);
// refresh device map
if (BootCommon::device_mapping == nil
@@ -842,11 +964,14 @@
grub_ProposeDeviceMap ();
}
- if (grub_DisksChanged () && ! Mode::autoinst ()) {
- if (BootCommon::askLocationResetPopup ((BootCommon::GetBootloaderDevices())[0]:nil)) {
- SetBootloaderDevice(`none);
- y2milestone ("Reconfiguring locations");
- grub_DetectDisks ();
+ if ( ! Mode::autoinst () ) {
+ map changed = grub_DisksChanged ();
+ if ( changed["changed"]:false ) {
+ if (BootCommon::askLocationResetPopup (changed["reason"]:"Disk configuration changed.\n")) {
+ SetBootloaderDevice(`none);
+ y2milestone ("Reconfiguring locations");
+ grub_DetectDisks ();
+ }
}
}
}
Modified: trunk/bootloader/src/modules/BootCommon.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootCommon.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootCommon.ycp (original)
+++ trunk/bootloader/src/modules/BootCommon.ycp Tue Jul 10 23:00:36 2007
@@ -124,10 +124,7 @@
/**
* string representing device name of extended partition
*/
-// FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
-// decisions are automatic anyway and perl-Bootloader should be able to make
-// these decisions without help from the user or the proposal.
-//global string ExtendedPartitionDevice = "";
+global string ExtendedPartitionDevice = "";
/**
* Parameters of currently used bootloader
@@ -379,13 +376,16 @@
* @return boolean true of XEN installed/selected
*/
global boolean XenPresent () {
- return (! contains (removed_sections, "xen"))
+ boolean ret = (! contains (removed_sections, "xen"))
&& (Mode::test ()
|| (Mode::normal () && Pkg::IsProvided ("xen")
&& Pkg::IsProvided ("kernel-xen"))
|| (! Mode::normal () && Pkg::IsSelected ("xen")
&& Pkg::IsSelected ("kernel-xen"))
|| UsingXenPae());
+
+ y2milestone("ret: %1", ret);
+ return ret;
}
global boolean UsingXenPae() {
@@ -625,9 +625,17 @@
}
});
+ // convert device names in device map to the kernel device names
+ map device_mapping =
+ mapmap (string k , string v, device_mapping, {
+ return $[BootCommon::MountByDev2Dev(k) : v];
+ });
+
// convert custom boot device names in globals to the kernel device names
+ // also, for legacy bootloaders like LILO that still pass device names,
+ // convert the stage1_dev
globals = mapmap (string k , string v, globals, {
- if ( regexpmatch(k, "^boot_.*custom$" ) )
+ if ( k == "stage1_dev" || regexpmatch(k, "^boot_.*custom$" ) )
return $[k : BootCommon::MountByDev2Dev(v)];
else
return $[k : v];
@@ -705,22 +713,29 @@
return s;
});
- map my_globals = globals;
-
// FIXME: give mountby information to perl-Bootloader (or define some
// better interface), so that perl-Bootloader can use mountby device names
// for these devices instead. Tracked in bug #248162.
// convert custom boot device names in globals to the device names
// indicated by "mountby"
- my_globals = mapmap (string k , string v, my_globals, {
- if ( regexpmatch(k, "^boot_.*custom$" ) )
+ // also, for legacy bootloaders like LILO that still pass device names,
+ // convert the stage1_dev
+ map my_globals = mapmap (string k , string v, globals, {
+ if ( k == "stage1_dev" || regexpmatch(k, "^boot_.*custom$" ) )
return $[k : BootCommon::Dev2MountByDev(v)];
else
return $[k : v];
});
- ret = ret && SetDeviceMap (device_mapping);
+ // convert device names in device map to the device names indicated by
+ // "mountby"
+ map my_device_mapping =
+ mapmap (string k , string v, device_mapping, {
+ return $[BootCommon::Dev2MountByDev(k) : v];
+ });
+
+ ret = ret && SetDeviceMap (my_device_mapping);
ret = ret && SetSections (sects);
ret = ret && SetGlobal (my_globals);
if (flush)
Modified: trunk/bootloader/src/modules/BootELILO.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootELILO.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootELILO.ycp (original)
+++ trunk/bootloader/src/modules/BootELILO.ycp Tue Jul 10 23:00:36 2007
@@ -220,10 +220,10 @@
boolean ret = BootCommon::Read (reread);
// check for meaningless EFI entry name in sysconfig
- if ( !haskey(BootCommon::globals,"efilabel")
- || BootCommon::globals["efilabel"]:"" == "mbr"
- || BootCommon::globals["efilabel"]:"" == ""
- || BootCommon::globals["efilabel"]:"" == nil )
+ if ( !haskey(BootCommon::globals,"boot_efilabel")
+ || BootCommon::globals["boot_efilabel"]:"" == "mbr"
+ || BootCommon::globals["boot_efilabel"]:"" == ""
+ || BootCommon::globals["boot_efilabel"]:"" == nil )
{
string efi_path = BootCommon::replaceAll (
getEliloConfSubpath (), "/", "\\");
@@ -232,7 +232,7 @@
"/usr/sbin/efibootmgr |grep \"%1\"", efi_path));
if (efi_status["exit"]:0 != 0)
{
- BootCommon::globals["efilabel"] = Product::name;
+ BootCommon::globals["boot_efilabel"] = Product::name;
}
else
{
@@ -241,13 +241,13 @@
output = lines[0]:"";
if (regexpmatch (output, "Boot.*\* (.*) HD"))
{
- BootCommon::globals["efilabel"]
+ BootCommon::globals["boot_efilabel"]
= regexpsub (output, "Boot.*\* (.*) HD", "\\1");
efi_entry_found = true;
}
else
{
- BootCommon::globals["efilabel"] = Product::name;
+ BootCommon::globals["boot_efilabel"] = Product::name;
}
}
}
@@ -255,12 +255,12 @@
{
efi_entry_found = 0 == SCR::Execute (.target.bash, sformat (
"/usr/sbin/efibootmgr |grep \"%1\"",
- BootCommon::globals["efilabel"]:"")
+ BootCommon::globals["boot_efilabel"]:"")
);
}
create_efi_entry = !efi_entry_found;
old_efi_entry = efi_entry_found
- ? BootCommon::globals["efilabel"]:""
+ ? BootCommon::globals["boot_efilabel"]:""
: (string)nil;
return ret;
}
@@ -286,9 +286,9 @@
{
create_efi_entry = true;
// make sure the code handling globals below triggers and that
- // efilabel is recreated
- if ( haskey(BootCommon::globals, "efilabel") )
- BootCommon::globals = remove(BootCommon::globals, "efilabel");
+ // boot_efilabel is recreated
+ if ( haskey(BootCommon::globals, "boot_efilabel") )
+ BootCommon::globals = remove(BootCommon::globals, "boot_efilabel");
}
if (! Stage::initial ())
create_efi_entry = true;
@@ -318,13 +318,13 @@
CreateGlobals ();
}
- if (BootCommon::globals["efilabel"]:nil == nil ||
- BootCommon::globals["efilabel"]:nil == "")
+ if (BootCommon::globals["boot_efilabel"]:nil == nil ||
+ BootCommon::globals["boot_efilabel"]:nil == "")
{
- BootCommon::globals["efilabel"] = Product::name;
+ BootCommon::globals["boot_efilabel"] = Product::name;
}
- y2milestone ("EFI entry name: %1", BootCommon::globals["efilabel"]:"");
+ y2milestone ("EFI entry name: %1", BootCommon::globals["boot_efilabel"]:"");
y2milestone ("Proposed sections: %1", BootCommon::sections);
y2milestone ("Proposed globals: %1", BootCommon::globals);
}
@@ -350,7 +350,7 @@
list<string> result = [ sformat (_("Boot loader type: %1"),
BootCommon::getLoaderName (BootCommon::getLoaderType (false), `summary)) ];
- if (BootCommon::globals["efilabel"]:"" == "" || !create_efi_entry )
+ if (BootCommon::globals["boot_efilabel"]:"" == "" || !create_efi_entry )
{
result =
// summary text
@@ -361,7 +361,7 @@
result = add (result, sformat (
// summary text, %1 is label of the entry of EFI boot manager
_("Create EFI Boot Manager Entry %1"),
- BootCommon::globals["efilabel"]:""));
+ BootCommon::globals["boot_efilabel"]:""));
}
list<string> sects = [];
foreach (map s, BootCommon::sections, {
@@ -449,14 +449,14 @@
/*
* Create new EFI Bootmgr Label if specified
*/
- if (BootCommon::globals["efilabel"]:"" != "")
+ if (BootCommon::globals["boot_efilabel"]:"" != "")
{
string bl_logfile = "/var/log/YaST2/y2log_bootloader";
string bl_command = sformat (
"/usr/sbin/efibootmgr -v --create --label \"%1\" " +
"--disk %2 --part %3 " +
"--loader '\\efi\\SuSE\\elilo.efi' --write-signature >> %4 2>&1",
- BootCommon::globals["efilabel"]:"", boot_disk, boot_part, bl_logfile
+ BootCommon::globals["boot_efilabel"]:"", boot_disk, boot_part, bl_logfile
);
ret = ret && installBootLoader (bl_command, bl_logfile);
}
@@ -495,7 +495,7 @@
// from efibootmgr output
string command = sformat (
"set -o pipefail; /usr/sbin/efibootmgr -v | " +
- "grep '%1' |sed 's/%1.*\\(HD([0-9]\\+,[a-fA-F0-9]\\+,[a-fA-F0-9]\\+,\\).*$/\\1/'",
+ "grep '%1' |sed 's/%1.*\\(HD(.*)File(.*)\\).*/\\1/'",
String::Quote (new_entry)
);
Modified: trunk/bootloader/src/modules/BootGRUB.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootGRUB.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootGRUB.ycp (original)
+++ trunk/bootloader/src/modules/BootGRUB.ycp Tue Jul 10 23:00:36 2007
@@ -318,7 +318,7 @@
}
});
}
- if (BootCommon::InstallingToFloppy ())
+ if (grub_InstallingToFloppy ())
{
out = add (out, $[
"name" : BootCommon::translateSectionTitle("hard disk"),
@@ -563,15 +563,21 @@
if (Mode::autoinst ())
{
// TODO whatever will be needed
- y2debug ("nothing to to in AI mode if globals are defined");
+// y2debug ("nothing to do in AI mode if globals are defined");
}
- else {
- // Merge default globals where not yet set
- BootCommon::globals = (map) union(
- StandardGlobals(),
- BootCommon::globals
- );
- }
+ // decided to merge in default values for missing keys, EVEN in AI mode (!)
+ // this is primarily done to allow for the LocationProposal() to
+ // run and set keys in globals before we check them for existing
+ // keys here; but rather than checking for an empty globals map
+ // before LocationProposal() and using the result here, we figured
+ // that augmenting the globals is not such a bad idea even for the
+ // AI case...
+ y2milestone ("merging defaults to missing keys in globals");
+ // Merge default globals where not yet set
+ BootCommon::globals = (map) union(
+ StandardGlobals(),
+ BootCommon::globals
+ );
// this currently does nothing more than fixing the "default" key,
// if that points to a section that does not exist anymore
BootCommon::FixGlobals ();
@@ -669,11 +675,13 @@
list<string> locations = [];
if (BootCommon::globals["boot_boot"]:"" == "true")
- locations = add(locations, BootCommon::BootPartitionDevice);
+ locations = add(locations, BootCommon::BootPartitionDevice + " (\"/boot\")");
+ if (BootCommon::globals["boot_extended"]:"" == "true")
+ locations = add(locations, BootCommon::ExtendedPartitionDevice + " (extended)");
if (BootCommon::globals["boot_root"]:"" == "true")
- locations = add(locations, BootCommon::RootPartitionDevice);
+ locations = add(locations, BootCommon::RootPartitionDevice + " (\"/\")");
if (BootCommon::globals["boot_mbr"]:"" == "true")
- locations = add(locations, BootCommon::mbrDisk);
+ locations = add(locations, BootCommon::mbrDisk + " (MBR)");
if (haskey (BootCommon::globals, "boot_custom"))
locations = add(locations, BootCommon::globals["boot_custom"]:"");
Modified: trunk/bootloader/src/modules/Bootloader.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Bootloader.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/modules/Bootloader.ycp (original)
+++ trunk/bootloader/src/modules/Bootloader.ycp Tue Jul 10 23:00:36 2007
@@ -616,10 +616,11 @@
// change only linux, failsafe and xen sections
BootCommon::sections = maplist (map s, BootCommon::sections, {
- // skip sections that are not linux, xen or failsafe
- if ( !contains ( ["linux", "xen"] , s["original_name"]:"") ||
+ // skip sections that are not linux, xen or failsafe,
+ // or that are not of type "image" (or "xen" <- needed?)
+ if ( !contains ( ["linux", "xen", "failsafe"] , s["original_name"]:"") ||
!contains ( ["image", "xen"] , s["type"]:"") ) {
- y2milestone("section %1: not linux or xen, skipping kernel and initrd remapping",
+ y2milestone("section %1: not linux, xen or failsafe, skipping kernel and initrd remapping",
s["name"]:"");
return s;
}
@@ -939,6 +940,7 @@
if (Mode::update ())
{
UpdateConfiguration ();
+ ResolveSymlinksInSections();
BootCommon::changed = true;
BootCommon::location_changed = true;
}
Modified: trunk/bootloader/src/routines/autoinstall.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/autoinstall.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/routines/autoinstall.ycp (original)
+++ trunk/bootloader/src/routines/autoinstall.ycp Tue Jul 10 23:00:36 2007
@@ -103,30 +103,71 @@
}
*/
// LILO and GRUB stuff
+
+ map old_key_to_new_global_key = $[
+ "repl_mbr" : "generic_mbr",
+ "activate" : "activate"
+ ];
+
if (ai["loader_type"]:"" == "lilo" || ai["loader_type"]:"" == "grub")
{
- // NOTE: repl_mbr and activate have an effect for lilo, for grub
- // they are ignored (we use globals["generic_mbr"] and
- // globals["activate"] there)
foreach (string k, ["repl_mbr", "activate", ],
{
if (haskey (ai, k))
{
- exp["specific", k] = ai[k]:nil;
+ if (ai["loader_type"]:"" == "grub") {
+ // NOTE: repl_mbr and activate have an effect for lilo,
+ // for grub they are only accepted for backwards
+ // compatibility (we use globals["generic_mbr"] and
+ // globals["activate"] there); anyhow, an existing
+ // new-style key in the global map from autoyast has
+ // precedence over the old-style key (and will
+ // overwrite this later when we import it from the ai
+ // map)
+ exp["specific", "global", old_key_to_new_global_key[k]:nil] =
+ (ai[k]:false) ? "true" : "false";
+ y2milestone("converted old key %1 to key %2 in globals: %3",
+ k, old_key_to_new_global_key[k]:nil, exp["specific", "global"]:nil);
+ } else {
+ exp["specific", k] = ai[k]:nil;
+ }
+
}
});
// loader_location needs other default and key
+ //
// NOTE: loader_device and loader_location (aka selected_location
- // internally) have an effect for lilo, for grub they are ignored
- // (we use globals["boot_*"] for these functions there)
- exp["loader_location"] = ai["location"]:"custom";
+ // internally) have an effect for lilo, for grub loader_location is
+ // only accepted for backwards compatibility, but loader_device is
+ // ignored (FIXME: can we map this to the boot_* variables, or is
+ // the target map not yet available?)
+ // (we use globals["boot_*"] for these functions now)
+ // anyhow, an existing new-style boot_* key in the global map from
+ // autoyast has precedence over the settings from the old-style key
+ // (and it will be overwritten later when we import the boot_* keys
+ // from the ai map)
+ if ( ai["loader_type"]:"" == "grub" && haskey(ai, "location") ) {
+ if ( ai["location"]:nil == "extended" )
+ exp["specific", "global", "boot_extended"] = "true";
+ if ( ai["location"]:nil == "boot" )
+ exp["specific", "global", "boot_boot"] = "true";
+ else if ( ai["location"]:nil == "root" )
+ exp["specific", "global", "boot_root"] = "true";
+ else if ( ai["location"]:nil == "mbr" )
+ exp["specific", "global", "boot_mbr"] = "true";
+ else if ( ai["location"]:nil == "mbr_md" )
+ exp["specific", "global", "boot_mbr"] = "true";
+ } else {
+ exp["loader_location"] = ai["location"]:"custom";
+ }
+
foreach (string k, [/*"loader_location",*/ "loader_device"], {
if (haskey (ai, k))
{
exp[k] = ai[k]:nil;
}
});
- }
+ } // LILO and GRUB stuff
// device map stuff
if (size (ai["device_map"]:[]) > 0)
Modified: trunk/bootloader/src/routines/lilolike.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/lilolike.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/routines/lilolike.ycp (original)
+++ trunk/bootloader/src/routines/lilolike.ycp Tue Jul 10 23:00:36 2007
@@ -787,6 +787,15 @@
});
BootCommon::globals["stage1_dev"] = mergestring (s1_devs, ",");
BootCommon::globals["gfxmenu"] = "/boot/message";
+
+ // now that the label for the "linux" section is not "linux" anymore, but
+ // some product dependent string that can change with an update ("SLES_10"
+ // -> "SLES_10_SP1"), we need to update the label in the "default" line for
+ // LILO and GRUB (although the latter only needs it to correctly transform
+ // back to the section number)
+ // FIXME: is this needed/wanted for ELILO as well?
+ if ( contains (["lilo", "grub"], getLoaderType (false)))
+ FixGlobals ();
}
/**
Modified: trunk/bootloader/src/routines/misc.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/misc.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/routines/misc.ycp (original)
+++ trunk/bootloader/src/routines/misc.ycp Tue Jul 10 23:00:36 2007
@@ -131,7 +131,7 @@
* Get the list of installed floppy drives
* @return a list of floppy devices
*/
- define list<string> getFloppyDevices () ``{
+ global list<string> getFloppyDevices () ``{
if (floppy_devices == nil)
{
list<map> floppies = (list<map>) SCR::Read (.probe.floppy);
@@ -615,7 +615,8 @@
}
/**
- * Get bootloader devices for specified locations
+ * Get list of bootloader device names for all selected or specified
+ * locations
* @return list device names
*/
global define list<string> GetBootloaderDevices () ``{
@@ -629,9 +630,9 @@
if (BootCommon::globals["boot_mbr"]:"false" == "true") {
ret = add(ret, BootCommon::mbrDisk);
}
-// FIXME: `extended and `mbr_md are probably unneeded; AFA we can see, these
-// decisions are automatic anyway and perl-Bootloader should be able to make
-// these decisions without help from the user or the proposal.
+// FIXME: `mbr_md is probably unneeded; AFA we can see, this decision is
+// automatic anyway and perl-Bootloader should be able to make it without help
+// from the user or the proposal.
// if (BootCommon::globals["boot_mbr_md"]:"false" == "true") {
// FIXME: make this work; this code was copied from
// BootGRUB::Save(), where it was commented out (changes in
@@ -670,10 +671,10 @@
// });
// ret = add(ret, BootCommon::mbrDisk);
// }
-// if ( haskey(BootCommon::globals, "boot_extended") &&
-// BootCommon::globals["boot_extended"]:"false" == "true" ) {
-// ret = add(ret, BootCommon::ExtendedPartitionDevice);
-// }
+ if ( haskey(BootCommon::globals, "boot_extended") &&
+ BootCommon::globals["boot_extended"]:"false" == "true" ) {
+ ret = add(ret, BootCommon::ExtendedPartitionDevice);
+ }
// FIXME: floppy support is probably obsolete
if ( haskey(BootCommon::globals, "boot_floppy") &&
BootCommon::globals["boot_floppy"]:"false" == "true" ) {
@@ -694,7 +695,9 @@
*/
global boolean InstallingToFloppy () {
boolean ret = false;
- if (loader_device == StorageDevices::FloppyDevice)
+ if (loader_device == nil)
+ ret = false;
+ else if (loader_device == StorageDevices::FloppyDevice)
ret = true;
else if (contains (getFloppyDevices (), loader_device))
ret = true;
Modified: trunk/bootloader/src/routines/popups.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/popups.ycp?rev=39304&r1=39303&r2=39304&view=diff
==============================================================================
--- trunk/bootloader/src/routines/popups.ycp (original)
+++ trunk/bootloader/src/routines/popups.ycp Tue Jul 10 23:00:36 2007
@@ -139,14 +139,13 @@
/**
* Ask for change of bootloader location because of device unavailability
- * @param device string currently confiogured device
+ * @param string reason text stating why the location should be re-proposed
* @return boolean yes if shall be reset
*/
- global boolean askLocationResetPopup (string device) ``{
+ global boolean askLocationResetPopup (string reason) ``{
// yes-no popup
- return Popup::YesNo(sformat(_("Partition '%1' is not available.
-Set default boot loader location?
-"), device));
+ return Popup::YesNo(sformat(_("%1Set default boot loader location?
+"), reason));
}
/**
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org