home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
root
/
usr
/
share
/
YaST2
/
clients
/
inst_vm_autoyast.ycp
< prev
next >
Wrap
Text File
|
2006-11-29
|
3KB
|
119 lines
/**
* Module: inst_vm_autoyast.ycp
*
* Authors: Ladislav Slezak <lslezak@suse.cz>
*
* Purpose: Ask for an AutoYaST profile.
*
* $Id: inst_vm_autoyast.ycp 31352 2006-06-06 23:53:13Z mgfritch $
*
*/
{
textdomain "vm";
import "VM";
import "Wizard";
import "Popup";
import "Report";
import "Label";
// screen title for network options
string title = _("AutoYaST Profile");
// build and show dialog
Wizard::OpenAcceptDialog();
term contents = `HBox(
`HSpacing(1),
`TextEntry(`id(`profile), `opt(`hstretch), _("AutoYaST &Profile"), VM::GetAutoYastProfile()),
`HSpacing(1),
`VBox(
`Label(""),
`PushButton(`id(`select_profile), _("Select Profile..."))
),
`HSpacing(1)
);
// help text for autoyast settings (1/2)
string help_text = sformat(_("<p><b><big>%1</big></b></p>"), title)
// help text for autoyast settings (2/2)
+ _("<p>You can install a VM using predefined settings from an AutoYaST profile. AutoYast profiles can be created using YaST > Miscellaneous > Autoinstallation.</p>");
Wizard::SetContents (title, contents, help_text, true, true);
symbol ret = nil;
while (true)
{
ret = (symbol) Wizard::UserInput();
if (ret == `abort && Popup::ConfirmAbort(`painless))
{
break;
}
else if (ret == `cancel || ret == `back)
{
break;
}
else if (ret == `select_profile)
{
string new_profile = (string) UI::QueryWidget (`id(`profile), `Value);
if (new_profile == nil || new_profile == "")
{
new_profile = "/var/lib/autoinstall/repository/";
}
new_profile = UI::AskForExistingFile(new_profile, "*", _("Select an AutoYaST Profile"));
if (new_profile != nil)
{
UI::ChangeWidget(`id(`profile), `Value, new_profile);
}
}
else if (ret == `next)
{
string profile = (string) UI::QueryWidget (`id(`profile), `Value);
if (profile != "" && (integer)SCR::Read(.target.size, profile) < 0) {
Report::Error(_("The specified AutoYaST Profile does not exist."));
continue;
}
VM::SetAutoYastProfile(profile);
if (profile != "")
{
import "Profile";
if (!Profile::ReadXML(profile))
{
Report::Warning(_("Cannot load the profile in
the current system. It may be broken."));
}
else
{
y2milestone("Loaded AutoYaST profile: %1", Profile::current);
// import VM config
map xen_setting = Profile::current["xen"]:$[];
if (xen_setting != nil && xen_setting != $[] &&
// ask user to load VM settings from the profile
Popup::YesNo(_("Load the virtual machine configuration from the profile?")))
{
y2milestone("Import settings: %1", xen_setting);
VM::Import(xen_setting);
}
}
}
break;
}
}
Wizard::CloseDialog();
return ret;
}