Author: juhliarik
Date: Thu Aug 30 16:28:05 2007
New Revision: 40626
URL: http://svn.opensuse.org/viewcvs/yast?rev=40626&view=rev
Log:
added patch for bug# 300124 - Adding boot options via yast bootloader
doesn't work
Modified:
trunk/kdump/src/Kdump.ycp
Modified: trunk/kdump/src/Kdump.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/Kdump.ycp?rev=40626&r1=40625&r2=40626&view=diff
==============================================================================
--- trunk/kdump/src/Kdump.ycp (original)
+++ trunk/kdump/src/Kdump.ycp Thu Aug 30 16:28:05 2007
@@ -47,6 +47,7 @@
import "Popup";
import "Arch";
import "Mode";
+import "BootCommon";
/**
* Prototypes
@@ -126,6 +127,18 @@
*/
global string alocated_memory = "0";
+
+
+/**
+ * String option identify which boot section was used
+ * during boot process
+ *
+ * string value actual boot section
+ */
+
+global string actual_boot_section = "";
+
+
/**
* Write only, used during autoinstallation.
* Don't run services and SuSEconfig, it's all done at one place.
@@ -258,6 +271,141 @@
/**
+ * Compare boot section options with
+ *
+ * options from running kernel
+ * @return integer return number of differences
+ */
+
+integer CmpKernelAndBootOptions (list <string> kernel_option, list <string> boot_options) {
+ integer result = size(kernel_option);
+ integer dif_size = size(boot_options) - size(kernel_option);
+ if (dif_size < 0)
+ dif_size = dif_size*(-1);
+ foreach (string option, kernel_option, {
+ if (contains(boot_options, option))
+ result = result -1;
+ });
+
+ result = result + dif_size;
+ return result;
+}
+
+
+/**
+ * Function add into option from boot
+ * section root device and vgamode
+ *
+ * @return list <string> boot section + root and vgamode
+ */
+
+
+list <string> AddDeviceVgamode (map section) {
+ string tmp_boot_section = tostring(section["append"]:nil);
+ //adding root device
+ tmp_boot_section = tmp_boot_section + " root=" + tostring(section["root"]:nil);
+ tmp_boot_section = tmp_boot_section + " vga=" + tostring(section["vgamode"]:nil);
+
+ return splitstring(tmp_boot_section," ");
+
+}
+
+
+/**
+ * Read actual boot section
+ *
+ * read kernal version and boot options
+ * @return string actual boot section
+ */
+
+
+string GetActualBootSection () {
+ //read option from bootlaoder
+
+ string result = "";
+ string kernel_boot_options = "";
+ string kernel_version = "";
+ integer min_dif_size = 1000;
+
+ //reading bootloader settings
+ boolean old_progress = Progress::set (false);
+ Bootloader::Read();
+ Progress::set (old_progress);
+
+ //reading kernel options
+ string command = "cat /proc/cmdline";
+ map options = (map)SCR::Execute (.target.bash_output, command);
+ y2milestone("[kdump] (GetActualBootSection) command read boot options from kernel: %1 output: %2",command, options);
+
+ if (options["exit"]:nil != 0)
+ return "";
+
+ kernel_boot_options = tostring(options["stdout"]:nil);
+ //Popup::Message(kernel_boot_options);
+
+ //reading version of kernel
+ command = "uname -r";
+ options = (map)SCR::Execute (.target.bash_output, command);
+ y2milestone("[kdump] (GetActualBootSection) command read kernel version: %1 output: %2",command, options);
+
+ if (options["exit"]:nil != 0)
+ return "";
+
+ kernel_version = tostring(options["stdout"]:nil);
+
+ //Popup::Message(kernel_version);
+
+ y2milestone("[kdump] (GetActualBootSection) kerne version: %1",kernel_version);
+
+
+ //boot sections from bootloader
+ list