/**
 * File:       clients/sysconfig_auto.ycp
 * Package:    Configuration of sysconfig
 * Summary:    Client for autoinstallation
 * Authors:    Ladislav Slezak <lslezak@suse.cz>
 *
 * $Id: sysconfig_auto.ycp,v 1.12 2004/09/27 15:26:27 lslezak Exp $
 *
 * This is a client for autoinstallation.
 * Does not do any changes to the configuration.
 *
 */


{

textdomain "sysconfig";

import "Sysconfig";
include "sysconfig/wizards.ycp";

/* The main () */
y2milestone("---------------------------------");
y2milestone("Sysconfig autoinst client started");
any ret = nil;
string func = "";
list param = [];


/* Check arguments */
if(size(WFM::Args()) > 0 && is(WFM::Args(0), string))
{
    func = (string)WFM::Args(0);

    if (size(WFM::Args()) > 1 && is(WFM::Args(1), list))
    {
	param = (list)WFM::Args(1);
    }
}

y2debug("func=%1", func);
y2debug("param=%1", param);

/* Import data*/
if(func == "Import")
{
    ret = Sysconfig::Import(param);
}
/* create a summary */
else if(func == "Summary")
{
    ret =  Sysconfig::Summary();
}
else if (func == "Packages")
{
	ret = $[];
}
else if (func == "Reset")
{
    ret = Sysconfig::Import([]);
}
else if (func == "Change")
{
    ret = SysconfigAutoSequence();
}
else if (func == "Export")
{
    ret = Sysconfig::Export();
}
else if (func == "GetModified") {
    ret =  Sysconfig::Modified();
}
else if (func == "SetModified") {
    Sysconfig::SetModified();
}
else if (func == "Write")
{
    import "Progress";
    Sysconfig::write_only = true;
    Progress::off();
    Sysconfig::RegisterAgents();
    ret = Sysconfig::Write();
    Progress::on();
}

/* unknown function */
else
{
    y2error("unknown function: %1", func);
    ret =  false;
}

/* Finish */
y2debug("ret=%1", ret);
y2milestone("Sysconfig autoinit client finished");
y2milestone("----------------------------------");

return ret;
/* EOF */

}
