home *** CD-ROM | disk | FTP | other *** search
- /**
- * File: OSRSystem.ycp
- * Module: repair
- * Summary:
- * Authors: Johannes Buchhold <jbuch@suse.de>
- *
- * $Id: OSRSystem.ycp 20450 2004-12-01 11:55:31Z jsuchome $
- *
- * Provide osr mode information.
- */
-
- {
- module "OSRSystem";
-
- import "Installation";
- import "Mode";
- import "Report";
-
- import "OSRStatus";
-
- textdomain "repair";
-
- /**
- * The current root environment.
- */
- string root = "/";
-
- /**
- * The target system root mount point.
- */
- string target_root = "/mnt";
-
- /**
- * The base root mount point.
- */
- string org_root = "/";
-
- /**
- * Change the root environment.
- * @param root The new root environment.
- */
- global define boolean ChangeRoot(string new_root )``{
-
- if( new_root != root && ! Mode::test())
- {
- y2milestone("changing root environment from %1 to %2",root, new_root);
-
- WFM::SCRClose ( Installation::scr_handle );
- Installation::scr_handle = WFM::SCROpen ("chroot="+ new_root +":scr", false );
- Installation::scr_destdir = new_root;
-
- if( Installation::scr_handle < 0 )
- {
- y2error("changing root was not successful");
- Report::Error(_("
- Changing environment to target
- system was not successful."));
-
- OSRStatus::ErrorSeverityBlocking();
- // try to reopen old SCR...
- Installation::scr_handle = WFM::SCROpen ("scr", false);
- Installation::scr_destdir = root;
- return false;
- }
- else
- {
- WFM::SCRSetDefault (Installation::scr_handle);
- SCR::Read (.target.tmpdir);
-
- root = new_root;
- y2milestone("changing root was successful");
- }
- }
- return true;
- }
-
- global define void SetOrgRoot()``{
-
- if( ChangeRoot( org_root) )
- {
- root = org_root;
- }
- }
-
- global define void Reset()``{
- target_root = "/mnt";
- org_root = "/";
- SetOrgRoot();
- }
-
- /**
- * Change root to target root mount point.
- */
- global define void SetTargetRoot()``{
-
- if( ChangeRoot( target_root ) )
- {
- root = target_root;
- }
- }
-
- global define string Root()``{
- return root;
- }
-
- global define string TargetRoot()``{
- return target_root;
- }
-
- global define string OrgRoot()``{
- return org_root;
- }
-
-
- }
-