[yast-commit] r55194 - in /trunk/installation: package/yast2-installation.changes src/modules/InstError.ycp
Author: locilka Date: Mon Feb 2 16:57:17 2009 New Revision: 55194 URL: http://svn.opensuse.org/viewcvs/yast?rev=55194&view=rev Log: - InstError can now save YaST logs on user request. Modified: trunk/installation/package/yast2-installation.changes trunk/installation/src/modules/InstError.ycp Modified: trunk/installation/package/yast2-installation.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-instal... ============================================================================== --- trunk/installation/package/yast2-installation.changes (original) +++ trunk/installation/package/yast2-installation.changes Mon Feb 2 16:57:17 2009 @@ -3,6 +3,7 @@ - Erasing all old additional control files in the final step of upgrade before rebooting to the second stage (bnc #471454). +- InstError can now save YaST logs on user request. - 2.18.4 ------------------------------------------------------------------- Modified: trunk/installation/src/modules/InstError.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/modules/InstErro... ============================================================================== --- trunk/installation/src/modules/InstError.ycp (original) +++ trunk/installation/src/modules/InstError.ycp Mon Feb 2 16:57:17 2009 @@ -16,9 +16,62 @@ import "Icon"; import "Label"; + import "String"; + import "Report"; + + boolean SaveLogs () { + map cmd = (map) WFM::Execute (.local.bash_output, "echo ${HOME}"); + string homedir = "/"; + + if (cmd["exit"]:-1 == 0) { + homedir = splitstring (cmd["stdout"]:"/", "\n")[0]:"/"; + if (homedir == "") homedir = "/"; + } else { + y2warning ("Unable to find out home dir: %1, using %2", cmd, homedir); + } + homedir = sformat ("%1/y2logs.tgz", homedir); + + string savelogsto = (string) UI::AskForSaveFileName ( + homedir, + "*.tgz *.tar.gz *.tar.bz2", + _("Save y2logs to...") + ); + + if (savelogsto == nil) + return nil; + + // Busy message, %1 is replaced with a filename + UI::OpenDialog (`Label (sformat (_("Saving YaST logs to %1..."), savelogsto))); + y2milestone ("Saving YaST logs to: %1", savelogsto); + + cmd = (map) WFM::Execute (.local.bash_output, sformat ("save_y2logs '%1'", String::Quote (savelogsto))); + boolean dialog_ret = nil; + + if (cmd["exit"]:-1 != 0) { + y2error ("Unable to save logs to %1", savelogsto); + + Report::Error (sformat ( + // Error message, %1 is replaced with a filename + // %2 with am error reason (there is a newline between %1 and %2) + _("Unable to save YaST logs to %1 +%2"), + savelogsto, + cmd["stderr"]:"" + )); + + dialog_ret = false; + } else { + y2milestone ("Logs have been saved to: %1", savelogsto); + dialog_ret = true; + } + + UI::CloseDialog(); + + return dialog_ret; + } global void ShowErrorPopUp (string heading, string error_text, string details) { - boolean success = UI::OpenDialog (`VBox ( + boolean success = (boolean) UI::OpenDialog (`VBox ( `Left (`HBox ( `HSquash (`MarginBox (0.5, 0.2, Icon::Error())), `Heading (heading) @@ -67,7 +120,17 @@ return; } - UI::UserInput(); + any uret = nil; + + while (true) { + uret = UI::UserInput(); + + if (uret == `save_y2logs) { + SaveLogs(); + } else { + break; + } + } UI::CloseDialog(); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
locilka@svn.opensuse.org