[yast-commit] r40143 - in /trunk/kdump/src: Kdump.ycp Makefile.am complex.ycp kdump.ycp kdump_auto.ycp kdump_proposal.ycp uifunctions.ycp wizards.ycp
Author: juhliarik
Date: Thu Aug 9 17:50:48 2007
New Revision: 40143
URL: http://svn.opensuse.org/viewcvs/yast?rev=40143&view=rev
Log:
added commandline interface and corrections
Removed:
trunk/kdump/src/kdump_auto.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/kdump.ycp
trunk/kdump/src/uifunctions.ycp
trunk/kdump/src/wizards.ycp
Modified: trunk/kdump/src/Kdump.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/Kdump.ycp?rev=40143&r1=40142&r2=40143&view=diff
==============================================================================
--- trunk/kdump/src/Kdump.ycp (original)
+++ trunk/kdump/src/Kdump.ycp Thu Aug 9 17:50:48 2007
@@ -46,6 +46,7 @@
import "Service";
import "Popup";
import "Arch";
+import "Mode";
/**
* Prototypes
@@ -145,7 +146,7 @@
"KDUMP_RUNLEVEL" : "1",
"KDUMP_IMMEDIATE_REBOOT" : "yes",
"KDUMP_TRANSFER" : "",
- "KDUMP_SAVEDIR" : "/var/log/dump",
+ "KDUMP_SAVEDIR" : "file:///var/log/dump",
"KDUMP_KEEP_OLD_DUMPS" : "5",
"KDUMP_FREE_DISK_SIZE" : "64",
"KDUMP_DUMPDEV" : "",
@@ -271,7 +272,7 @@
crashkernel_param_value = result;
if (result != "false")
- alocated_memory = substring(result,0,find(result,"@"));
+ alocated_memory = substring(result,0,search(result,"@"));
//Popup::Message(alocated_memory);
@@ -371,7 +372,8 @@
} else if (Arch::ppc64()) {
crash_value = crash_value + "32M";
} else {
- Popup::Error("Unsupported architecture, \"crashkernel\" was not added");
+ if (!Mode::commandline())
+ Popup::Error(_("Unsupported architecture, \"crashkernel\" was not added"));
return false;
}
@@ -380,7 +382,8 @@
//Popup::Message(Bootloader::getDefaultSection ());
result = Bootloader::setKernelParam (Bootloader::getDefaultSection (), "crashkernel", crash_value); //
//Popup::Message(crash_value);
- Popup::Message("For applying changes is necessary reboot.");
+ if (!Mode::commandline())
+ Popup::Message(_("For applying changes is necessary reboot."));
return result;
}
@@ -392,7 +395,8 @@
if (crashkernel_param) {
//delete crashkernel paramter from bootloader
result = Bootloader::setKernelParam (Bootloader::getDefaultSection (), "crashkernel", "false");
- Popup::Message("For applying changes is necessary reboot.");
+ if (!Mode::commandline())
+ Popup::Message(_("For applying changes is necessary reboot."));
}
Service::Disable("kernel-kdump");
return result;
@@ -484,23 +488,22 @@
/* Kdump read dialog caption */
string caption = _("Saving kdump Configuration");
- // TODO FIXME And set the right number of stages
+ //number of stages
integer steps = 2;
sleep(sl);
- // TODO FIXME Names of real stages
// We do not set help text here, because it was set outside
Progress::New(caption, " ", steps, [
/* Progress stage 1/2 */
_("Write the settings"),
/* Progress stage 2/2 */
- _("Run SuSEconfig")
+ _("Update boot options")
], [
/* Progress step 1/2 */
_("Writing the settings..."),
/* Progress step 2/2 */
- _("Running SuSEconfig..."),
+ _("Updating boot options..."),
/* Progress finished */
_("Finished")
],
@@ -514,7 +517,7 @@
if(!WriteKdumpSettings ()) Report::Error (_("Cannot write settings."));
sleep(sl);
- // run SuSEconfig
+ // write/delete bootloader option for kernel "crashkernel"
if(Abort()) return false;
Progress::NextStage ();
/* Error message */
@@ -530,56 +533,5 @@
return true;
}
-/**
- * Get all kdump settings from the first parameter
- * (For use by autoinstallation.)
- * @param settings The YCP structure to be imported.
- * @return boolean True on success
- */
-global boolean Import (map settings) {
- // TODO FIXME: your code here (fill the above mentioned variables)...
- return true;
-}
-
-/**
- * Dump the kdump settings to a single map
- * (For use by autoinstallation.)
- * @return map Dumped settings (later acceptable by Import ())
- */
-global map Export () {
- // TODO FIXME: your code here (return the above mentioned variables)...
- return $[];
-}
-
-/**
- * Create a textual summary and a list of unconfigured cards
- * @return summary of the current configuration
- */
-global list Summary() {
- // TODO FIXME: your code here...
- /* Configuration summary text for autoyast */
- return [ _("Configuration summary..."), [] ];
-}
-
-/**
- * Create an overview table with all configured cards
- * @return table items
- */
-global list Overview() {
- // TODO FIXME: your code here...
- return [];
-}
-
-/**
- * Return packages needed to be installed and removed during
- * Autoinstallation to insure module has all needed software
- * installed.
- * @return map with 2 lists.
- */
-global map AutoPackages() {
- // TODO FIXME: your code here...
- return $[ "install":[], "remove":[] ];
-}
-
/* EOF */
}
Modified: trunk/kdump/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/Makefile.am?rev=40143&r1=40142&r2=40143&view=diff
==============================================================================
--- trunk/kdump/src/Makefile.am (original)
+++ trunk/kdump/src/Makefile.am Thu Aug 9 17:50:48 2007
@@ -3,9 +3,7 @@
yncludedir = @yncludedir@/kdump
client_DATA = \
- kdump.ycp \
- kdump_auto.ycp \
- kdump_proposal.ycp
+ kdump.ycp
ynclude_DATA = \
helps.ycp \
Modified: trunk/kdump/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/complex.ycp?rev=40143&r1=40142&r2=40143&view=diff
==============================================================================
--- trunk/kdump/src/complex.ycp (original)
+++ trunk/kdump/src/complex.ycp Thu Aug 9 17:50:48 2007
@@ -88,13 +88,14 @@
kdump_available = Package::Available("kernel-kdump");
if ((!kexec_installed) &&(!kexec_available)) {
- Popup::Error("Package for kexec-tools is not available.");
+
+ Popup::Error(_("Package for kexec-tools is not available."));
y2error("[kdump] (ReadDialog ()) Packages for kexec-tools is not available.");
return `abort;
}
if ((!kdump_installed) &&(!kdump_available)) {
- Popup::Error("Package for kernel-kdump is not available.");
+ Popup::Error(_("Package for kernel-kdump is not available."));
y2error("[kdump] (ReadDialog ()) Packages for kernel-kdump is not available.");
return `abort;
}
@@ -108,7 +109,7 @@
//install packages
if (!Package::DoInstall(package_list)) {
- Popup::Error("Installation failed!");
+ Popup::Error(_("Installation failed!"));
y2error("[kdump] Installation of package list %1 failed", package_list);
return `abort;
}
@@ -132,126 +133,5 @@
return ret ? `next : `abort;
}
-/**
- * Summary dialog
- * @return dialog result
- */
-any SummaryDialog() {
-
- /* Kdump summary dialog caption */
- string caption = _("Kdump Configuration");
-
- /* FIXME */
- list summary = Kdump::Summary();
- list unconfigured = summary[1]:[];
- string configured = summary[0]:"";
-
- /* Frame label */
- term contents = Wizard_hw::DetectedContent(_("Kdump to Configure"),
- unconfigured, false, configured);
-
- Wizard::SetContentsButtons(caption, contents, HELPS["summary"]:"",
- Label::BackButton(), Label::FinishButton());
-
- any ret = nil;
- while(true) {
-
- ret = UI::UserInput();
-
- /* abort? */
- if(ret == `abort || ret == `cancel || ret == `back) {
- if(ReallyAbort()) break;
- else continue;
- }
- /* overview dialog */
- else if(ret == `edit_button) {
- ret = `overview;
- break;
- }
- /* configure the selected device */
- else if(ret == `configure_button) {
- // TODO FIXME: check for change of the configuration
- any selected = UI::QueryWidget(`id(`detected_selbox), `CurrentItem);
- if(selected == `other) {
- ret = `other;
- }
- else {
- ret = `configure;
- }
- break;
- }
- else if(ret == `next) {
- break;
- }
- else {
- y2error("unexpected retcode: %1", ret);
- continue;
- }
- }
-
- return ret;
-}
-
-/**
- * Overview dialog
- * @return dialog result
- */
-any OverviewDialog() {
-
- /* Kdump overview dialog caption */
- string caption = _("Kdump Overview");
-
- list overview = Kdump::Overview();
-
- /* FIXME table header */
- term contents = Wizard_hw::ConfiguredContent(
- /* Table header */
- `header(_("Number"), _("Kdump")),
- overview, nil, nil, nil, nil );
-
- contents = Wizard_hw::SpacingAround(contents, 1.5, 1.5, 1.0, 1.0);
-
- Wizard::SetContentsButtons(caption, contents, HELPS["overview"]:"",
- Label::BackButton(), Label::FinishButton());
-
- any ret = nil;
- while(true) {
-
- ret = UI::UserInput();
-
- /* abort? */
- if(ret == `abort || ret == `cancel) {
- if(ReallyAbort()) break;
- else continue;
- }
- /* add */
- else if(ret == `add_button) {
- /* FIXME */
- ret = `add;
- break;
- }
- /* edit */
- else if(ret == `edit_button) {
- /* FIXME */
- ret = `edit;
- break;
- }
- /* delete */
- else if(ret == `delete_button) {
- /* FIXME */
- continue;
- }
- else if(ret == `next || ret == `back) {
- break;
- }
- else {
- y2error("unexpected retcode: %1", ret);
- continue;
- }
- }
-
- return ret;
-}
-
/* EOF */
}
Modified: trunk/kdump/src/kdump.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/kdump.ycp?rev=40143&r1=40142&r2=40143&view=diff
==============================================================================
--- trunk/kdump/src/kdump.ycp (original)
+++ trunk/kdump/src/kdump.ycp Thu Aug 9 17:50:48 2007
@@ -44,25 +44,824 @@
import "Progress";
import "Report";
import "Summary";
+import "Popup";
+import "String";
+import "FileUtils";
import "CommandLine";
include "kdump/wizards.ycp";
+include "kdump/uifunctions.ycp";
+
+/**
+ * Command line function for display options from kdump
+ *
+ */
+boolean cmdKdumpShow (map options) {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(String::UnderlinedHeader(_("Display Settings:"), 0));
+ CommandLine::Print("");
+ if (Kdump::crashkernel_param) {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("Kdump is enabled (boot option \"crashkernel\" is added)"));
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Alocate memory (MB) for kdump is: %1"), Kdump::alocated_memory));
+
+ } else {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("Kdump is disable"));
+ }
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Dump Level: %1"), Kdump::KDUMP_SETTINGS["KDUMP_DUMPLEVEL"]:nil));
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Dump Format: %1"), Kdump::KDUMP_SETTINGS["KDUMP_DUMPFORMAT"]:nil));
+ CommandLine::Print("");
+
+ // parsing target info
+ CommandLine::Print(_("Dump Target Settings"));
+ if (SetUpKDUMP_SAVE_TARGET(Kdump::KDUMP_SETTINGS["KDUMP_SAVEDIR"]:nil)) {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("target: %1"), KDUMP_SAVE_TARGET["target"]:nil));
+
+ //local filesystem
+ if (KDUMP_SAVE_TARGET["target"]:nil == "file") {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("file directory: %1"), KDUMP_SAVE_TARGET["dir"]:nil));
+
+ //ftp target
+ } else if (KDUMP_SAVE_TARGET["target"]:nil == "ftp") {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("server name: %1"),KDUMP_SAVE_TARGET["server"]:nil));
+
+ if (KDUMP_SAVE_TARGET["port"]:nil != "") {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("port: %1"), KDUMP_SAVE_TARGET["port"]:nil));
+ }
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("file directory: %1"), KDUMP_SAVE_TARGET["dir"]:nil));
+
+ if ((KDUMP_SAVE_TARGET["user_name"]:nil == "") ||
+ (KDUMP_SAVE_TARGET["user_name"]:nil == "anonymous")) {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("user name: anonymous connection is allowed"));
+ } else {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("user name: %1"),KDUMP_SAVE_TARGET["user_name"]:nil));
+ }
+
+ //ssh connection
+ } else if (KDUMP_SAVE_TARGET["target"]:nil == "ssh") {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("server name: %1"), KDUMP_SAVE_TARGET["server"]:nil));
+
+
+ if (KDUMP_SAVE_TARGET["port"]:nil != "") {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("port: %1"), KDUMP_SAVE_TARGET["port"]:nil));
+ }
+
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("file directory: %1"), KDUMP_SAVE_TARGET["dir"]:nil));
+
+ if ((KDUMP_SAVE_TARGET["user_name"]:nil != "") &&
+ (KDUMP_SAVE_TARGET["user_name"]:nil != "anonymous")) {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("user name: %1"),KDUMP_SAVE_TARGET["user_name"]:nil));
+ }
+
+ // nfs target
+ } else if (KDUMP_SAVE_TARGET["target"]:nil == "nfs") {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("server name: %1"), KDUMP_SAVE_TARGET["server"]:nil));
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("file directory: %1"), KDUMP_SAVE_TARGET["dir"]:nil));
+
+ //cifs target
+ } else if (KDUMP_SAVE_TARGET["target"]:nil == "cifs") {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("server name: %1"), KDUMP_SAVE_TARGET["server"]:nil));
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("file directory: %1"), KDUMP_SAVE_TARGET["dir"]:nil));
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("share: %1"),KDUMP_SAVE_TARGET["share"]:nil));
+
+ if ((KDUMP_SAVE_TARGET["user_name"]:nil == "") ||
+ (KDUMP_SAVE_TARGET["user_name"]:nil == "anonymous")) {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("user name: anonymous connection is allowed"));
+ } else {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("user name: %1"),KDUMP_SAVE_TARGET["user_name"]:nil));
+ }
+
+
+ }
+ } else {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("EMPTY"));
+
+
+ } //end of if (SetUpKDUMP_SAVE_TARGET(Kdump::KDUMP_SETTINGS["KDUMP_SAVEDIR"]:nil))
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_DUMPDEV"]:nil != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Save first to raw partition: %1"), Kdump::KDUMP_SETTINGS["KDUMP_DUMPDEV"]:nil));
+ }
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_KERNELVER"]:nil != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Custom kdump kernel: %1"), Kdump::KDUMP_SETTINGS["KDUMP_KERNELVER"]:nil));
+ }
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_COMMANDLINE"]:nil != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Kdump command line: %1"), Kdump::KDUMP_SETTINGS["KDUMP_COMMANDLINE"]:nil));
+ }
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_COMMANDLINE_APPEND"]:nil != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Kdump command line append: %1"), Kdump::KDUMP_SETTINGS["KDUMP_COMMANDLINE_APPEND"]:nil));
+
+ }
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_RUNLEVEL"]:nil != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Kdump runlevel: %1"), Kdump::KDUMP_SETTINGS["KDUMP_RUNLEVEL"]:nil));
+ }
+
+
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Kdump immediate reboots: %1"),(Kdump::KDUMP_SETTINGS["KDUMP_IMMEDIATE_REBOOT"]:nil == "yes") ? _("ENABLED"):_("DISABLED") ));
+
+ CommandLine::Print("");
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_KEEP_OLD_DUMPS"]:nil == "0") {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("Numbers of old dumps: All dumps are saved without deleting old dumps"));
+ } else {
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Numbers of old dumps: %1"),Kdump::KDUMP_SETTINGS["KDUMP_KEEP_OLD_DUMPS"]:nil));
+ }
+ CommandLine::Print("");
+
+
+ return true;
+}
+
+
+
+boolean cmdKdumpStartup (map options) {
+
+ if ((options["enable"]:nil!=nil) && (options["alloc_mem"]:nil!=nil)) {
+ Kdump::add_crashkernel_param = true;
+ Kdump::alocated_memory = tostring(options["alloc_mem"]:nil);
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("For applying changes is necessary reboot."));
+ return true;
+
+ } else if (options["disable"]:nil!=nil) {
+ Kdump::add_crashkernel_param = false;
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("For applying changes is necessary reboot."));
+ return true;
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+}
+
+
+boolean cmdKdumpDumpLevel (map options) {
+ if (options["dump_level"]:nil!=nil) {
+
+ if ((options["dump_level"]:nil < 32) && (options["dump_level"]:nil >-1)) {
+ Kdump::KDUMP_SETTINGS["KDUMP_DUMPLEVEL"] = tostring(options["dump_level"]:nil);
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("Dump level was set."));
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value of option."));
+ return false;
+ }
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+}
+
+boolean cmdKdumpDumpFormat (map options) {
+ if (options["dump_format"]:nil!=nil) {
+
+ if ((options["dump_format"]:nil == "ELF") || (options["dump_format"]:nil == "compressed")) {
+ Kdump::KDUMP_SETTINGS["KDUMP_DUMPFORMAT"] = tostring(options["dump_format"]:nil);
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("Dump format was set."));
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value of option."));
+ //TRANSLATORS: CommandLine printed text help
+ CommandLine::Print(_("Option can include only \"ELF\" or \"compressed\" value."));
+ return false;
+ }
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+
+}
+
+string cmdParsePassPath (string path_file) {
+ string password = nil;
+ if (FileUtils::IsFile(path_file)) {
+ password = (string)SCR::Read(.target.string, path_file);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(sformat(_("File %1 doesn't exist."),path_file));
+ }
+ return password;
+}
+
+
+boolean cmdKdumpDumpTarget (map options) {
+ if (options["target"]:nil!=nil) {
+ string target = tostring(options["target"]:nil);
+ switch(target) {
+
+ case("file"):
+ KDUMP_SAVE_TARGET["target"] = "file";
+ if (options["dir"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["dir"] = tostring(options["dir"]:nil);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Value for \"dir\" missing."));
+ return false;
+ }
+ break;
+
+ case("ftp"):
+ KDUMP_SAVE_TARGET["target"] = "ftp";
+
+ if (options["server"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["server"] = tostring(options["server"]:nil);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Value for \"server\" missing."));
+ return false;
+ }
+
+ if (options["port"]:nil!=nil)
+ KDUMP_SAVE_TARGET["port"] = tostring(options["port"]:nil);
+
+ if (options["dir"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["dir"] = tostring(options["dir"]:nil);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Value for \"dir\" missing."));
+ return false;
+ }
+
+ if (options["user"]:nil!=nil)
+ KDUMP_SAVE_TARGET["user_name"] = tostring(options["user"]:nil);
+
+ if (options["pass"]:nil!=nil) {
+ string password = cmdParsePassPath(tostring(options["pass"]:nil));
+ if ((password == nil) || (password == ""))
+ return false;
+ KDUMP_SAVE_TARGET["password"] = password;
+ }
+ break;
+
+ case("ssh"):
+ KDUMP_SAVE_TARGET["target"] = "ssh";
+
+ if (options["server"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["server"] = tostring(options["server"]:nil);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Value for \"server\" missing."));
+ return false;
+ }
+
+ if (options["port"]:nil!=nil)
+ KDUMP_SAVE_TARGET["port"] = tostring(options["port"]:nil);
+
+ if (options["dir"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["dir"] = tostring(options["dir"]:nil);
+ } else {
+ CommandLine::Error(_("Value for \"dir\" missing."));
+ return false;
+ }
+
+ if (options["user"]:nil!=nil)
+ KDUMP_SAVE_TARGET["user_name"] = tostring(options["user"]:nil);
+
+ break;
+
+ case("nfs"):
+
+ KDUMP_SAVE_TARGET["target"] = "nfs";
+
+ if (options["server"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["server"] = tostring(options["server"]:nil);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Value for \"server\" missing."));
+ return false;
+ }
+
+ if (options["dir"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["dir"] = tostring(options["dir"]:nil);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Value for \"dir\" missing."));
+ return false;
+ }
+
+ break;
+
+ case("cifs"):
+ KDUMP_SAVE_TARGET["target"] = "cifs";
+
+ if (options["server"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["server"] = tostring(options["server"]:nil);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Value for \"server\" missing."));
+ return false;
+ }
+
+ if (options["share"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["share"] = tostring(options["share"]:nil);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Value for \"share\" missing."));
+ return false;
+ }
+
+
+ if (options["port"]:nil!=nil)
+ KDUMP_SAVE_TARGET["port"] = tostring(options["port"]:nil);
+
+ if (options["dir"]:nil!=nil) {
+ KDUMP_SAVE_TARGET["dir"] = tostring(options["dir"]:nil);
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Value for \"dir\" missing."));
+ return false;
+ }
+
+ if (options["user"]:nil!=nil)
+ KDUMP_SAVE_TARGET["user_name"] = tostring(options["user"]:nil);
+
+ if (options["pass"]:nil!=nil) {
+ string password = cmdParsePassPath(tostring(options["pass"]:nil));
+ if ((password == nil) || (password == ""))
+ return false;
+ KDUMP_SAVE_TARGET["password"] = password;
+ }
+ break;
+
+ default:
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value for target."));
+ return false;
+ break;
+ }
+ Kdump::KDUMP_SETTINGS["KDUMP_SAVEDIR"]= tostringKDUMP_SAVE_TARGET();
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+}
+
+
+
+boolean cmdKdumpRawPartition (map options) {
+ if (options["raw"]:nil!=nil) {
+
+ string value = tostring(find(string key, Kdump::uknown_fs_partitions,
+ ``(search(key, tostring(options["raw"]:nil)) != nil)));
+
+ if ((value != "") && (value != nil)) {
+ Kdump::KDUMP_SETTINGS["KDUMP_DUMPDEV"] = tostring(options["raw"]:nil);
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value of options \"raw\". Partition doesn't exist."));
+ return false;
+ }
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+
+}
+
+boolean cmdKdumpCustomKernel (map options) {
+
+ if (options["kernel"]:nil!=nil) {
+ Kdump::KDUMP_SETTINGS["KDUMP_KERNELVER"] = tostring(options["kernel"]:nil);
+ return true;
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+}
+
+
+boolean cmdKdumpKernelCommandLine (map options) {
+ if (options["command"]:nil!=nil) {
+ Kdump::KDUMP_SETTINGS["KDUMP_COMMANDLINE"] = tostring(options["command"]:nil);
+ return true;
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+}
+
+
+boolean cmdKdumpKernelCommandLineAppend (map options) {
+ if (options["command"]:nil!=nil) {
+ Kdump::KDUMP_SETTINGS["KDUMP_COMMANDLINE_APPEND"] = tostring(options["command"]:nil);
+ return true;
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+}
+
+boolean cmdKdumpImmediateReboot (map options) {
+ if (options["enable"]:nil!=nil) {
+ Kdump::KDUMP_SETTINGS["KDUMP_IMMEDIATE_REBOOT"]="yes";
+ return true;
+
+ } else if (options["disable"]:nil!=nil) {
+ Kdump::KDUMP_SETTINGS["KDUMP_IMMEDIATE_REBOOT"]="no";
+ return true;
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+}
+
+
+boolean cmdKdumpRunLevel (map options) {
+ if (options["level"]:nil!=nil) {
+ string level = filterchars(tostring(options["level"]:nil),"1235s");
+
+ if ((level != "") && (level != nil)){
+ Kdump::KDUMP_SETTINGS["KDUMP_RUNLEVEL"]= tostring(options["level"]:nil);
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value of options \"level\"."));
+ return false;
+ }
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+}
+
+
+boolean cmdKdumpKeepOldDumps (map options) {
+ if (options["no"]:nil!=nil) {
+
+ if (options["no"]:nil > -1){
+ Kdump::KDUMP_SETTINGS["KDUMP_KEEP_OLD_DUMPS"]= tostring(options["no"]:nil);
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value of options \"no\"."));
+ return false;
+ }
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options was used."));
+ return false;
+ }
+
+}
+
+
map cmdline_description = $[
"id" : "kdump",
- /* Command line help text for the Xkdump module */
+ /* Command line help text for the kdump module */
"help" : _("Configuration of kdump"),
"guihandler" : KdumpSequence,
"initialize" : Kdump::Read,
"finish" : Kdump::Write,
"actions" : $[
- // FIXME TODO: fill the functionality description here
+
+ "show" : $[
+ "handler" : cmdKdumpShow,
+ // TRANSLATORS: CommandLine help
+ "help" : _("Display settings"),
+ "example" : [
+ "show",
+ ],
+ ],
+
+ "startup" : $[
+ "handler" : cmdKdumpStartup,
+ // TRANSLATORS: CommandLine help
+ "help" : _("Start-up settings"),
+ "example" : [
+ "startup enable alloc_mem=256",
+ "startup disable",
+ ],
+ ],
+
+ "dumplevel" : $[
+ "handler" : cmdKdumpDumpLevel,
+ // TRANSLATORS: CommandLine help
+ "help" : _("Dump Level number 0-31"),
+ "example" : [
+ "dumplevel dump_level=24",
+ ],
+ ],
+
+
+ "dumpformat" : $[
+ "handler" : cmdKdumpDumpFormat,
+ // TRANSLATORS: CommandLine help
+ "help" : _("Dump format for dump image ELF/compressed"),
+ "example" : [
+ "dumpformat dump_format=ELF",
+ "dumpformat dump_format=compressed",
+ ],
+ ],
+
+ "dumptarget" : $[
+ "handler" : cmdKdumpDumpTarget,
+ // TRANSLATORS: CommandLine help
+ "help" : _("Dump target includes destination for saving dump images"),
+ "example" : [
+ "dumptarget taget=file dir=/var/log/dump",
+ "dumptarget taget=ftp server=name_server port=21 dir=/var/log/dump user=user_name pass=path_to_file_with_password",
+ "dumptarget taget=ssh server=name_server port=22 dir=/var/log/dump user=user_name",
+ "dumptarget taget=nfs server=name_server dir=/var/log/dump",
+ "dumptarget taget=cifs server=name_server share=share_name dir=/var/log/dump user=user_name pass=path_to_file_with_password",
+ ],
+ ],
+
+ "rawpartition" : $[
+ "handler" : cmdKdumpRawPartition,
+ // TRANSLATORS: CommandLine help
+ "help" : _("Raw partition allows to save the dump in initrd before mounting any filesystem."),
+ "example" : [
+ "rawpartition raw=scsi-SATA_ST3200827AS_5ND4TNCS-part2",
+ ],
+ ],
+
+ "customkernel" : $[
+ "handler" : cmdKdumpCustomKernel,
+ // TRANSLATORS: CommandLine help
+ "help" : _("The naming scheme is:/boot/vmlinu[zx]-
participants (1)
-
juhliarik@svn.opensuse.org