home *** CD-ROM | disk | FTP | other *** search
- /**
- * Module: rootpart_proposal.ycp
- *
- * Author: Arvin Schnell <arvin@suse.de>
- *
- * Purpose: Let user choose root partition during update.
- *
- * $Id: rootpart_proposal.ycp 33392 2006-10-13 11:39:53Z locilka $
- */
- {
- textdomain "update";
-
- import "Mode";
- import "Linuxrc";
- import "Update";
- import "PackageCallbacks";
- import "RootPart";
-
- include "update/rootpart.ycp";
-
- string func = (string) WFM::Args(0);
- map param = (map) WFM::Args(1);
- map ret = $[];
-
-
- if ( func == "MakeProposal" )
- {
- boolean force_reset = param["force_reset" ]:false;
- boolean language_changed = param["language_changed"]:false;
-
- PackageCallbacks::SetRebuildDBCallbacks ();
-
- // call some function that makes a proposal here:
- //
- // DummyMod::MakeProposal( force_reset );
-
- // Fill return map
-
- if (force_reset)
- {
- RootPart::selectedRootPartition = "";
- }
-
- if (RootPart::numberOfValidRootPartitions == 0
- && RootPart::selectedRootPartition == "")
- {
- RootPart::targetOk = false;
-
- ret = $[ "warning" :
- // Proposal for system to update
- _("No root partition found"),
- "warning_level" : `fatal,
- "raw_proposal" : []
- ];
- }
- else
- {
- if (RootPart::selectedRootPartition == "")
- {
- if (RootPart::numberOfValidRootPartitions == 1 && !Linuxrc::manual ())
- {
- RootPart::SetSelectedToValid ();
- }
- else
- {
- symbol result = (symbol) WFM::CallFunction ("inst_rootpart", [true, true, `update_popup]);
- }
-
- RootPart::targetOk = RootPart::mount_target ();
- }
- else if (! RootPart::Mounted ())
- {
- RootPart::targetOk = RootPart::mount_target ();
- }
-
- if (RootPart::numberOfValidRootPartitions == 1)
- {
- ret = $[ "raw_proposal" :
- [ RootPart::GetInfoOfSelected (`name) ]
- ];
- }
- else
- {
- ret = $[ "raw_proposal" :
- // Proposal for system to update
- [ sformat (_("%1 on root partition %2"),
- RootPart::GetInfoOfSelected (`name),
- RootPart::selectedRootPartition) ]
- ];
- }
-
- if (!RootPart::targetOk)
- {
- // inform user in the proposal about the failed mount
- ret = add (ret, "warning", _("Failed to mount target system"));
- ret = add (ret, "warning_level", `fatal);
- ret = add (ret, "raw_proposal", []);
- }
- }
- }
- else if ( func == "AskUser" )
- {
- boolean has_next = param["has_next"]:false;
-
- // call some function that displays a user dialog
- // or a sequence of dialogs here:
- //
- // sequence = DummyMod::AskUser( has_next );
-
- string tmp = RootPart::selectedRootPartition;
-
- symbol result = RootPartitionDialog (`update_dialog_proposal);
-
- if (result == `next)
- {
- Update::Detach ();
- RootPart::UnmountPartitions (false);
-
- // RootPart::targetOk = mount_target ();
- }
-
- // Fill return map
-
- ret = $[ "workflow_sequence" : result,
- "rootpart_changed" : RootPart::selectedRootPartition != tmp ];
- }
- else if ( func == "Description" )
- {
- // Fill return map.
-
- if (Mode::normal ())
- {
- ret = $[];
- }
- else
- {
- ret = $[
- // this is a heading
- "rich_text_title" : _("Selected for Update"),
- // this is a menu entry
- "menu_title" : _("&Selected for Update"),
- "id" : "rootpart_stuff"
- ];
- }
- }
-
- return ret;
- }
-