/**
 * File:	clients/nis_auto.ycp
 * Package:	nis-client configuration
 * Summary:	client for autoinstallation
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: nis_auto.ycp 20587 2004-12-16 14:42:44Z jsuchome $
 */

{

textdomain "nis";

import "Nis";
include "nis/ui.ycp";

/* The main () */
y2milestone("----------------------------------------");
y2milestone("NIS client autoinst client started");
any ret = nil;
string func = "";
map 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), map))
    param = (map) WFM::Args(1);
}
y2debug("func=%1", func);
y2debug("param=%1", param);

/* Import data*/
if(func == "Import") {
	ret = Nis::Import(param);
}
/* create a  summary*/
else if(func == "Summary") {
    ret =  Nis::Summary();
}
// ShortSummary is used by Users module
else if(func == "ShortSummary") {
    ret =  Nis::ShortSummary();
}
else if (func == "Reset") {
	Nis::Import($[]);
	ret = $[];
}
else if (func == "Change") {
	ret = AutoSequence();
}
else if (func == "Read") {
    ret = Nis::Read();
}
else if (func == "GetModified") {
    ret =  Nis::GetModified();
}
else if (func == "SetModified") {
    Nis::SetModified();
}
else if (func == "Export") {
    ret = Nis::Export();
}
else if (func == "Packages") {
	ret = Nis::AutoPackages();
}
else if (func == "Write") {
    import "Progress";
    boolean progress_orig = Progress::set (false);
    ret = Nis::WriteOnly();
    Progress::set (progress_orig);

}

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

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

return ret;
/* EOF */
}
