home *** CD-ROM | disk | FTP | other *** search
- /**
- * File:
- * switch_scr_finish.ycp
- *
- * Module:
- * Step of base installation finish
- *
- * Authors:
- * Jiri Srain <jsrain@suse.cz>
- *
- * $Id: switch_scr_finish.ycp 33233 2006-10-02 15:07:05Z locilka $
- *
- */
-
- {
-
- textdomain "installation";
-
- import "Directory";
- import "Installation";
-
- any ret = nil;
- string func = "";
- map param = $[];
-
- /**
- * SCR Switch failed. Reporting error, collecting data.
- * bugzilla #201058
- */
- void ErrorDuringSCRSwitch (string chroot_dir) {
- // import the library once it is needed
- import "Popup";
-
- y2error("Cannot switch to SCR '%1'", chroot_dir);
-
- // Ask users whether they want to debug the problem
- if (Popup::YesNoHeadline (
- // popup error headline
- _("Installation Error"),
- // popup question
- _("An error occurred while switching to the installed system
- and no recovery is possible.
- Run the automatic debugger to find out why it has failed?")
- )) {
- y2milestone("User decided to debug the current problem");
-
- // include the file once it is needed
- include "installation/scr_switch_debugger.ycp";
- RunSCRSwitchDebugger(chroot_dir);
- } else {
- y2warning("User decided not to debug the current problem");
- }
- }
-
- /* 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 switch_scr_finish");
- y2debug("func=%1", func);
- y2debug("param=%1", param);
-
- if (func == "Info")
- {
- return (any)$[
- "steps" : 1,
- // progress step title
- "title" : _("Moving to installed system..."),
- "when" : [ `installation, `update, `autoinst ],
- ];
- }
- else if (func == "Write")
- {
- // --------------------------------------------------------------
- // stop SCR
- // restart on destination
-
- y2milestone ("Stopping SCR");
-
- WFM::SCRClose (Installation::scr_handle);
-
-
- // --------------------------------------------------------------
-
-
- y2milestone ("Re-starting SCR on %1", Installation::destdir);
- Installation::scr_handle = WFM::SCROpen ("chroot="+Installation::destdir+":scr", false);
-
- // bugzilla #201058
- // WFM::SCROpen returns negative integer in case of failure
- if (Installation::scr_handle < 0) {
- ErrorDuringSCRSwitch (Installation::destdir);
- return false;
- }
-
- Installation::scr_destdir = "/";
- WFM::SCRSetDefault (Installation::scr_handle);
-
- // re-init tmpdir from new SCR !
- Directory::ResetTmpDir();
- }
- else
- {
- y2error ("unknown function: %1", func);
- ret = nil;
- }
-
- y2debug("ret=%1", ret);
- y2milestone("switch_scr_finish finished");
- return ret;
-
-
- } /* EOF */
-