2006-04-14 22:38:26 +02:00
|
|
|
/**
|
|
|
|
* File: modules/NovellCasa.ycp
|
2006-04-19 00:12:38 +02:00
|
|
|
* Package: Configuration of CASA
|
2006-04-14 22:38:26 +02:00
|
|
|
* Summary: NovellCasa settings, input and output functions
|
|
|
|
* Authors: casa <casa@novell.com>
|
|
|
|
*
|
2006-04-19 00:12:38 +02:00
|
|
|
*********************************************************************
|
|
|
|
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
|
2006-04-14 22:38:26 +02:00
|
|
|
*
|
2006-04-19 00:12:38 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*********************************************************************
|
|
|
|
*
|
|
|
|
* Representation of the configuration of CASA.
|
2006-04-14 22:38:26 +02:00
|
|
|
* Input and output routines.
|
|
|
|
*/
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
module "NovellCasa";
|
2006-04-19 00:12:38 +02:00
|
|
|
textdomain "CASA";
|
2006-04-14 22:38:26 +02:00
|
|
|
|
|
|
|
import "Progress";
|
|
|
|
import "Report";
|
|
|
|
import "Summary";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prototypes
|
|
|
|
*/
|
|
|
|
global boolean Modified();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data was modified?
|
|
|
|
*/
|
|
|
|
global boolean modified = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
global boolean proposal_valid = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write only, used during autoinstallation.
|
|
|
|
* Don't run services and SuSEconfig, it's all done at one place.
|
|
|
|
*/
|
|
|
|
global boolean write_only = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abort function
|
|
|
|
* return boolean return true if abort
|
|
|
|
*/
|
|
|
|
global boolean() AbortFunction = Modified;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abort function
|
|
|
|
* @return boolean return true if abort
|
|
|
|
*/
|
|
|
|
global define boolean Abort() ``{
|
|
|
|
if(AbortFunction != nil)
|
|
|
|
{
|
|
|
|
return AbortFunction () == true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data was modified?
|
|
|
|
* @return true if modified
|
|
|
|
*/
|
|
|
|
global boolean Modified() {
|
|
|
|
y2debug("modified=%1",modified);
|
|
|
|
return modified;
|
|
|
|
}
|
|
|
|
|
2006-04-19 00:12:38 +02:00
|
|
|
// Settings: Define all variables needed for configuration of CASA
|
2006-04-14 22:38:26 +02:00
|
|
|
// TODO FIXME: Define all the variables necessary to hold
|
|
|
|
// TODO FIXME: the configuration here (with the appropriate
|
|
|
|
// TODO FIXME: description)
|
|
|
|
// TODO FIXME: For example:
|
|
|
|
// /**
|
|
|
|
// * List of the configured cards.
|
|
|
|
// */
|
|
|
|
// list cards = [];
|
|
|
|
//
|
|
|
|
// /**
|
|
|
|
// * Some additional parameter needed for the configuration.
|
|
|
|
// */
|
|
|
|
// boolean additional_parameter = true;
|
|
|
|
|
|
|
|
/**
|
2006-04-19 00:12:38 +02:00
|
|
|
* Read all CASA settings
|
2006-04-14 22:38:26 +02:00
|
|
|
* @return true on success
|
|
|
|
*/
|
|
|
|
global boolean Read() {
|
|
|
|
|
|
|
|
/* NovellCasa read dialog caption */
|
2006-04-19 00:12:38 +02:00
|
|
|
string caption = _("Initializing CASA Configuration");
|
2006-04-14 22:38:26 +02:00
|
|
|
|
|
|
|
// TODO FIXME Set the right number of stages
|
|
|
|
integer steps = 4;
|
|
|
|
|
|
|
|
integer sl = 500;
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
// TODO FIXME Names of real stages
|
|
|
|
// We do not set help text here, because it was set outside
|
|
|
|
Progress::New( caption, " ", steps, [
|
|
|
|
/* Progress stage 1/3 */
|
|
|
|
_("Read the database"),
|
|
|
|
/* Progress stage 2/3 */
|
|
|
|
_("Read the previous settings"),
|
|
|
|
/* Progress stage 3/3 */
|
|
|
|
_("Detect the devices")
|
|
|
|
], [
|
|
|
|
/* Progress step 1/3 */
|
|
|
|
_("Reading the database..."),
|
|
|
|
/* Progress step 2/3 */
|
|
|
|
_("Reading the previous settings..."),
|
|
|
|
/* Progress step 3/3 */
|
|
|
|
_("Detecting the devices..."),
|
|
|
|
/* Progress finished */
|
|
|
|
_("Finished")
|
|
|
|
],
|
|
|
|
""
|
|
|
|
);
|
|
|
|
|
|
|
|
// read database
|
|
|
|
if(Abort()) return false;
|
|
|
|
Progress::NextStage();
|
|
|
|
/* Error message */
|
|
|
|
if(false) Report::Error(_("Cannot read the database1."));
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
// read another database
|
|
|
|
if(Abort()) return false;
|
|
|
|
Progress::NextStep();
|
|
|
|
/* Error message */
|
|
|
|
if(false) Report::Error(_("Cannot read the database2."));
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
// read current settings
|
|
|
|
if(Abort()) return false;
|
|
|
|
Progress::NextStage();
|
|
|
|
/* Error message */
|
|
|
|
if(false) Report::Error(_("Cannot read current settings."));
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
// detect devices
|
|
|
|
if(Abort()) return false;
|
|
|
|
Progress::NextStage();
|
|
|
|
/* Error message */
|
|
|
|
if(false) Report::Warning(_("Cannot detect devices."));
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
if(Abort()) return false;
|
|
|
|
/* Progress finished */
|
|
|
|
Progress::NextStage();
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
if(Abort()) return false;
|
|
|
|
modified = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-04-19 00:12:38 +02:00
|
|
|
* Write all CASA settings
|
2006-04-14 22:38:26 +02:00
|
|
|
* @return true on success
|
|
|
|
*/
|
|
|
|
global boolean Write() {
|
|
|
|
|
|
|
|
/* NovellCasa read dialog caption */
|
2006-04-19 00:12:38 +02:00
|
|
|
string caption = _("Saving CASA Configuration");
|
2006-04-14 22:38:26 +02:00
|
|
|
|
|
|
|
// TODO FIXME And set the right number of stages
|
|
|
|
integer steps = 2;
|
|
|
|
|
|
|
|
integer sl = 500;
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
// TODO FIXME Names of real stages
|
|
|
|
// We do not set help text here, because it was set outside
|
|
|
|
Progress::New(caption, " ", steps, [
|
|
|
|
/* Progress stage 1/2 */
|
|
|
|
_("Write the settings"),
|
|
|
|
/* Progress stage 2/2 */
|
|
|
|
_("Run SuSEconfig")
|
|
|
|
], [
|
|
|
|
/* Progress step 1/2 */
|
|
|
|
_("Writing the settings..."),
|
|
|
|
/* Progress step 2/2 */
|
|
|
|
_("Running SuSEconfig..."),
|
|
|
|
/* Progress finished */
|
|
|
|
_("Finished")
|
|
|
|
],
|
|
|
|
""
|
|
|
|
);
|
|
|
|
|
|
|
|
// write settings
|
|
|
|
if(Abort()) return false;
|
|
|
|
Progress::NextStage();
|
|
|
|
/* Error message */
|
|
|
|
if(false) Report::Error (_("Cannot write settings."));
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
// run SuSEconfig
|
|
|
|
if(Abort()) return false;
|
|
|
|
Progress::NextStage ();
|
|
|
|
/* Error message */
|
|
|
|
if(false) Report::Error (_("SuSEconfig script failed."));
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
if(Abort()) return false;
|
|
|
|
/* Progress finished */
|
|
|
|
Progress::NextStage();
|
|
|
|
sleep(sl);
|
|
|
|
|
|
|
|
if(Abort()) return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-04-19 00:12:38 +02:00
|
|
|
* Get all CASA settings from the first parameter
|
2006-04-14 22:38:26 +02:00
|
|
|
* (For use by autoinstallation.)
|
|
|
|
* @param settings The YCP structure to be imported.
|
|
|
|
* @return boolean True on success
|
|
|
|
*/
|
|
|
|
global boolean Import (map settings) {
|
|
|
|
// TODO FIXME: your code here (fill the above mentioned variables)...
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-04-19 00:12:38 +02:00
|
|
|
* Dump the CASA settings to a single map
|
2006-04-14 22:38:26 +02:00
|
|
|
* (For use by autoinstallation.)
|
|
|
|
* @return map Dumped settings (later acceptable by Import ())
|
|
|
|
*/
|
|
|
|
global map Export () {
|
|
|
|
// TODO FIXME: your code here (return the above mentioned variables)...
|
|
|
|
return $[];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a textual summary and a list of unconfigured cards
|
|
|
|
* @return summary of the current configuration
|
|
|
|
*/
|
|
|
|
global list Summary() {
|
|
|
|
// TODO FIXME: your code here...
|
|
|
|
/* Configuration summary text for autoyast */
|
|
|
|
return [ _("Configuration summary ..."), [] ];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create an overview table with all configured cards
|
|
|
|
* @return table items
|
|
|
|
*/
|
|
|
|
global list Overview() {
|
|
|
|
// TODO FIXME: your code here...
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return packages needed to be installed and removed during
|
|
|
|
* Autoinstallation to insure module has all needed software
|
|
|
|
* installed.
|
|
|
|
* @return map with 2 lists.
|
|
|
|
*/
|
|
|
|
global map AutoPackages() {
|
|
|
|
// TODO FIXME: your code here...
|
|
|
|
return $[ "install":[], "remove":[] ];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|
|
|
|
}
|