Author: jsuchome
Date: Thu Jan 17 10:24:37 2008
New Revision: 43688
URL: http://svn.opensuse.org/viewcvs/yast?rev=43688&view=rev
Log:
- support more user groups in kiwi configuration (#346501)
- added command line support (F302395)
- 2.13.26
Modified:
branches/SuSE-SLE-10-SP1-Branch/product-creator/VERSION
branches/SuSE-SLE-10-SP1-Branch/product-creator/package/yast2-product-creator.changes
branches/SuSE-SLE-10-SP1-Branch/product-creator/src/Kiwi.ycp
branches/SuSE-SLE-10-SP1-Branch/product-creator/src/ProductCreator.ycp
branches/SuSE-SLE-10-SP1-Branch/product-creator/src/commandline.ycp
branches/SuSE-SLE-10-SP1-Branch/product-creator/src/kiwi_dialogs.ycp
branches/SuSE-SLE-10-SP1-Branch/product-creator/src/product-creator.ycp
Modified: branches/SuSE-SLE-10-SP1-Branch/product-creator/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/product-creator/VERSION?rev=43688&r1=43687&r2=43688&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/product-creator/VERSION (original)
+++ branches/SuSE-SLE-10-SP1-Branch/product-creator/VERSION Thu Jan 17 10:24:37 2008
@@ -1 +1 @@
-2.13.25
+2.13.26
Modified: branches/SuSE-SLE-10-SP1-Branch/product-creator/package/yast2-product-creator.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/product-creator/package/yast2-product-creator.changes?rev=43688&r1=43687&r2=43688&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/product-creator/package/yast2-product-creator.changes (original)
+++ branches/SuSE-SLE-10-SP1-Branch/product-creator/package/yast2-product-creator.changes Thu Jan 17 10:24:37 2008
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Wed Jan 16 11:19:03 CET 2008 - jsuchome@suse.cz
+
+- support more user groups in kiwi configuration (#346501)
+- added command line support (F302395)
+- 2.13.26
+
+-------------------------------------------------------------------
Wed Dec 5 12:33:16 CET 2007 - jsuchome@suse.cz
- fixed generating configuration path name (#346152)
Modified: branches/SuSE-SLE-10-SP1-Branch/product-creator/src/Kiwi.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/product-creator/src/Kiwi.ycp?rev=43688&r1=43687&r2=43688&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/product-creator/src/Kiwi.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/product-creator/src/Kiwi.ycp Thu Jan 17 10:24:37 2008
@@ -330,11 +330,11 @@
foreach (string user, map usermap, (map) config["users"]:$[], {
if (!haskey (ret, "users"))
ret["users"] = $[];
- if (haskey (usermap, "group"))
- ret["group"] = usermap["group"]:"";
ret["users",user] = $[
"home" : usermap["home"]:sformat ("/home/%1", user),
- "pwd" : user
+ "pwd" : user,
+ "group" : usermap["group"]:"",
+ "username" : user,
];
});
return ret;
@@ -508,19 +508,29 @@
write_list[0,"inherit"] = KiwiConfig["inherit"]:"";
if (haskey (KiwiConfig, "users"))
{
- write_list[0,"__children"] = add (write_list[0,"__children"]:[], $[
- "__key" : "users",
- "group" : KiwiConfig["group"]:"users",
- "__children" :
- maplist (string user, map usermap, (map) KiwiConfig["users"]:$[], ``(
+ map groups2users = $[];
+ foreach (string user, map usermap, (map) KiwiConfig["users"]:$[], {
+ string g = usermap["group"]:"";
+ if (g == "")
+ g = user == "root" ? "root" : "users";
+ if (!haskey (groups2users, g))
+ groups2users[g] = [];
+ groups2users[g] = add (groups2users[g]:[], usermap);
+ });
+ foreach (string group, list userlist, groups2users, {
+ write_list[0,"__children"] = add (write_list[0,"__children"]:[], $[
+ "__key" : "users",
+ "group" : group,
+ "__children" : maplist (map usermap, (list<map>) userlist, ``(
$[
"__key" : "user",
- "name" : user,
+ "name" : usermap["username"]:"",
"pwd" : crypt_password (usermap["pwd"]:""),
"home" : usermap["home"]:"",
]
))
- ]);
+ ]);
+ });
}
write_list[0,"__children"] = union (write_list[0,"__children"]:[],
maplist (string source, (list<string>) KiwiConfig["sources"]:[],
Modified: branches/SuSE-SLE-10-SP1-Branch/product-creator/src/ProductCreator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/product-creator/src/ProductCreator.ycp?rev=43688&r1=43687&r2=43688&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/product-creator/src/ProductCreator.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/product-creator/src/ProductCreator.ycp Thu Jan 17 10:24:37 2008
@@ -163,8 +163,13 @@
symbol autoyastPackages ()
{
string base_selection = "";
- //Pkg::TargetFinish ();
- Popup::ShowFeedback(_("Reading data from Package Database..."), _("Please wait..."));
+ // busy message
+ string feedback = _("Reading data from Package Database...");
+ if (Mode::commandline())
+ CommandLine::PrintVerbose (feedback);
+ else
+ // popup
+ Popup::ShowFeedback (feedback, _("Please wait..."));
Pkg::TargetFinish ();
string tmp = (string)SCR::Read( .target.tmpdir );
Modified: branches/SuSE-SLE-10-SP1-Branch/product-creator/src/commandline.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/product-creator/src/commandline.ycp?rev=43688&r1=43687&r2=43688&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/product-creator/src/commandline.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/product-creator/src/commandline.ycp Thu Jan 17 10:24:37 2008
@@ -9,10 +9,12 @@
{
import "CommandLine";
+ import "FileUtils";
import "Progress";
import "ProductCreator";
- textdomain "product-creator";
+ import "RichText";
+ textdomain "product-creator";
void ProcessConfigFileOption(map params)
{
@@ -32,6 +34,135 @@
}
}
+ /**
+ * Go through the command line parameters map, verify the validity
+ * and fill appropriate gloal values
+ * @param params map with command line parameters
+ * @param action for what action are the parameters intended (create/edit)
+ */
+ boolean ProcessParameters (map params, string action)
+ {
+ string name = params["name"]:"";
+ if (name == "")
+ {
+ // command line error message
+ Report::Error (_("Configuration name is missing."));
+ return false;
+ }
+ map Config = $[
+ "name" : name
+ ];
+
+ if (action != "create" && !haskey (ProductCreator::Configs, name))
+ {
+ // command line error message, %1 is a name
+ Report::Error (sformat (_("There is no configuration %1."), name));
+ return false;
+ }
+ if (action == "edit" || action == "show")
+ {
+ ProductCreator::LoadConfig (name);
+ Config = ProductCreator::Config;
+ }
+ if (action == "show")
+ return true;
+
+ // first, handle required parameters
+ if (params["output_dir"]:"" != "")
+ {
+ Config["iso-directory"] = params["output_dir"]:"";
+ }
+ else if (action == "create")
+ {
+ // command line error message
+ Report::Error (_("Path to output directory is missing."));
+ return false;
+ }
+
+ list<string> repos = splitstring (params["repositories"]:"", ",");
+ if (repos != [])
+ Config["sources"] = repos;
+ else if (action == "create")
+ {
+ // command line error message
+ Report::Error (_("List of package repositories is empty."));
+ return false;
+ }
+
+ if (params["profile"]:"" != "")
+ Config["profile"] = params["profile"]:"";
+ else if (action == "create")
+ {
+ // command line error message
+ Report::Error (_("Path to AutoYaST profile is missing."));
+ return false;
+ }
+ if (haskey (params, "copy_profile"))
+ Config["copy_profile"] = true;
+
+ // there is no manual way for selecting packages:
+ if (action == "create" || params["profile"]:"" != "")
+ {
+ Config["pkgtype"] = "autoyast";
+ ProductCreator::profile_parsed = false;
+ }
+
+ if (params["iso_name"]:"" != "")
+ Config["isofile"] = params["iso_name"]:"";
+ else if (action == "create")
+ Config["isofile"] = name + ".iso";
+
+ if (haskey (params, "create_iso"))
+ Config["result"] = "iso";
+ else if (action == "create")
+ Config["result"] = "tree";
+
+ if (haskey (params, "savespace"))
+ Config["savespace"] = true;
+
+ if (params["gpg_key"]:"" != "")
+ {
+ Config["gpg_key"] = params["gpg_key"]:"";
+ }
+
+ // no selections
+ if (action == "create")
+ Config["type"] = `patterns;
+
+ if (params["isolinux_path"]:"" != "")
+ {
+ string file = params["isolinux_path"]:"";
+ if (!FileUtils::Exists (file))
+ {
+ // command line error message
+ Report::Error (sformat (_("File %1 does not exist."), file));
+ return false;
+ }
+ if (SCR::Read(.target.size, file)> 0)
+ {
+ string cont = (string)SCR::Read (.target.string, file);
+ if (cont != nil)
+ Config["bootconfig"] = cont;
+ }
+ }
+
+ ProductCreator::Config = Config;
+
+ // read default isolinux (Config needs to be saved already to
+ // ProductCreator::Config, it is used by Readisolinux)
+ if (params["isolinux_path"]:"" == "" && action == "create")
+ {
+ ProductCreator::Config["bootconfig"] =
+ ProductCreator::Readisolinux();
+ }
+
+ // save the new configuration into global map, parse autoyast profile
+ ProductCreator::CommitConfig ();
+ }
+
+ /**
+ * Command line handler for List action: list available configurations
+ */
boolean ListHandler(map params)
{
ProcessConfigFileOption(params);
@@ -42,9 +173,12 @@
}
);
- return true;
+ return false; // = do not try to write
}
+ /**
+ * Command line handler for Create ISO action
+ */
boolean CreateIsoHandler(map params)
{
y2milestone("CreateIsoHandler parameters: %1", params);
@@ -60,6 +194,7 @@
if (!ProductCreator::LoadConfig(name))
{
+ // command line error message
CommandLine::Print(sformat(_("Cannot load configuration %1."), name));
return false;
}
@@ -80,6 +215,7 @@
// verify the destination
if (VerifyDialog() != `next)
{
+ // command line error message
CommandLine::Print("Cannot verify the destination");
return false;
}
@@ -94,11 +230,13 @@
integer image_size = (integer)SCR::Read(.target.size, iso_name);
if (SCR::Read(.target.size, iso_name) < 0)
{
+ // command line error message (%1 is path)
CommandLine::Print(sformat(_("Cannot create ISO image %1."), iso_name));
return false;
}
else
{
+ // command line info message
CommandLine::Print(sformat(_("ISO image %1 has been written."), iso_name));
}
@@ -106,10 +244,127 @@
}
else
{
- CommandLine::Print(_("Error: Configuration name cannot be empty."));
+ // command line error message
+ Report::Error (_("Configuration name cannot be empty."));
return false;
}
return true;
}
+
+ /**
+ * Command line handler for Create Config action: create new product
+ * configuration
+ */
+ boolean CreateConfigHandler (map params)
+ {
+ y2milestone ("CreateConfigHandler parameters: %1", params);
+ ProcessConfigFileOption(params);
+
+ return ProcessParameters (params, "create");
+ }
+
+ /**
+ * Command line handler for Delete Config action
+ */
+ boolean DeleteConfigHandler (map params)
+ {
+ y2milestone ("DeleteConfigHandler parameters: %1", params);
+ string name = params["name"]:"";
+
+ if (name == "")
+ {
+ // command line error message
+ Report::Error (_("Configuration name is missing."));
+ return false;
+ }
+ ProductCreator::Configs = filter(string k, map v, ProductCreator::Configs, ``(k!=name));
+ return true;
+ }
+
+ /**
+ * Command line handler for Edit Config action
+ */
+ boolean EditConfigHandler (map params)
+ {
+ y2milestone ("EditConfigHandler parameters: %1", params);
+ ProcessConfigFileOption(params);
+
+ return ProcessParameters (params, "edit");
+ }
+
+ /**
+ * Command line handler for Show Config action
+ */
+ boolean ShowConfigHandler (map params)
+ {
+ y2milestone ("EditConfigHandler parameters: %1", params);
+ ProcessConfigFileOption(params);
+ if (!ProcessParameters (params, "show"))
+ return false;
+
+ // summary caption
+ CommandLine::Print (_("Package Source"));
+ foreach(string s, ProductCreator::Config["sources"]:[], ``{
+ CommandLine::Print ("* " + s);
+ });
+
+
+ /*
+ // summary line (%1 is number)
+ CommandLine::Print (sformat(_("Selected %1 packages"),
+ size (ProductCreator::Config["packages"]:[])));
+ // currently does not have sense: packages from patterns would need
+ // to be counted as well
+ */
+ if (ProductCreator::Config["profile"]:"" != "")
+ {
+ // summary line (%1 is file path)
+ CommandLine::Print (sformat(_("Using AutoYaST profile %1"),
+ ProductCreator::Config["profile"]:""));
+ }
+
+
+ if (ProductCreator::Config["result"]:"tree" == "iso")
+ {
+ // summary line (%1/%2 is file path)
+ CommandLine::Print (sformat(_("Creating ISO image %1/%2"),
+ ProductCreator::Config["iso-directory"]:"",
+ ProductCreator::Config["isofile"]:"") );
+ }
+ else
+ {
+ // summary line (%1/%2 is file path)
+ CommandLine::Print (sformat(_("Creating directory tree in %1/%2"),
+ ProductCreator::Config["iso-directory"]:"",
+ ProductCreator::Config["name"]:"") );
+ }
+
+ string gpgkey = ProductCreator::Config["gpg_key"]:"";
+
+ if (gpgkey != "")
+ {
+ list<map> privatekeys = GPG::PrivateKeys();
+ string uid = "";
+ foreach(map key, privatekeys,
+ {
+ if (key["id"]:"" == gpgkey)
+ {
+ uid = mergestring(key["uid"]:[], ", ");
+ }
+ }
+ );
+ if (uid != "")
+ uid = sformat(" (%1)", uid);
+
+ // summary text - %1 is GPG key ID (e.g. ABCDEF01), %2 is GPG key user ID (or empty if not defined)
+ CommandLine::Print (sformat(_("Digitally sign the medium with GPG key %1%2"), gpgkey, uid));
+ }
+ else
+ {
+ // summary text
+ CommandLine::Print (_("The medium will not be digitally signed"));
+ }
+ return false;
+ }
}
Modified: branches/SuSE-SLE-10-SP1-Branch/product-creator/src/kiwi_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/product-creator/src/kiwi_dialogs.ycp?rev=43688&r1=43687&r2=43688&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/product-creator/src/kiwi_dialogs.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/product-creator/src/kiwi_dialogs.ycp Thu Jan 17 10:24:37 2008
@@ -335,7 +335,7 @@
define void InitUsersTable (string id) {
list items = maplist (string user, map usermap, (map) KiwiConfig["users"]:$[],
- ``(`item (`id (user), user, usermap["home"]:"")));
+ ``(`item (`id (user), user, usermap["home"]:"", usermap["group"]:"users")));
UI::ChangeWidget (`id ("table"), `Items, items);
UI::ChangeWidget (`id ("edituser"), `Enabled, size (items) > 0);
UI::ChangeWidget (`id ("deleteuser"), `Enabled, size (items) > 0);
@@ -359,6 +359,7 @@
`Password (`id (`pw1), Label::Password(), ""),
`Password (`id(`pw2), Label::ConfirmPassword(), ""),
`TextEntry (`id (`home), _("&Home Directory")),
+ `TextEntry (`id (`group), _("&Group Name")),
`HBox (
`PushButton (`id(`ok),`opt(`key_F10), Label::OKButton()),
`PushButton (`id(`cancel),`opt(`key_F9), Label::CancelButton())
@@ -369,6 +370,7 @@
{
UI::ChangeWidget (`id (`username), `Value, current_user);
UI::ChangeWidget (`id (`home), `Value, KiwiConfig["users", current_user, "home"]:"");
+ UI::ChangeWidget (`id (`group), `Value, KiwiConfig["users", current_user, "group"]:"users");
UI::ChangeWidget (`id (`pw1), `Value, "*****");
UI::ChangeWidget (`id (`pw2), `Value, "*****");
// popup label
@@ -408,9 +410,14 @@
KiwiConfig["users"] = $[];
else if (key == "edituser" && username != current_user)
KiwiConfig["users"] = remove (KiwiConfig["users"]:$[], current_user);
+ string group = (string) UI::QueryWidget (`id(`group), `Value);
+ if (group == "")
+ group = username == "root" ? "root" : "users";
KiwiConfig["users", username] = $[
"pwd" : pwd,
- "home" : UI::QueryWidget (`id(`home), `Value)
+ "home" : UI::QueryWidget (`id(`home), `Value),
+ "group" : group,
+ "username" : username,
];
}
} until (ret == `ok || ret == `cancel);
@@ -933,7 +940,7 @@
`VBox (
"general_users",
`VSpacing (0.2),
- "group",
+// "group",
`VSpacing (0.2),
"userstable",
`VSpacing (0.2),
@@ -1345,6 +1352,7 @@
// general help for users tab
"help" : _("<p>Here, create users that should be available in the target system.</p>"),
],
+ /*
"group" : $[
"widget" : `textentry,
// textentry label
@@ -1354,15 +1362,20 @@
"store" : StoreDescription,
"handle" : HandleDescription,
],
+ */
"userstable" : $[
"widget" : `custom,
"custom_widget" : `Table (`id("table"), `opt (`notify), `header(
// table header
_("Name"),
// table header
- _("Home Directory"))),
+ _("Home Directory"),
+ // table header
+ _("Group"))
+ ),
// help for table with users
- "help" : _("<p>For each user, specify <b>Name</b>, <b>Password</b>, and <b>Home Directory</b>.</p>"),
+ "help" : _("<p>For each user, specify <b>Name</b>, <b>Password</b>, <b>Home Directory</b> and group
+to which the users belongs.</p>"),
"init" : InitUsersTable,
"handle" : HandleAddEditUser,
],
Modified: branches/SuSE-SLE-10-SP1-Branch/product-creator/src/product-creator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/product-creator/src/product-creator.ycp?rev=43688&r1=43687&r2=43688&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/product-creator/src/product-creator.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/product-creator/src/product-creator.ycp Thu Jan 17 10:24:37 2008
@@ -34,16 +34,36 @@
"initialize" : ProductCreator::Read,
"finish" : ProductCreator::Write,
"actions" : $[
- "list" :$[
+ "list" : $[
"handler" : ListHandler,
- // translators: command line help text for summary action
+ // translators: command line help text for list action
"help" : _("Print existing configurations")
],
- "create-iso" :$[
+ "create-iso" : $[
"handler" : CreateIsoHandler,
- // translators: command line help text for summary action
+ // translators: command line help text for create-iso action
"help" : _("Create installation ISO image")
- ]
+ ],
+ "create" : $[
+ "handler" : CreateConfigHandler,
+ // translators: command line help text for create-config action
+ "help" : _("Create new product configuration")
+ ],
+ "delete" : $[
+ "handler" : DeleteConfigHandler,
+ // translators: command line help text for delete-config action
+ "help" : _("Delete existing configuration")
+ ],
+ "edit" : $[
+ "handler" : EditConfigHandler,
+ // translators: command line help text for delete-config action
+ "help" : _("Edit existing configuration")
+ ],
+ "show" : $[
+ "handler" : ShowConfigHandler,
+ // translators: command line help text for show action
+ "help" : _("Show the summary of selected configuration")
+ ],
],
"options" : $[
"name" : $[
@@ -52,13 +72,13 @@
"type" : "string"
],
"passphrase" : $[
- // translators: command line help text for the 'passhrase' option
+ // translators: command line help text for the 'passphrase' option
"help" : _("GPG passhrase required for signing the source."),
"type" : "string"
],
"passphrase_file" : $[
// command line help text for the 'passhrase_file' option
- "help" : _("File with GPG passhrase required for signing the source"),
+ "help" : _("File with GPG passphrase required for signing the source"),
"type" : "string"
],
"configfile" : $[
@@ -66,11 +86,64 @@
"help" : sformat(_("Path to the configuration file (default is %1"),
ProductCreator::ConfigFile),
"type" : "string"
- ]
+ ],
+ "output_dir" : $[
+ // command line help text for 'output_dir' option
+ "help" : _("Path to the output directory"),
+ "type" : "string"
+ ],
+ // TODO provide also for create-iso...?
+ "create_iso" : $[
+ // command line help text for 'create_iso' option
+ "help" : _("Output should be ISO image instead of directory tree"),
+ ],
+ "iso_name" : $[
+ // command line help text for 'iso_name' option
+ "help" : _("Name of the output ISO image"),
+ "type" : "string",
+ ],
+ "savespace" : $[
+ // command line help text for 'savespace' option
+ "help" : _("Copy only needed files to save space"),
+ ],
+ "profile" : $[
+ // command line help text for 'profile' option
+ "help" : _("Path to AutoYaST profile"),
+ "type" : "string"
+ ],
+ "copy_profile" : $[
+ // command line help text for 'copy_profile' option
+ "help" : _("Copy AutoYaST profile to CD image"),
+ ],
+ "isolinux_path" : $[
+ // command line help text for 'isolinux_path' option
+ "help" : _("Path to isolinux.cfg file"),
+ "type" : "string"
+ ],
+ "gpg_key" : $[
+ // command line help text for 'gpg_key' option
+ "help" : _("GPG key ID used to sign a product"),
+ "type" : "string",
+ ],
+ "repositories" : $[
+ // command line help text for 'repositories' option
+ "help" : _("List of package repositories (separated by commas)"),
+ "type" : "string"
+ ],
],
"mappings" : $[
"list" : ["configfile"],
"create-iso" : ["name", "passphrase", "passphrase_file", "configfile"],
+ "create" : ["name", "configfile", "output_dir", "create_iso",
+ "iso_name", "savespace", "profile", "copy_profile", "isolinux_path",
+ "gpg_key", "repositories",
+ ],
+ "edit" : ["name", "configfile", "output_dir", "create_iso",
+ "iso_name", "savespace", "profile", "copy_profile", "isolinux_path",
+ "gpg_key", "repositories",
+ ],
+ "delete" : ["name"],
+ "show" : ["name"],
]
];
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org