ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/nfs_auto.ycp

/**
 * File:
 *   nfs_auto.ycp
 *
 * Package:
 *   Configuration of NFS client
 *
 * Summary:
 *   Client for autoinstallation
 *
 * Authors:
 *   Martin Vidner <mvidner@suse.cz>
 *
 * $Id: nfs_auto.ycp 60697 2010-02-04 14:04:09Z kmachalkova $
 *
 * 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 first a map of mail settings
 * @return map edited settings or empty map if canceled
 * @example map mm = $[ "FAIL_DELAY" : "77" ];
 * @example map ret = WFM::CallModule ("mail_auto", [ mm ]);
 */

{
textdomain "nfs";

y2milestone("----------------------------------------");
y2milestone("Nfs auto started");

import "Nfs";
import "Wizard";
include "nfs/ui.ycp";

any ret = nil;
string func = "";
map <string, any> 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 <string, any> ) WFM::Args(1);
    if(size(WFM::Args()) > 1 && is(WFM::Args(1), list))
	y2warning("Old-style configuration detected (got list, expected map). <nfs> section needs to be converted to match up-to-date schema");
}
y2debug("func=%1", func);
y2debug("param=%1", param);

/* Create a  summary*/
if(func == "Import") {
    ret = (boolean) Nfs::Import(param);
}
/* Create a  summary*/
else if(func == "Summary") {
    ret = (string) Nfs::Summary();
}
/* Reset configuration */
else if (func == "Reset") {
    Nfs::Import($[]);
    ret = $[];
}
/* Change configuration (run AutoSequence) */
else if (func == "Change") {
    Wizard::CreateDialog ();
    Wizard::SetDesktopIcon("nfs");
    ret = (symbol) FstabDialog ();
    UI::CloseDialog ();
}
else if (func == "GetModified") {
    ret =  Nfs::GetModified();
}
else if (func == "SetModified") {
    Nfs::SetModified();
}
/* Return actual state */
else if (func == "Packages") {
    ret = (map) Nfs::AutoPackages();
}
/* Return actual state */
else if (func == "Export") {
    ret = (map) Nfs::Export();
}
else if (func == "Read") {
    ret = (boolean)  Nfs::Read();
}
/* Write givven settings */
else if (func == "Write") {
    import "Progress";
    boolean progress_orig = Progress::set (false);
    ret = (boolean) Nfs::WriteOnly();
    Progress::set (progress_orig);
}
/* Unknown function */
else {
    y2error("Unknown function: %1", func);
    ret = false;
}

y2debug("ret=%1", ret);
y2milestone("Nfs auto finished");
y2milestone("----------------------------------------");

return ret;

/* EOF */
}


ACC SHELL 2018