ACC SHELL
/**
* File:
* users_auto.ycp
*
* Package:
* Configuration of Users
*
* Summary:
* Client for autoinstallation
*
* Authors:
* Anas Nashif <nashif@suse.de>
*
* $Id: users_auto.ycp 60823 2010-02-16 14:02:47Z jsuchome $
*
* 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.
*/
{
textdomain "users";
import "Mode";
import "Users";
import "Wizard";
include "users/wizards.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);
}
y2debug("func=%1", func);
y2debug("param=%1", param);
list users = [
$[ "username":"my_user",
"user_password":"passw",
"encrypted": false,
// "uid":501,
"gid":100,
"password_settings":$[
"expire":""
],
"grouplist": "audio"
],
$[ "username":"daemon",
"user_password":"pass",
"encrypted": false,
],
$[ "username":"root",
"uidNumber": 0,
"user_password":"pass",
],
];
// param = $["users": users];
if (func == "Import") {
ret = Users::Import(param);
}
/* create a summary*/
else if (func == "Summary") {
ret = Users::Summary();
}
else if (func == "Reset") {
Users::Import($[]);
ret = $[];
}
else if (func == "Packages") {
ret = $[];
}
else if (func == "Change") {
string start_dialog = "summary"; //look to users.ycp for possible values
Wizard::CreateDialog();
Wizard::SetDesktopIcon("users");
ret = AutoSequence(start_dialog);
Wizard::CloseDialog();
}
else if (func == "Export") {
ret = Users::Export();
Users::SetExportAll (false);
}
else if (func == "Read") {
import "Progress";
Users::SetExportAll (true);
boolean progress_orig = Progress::set (false);
ret = (Users::Read () == "");
Progress::set (progress_orig);
}
else if (func == "Write") {
import "Progress";
Users::SetWriteOnly (true);
boolean progress_orig = Progress::set (false);
ret = (Users::Write () == "");
Progress::set (progress_orig);
}
/**
* Return if configuration was changed
* return boolean
*/
else if (func == "GetModified") {
ret = Users::Modified ();
}
/**
* Set all modified flags
* return boolean
*/
else if (func == "SetModified") {
Users::SetModified (true);
ret = true;
}
/* unknown function */
else {
y2error("unknown function: %1", func);
ret = false;
}
y2debug("ret=%1", ret);
y2milestone("users auto finished");
y2milestone("----------------------------------------");
return ret;
}
ACC SHELL 2018