Author: odabrunz
Date: Mon Sep 17 19:30:15 2007
New Revision: 40947
URL: http://svn.opensuse.org/viewcvs/yast?rev=40947&view=rev
Log:
- #309837:
- fix setting the default section at the end of an update,
according to saved previous default kernel image flavor
- use fallback flavors if previous flavor is unavailable
Modified:
trunk/bootloader/src/routines/lilolike.ycp
Modified: trunk/bootloader/src/routines/lilolike.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/lilolike.ycp?rev=40947&r1=40946&r2=40947&view=diff
==============================================================================
--- trunk/bootloader/src/routines/lilolike.ycp (original)
+++ trunk/bootloader/src/routines/lilolike.ycp Mon Sep 17 19:30:15 2007
@@ -364,27 +364,101 @@
/**
+ * fallback list for kernel flavors (adapted from Kernel.ycp), used if we have
+ * no better information
+ * order is from special to general, but prefer "default" in favor of "xen"
+ */
+// FIXME: handle "rt" and "vanilla"?
+list<string> generic_fallback_flavors = [
+ "s390", "iseries64", "ppc64", "bigsmp", "default", "xenpae", "xen",
+];
+
+/**
* Fix global section of lilo-like bootloader
- * This currently only changes the "default" key to point to the first section,
- * in case the referenced section does not exist anymore. An empty "default"
- * value is not changed.
+ *
+ * This currently only tries to fix the "default" key in case the referenced
+ * section does not exist anymore. An empty "default" value is not changed,
+ * because this means that no default is wanted.
+ *
+ * If we need to fix the "default" key we take the following steps:
+ *
+ * - If we are fixing the configuration at the end of an update and the
+ * special key "former_default_image_flavor" exists, try to set the default
+ * to the first "linux.*" section with an image of this flavor (preferring
+ * "linux" entries over possibly older "linux-.*" entries).
+ *
+ * - Otherwise go through a list of fallback kernel flavours and use the first
+ * "linux.*" section that contains a matching image (preferring "linux"
+ * entries over possibly older "linux-.*" entries).
+ *
+ * - Otherwise, simply use the first section as the default section.
*/
global void FixGlobals () {
string defaultv = globals["default"]:"";
string first = "";
- if (defaultv != "")
- {
- boolean exists = false;
+
+ y2milestone ("fixing default section");
+
+ // nothing to do if default is empty
+ if (defaultv == "")
+ return;
+
+ // does default section exist?
+ boolean exists = false;
+ foreach (map