CASA/yast2-CASA/src/CASA_auto.ycp

118 lines
3.1 KiB
Plaintext

/**
* File: clients/CASA_auto.ycp
* Package: Configuration of CASA
* Summary: Client for autoinstallation
* Authors: casa <casa@novell.com>
*
*********************************************************************
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com.
*
*********************************************************************
*
* This is a client for autoinstallation. It takes its arguments,
* goes through the configuration and return the setting.
* Does not do any changes to the configuration.
*/
/**
* @param function to execute
* @param map/list of CASA settings
* @return map edited settings, Summary or boolean on success depending on called function
* @example map mm = $[ "FAIL_DELAY" : "77" ];
* @example map ret = WFM::CallFunction ("CASA_auto", [ "Summary", mm ]);
*/
{
textdomain "CASA";
y2milestone("----------------------------------------");
y2milestone("CASA auto started");
import "NovellCasa";
include "CASA/wizards.ycp";
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);
/* Create a summary*/
if(func == "Summary") {
ret = select(NovellCasa::Summary(), 0, "");
}
/* Reset configuration */
else if (func == "Reset") {
NovellCasa::Import($[]);
ret = $[];
}
/* Change configuration (run AutoSequence) */
else if (func == "Change") {
ret = NovellCasaAutoSequence();
}
/* Import configuration */
else if (func == "Import") {
ret = NovellCasa::Import(param);
}
/* Return actual state */
else if (func == "Export") {
ret = NovellCasa::Export();
}
/* Return needed packages */
else if (func == "Packages") {
ret = NovellCasa::AutoPackages();
}
/* Read current state */
else if (func == "Read") {
import "Progress";
Progress::off();
ret = NovellCasa::Read();
Progress::on();
}
/* Write givven settings */
else if (func == "Write") {
import "Progress";
Progress::off();
// NovellCasa::write_only = true;
ret = NovellCasa::Write();
Progress::on();
}
/* Unknown function */
else {
y2error("Unknown function: %1", func);
ret = false;
}
y2debug("ret=%1", ret);
y2milestone("CASA auto finished");
y2milestone("----------------------------------------");
return ret;
/* EOF */
}