home *** CD-ROM | disk | FTP | other *** search
- /**
- * File:
- * osr_module_init.ycp
- *
- * Module:
- * YaST2 OS Repair init module.
- *
- * Summary:
- * YaST2 OS Repair. Automatic error detection & repair tool for Linux.
- *
- * Author:
- * Michael Koehrmann <curry@suse.de>
- *
- * $Id: osr_module_init.ycp 23769 2005-06-21 12:18:10Z jsuchome $
- */
-
- {
-
- import "Stage";
- import "StorageDevices";
-
- import "OSR";
- import "OSRCommon";
- import "OSRSummary";
- import "OSRFloppy";
- import "OSRPopup";
-
- textdomain "repair";
-
- //////////////////////////////////////////////////////////////////////
- //
- // DETECTION METHODS
- //
- //////////////////////////////////////////////////////////////////////
-
- /**
- */
- define boolean OSRInitSelectFloppy() ``{
-
- /////////////////////////////////////////////////////////////////////////
- //
- // Check Floppy
- //
- /////////////////////////////////////////////////////////////////////////
-
- if ( size( StorageDevices::FloppyDrives) == 1 )
- {
- // summary text, %1 is floppy device
- OSRSummary::DetectOK("",sformat(_("Floppy device found on %1"),
- OSRFloppy::floppy_device ));
-
- OSRCommon::ProvideBoolean("has_floppy", true);
- }
- else if ( size( StorageDevices::FloppyDrives) > 1 )
- {
- list<string> drives = (list<string>) maplist (
- map floppy, StorageDevices::FloppyDrives, ``{
- return floppy["dev_name"]:"";
- });
-
- OSRSummary::DetectOK("",
- // summary text, %1 are floppy devices
- sformat(_("Several floppy devices found<br>%1"),
- mergestring (drives, " ,")));
-
-
- // let the user select the floppy device to use
- OSRFloppy::floppy_device = OSRPopup::RadioButtonGroup(
- // popup headline
- _("Select the Floppy Device"),
- // radibutton group description
- _("Select one of the floppy
- devices for later use."),
- drives,
- "",
- true);
-
- OSRSummary::DetectOK("",
- // summary text, %1 is floppy device
- sformat(_("Selected floppy device %1"), OSRFloppy::floppy_device));
-
- OSRCommon::ProvideBoolean("has_floppy", true);
- }
- else
- {
- // summary text
- OSRSummary::NotFound("", _("No floppy device found"));
- OSRCommon::ProvideBoolean("has_floppy", false );
- return false;
- }
- return true;
- }
-
- define boolean OSRInitTarget() {
-
- // summary text
- OSRSummary::DetectOK("", _("Target system initialized"));
-
- // if the rescue-system is launched from a running Linux-system
- // the target-directory is empty, else "/mnt"
- if (!Stage::initial () && !Stage::cont ())
- {
- OSRCommon::ProvideString("repair_target", "") ;
- }
- else
- {
- OSRCommon::ProvideString("repair_target", "/mnt") ;
- }
-
- return true;
- }
- //////////////////////////////////////////////////////////////////////
- //
- // METHODS
- //
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Initialization of the module map that contains all important information
- * for this module.
- *
- * @return map The map that contains all information about
- * the module osr_module_init.
- */
- define map OSRInitInit () {
-
- y2debug("OSRInitInit");
-
- return $[
- "name" : "osr_module_init",
- // module headline
- "headline" : _("OSRInit"),
- "global_entries" : $[
- "init" : $[
- // module action label
- "text" : _("Initialize Repair System"),
- // module helptext
- "help" : _("TODO"),
- "mode" : "forall"
- ]
- ],
-
- "detect_methods" : [
- // module method progress label
- $[ "summary" : _("Probing floppy..."),
- "method" : OSRInitSelectFloppy,
- "requires" : [],
- "provides" : [ "has_floppy"],
- "group" : "init",
- "progress" : 10,
- "name" : "init_floppy",
- ],
- // module method progress label
- $[ "summary" : _("Initializing target system..."),
- "method" : OSRInitTarget,
- "requires" : [],
- "provides" : ["repair_target"],
- "group" : "init",
- "progress" : 10,
- "name" : "init_target"
- ]
- ]
- ];
- }
-
- }//EOF
-