home *** CD-ROM | disk | FTP | other *** search
- /**
- * File:
- * include/vm/cmdline.ycp
- *
- * Summary:
- * Command line interface functions
- *
- * Authors:
- * Ladislav Slezak <lslezak@suse.cz>
- * Michael G. Fritch <mgfritch@novell.com>
- *
- * $Id: cmdline.ycp 34434 2006-11-16 21:34:28Z mgfritch $
- *
- * Handlers for command line mode.
- *
- */
-
- {
- import "Progress";
- import "Wizard";
- import "GetInstArgs";
- import "VM";
- import "VM_Common";
- import "Mode";
- import "Sequencer";
- import "CommandLine";
-
-
- textdomain "vm";
-
-
- define symbol manage() {
- return (symbol)WFM::CallFunction ("inst_vm_manage", [false, true]);
- }
-
-
- define symbol select_create() {
- return (symbol)WFM::CallFunction ("inst_xen_create", [true, true]);
- }
-
-
- define symbol proposal() {
- string proposal_type = sformat("%1_%2", VM::GetVMMtype(), VM_Common::proposal_type);
- symbol retval = (symbol)WFM::CallFunction ("inst_proposal",
- [GetInstArgs::ButtonsProposal(true, true, proposal_type)]);
-
- if (retval == `back) {
- return `forceback;
- }
- return retval;
- }
-
-
- define symbol start() {
-
- if (!Mode::config()) {
- symbol retval = (symbol)WFM::CallFunction("inst_vm_kickoff", [false, false]);
- VM_Common::RemoveTmpDir(); // Remove all bogus tmp directories (bugzilla #217403)
- return retval;
- }
- else {
- // save the current settings into the AutoYaST profile settings
- VM_Common::autoyast_profile_settings[VM_Common::proposal_type] = VM::SubExport();
- }
-
- return `next;
- }
-
-
- define symbol prepare(string new_proposal_type) {
- // set the proposal_type
- VM_Common::proposal_type = new_proposal_type;
-
- // reset the appropriate proposal settings
- if (VM_Common::proposal_type == "boot") {
- VM::ResetSource();
- VM::ResetExtraArgs();
- if (!Mode::config()) {
- //load the saved AutoYaST profile settings
- VM::Import(VM_Common::autoyast_profile_settings);
- }
- }
- else {
- VM::ResetAllSettings();
- }
-
- return `next;
- }
-
-
- define symbol GUIhandler() {
- // create initial dialog
- Wizard::CreateDialog();
- Wizard::SetDesktopIcon ("vm");
-
- map aliases = $[
- "manage" : ``(manage()), // manage virtual machines
- "select_create" : ``(select_create()), // creation options
- "install_prepare" : ``(prepare("install")), // change proposal_type to install and reset the proposal settings.
- "install_proposal" : ``(proposal()), // install options
- "install_start" : ``(start()), // start vm install
- "boot_prepare" : ``(prepare("boot")), // change proposal_type to boot and reset the proposal settings.
- "boot_proposal" : ``(proposal()), // boot options
- "boot_start" : ``(start()), // boot vm and display feedback dialog
- "existing_prepare" : ``(prepare("existing")), // change proposal_type to existing and reset the proposal settings.
- "existing_proposal" : ``(proposal()), // existing vm install options
- "existing_start" : ``(start()), // boot vm and display feedback dialog
- ];
-
- boolean isAutoinstallation = false;
- if (Mode::config()) { // running inside of autoinstallation wizard (AutoYaST)
- isAutoinstallation = true;
- }
-
- map sequence = $[
- "ws_start" : (isAutoinstallation) ? "install_prepare" : "manage",
- "manage" :
- $[
- `close : `finish,
- `add : "select_create",
- `next : `next,
- `finish : `finish,
- `abort : `abort,
- ],
- "select_create" :
- $[
- `install : "install_prepare",
- `existing : "existing_prepare",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ],
- "install_prepare" :
- $[
- `forceback : (isAutoinstallation) ? `back : "select_create",
- `next : "install_proposal",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ],
- "install_proposal" :
- $[
- `forceback : (isAutoinstallation) ? `back : "select_create",
- `next : "install_start",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ],
- "install_start" :
- $[
- `forceback : "install_proposal",
- `next : "boot_prepare",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ],
- "boot_prepare" :
- $[
- `forceback : "install_prepare",
- `next : "boot_proposal",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ],
- "boot_proposal" :
- $[
- `forceback : "install_prepare",
- `next : "boot_start",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ],
- "boot_start" :
- $[
- `forceback : "boot_proposal",
- `again : "select_create",
- `next : (isAutoinstallation) ? `next : "manage",
- `finish : (isAutoinstallation) ? `finish : "manage",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ],
- "existing_prepare" :
- $[
- `forceback : "select_create",
- `next : "existing_proposal",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ],
- "existing_proposal" :
- $[
- `forceback : "select_create",
- `next : "existing_start",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ],
- "existing_start" :
- $[
- `forceback : "existing_proposal",
- `again : "select_create",
- `next : (isAutoinstallation) ? `next : "manage",
- `finish : (isAutoinstallation) ? `finish : "manage",
- `abort : (isAutoinstallation) ? `abort : "manage",
- ]
- ];
-
- y2milestone("sequence: %1", sequence);
-
- symbol ret = Sequencer::Run(aliases, sequence);
-
- Wizard::CloseDialog();
-
- return ret;
- }
- }
-
-