Author: juhliarik
Date: Wed Jul 9 15:17:57 2008
New Revision: 48929
URL: http://svn.opensuse.org/viewcvs/yast?rev=48929&view=rev
Log:
added support for autoyast(fate #303263) and installation (fate #303893)
A kdump/config
A kdump/config/kdump.rnc
A kdump/config/Makefile.am
* adding kdump.rnc - autoyast
M kdump/src/complex.ycp
* changes in Set/Getmodified()
A kdump/src/kdump_auto.ycp
* adding support of autoyast
M kdump/src/Makefile.am
* added new files
A kdump/src/kdump_proposal.ycp
* added support for installation
M kdump/src/Kdump.ycp
* added new function for autoyast and installation
A kdump/src/kdump_finish.ycp
* added support fot installation
M kdump/src/wizards.ycp
* added sequence for autoyast
Added:
trunk/kdump/config/
trunk/kdump/config/Makefile.am
trunk/kdump/config/kdump.rnc
trunk/kdump/src/kdump_auto.ycp
trunk/kdump/src/kdump_finish.ycp
trunk/kdump/src/kdump_proposal.ycp
Modified:
trunk/kdump/src/Kdump.ycp
trunk/kdump/src/Makefile.am
trunk/kdump/src/complex.ycp
trunk/kdump/src/wizards.ycp
Added: trunk/kdump/config/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/config/Makefile.am?rev=48929&view=auto
==============================================================================
--- trunk/kdump/config/Makefile.am (added)
+++ trunk/kdump/config/Makefile.am Wed Jul 9 15:17:57 2008
@@ -0,0 +1,7 @@
+# Makefile.am for source/kdump/config
+# $Id: $
+
+rncdir = $(schemadir)/autoyast/rnc
+rnc_DATA = kdump.rnc
+
+EXTRA_DIST = $(rnc_DATA)
Added: trunk/kdump/config/kdump.rnc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/config/kdump.rnc?rev=48929&view=auto
==============================================================================
--- trunk/kdump/config/kdump.rnc (added)
+++ trunk/kdump/config/kdump.rnc Wed Jul 9 15:17:57 2008
@@ -0,0 +1,30 @@
+default namespace = "http://www.suse.com/1.0/yast2ns"
+namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
+namespace config = "http://www.suse.com/1.0/configns"
+
+
+kdump =
+ element kdump {
+ kdump_crash_kernel? &
+ kdump_general?
+}
+
+kdump_crash_kernel = element crash_kernel { text }
+
+kdump_general =
+ element general {
+ element KDUMP_KERNELVER { text }? &
+ element KDUMP_COMMANDLINE { text }? &
+ element KDUMP_COMMANDLINE_APPEND { text }? &
+ element KEXEC_OPTIONS { text }? &
+ element KDUMP_RUNLEVEL { text }? &
+ element KDUMP_IMMEDIATE_REBOOT { text }? &
+ element KDUMP_TRANSFER { text }? &
+ element KDUMP_SAVEDIR { text }? &
+ element KDUMP_KEEP_OLD_DUMPS { text }? &
+ element KDUMP_FREE_DISK_SIZE { text }? &
+ element KDUMP_DUMPDEV { text }? &
+ element KDUMP_VERBOSE { text }? &
+ element KDUMP_DUMPLEVEL { text }? &
+ element KDUMP_DUMPFORMAT { text }?
+}
Modified: trunk/kdump/src/Kdump.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/Kdump.ycp?rev=48929&r1=48928&r2=48929&view=diff
==============================================================================
--- trunk/kdump/src/Kdump.ycp (original)
+++ trunk/kdump/src/Kdump.ycp Wed Jul 9 15:17:57 2008
@@ -48,11 +48,14 @@
import "Arch";
import "Mode";
import "BootCommon";
+import "Map";
/**
* Prototypes
*/
-global boolean Modified();
+global boolean GetModified();
+
+global void SetModified();
/**
* Data was modified?
@@ -174,7 +177,7 @@
* Abort function
* return boolean return true if abort
*/
-global boolean() AbortFunction = Modified;
+global boolean() AbortFunction = GetModified;
/**
* map of deafult values for options in UI
@@ -227,13 +230,21 @@
* Data was modified?
* @return true if modified
*/
-global boolean Modified() {
+global boolean GetModified() {
y2debug("modified=%1",modified);
return modified;
}
/**
+ * Set data was modified
+ */
+global void SetModified() {
+ modified = true;
+ y2debug("modified=%1",modified);
+}
+
+/**
* Read disk partitions
*
* @return boolean successfull
@@ -790,8 +801,8 @@
* Read all kdump settings
* @return true on success
*/
-global boolean Read() {
-
+global boolean Read()
+{
/* Kdump read dialog caption */
string caption = _("Initializing kdump Configuration");
integer steps = 4;
@@ -863,8 +874,8 @@
* Write all kdump settings
* @return true on success
*/
-global boolean Write() {
-
+global boolean Write()
+{
/* Kdump read dialog caption */
string caption = _("Saving kdump Configuration");
@@ -913,5 +924,83 @@
return true;
}
+/**
+ * Propose all kdump settings
+ *
+ */
+global define void Propose ()
+{
+
+ y2milestone("Proposing new settings of kdump");
+ // adding defualt settings
+ KDUMP_SETTINGS = DEFAULT_CONFIG;
+ // set available partitions...
+ ReadDiskPartitions ();
+ //FIXME: IMO it should be in Write because after writing bootloader...
+ // read bootloader settings
+ Bootloader::Read();
+ // set actual/defualt boot section
+ actual_boot_section = Bootloader::getDefaultSection ();
+
+ // set adding boot option...
+ crashkernel_param = false;
+ add_crashkernel_param = false;
+
+ // read available memory
+ ReadAvailableMemory ();
+}
+/**
+ * Create a textual summary and a list of unconfigured cards
+ * @return summary of the current configuration
+ */
+global define list<string> Summary ()
+{
+ list<string> result = [];
+ result = add (result, sformat (_("Kdump status: %1"), (add_crashkernel_param ? _("disabled"):_("enabled"))));
+ if (!add_crashkernel_param )
+ {
+ result = add (result, sformat (_("Value of crashkernel option: %1"), BuildCrashkernelValue()));
+ result = add (result, sformat (_("Dump format: %1"), KDUMP_SETTINGS["KDUMP_DUMPFORMAT"]:""));
+ result = add (result, sformat (_("Target of dumps: %1"), KDUMP_SETTINGS["KDUMP_SAVEDIR"]:""));
+ result = add (result, sformat (_("Number of dumps: %1"), KDUMP_SETTINGS["KDUMP_KEEP_OLD_DUMPS"]:""));
+ }
+ return result;
+}
+
+/**
+ * Export kdump settings to a map
+ * @return kdump settings
+ */
+global define map Export ()
+{
+ map out = $[
+ "crash_kernel" : BuildCrashkernelValue(),
+ "general" : KDUMP_SETTINGS,
+ ];
+
+ y2milestone ("Kdump exporting settings: %1", out);
+ return out;
+
+}
+
+/**
+ * Import settings from a map
+ * @param settings map of kdump settings
+ * @return boolean true on success
+ */
+global define boolean Import (map settings)
+{
+ crashkernel_param_value = settings["crash_kernel"]:"";
+ boolean result = true;
+ map my_import_map = settings["general"]:$[];
+ foreach (any key, Map::Keys(DEFAULT_CONFIG),
+ {
+ string str_key = tostring(key);
+ string val = (string) my_import_map[str_key]:nil;
+ if (val != nil) KDUMP_SETTINGS[str_key] = val;
+ if (val == nil) KDUMP_SETTINGS[str_key] = DEFAULT_CONFIG[str_key]:nil;
+ });
+ return result;
+}
/* EOF */
}
Modified: trunk/kdump/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/Makefile.am?rev=48929&r1=48928&r2=48929&view=diff
==============================================================================
--- trunk/kdump/src/Makefile.am (original)
+++ trunk/kdump/src/Makefile.am Wed Jul 9 15:17:57 2008
@@ -3,7 +3,10 @@
yncludedir = @yncludedir@/kdump
client_DATA = \
- kdump.ycp
+ kdump.ycp \
+ kdump_auto.ycp \
+ kdump_proposal.ycp \
+ kdump_finish.ycp
ynclude_DATA = \
helps.ycp \
Modified: trunk/kdump/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/complex.ycp?rev=48929&r1=48928&r2=48929&view=diff
==============================================================================
--- trunk/kdump/src/complex.ycp (original)
+++ trunk/kdump/src/complex.ycp Wed Jul 9 15:17:57 2008
@@ -51,11 +51,11 @@
* @return true if data was modified
*/
boolean Modified() {
- return Kdump::Modified();
+ return Kdump::GetModified();
}
boolean ReallyAbort() {
- return !Kdump::Modified() || Popup::ReallyAbort(true);
+ return !Kdump::GetModified() || Popup::ReallyAbort(true);
}
boolean PollAbort() {
Added: trunk/kdump/src/kdump_auto.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/kdump_auto.ycp?rev=48929&view=auto
==============================================================================
--- trunk/kdump/src/kdump_auto.ycp (added)
+++ trunk/kdump/src/kdump_auto.ycp Wed Jul 9 15:17:57 2008
@@ -0,0 +1,121 @@
+/**
+ * File:
+ * kdump_auto.ycp
+ *
+ * Module:
+ * Kdump installation and configuration
+ *
+ * Summary:
+ * Kdump autoinstallation preparation
+ *
+ * Authors:
+ * Jozef Uhliarik
+ *
+ *
+ */
+{
+ textdomain "kdump";
+
+ y2milestone("----------------------------------------");
+ y2milestone("kdump auto started");
+
+ import "Kdump";
+ import "Mode";
+
+ include "kdump/wizards.ycp";
+
+ boolean progress_orig = Progress::set (false);
+
+
+ any ret = nil;
+ string func = "";
+ map param = $[];
+
+ /* Check arguments */
+ if(size((list)WFM::Args()) > 0 && is(WFM::Args(0), string)) {
+ func = (string)WFM::Args(0);
+ if(size((list)WFM::Args()) > 1 && is(WFM::Args(1), map))
+ param = (map)WFM::Args(1);
+ }
+ y2debug("func=%1", func);
+ y2debug("param=%1", param);
+
+ if(func == "Import")
+ {
+ ret = Kdump::Import(AI2Export ((map)param));
+ }
+ /**
+ * Create a summary
+ * return string
+ */
+ else if(func == "Summary") {
+ ret = "<UL>"
+ + mergestring (maplist (string l, Kdump::Summary(),
+ ``("<LI>" + l)),
+ "\n")
+ + "</UL>";
+ }
+ /**
+ * did configuration changed
+ * return boolean
+ */
+ else if (func == "GetModified") {
+ ret = Kdump::GetModified();
+ }
+ /**
+ * set configuration as changed
+ * return boolean
+ */
+ else if (func == "SetModified") {
+ Kdump::SetModified();
+ ret = true;
+ }
+ /**
+ * Reset configuration
+ * return map or list
+ */
+ else if (func == "Reset") {
+ Kdump::Reset();
+ ret = ($[]);
+ }
+ /**
+ * Change configuration
+ * return symbol (i.e. `finish || `accept || `next || `cancel || `abort)
+ */
+ else if (func == "Change") {
+ ret = KdumpAutoSequence ();
+ return ret;
+ }
+ /**
+ * Return configuration data
+ * return map or list
+ */
+ else if (func == "Export") {
+ ret = Export2AI ((map)Kdump::Export());
+ }
+ /**
+ * Write configuration data
+ * return boolean
+ */
+ else if (func == "Write") {
+ ret = Kdump::Write();
+ }
+ else if (func == "Read") {
+ ret = Kdump::Read();
+ }
+ /* unknown function */
+ else {
+ y2error("unknown function: %1", func);
+ ret = false;
+ }
+ Progress::set (progress_orig);
+
+ y2debug("ret=%1", ret);
+ y2milestone("kdump_auto finished");
+ y2milestone("----------------------------------------");
+
+ return ret;
+
+/* EOF */
+
+}
Added: trunk/kdump/src/kdump_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/kdump_finish.ycp?rev=48929&view=auto
==============================================================================
--- trunk/kdump/src/kdump_finish.ycp (added)
+++ trunk/kdump/src/kdump_finish.ycp Wed Jul 9 15:17:57 2008
@@ -0,0 +1,61 @@
+/**
+ * File:
+ * kdump_finish.ycp
+ *
+ * Module:
+ * Step of base installation finish
+ *
+ * Authors:
+ * Jozef Uhliarik
+ *
+ *
+ */
+
+{
+
+textdomain "kdump";
+
+import "Kdump";
+import "Mode";
+
+
+any ret = nil;
+string func = "";
+map param = $[];
+
+/* Check arguments */
+if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
+ func = (string)WFM::Args(0);
+ if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
+ param = (map)WFM::Args(1);
+}
+
+y2milestone ("starting kdump_finish");
+y2debug("func=%1", func);
+y2debug("param=%1", param);
+
+if (func == "Info")
+{
+ return (any)$[
+ "steps" : 3,
+ // progress step title
+ "title" : _("Saving kdump configuration..."),
+ "when" : [ `installation, `update, `autoinst ],
+ ];
+}
+else if (func == "Write")
+{
+ Kdump::Write();
+}
+else
+{
+ y2error ("unknown function: %1", func);
+ ret = nil;
+}
+
+y2debug("ret=%1", ret);
+y2milestone("kdump_finish finished");
+return ret;
+
+
+} /* EOF */
\ No newline at end of file
Added: trunk/kdump/src/kdump_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/kdump_proposal.ycp?rev=48929&view=auto
==============================================================================
--- trunk/kdump/src/kdump_proposal.ycp (added)
+++ trunk/kdump/src/kdump_proposal.ycp Wed Jul 9 15:17:57 2008
@@ -0,0 +1,81 @@
+/* ------------------------------------------------------------------------------
+ * Copyright (c) 2008 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may find
+ * current contact information at www.novell.com.
+ * ------------------------------------------------------------------------------
+ */
+
+/**
+ * File: kdump_proposal.ycp
+ * Package: Configuration of kdump
+ * Summary: Proposal handlingss
+ * Authors: Jozef Uhliarik
+ *
+ */
+
+{
+ textdomain "kdump";
+
+ import "Kdump";
+ import "Mode";
+
+ include "kdump/wizards.ycp";
+
+ string func = (string)WFM::Args(0);
+ map param = (map)WFM::Args(1);
+ map ret = $[];
+
+ if ( func == "MakeProposal" )
+ {
+ Kdump::Propose();
+ }
+ else if ( func == "AskUser" )
+ {
+ boolean has_next = param["has_next"]:false;
+ y2milestone("I don't know...");
+ map settings = Kdump::Export ();
+ Kdump::modified = false;
+ symbol result = KdumpAutoSequence ();
+ Kdump::SetModified();
+ if (result != `next)
+ Kdump::Import ((map)settings);
+
+ // Fill return map
+ ret = $[ "workflow_sequence" : result ];
+ }
+ else if ( func == "Description" )
+ {
+ ret =
+ $[
+ // proposal part - kdump label
+ "rich_text_title" : _("Kdump"),
+ // menubutton entry
+ "menu_title" : _("&Kdump"),
+ "id" : "kdump_stuff"
+ ];
+
+ }
+ else if (func == "Write")
+ {
+ boolean succ = Kdump::Write ();
+ ret =
+ $[
+ "success" : succ
+ ];
+ }
+
+ return ret;
+}
Modified: trunk/kdump/src/wizards.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/wizards.ycp?rev=48929&r1=48928&r2=48929&view=diff
==============================================================================
--- trunk/kdump/src/wizards.ycp (original)
+++ trunk/kdump/src/wizards.ycp Wed Jul 9 15:17:57 2008
@@ -33,6 +33,7 @@
import "Sequencer";
import "Wizard";
+import "Stage";
include "kdump/complex.ycp";
include "kdump/dialogs.ycp";
@@ -96,5 +97,26 @@
return ret;
}
+
+
+/**
+ * Whole configuration of kdump but without reading and writing.
+ * For use with autoinstallation.
+ * @return sequence result
+ */
+any KdumpAutoSequence () {
+ Wizard::CreateDialog();
+ Wizard::SetContentsButtons("", `VBox (), "",
+ Label::BackButton(), Label::NextButton());
+ if ( Stage::initial () )
+ Wizard::SetTitleIcon("kdump"); // no .desktop file in inst-sys
+ else
+ Wizard::SetDesktopIcon("kdump");
+ any ret = MainSequence ();
+ UI::CloseDialog();
+ return ret;
+}
+
+
/* EOF */
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org