Author: jsuchome
Date: Thu Oct 25 16:01:56 2007
New Revision: 41570
URL: http://svn.opensuse.org/viewcvs/yast?rev=41570&view=rev
Log:
- adapted for the API change of StorageDevices.ycp
- merged features done in SLE10SP version 2.13.17, mostly the
SLEPOS requirements (F302370, F302371) and related bugfixes:
- allow more characters in the image name
- fix modifying of repository (#334208)
- check for duplicates in the list of boot images (#332581)
- disable Delete button when there's nothing to delete (#334255)
- update defaultroot only for new configurations (#327057)
- check for absolute paths in boot image entry
- fix initializing when going Back (#332581)
- fix adding CD/DVD/SLP repositories (#333106)
- show correct list of repositories when going back (#332253)
- use system repositories when none is specified (#332253)
- menubutton for adding system repositories (#332253)
- added SUPPORTED_BOOT_IMAGES to /etc/sysconfig/product-creator:
possibility to limit list of offered boot images (#331733)
- append image name to defaultdestination and defaultroot (#327057)
- copy whole content of imported kiwi config directory (#330052)
- save defaultroot value to config.xml (#330059)
- don't ignore 'inherit' tag (#330079)
- added support for "this://" in repository paths (#330095)
- destination directory specified in sysconfig file (#327055)
- tell zypper to ignore zypp lock (#310581)
- remove 'prepare' directory before calling kiwi (#325664)
- added /etc/sysconfig/product-creator config file
- 2.16.1
Added:
trunk/product-creator/agents/cfg_product-creator.scr
trunk/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/create_xconf (with props)
trunk/product-creator/src/data/sysconfig.product-creator
trunk/product-creator/src/image-creator.desktop
- copied, changed from r41191, trunk/product-creator/src/kiwi.desktop
trunk/product-creator/src/image-creator.ycp (with props)
Removed:
trunk/product-creator/src/kiwi.desktop
Modified:
trunk/product-creator/VERSION
trunk/product-creator/agents/Makefile.am
trunk/product-creator/package/yast2-product-creator.changes
trunk/product-creator/src/Kiwi.ycp
trunk/product-creator/src/Makefile.am
trunk/product-creator/src/ProductCreator.ycp
trunk/product-creator/src/complex.ycp
trunk/product-creator/src/data/Makefile.am
trunk/product-creator/src/dialogs.ycp
trunk/product-creator/src/kiwi.ycp
trunk/product-creator/src/kiwi_dialogs.ycp
trunk/product-creator/src/wizards.ycp
trunk/product-creator/yast2-product-creator.spec.in
Modified: trunk/product-creator/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/VERSION?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/VERSION (original)
+++ trunk/product-creator/VERSION Thu Oct 25 16:01:56 2007
@@ -1 +1 @@
-2.16.0
+2.16.1
Modified: trunk/product-creator/agents/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/agents/Makefile.am?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/agents/Makefile.am (original)
+++ trunk/product-creator/agents/Makefile.am Thu Oct 25 16:01:56 2007
@@ -4,6 +4,6 @@
agent_SCRIPTS =
-scrconf_DATA =
+scrconf_DATA = cfg_product-creator.scr
EXTRA_DIST = $(agent_SCRIPTS) $(scrconf_DATA)
Added: trunk/product-creator/agents/cfg_product-creator.scr
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/agents/cfg_product-creator.scr?rev=41570&view=auto
==============================================================================
--- trunk/product-creator/agents/cfg_product-creator.scr (added)
+++ trunk/product-creator/agents/cfg_product-creator.scr Thu Oct 25 16:01:56 2007
@@ -0,0 +1,17 @@
+/**
+ * File:
+ * cfg_product-creator.scr
+ * Summary:
+ * SCR Agent for reading/writing /etc/sysconfig/product-creator
+ * using the sysconfig-agent
+ *
+ * $Id: cfg_product-creator.scr 13009 2003-12-10 13:59:07Z jsuchome $
+ *
+ * Read/Sets the values defined in <tt>/etc/sysconfig/product-creator</tt>
+ * in an easy manner.
+ */
+.sysconfig.product-creator
+
+`ag_ini(
+ `SysConfigFile("/etc/sysconfig/product-creator")
+)
Modified: trunk/product-creator/package/yast2-product-creator.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/package/yast2-product-creator.changes?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/package/yast2-product-creator.changes (original)
+++ trunk/product-creator/package/yast2-product-creator.changes Thu Oct 25 16:01:56 2007
@@ -1,4 +1,34 @@
-------------------------------------------------------------------
+Thu Oct 25 15:12:09 CEST 2007 - jsuchome@suse.cz
+
+- adapted for the API change of StorageDevices.ycp
+- merged features done in SLE10SP version 2.13.17, mostly the
+ SLEPOS requirements (F302370, F302371) and related bugfixes:
+ - allow more characters in the image name
+ - fix modifying of repository (#334208)
+ - check for duplicates in the list of boot images (#332581)
+ - disable Delete button when there's nothing to delete (#334255)
+ - update defaultroot only for new configurations (#327057)
+ - check for absolute paths in boot image entry
+ - fix initializing when going Back (#332581)
+ - fix adding CD/DVD/SLP repositories (#333106)
+ - show correct list of repositories when going back (#332253)
+ - use system repositories when none is specified (#332253)
+ - menubutton for adding system repositories (#332253)
+ - added SUPPORTED_BOOT_IMAGES to /etc/sysconfig/product-creator:
+ possibility to limit list of offered boot images (#331733)
+ - append image name to defaultdestination and defaultroot (#327057)
+ - copy whole content of imported kiwi config directory (#330052)
+ - save defaultroot value to config.xml (#330059)
+ - don't ignore 'inherit' tag (#330079)
+ - added support for "this://" in repository paths (#330095)
+ - destination directory specified in sysconfig file (#327055)
+ - tell zypper to ignore zypp lock (#310581)
+ - remove 'prepare' directory before calling kiwi (#325664)
+ - added /etc/sysconfig/product-creator config file
+- 2.16.1
+
+-------------------------------------------------------------------
Thu Oct 4 09:50:06 CEST 2007 - jsuchome@suse.cz
- add a default user to the iso template (#328145)
Modified: trunk/product-creator/src/Kiwi.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/Kiwi.ycp?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/src/Kiwi.ycp (original)
+++ trunk/product-creator/src/Kiwi.ycp Thu Oct 25 16:01:56 2007
@@ -24,18 +24,40 @@
string encryption_method = nil;
+ // temporary directory, where kiwi is working
global string tmp_dir = "";
- global string images_dir = Directory::vardir + "/product-creator/images";
+ // directory for saving image configurations
+ global string images_dir = Directory::vardir + "/product-creator/images";
+
+ // bug 331733
+ global string supported_boot_images = "";
+
+ // directories with user-made templated
+ global list<string> templates_dirs = [];
global string default_packagemanager = "smart";
- // all repositories of current configuration
list<map> all_sources = [];
+ // repositories used for current configuration
+ global map current_repositories = $[];
+
+ // initial system repositories
+ global map initial_repositories = $[];
+
// where the kiwi configuration files are stored
string config_dir = "";
+ // chroot directory for creating the physical extend
+ string chroot_dir = "";
+
+ // What we want to create with kiwi
+ global string kiwi_task = "iso";
+
+ // map with image templates (to base new projects on)
+ global map Templates = $[];
+
/**
* crypt given user password with current encryption algorithm
*/
@@ -71,6 +93,32 @@
*/
map get_source_value (string source, map config) {
+ map ret = $[];
+ // first check if we weren't importing this source:
+ foreach (string url, map repo, current_repositories, {
+ if (url == source && repo["org"]:$[] != $[])
+ {
+ ret = $[
+ "__key" : "repository",
+ "type" : repo["org","type"]:"",
+ "__children": [
+ $[
+ "__key" : "source",
+ "path" : repo["org","source",0,"path"]:"",
+ ]
+ ]
+ ];
+ if (repo["org","status"]:"" != "")
+ ret["status"] = repo["org","status"]:"";
+ }
+ });
+ if (ret != $[])
+ {
+ y2milestone ("imported source: %1", source);
+ return ret;
+ }
+
+ // ... otherwise, we must ask zypp:
string type = "yast2";
string source_path = adapt_source_path (source);
@@ -86,7 +134,7 @@
type = "rpm-md";
}
});
- map ret = $[
+ ret = $[
"__key" : "repository",
"type" : type,
"__children": [
@@ -96,7 +144,7 @@
]
]
];
- return ret; // FIXME add status?
+ return ret;
}
/**
@@ -111,9 +159,9 @@
*/
map get_type_value (map config, string task) {
- string boot_image = sformat ("%1boot/%2", task, config[task + "boot"]:"suse-10.2");
+ string boot_image = sformat ("%1boot/%2", task, config[task + "boot"]:"suse-10.2");
if (config["type",task,"boot"]:"" != "")
- boot_image = config["type",task,"boot"]:"";
+ boot_image = config["type",task,"boot"]:"";
map ret = $[
"__key" : "type",
"__value" : task,
@@ -123,7 +171,7 @@
if (task != "iso")
ret["filesystem"] = config["type",task,"filesystem"]:"ext3";
if (config["type",task,"flags"]:"" != "")
- ret["flags"] = config["type",task,"flags"]:"";
+ ret["flags"] = config["type",task,"flags"]:"";
return ret;
}
@@ -224,6 +272,12 @@
ret["packages"] = maplist (map p,
(list<map>)packages["image","package"]:[], ``(p["name"]:""));
+ if (haskey (packages, "delete"))
+ {
+ ret["delete_packages"] = maplist (map p,
+ (list<map>)packages["delete", "package"]:[], ``(p["name"]:""));
+ }
+
if (packages["image","patternType"]:"" != "")
ret["image_patternType"] = packages["image","patternType"]:"";
if (packages["xen","disk"]:"" != "")
@@ -232,8 +286,8 @@
ret["xen_memory"] = tointeger (packages["xen","memory"]:"512");
foreach (string key, [ "author", "contact", "specification",
"packagemanager", "version", "rpm-check-signatures", "rpm-force",
- "sizeunit", "type", "name", "repository", "defaultdestination",
- "schemeversion"],
+ "sizeunit", "type", "name", "repository", "defaultdestination",
+ "schemeversion", "defaultroot", "inherit"],
{
if (config[key]:nil != nil)
ret[key] = config[key]:nil;
@@ -241,7 +295,7 @@
if (haskey (config, "size"))
ret["size"] = tointeger (config["size"]:"2700");
if (haskey (config, "defaultdestination"))
- ret["iso-directory"] = config["defaultdestination"]:"";
+ ret["iso-directory"] = config["defaultdestination"]:"";
foreach (string user, map usermap, (map) config["users"]:$[], {
if (!haskey (ret, "users"))
ret["users"] = $[];
@@ -258,11 +312,19 @@
/**
* Write currect configuration to new config.xml
*/
- global boolean WriteConfigXML (map KiwiConfig, string kiwi_task) {
+ global boolean WriteConfigXML (map KiwiConfig, string task) {
all_sources = Pkg::SourceEditGet();
tmp_dir = Directory::tmpdir;
+ chroot_dir = tmp_dir + "/myphysical";
+ if (KiwiConfig["defaultroot"]:"" != "")
+ {
+ chroot_dir = KiwiConfig["defaultroot"]:"";
+ if (KiwiConfig["new_configuration"]:false)
+ chroot_dir = chroot_dir + "/" + KiwiConfig["name"]:"";
+ KiwiConfig["defaultroot"] = chroot_dir;
+ }
list packages_list = [];
list patterns_list = [];
@@ -328,33 +390,17 @@
]);
});
- list write_list = [ $[
- "__key" : "image",
- "name" : KiwiConfig["name"]:"",
- "schemeversion" : KiwiConfig["schemeversion"]:"1.4",
- "__children" : [
- $[
- "__key" : "description",
- "type" : "system",
- "__children" : [
- $[
- "__key" : "author",
- "__value" : KiwiConfig["author"]:"",
- ],
- $[
- "__key" : "contact",
- "__value" : KiwiConfig["contact"]:"",
- ],
- $[
- "__key" : "specification",
- "__value" : KiwiConfig["specification"]:"",
- ],
- ],
- ],
- $[
+ list packages_delete_list = maplist (string package,
+ KiwiConfig["delete_packages"]:[], ``($[
+ "__key" : "package",
+ "name" : package,
+ ])
+ );
+
+ map preferences = $[
"__key" : "preferences",
"__children" : [
- get_type_value (KiwiConfig, kiwi_task),
+ get_type_value (KiwiConfig, task),
$[
"__key" : "version",
"__value" : KiwiConfig["version"]:"1",
@@ -381,9 +427,44 @@
"__value" : KiwiConfig["iso-directory"]:"",
],
],
+ ];
+ if (KiwiConfig["defaultroot"]:"" != "")
+ {
+ preferences["__children"] = add (preferences["__children"]:[], $[
+ "__key" : "defaultroot",
+ "__value" : KiwiConfig["defaultroot"]:"",
+ ]);
+ }
+
+
+ list write_list = [ $[
+ "__key" : "image",
+ "name" : KiwiConfig["name"]:"",
+ "schemeversion" : KiwiConfig["schemeversion"]:"1.4",
+ "__children" : [
+ $[
+ "__key" : "description",
+ "type" : "system",
+ "__children" : [
+ $[
+ "__key" : "author",
+ "__value" : KiwiConfig["author"]:"",
+ ],
+ $[
+ "__key" : "contact",
+ "__value" : KiwiConfig["contact"]:"",
+ ],
+ $[
+ "__key" : "specification",
+ "__value" : KiwiConfig["specification"]:"",
+ ],
+ ],
],
+ preferences,
],
]];
+ if (KiwiConfig["inherit"]:"" != "")
+ write_list[0,"inherit"] = KiwiConfig["inherit"]:"";
if (haskey (KiwiConfig, "users"))
{
write_list[0,"__children"] = add (write_list[0,"__children"]:[], $[
@@ -414,7 +495,7 @@
"__children": union (union (packages_boot_list, patterns_boot_list), ignored_boot_list)
],
]);
- if (kiwi_task == "xen")
+ if (task == "xen")
{
write_list[0,"__children"] = add (write_list[0,"__children"]:[], $[
"__key" : "packages",
@@ -426,14 +507,22 @@
]);
}
+ if (packages_delete_list != [])
+ {
+ write_list[0,"__children"] = add (write_list[0,"__children"]:[], $[
+ "__key" : "packages",
+ "type" : "delete",
+ "__children": packages_delete_list
+ ]);
+ }
+
string write_string = Map2XML (write_list[0]:$[], 0);
- config_dir = tmp_dir + "/" +
- get_config_dir (KiwiConfig["name"]:"", kiwi_task);
+ config_dir = tmp_dir + "/" + KiwiConfig["name"]:"";
SCR::Execute (.target.mkdir, config_dir);
SCR::Write (.target.string, config_dir + "/config.xml", write_string);
foreach (string dir, ["root_dir", "config_dir"], {
foreach (string val, KiwiConfig[dir]:[], {
- string realdir = config_dir + "/" + substring (dir, 0, find (dir, "_"));
+ string realdir = config_dir + "/" + substring (dir, 0, search (dir, "_"));
boolean created = false;
if (val != "" && FileUtils::Exists (val))
{
@@ -471,9 +560,10 @@
return false;
}
- if (FileUtils::Exists (tmp_dir + "/myphysical"))
+ if (FileUtils::Exists (chroot_dir))
{
- SCR::Execute (.target.bash, sformat ("rm -rf %1/myphysical", tmp_dir));
+ y2milestone ("%1 directory is present, removing...", chroot_dir);
+ SCR::Execute (.target.bash, sformat ("rm -rf %1", chroot_dir));
}
// construct the dialog
@@ -500,13 +590,10 @@
void update_output () {
// read the output line from irw:
list<string> out = (list<string>)SCR::Read(.background.newout);
- /*
foreach (string line, out, {
line = String::Replace (line, "\r", "\n");
UI::ChangeWidget (`id(`log), `LastLine, line + "\n");
});
- */
- UI::ChangeWidget (`id(`log), `LastLine, mergestring (out, "\n") + "\n");
list<string> err = (list<string>) SCR::Read(.background.newerr);
foreach (string line, err, {
@@ -515,7 +602,7 @@
});
}
- string cmd = sformat ("kiwi --root %1/myphysical --prepare %2 --logfile terminal", tmp_dir, config_dir);
+ string cmd = sformat ("ZYPP_READONLY_HACK=1 kiwi --root %1 --prepare %2 --logfile terminal", chroot_dir, config_dir);
y2milestone ("calling '%1'", cmd);
@@ -523,26 +610,17 @@
symbol ret = nil;
boolean creating = false;
- boolean first_lines = false;
- integer lines_show = 0;
- integer times_read = 0;
do
{
ret = (symbol) UI::PollInput();
if ((boolean) SCR::Read(.background.output_open) &&
- (integer) SCR::Read(.background.newlines) > lines_show)
+ (integer) SCR::Read(.background.newlines)>0)
{
- if (times_read > 10)
- lines_show = 50;
- else
- times_read = times_read + 1;
update_output ();
}
else if (!(boolean)SCR::Read(.background.isrunning))
{
update_output ();
- lines_show = 0;
- times_read = 0;
integer status = (integer) SCR::Read (.background.status);
if (status != 0)
@@ -562,8 +640,7 @@
// now continue with creating
UI::ChangeWidget (`id(`log), `LastLine, "\n");
- cmd = sformat ("kiwi --create %1/myphysical -d %2 --logfile terminal",
- tmp_dir, out_dir);
+ cmd = sformat ("ZYPP_READONLY_HACK=1 kiwi --create %1 -d %2 --logfile terminal", chroot_dir, out_dir);
y2milestone ("calling '%1'", cmd);
// label
UI::ReplaceWidget (`id (`rpl), `Left (`Label (_("Creating Image"))));
@@ -597,13 +674,118 @@
/**
* save the image configuration to the kiwi images directory
*/
- global string SaveConfiguration (map KiwiConfig, string kiwi_task) {
+ global string SaveConfiguration (map KiwiConfig, string task) {
if (config_dir == "" || !FileUtils::Exists (config_dir))
return nil;
if (!FileUtils::Exists (images_dir))
SCR::Execute (.target.mkdir, images_dir);
SCR::Execute (.target.bash, sformat ("cp -ar %1 %2/", config_dir, images_dir));
- return (images_dir + get_config_dir (KiwiConfig["name"]:"", kiwi_task));
+ return (images_dir + KiwiConfig["name"]:"");
+ }
+
+ /**
+ * Import repositories from given kiwi image configuration
+ * @patam Config configuration map, as read from config.xml
+ * @param dir path to directory containing this config.xml
+ */
+ global map ImportImageRepositories (map Config, string dir) {
+
+ current_repositories = $[];
+ foreach (map repo, (list<map>) Config["repository"]:[], {
+ string source = repo["source",0,"path"]:"";
+ if (source != "")
+ {
+ string url = "";
+ if (substring (source, 0, 7) == "this://")
+ {
+ string source_path = substring (source, 7);
+ source = dir + "/" + source_path;
+ }
+ if (substring (source, 0, 1) == "/")
+ url = "dir://";
+ url = url + source;
+ current_repositories [url] = $[
+ "url" : url,
+ "plaindir" : repo["type"]:"" == "rpm-dir",
+ "org" : repo,
+ ];
+ }
+ });
+ return current_repositories;
+ }
+
+ /**
+ * Initialize the list of current repositories
+ */
+ global map InitCurrentRepositories () {
+
+ Pkg::SourceRestore ();
+ foreach (map source, Pkg::SourceEditGet (), {
+ integer srcid = source["SrcId"]:-1;
+ map data = Pkg::SourceGeneralData (srcid);
+ string url = data["url"]:"";
+ current_repositories[url] = $[
+ "url" : url,
+ "plaindir" : data["type"]:"" == "Plaindir"
+ ];
+ });
+ return current_repositories;
+ }
+
+ /**
+ * Read the templates on which the images can be based
+ */
+ global boolean ReadImageTemplates () {
+
+ string dirs = (string)SCR::Read(.sysconfig.product-creator.IMAGE_TEMPLATES);
+ map name_version = $[];
+ foreach (string line, splitstring (dirs, "\t "), {
+ if (line == "" || substring (line, 0, 1) == "#")
+ return;
+ templates_dirs = add (templates_dirs, line);
+ if (!FileUtils::IsDirectory (line))
+ {
+ y2warning ("%1 is not a directory", line);
+ return;
+ }
+ map out = (map) SCR::Execute (.target.bash_output,
+ sformat ("ls -A1 %1", line));
+ foreach (string d, splitstring(out["stdout"]:"", "\n"), {
+ if (d == "") return;
+ map config = Kiwi::ReadConfigXML (line + "/" + d);
+ // index by full path, there may be same names
+ // (templates could be provided by different vendors)
+ if (config != nil && config != $[])
+ {
+ string name = config["name"]:"";
+ string ver = config["version"]:"";
+ if (name_version[name]:"" == ver)
+ y2warning ("template %1,%2 already imported", name, ver);
+ else
+ {
+ name_version[name] = ver;
+ Templates[line + "/" + d] = config;
+ }
+ }
+ });
+ });
+ return true;
+ }
+
+ /**
+ * REad the confgiuration stuff for image creator
+ */
+ global boolean Read () {
+
+ string dir =
+ (string) SCR::Read (.sysconfig.product-creator.IMAGE_CONFIGURATIONS);
+ if (dir != nil && dir != "")
+ images_dir = dir;
+ supported_boot_images =
+ (string) SCR::Read (.sysconfig.product-creator.SUPPORTED_BOOT_IMAGES);
+ if (supported_boot_images == nil)
+ supported_boot_images = "";
+ return ReadImageTemplates ();
}
}
Modified: trunk/product-creator/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/Makefile.am?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/src/Makefile.am (original)
+++ trunk/product-creator/src/Makefile.am Thu Oct 25 16:01:56 2007
@@ -9,6 +9,7 @@
client_DATA = \
product-creator.ycp \
+ image-creator.ycp \
kiwi.ycp
ynclude_DATA = \
@@ -22,7 +23,7 @@
desktop_DATA = \
product-creator.desktop \
- kiwi.desktop
+ image-creator.desktop
module_DATA = \
ProductCreator.ycp \
Modified: trunk/product-creator/src/ProductCreator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/ProductCreator.ycp?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/src/ProductCreator.ycp (original)
+++ trunk/product-creator/src/ProductCreator.ycp Thu Oct 25 16:01:56 2007
@@ -62,7 +62,7 @@
global boolean profile_parsed = false;
-global integer max_size_mb = 999 * 1024;
+global integer max_size_mb = 999 * 1024;
/* Configuration Map */
global map Config = $[];
@@ -91,9 +91,6 @@
global boolean proposal_valid = false;
-// What we want to create with kiwi
-global string kiwi_task = "iso";
-
// if the YaST sources should be enabled when opening package selector
global boolean enable_sources = true;
@@ -129,6 +126,8 @@
global boolean isCode10Source()
{
boolean code10 = false;
+ string arch = Arch::architecture ();
+ if (arch == "s390_64") arch = "s390x";
foreach (string url , ProductCreator::Config["sources"]:[],
{
integer i = SourceManager::getSourceId(url);
@@ -145,7 +144,7 @@
{
list<string> items = splitstring(dir_listing, "\n");
- code10 = code10 || contains(items, Arch::architecture() + "/");
+ code10 = code10 || contains(items, arch + "/");
}
}
});
@@ -562,7 +561,9 @@
}
else
{
- bootconfig_path = sformat("boot/%1/loader/isolinux.cfg", Arch::architecture());
+ string arch = Arch::architecture();
+ if (arch == "s390_64") arch = "s390x";
+ bootconfig_path = sformat("boot/%1/loader/isolinux.cfg", arch);
list<integer> srcids = [checkProductDependency()];
@@ -1045,6 +1046,7 @@
integer sles_src = 0;
string descr_dir = "";
string arch = Arch::architecture();
+ if (arch == "s390_64") arch = "s390x";
y2milestone("Config: %1", Config);
@@ -1783,6 +1785,7 @@
string cpCmd = "";
string arch = Arch::architecture();
+ if (arch == "s390_64") arch = "s390x";
y2debug("isolinux.cfg: %1", Config["bootconfig"]:"" );
if (Config["bootconfig"]:"" != "")
{
Modified: trunk/product-creator/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/complex.ycp?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/src/complex.ycp (original)
+++ trunk/product-creator/src/complex.ycp Thu Oct 25 16:01:56 2007
@@ -11,18 +11,19 @@
textdomain "product-creator";
- import "Wizard";
- import "Popup";
- import "Wizard_hw";
- import "Report";
import "Arch";
- import "String";
-
- import "ProductCreator";
-
+ import "CommandLine";
+ import "Directory";
+ import "FileUtils";
+ import "Kiwi";
import "Label";
import "Mode";
- import "CommandLine";
+ import "Popup";
+ import "ProductCreator";
+ import "Report";
+ import "String";
+ import "Wizard";
+ import "Wizard_hw";
include "product-creator/helps.ycp";
include "product-creator/dialogs.ycp";
@@ -172,7 +173,7 @@
Package::InstallAll (["kiwi", "kiwi-desc-isoboot"])) {
string current = (string) UI::QueryWidget(`id(`table), `CurrentItem);
ProductCreator::Config = ProductCreator::Configs[current]:$[];
- ProductCreator::kiwi_task = "iso";
+ Kiwi::kiwi_task = "iso";
ret = `kiwi;
break;
}
@@ -180,7 +181,7 @@
Package::InstallAll (["kiwi", "kiwi-desc-xenboot"])) {
string current = (string) UI::QueryWidget(`id(`table), `CurrentItem);
ProductCreator::Config = ProductCreator::Configs[current]:$[];
- ProductCreator::kiwi_task = "xen";
+ Kiwi::kiwi_task = "xen";
ret = `kiwi;
break;
}
@@ -188,7 +189,7 @@
Package::InstallAll (["kiwi", "kiwi-desc-usbboot"])) {
string current = (string) UI::QueryWidget(`id(`table), `CurrentItem);
ProductCreator::Config = ProductCreator::Configs[current]:$[];
- ProductCreator::kiwi_task = "usb";
+ Kiwi::kiwi_task = "usb";
ret = `kiwi;
break;
}
@@ -196,7 +197,7 @@
Package::InstallAll (["kiwi", "kiwi-desc-vmxboot"])) {
string current = (string) UI::QueryWidget(`id(`table), `CurrentItem);
ProductCreator::Config = ProductCreator::Configs[current]:$[];
- ProductCreator::kiwi_task = "vmx";
+ Kiwi::kiwi_task = "vmx";
ret = `kiwi;
break;
}
@@ -343,8 +344,10 @@
{
Popup::ShowFeedback(_("Creating CD Image..."), _("This may take a while"));
}
+ string arch = Arch::architecture ();
+ if (arch == "s390_64") arch = "s390x";
- string command = sformat("/usr/lib/YaST2/bin/y2mkiso '%1' '%2' '%3'", String::Quote(isodir), String::Quote(isofile), String::Quote((ProductCreator::Config["code10"]:false) ? Arch::architecture() : ""));
+ string command = sformat("/usr/lib/YaST2/bin/y2mkiso '%1' '%2' '%3'", String::Quote(isodir), String::Quote(isofile), String::Quote((ProductCreator::Config["code10"]:false) ? arch : ""));
y2milestone("command: %1", command);
SCR::Execute (.target.bash, command, $["CD_PUBLISHER": pub, "CD_PREPARER": prep ]);
@@ -527,6 +530,176 @@
return `next;
}
+/**
+ * overview dialog with image configurations
+ */
+define symbol ImagesOverviewDialog() {
+
+ list overview = [];
+ map Configurations = $[];
+
+ string images_dir = Kiwi::images_dir;
+ if (!FileUtils::Exists (images_dir))
+ SCR::Execute (.target.mkdir, images_dir);
+
+ map out = (map) SCR::Execute (.target.bash_output,
+ sformat ("ls -A1 %1", images_dir));
+ if (out != $[])
+ {
+ foreach (string d, splitstring(out["stdout"]:"", "\n"), {
+ if (d == "") return;
+ if (FileUtils::Exists (images_dir + "/" + d + "/config.xml"))
+ {
+ map config = Kiwi::ReadConfigXML (images_dir + "/" + d);
+ string task = "iso";
+ // FIXME duplicated in kiwi_dialogs
+ foreach (string type, map data, config["type"]:$[], {
+ task = type;
+ if (data["primary"]:"" == "true")
+ break;
+ });
+
+ config["kiwi_configuration_" + task] = images_dir + "/" + d;
+ config["current_task"] = task;
+
+ string name = config["name"]:d;
+ Configurations[name] = config;
+ overview = add (overview, `item (
+ `id (name), name,
+ config["version"]:"1", config["size"]:0
+ ));
+ }
+ });
+ }
+
+ // help text
+ string help_text = _("<p>Start the creating of new image configuration with <b>Add</b>.</p>") +
+
+ // help text
+ _("<p>Use <b>Edit</b> to change selected image configuration or create the image.</p>") +
+
+ // help text
+ _("<p>Delete the directory with selected configuration using <b>Delete</b>.</p>") +
+
+ // help text, %1 is directory
+ sformat (_("<p>All image configurations are saved in <tt>%1</tt> directory.</p>"), images_dir);
+
+ // main dialog caption
+ string caption = _("Image Creator Configuration Overview");
+
+ term contents = `VBox (
+ `VWeight (3, `Table (`id (`table), `opt (`notify, `immediate),
+ `header (_("Name"), _("Version"), _("Size")),
+ overview
+ )),
+ `VWeight (1, `RichText (`id (`descr), "")),
+ `HBox (
+ `PushButton (`id (`add), `opt (`key_F3), Label::AddButton ()),
+ `PushButton (`id (`delete), `opt (`key_F5), Label::DeleteButton ()),
+ `PushButton (`id (`edit), `opt (`key_F4), Label::EditButton ()),
+ `HStretch ()
+ )
+ );
+
+ contents = Wizard_hw::SpacingAround(contents, 1.5, 1.5, 1.0, 1.0);
+
+ Wizard::SetContentsButtons(caption, contents, help_text,
+ Label::BackButton(), Label::CloseButton());
+ Wizard::HideBackButton();
+ Wizard::HideAbortButton();
+
+ UI::ChangeWidget (`id (`edit), `Enabled, size (overview) > 0);
+ if (size (overview) > 0)
+ {
+ string current = (string) UI::QueryWidget(`id(`table), `CurrentItem);
+ string val = Configurations[current,"specification"]:"";
+ UI::ChangeWidget (`id (`descr), `Value,
+ mergestring (splitstring(String::EscapeTags (val), "\n"), "<br>"));
+ }
+
+ any ret = nil;
+ while(true) {
+
+ ret = UI::UserInput();
+ string current = (string) UI::QueryWidget(`id(`table), `CurrentItem );
+
+ if(ret == `abort || ret == `cancel) {
+ if(ProductCreator::ReallyAbort()) break;
+ else continue;
+ }
+ else if (ret == `table)
+ {
+ UI::ChangeWidget (`id (`descr), `Value,
+ Configurations[current,"specification"]:"");
+ }
+ else if (ret == `add)
+ {
+ ProductCreator::Config = $[];
+ ret = `kiwi;
+ break;
+ }
+ else if(ret == `delete)
+ {
+ if (Popup::YesNo (
+// yes/no popup
+sformat (_("Delete configutation %1 now?"), current)))
+ {
+ map config = Configurations[current]:$[];
+ string dir =
+ config["kiwi_configuration_"+ config["current_task"]:""]:"";
+ // TODO at the end? (solve possible new config with same name..)
+ if (dir != "" && issubstring (dir, Kiwi::images_dir))
+ SCR::Execute (.target.bash, "rm -rf " + dir);
+ Configurations = remove (Configurations, current);
+ overview = filter (term it, (list<term>) overview,
+ ``(it[0,0]:"" != current));
+ UI::ChangeWidget (`id (`table), `Items, overview);
+ }
+ }
+ else if (ret == `edit)
+ {
+ ProductCreator::Config = Configurations[current]:$[];
+ string task = ProductCreator::Config["current_task"]:"";
+ list<string> to_install = [ "kiwi" ];
+ if (contains ([ "iso", "xen", "vmx", "usb" ], task))
+ {
+ string bootdir = ProductCreator::Config["type",task,"boot"]:"";
+ if (bootdir == "" ||
+ (!FileUtils::Exists ("/usr/share/kiwi/image/" + bootdir) &&
+ !FileUtils::Exists (bootdir))
+ )
+ {
+ to_install = add (to_install, sformat("kiwi-desc-%1boot", task));
+ }
+ }
+ if (Package::InstallAll (to_install))
+ {
+ string dir =
+ ProductCreator::Config["kiwi_configuration_" + task]:"";
+ Kiwi::ImportImageRepositories (ProductCreator::Config, dir);
+ Kiwi::kiwi_task = task;
+ ret = `kiwi;
+ break;
+ }
+ continue;
+ }
+ else if (ret == `next || ret == `back) {
+ break;
+ }
+ else {
+ y2error("unexpected retcode: %1", ret);
+ continue;
+ }
+ }
+ if (ret == `kiwi)
+ {
+ // we do import own sources...
+ ProductCreator::enable_sources = false;
+ // ask on abort...
+ ProductCreator::modified = true;
+ }
+ return (symbol)ret;
+}
/* EOF */
}
Modified: trunk/product-creator/src/data/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/data/Makefile.am?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/src/data/Makefile.am (original)
+++ trunk/product-creator/src/data/Makefile.am Thu Oct 25 16:01:56 2007
@@ -1,7 +1,7 @@
#
# Makefile.am for devtools/devtools/skeletons/config/agents
#
-SUBDIRS = kiwi_templates
+SUBDIRS = kiwi_templates
ydatadir = @ydatadir@/product-creator
@@ -11,5 +11,8 @@
message \
options.msg
+fillup_DATA = sysconfig.product-creator
-EXTRA_DIST = $(ydata_DATA)
+fillupdir = /var/adm/fillup-templates
+
+EXTRA_DIST = $(ydata_DATA) $(fillup_DATA)
Added: trunk/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/create_xconf
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/create_xconf?rev=41570&view=auto
==============================================================================
--- trunk/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/create_xconf (added)
+++ trunk/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/create_xconf Thu Oct 25 16:01:56 2007
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Copyright (c) 1995-2003 SuSE Linux AG, Nuernberg, Germany.
+# All rights reserved.
+#
+### BEGIN INIT INFO
+# Provides: create_xconf
+# Required-Start: $local_fs
+# Required-Stop:
+# Default-Start: 5
+# Default-Stop:
+# X-Start-Before: earlyxdm
+# Description: Call sax
+### END INIT INFO
+
+# First reset status of this service
+. /etc/rc.status
+rc_reset
+
+# Return values acc. to LSB for all commands but status:
+# 0 - success
+# 1 - generic or unspecified error
+# 2 - invalid or excess argument(s)
+# 3 - unimplemented feature (e.g. "reload")
+# 4 - insufficient privilege
+# 5 - program is not installed
+# 6 - program is not configured
+# 7 - program is not running
+
+case "$1" in
+ start)
+ echo -n "Creating X Config"
+ # create config file if not yet done
+ if [ ! -f /etc/X11/xorg.conf ];then
+ /usr/sbin/sax2 -c 0 -a -i &>/dev/null
+ fi
+ rc_status -v
+ ;;
+ stop)
+ ;;
+ try-restart)
+ rc_status
+ ;;
+ restart)
+ rc_status
+ ;;
+ try-restart-iburst)
+ rc_status
+ ;;
+ force-reload)
+ # Does not support signalling to reload
+ $0 try-restart
+ rc_status
+ ;;
+ reload)
+ rc_status -v
+ ;;
+ status)
+ rc_status -v
+ ;;
+ probe)
+ rc_failed 3
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status|try-restart|restart|try-restart-iburst|force-reload|reload|probe|ntptimeset}"
+ exit 1
+ ;;
+esac
+rc_exit
Added: trunk/product-creator/src/data/sysconfig.product-creator
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/data/sysconfig.product-creator?rev=41570&view=auto
==============================================================================
--- trunk/product-creator/src/data/sysconfig.product-creator (added)
+++ trunk/product-creator/src/data/sysconfig.product-creator Thu Oct 25 16:01:56 2007
@@ -0,0 +1,32 @@
+## Path: System/Yast2/Product-creator
+## Description: YaST2 Product Creator
+## Type: string
+## Default: none
+#
+# List of full paths to directories storing the image configuration templates.
+# Items are separated by spaces.
+#
+#
+IMAGE_TEMPLATES="/var/lib/YaST2/product-creator/templates"
+
+## Path: System/Yast2/Product-creator
+## Description: YaST2 Product Creator
+## Type: string
+## Default: "/var/lib/YaST2/product-creator/images"
+#
+# Path to the directory storing image configurations for Image Creator.
+#
+#
+IMAGE_CONFIGURATIONS="/var/lib/YaST2/product-creator/images"
+
+## Path: System/Yast2/Product-creator
+## Description: YaST2 Product Creator
+## Type: string(template)
+## Default: none
+#
+# Which boot images are offered for configuration. Use comma separated list
+# of image types (like "iso,xen,usb") or special value "template" for
+# supporting only image types found in imported configurations.
+#
+#
+SUPPORTED_BOOT_IMAGES=""
Modified: trunk/product-creator/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/dialogs.ycp?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/src/dialogs.ycp (original)
+++ trunk/product-creator/src/dialogs.ycp Thu Oct 25 16:01:56 2007
@@ -19,13 +19,13 @@
import "StorageDevices";
import "Arch";
import "Label";
- import "Package";
import "Popup";
import "URL";
import "GPG";
import "GPGWidgets";
import "CWM";
import "String";
+ import "Package";
include "product-creator/helps.ycp";
@@ -495,8 +495,8 @@
ret = UI::UserInput();
if (ret == `table)
{
- integer ID = (integer)UI::QueryWidget(`id(`table),`CurrentItem);
- ret = contains (selected_items, ID) ? `remove : `select;
+ integer ID = (integer)UI::QueryWidget(`id(`table),`CurrentItem);
+ ret = contains (selected_items, ID) ? `remove : `select;
}
/* abort? */
if(ret == `abort || ret == `cancel) {
@@ -509,6 +509,9 @@
map general_info = Pkg::SourceGeneralData(SrcID);
boolean found_architecture = false;
+ string arch = Arch::architecture ();
+ if (arch == "s390_64") arch = "s390x";
+
// architecture check is possible only for YaST sources
if (general_info["type"]:"" == "YaST")
{
@@ -518,7 +521,7 @@
foreach(string key, string value, read_content,
{
- if (key == "ARCH." + Arch::architecture())
+ if (key == "ARCH." + arch)
{
found_architecture = true;
break;
@@ -532,7 +535,7 @@
found_architecture = true;
}
- y2milestone("Architecture %1 is supported: %2", Arch::architecture(), found_architecture);
+ y2milestone("Architecture %1 is supported: %2", arch, found_architecture);
if (true)
{
@@ -547,7 +550,7 @@
{
Report::Error(sformat(_("The source does not support the architecture of this machine (%1).
Select another source.
-"), Arch::architecture()));
+"), arch));
}
}
else if (ret == `remove)
@@ -785,8 +788,8 @@
// while the package manager is initialized
UI::ReplaceWidget(`rep,
mode == nil ?
- `PackageSelector(`id(`packages ), StorageDevices::FloppyDevice ) :
- `PackageSelector(`id(`packages ), `opt(mode), StorageDevices::FloppyDevice )
+ `PackageSelector(`id(`packages ), StorageDevices::FloppyDevice ()) :
+ `PackageSelector(`id(`packages ), `opt(mode), StorageDevices::FloppyDevice ())
);
symbol result = (symbol) UI::RunPkgSelection(`id(`packages ) );
Copied: trunk/product-creator/src/image-creator.desktop (from r41191, trunk/product-creator/src/kiwi.desktop)
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/image-creator.desktop?p2=trunk/product-creator/src/image-creator.desktop&p1=trunk/product-creator/src/kiwi.desktop&r1=41191&r2=41570&rev=41570&view=diff
==============================================================================
--- trunk/product-creator/src/kiwi.desktop (original)
+++ trunk/product-creator/src/image-creator.desktop Thu Oct 25 16:01:56 2007
@@ -6,7 +6,7 @@
X-KDE-RootOnly=true
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2
-X-SuSE-YaST-Call=kiwi
+X-SuSE-YaST-Call=image-creator
X-SuSE-YaST-Group=Misc
X-SuSE-YaST-Argument=
@@ -16,7 +16,7 @@
X-SuSE-YaST-SortKey=
Icon=yast-kiwi
-Exec=/sbin/yast2 kiwi
+Exec=/sbin/yast2 image-creator
Name=Image Creator
GenericName=Create the Live CD, USB or XEN image
Added: trunk/product-creator/src/image-creator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/image-creator.ycp?rev=41570&view=auto
==============================================================================
--- trunk/product-creator/src/image-creator.ycp (added)
+++ trunk/product-creator/src/image-creator.ycp Thu Oct 25 16:01:56 2007
@@ -0,0 +1,65 @@
+/**
+ * $Id$
+ *
+ */
+
+{
+
+textdomain "product-creator";
+
+import "CommandLine";
+import "Confirm";
+import "FileUtils";
+import "Kiwi";
+import "Label";
+import "ProductCreator";
+import "Sequencer";
+import "Wizard";
+import "Wizard_hw";
+
+include "product-creator/wizards.ycp";
+
+
+
+// TODO merge with main product-creator sequence?
+define boolean ICSequence() {
+
+ Wizard::CreateDialog();
+ Wizard::SetDesktopIcon("cd-creator");
+
+ if (!Confirm::MustBeRoot ())
+ {
+ UI::CloseDialog ();
+ return false;
+ }
+
+ if (!Package::InstallAll (["kiwi", "yast2-instserver"]))
+ {
+ Popup::Error(_("Installation of required packages
+failed."));
+ UI::CloseDialog ();
+ return false;
+ }
+
+ symbol ret = ImageCreatorSequence ();
+
+ UI::CloseDialog();
+ return ret == `next;
+}
+
+map cmdline_description = $[
+ "id" : "image-creator",
+ // transltors: command line help text for the Xproduct-creator module
+ "help" : _("Configuration of Image creator"),
+ "guihandler" : ICSequence,
+];
+
+
+/* start the module */
+any ret = CommandLine::Run(cmdline_description);
+y2debug("ret=%1", ret);
+
+return ret;
+
+/* EOF */
+}
Modified: trunk/product-creator/src/kiwi.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/kiwi.ycp?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/src/kiwi.ycp (original)
+++ trunk/product-creator/src/kiwi.ycp Thu Oct 25 16:01:56 2007
@@ -13,6 +13,7 @@
textdomain "product-creator";
include "product-creator/kiwi_dialogs.ycp";
+include "product-creator/wizards.ycp";
import "CommandLine";
import "Confirm";
@@ -23,7 +24,7 @@
* configuration workflow for kiwi
* @return sequence result
*/
-define boolean KiwiSequence() {
+define boolean ShortKiwiSequence() {
map aliases = $[
"prepare" : ``( PrepareDialog() ),
@@ -60,6 +61,7 @@
return false;
}
+ InitRepositories ();
PackageCallbacksInit::InitPackageCallbacks();
symbol ret = Sequencer::Run(aliases, sequence);
@@ -71,7 +73,7 @@
"id" : "kiwi",
// command line help text for the kiwi module
"help" : _("Configuration of Kiwi"),
- "guihandler" : KiwiSequence,
+ "guihandler" : ShortKiwiSequence,
"actions" : $[],
];
Modified: trunk/product-creator/src/kiwi_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/kiwi_dialogs.ycp?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/src/kiwi_dialogs.ycp (original)
+++ trunk/product-creator/src/kiwi_dialogs.ycp Thu Oct 25 16:01:56 2007
@@ -16,15 +16,17 @@
import "FileUtils";
import "Label";
import "Kiwi";
+ import "PackageSystem";
import "Popup";
import "SourceDialogs";
+ import "SourceManager";
import "Summary";
import "URL";
import "Wizard";
include "product-creator/dialogs.ycp";
- // map of current Live ISO configuration
+ // map of current image configuration
map KiwiConfig = $[];
// what are we configuring now ("iso"/"xen"/...)
@@ -39,7 +41,7 @@
list<term> GetAvailableImages (string subdir) {
list<term> ret = [];
- string dir = "/usr/share/kiwi/image/";
+ string dir = "/usr/share/kiwi/image/";
map out = (map) SCR::Execute (.target.bash_output,
sformat ("ls %1/%2", dir, subdir));
if (out["exit"]:0 != 0)
@@ -78,6 +80,23 @@
return nil;
}
+ /**
+ * Initialize the widget with packages intended for deletion
+ */
+ define void InitSWDelete (string id) {
+ UI::ChangeWidget (`id (id), `Value, mergestring (KiwiConfig["delete_packages"]:[], "\n"));
+ }
+
+ define void StoreSWDelete (string key, map event) {
+ string ignore_key = "delete_packages";
+ KiwiConfig[ignore_key] = filter (string p,
+ splitstring ((string) UI::QueryWidget(`id(key), `Value), "\n"), ``(p != ""));
+ }
+
+ define symbol HandleSWDelete (string key, map event) {
+ if (event["ID"]:nil == `next) StoreSWDelete (key, event);
+ return nil;
+ }
/**
* Initialize the contents of richtext with selected software
@@ -115,10 +134,10 @@
{
string sw_selection = KiwiConfig["sw_selection"]:"image";
- integer mbytes = (integer) UI::QueryWidget (`id ("size"), `Value);
- if (UI::QueryWidget (`id ("sizeunit"), `Value) == "G")
- mbytes = mbytes * 1024;
- ProductCreator::max_size_mb = mbytes;
+ integer mbytes = (integer) UI::QueryWidget (`id ("size"), `Value);
+ if (UI::QueryWidget (`id ("sizeunit"), `Value) == "G")
+ mbytes = mbytes * 1024;
+ ProductCreator::max_size_mb = mbytes;
if (sw_selection == "image" && packageSelector () != `cancel)
{
KiwiConfig["addons"] = ProductCreator::Config["addons"]:[];
@@ -218,7 +237,7 @@
* initialize the value of compress checkbox
*/
define void InitCompressCheckBox (string id) {
- UI::ChangeWidget (`id (id), `Enabled, false);// FIXME squashfs not available?
+ UI::ChangeWidget (`id (id), `Enabled, false);
UI::ChangeWidget (`id (id), `Value, KiwiConfig["compressed"]:false);
}
@@ -661,7 +680,8 @@
];
Kiwi::WriteConfigXML (KiwiConfig, kiwi_task);
- if (Popup::YesNo (question[kiwi_task]:""))
+ // default question
+ if (Popup::YesNo (question[kiwi_task]:_("Create image now?")))
{
if (true)
{
@@ -679,7 +699,10 @@
}
else
{
- Popup::Message (sformat (success[kiwi_task]:"", out_dir));
+ // default popup message, %1 is a dir
+ Popup::Message (sformat (success[kiwi_task]:_("Image successfully created in
+%1
+directory."), out_dir));
}
}
else
@@ -702,8 +725,8 @@
*/
define void InitImageConfiguration () {
- kiwi_task = ProductCreator::kiwi_task;
- string kiwi_dir = "/usr/share/kiwi/image/";
+ kiwi_task = Kiwi::kiwi_task;
+ string kiwi_dir = "/usr/share/kiwi/image/";
// read the information from the base product
integer src_id = ProductCreator::checkProductDependency ();
@@ -711,7 +734,7 @@
KiwiConfig = ProductCreator::Config;
// busy popup
- Popup::ShowFeedback (_("Reading current live image configuration..."), _("Please wait..."));
+ Popup::ShowFeedback (_("Reading current image configuration..."), _("Please wait..."));
map default_dirmap = $[
"iso" : sformat ("%1/kwliveDVD-suse-10.3", kiwi_dir),
@@ -723,7 +746,6 @@
// path to current config directory
string default_dir = default_dirmap[kiwi_task]:"";
string kiwi_configuration = KiwiConfig["kiwi_configuration_" + kiwi_task]:default_dir;
-
if (!FileUtils::Exists (kiwi_configuration))
{
// use local template if default dir does not exist (bug #289552)
@@ -760,20 +782,21 @@
}
});
// take care of the rest in the input directory (#330052)
- list import_files = [];
+ list import_files = [];
map out = (map) SCR::Execute (.target.bash_output,
sformat ("ls -A1 -d %1/* 2>/dev/null", kiwi_configuration));
foreach (string line, splitstring (out["stdout"]:"", "\n"), {
if (line == "") return;
- string last = substring (line, findlastof (line, "/") + 1);
+ string last = substring (line, findlastof (line, "/") + 1);
if (contains (["images.sh", "config.sh", "config.xml", "root","config"],
last))
return;
- import_files = add (import_files, line);
+ import_files = add (import_files, line);
});
- KiwiConfig["import_files"] = import_files;
+ KiwiConfig["import_files"] = import_files;
+
- map read_config = Kiwi::ReadConfigXML (kiwi_configuration);
+ map read_config = Kiwi::ReadConfigXML (kiwi_configuration);
if (!KiwiConfig["_imported"]:false)
{
KiwiConfig = (map) union (KiwiConfig, read_config);
@@ -788,9 +811,10 @@
y2milestone ("imported configuration...");
// ignore options already set earlier...
foreach (string key, any val, read_config, {
- if (!contains (["name", "iso-directory", "sources"], key))
+ if (!contains (["name", "iso-directory", "sources", "version",
+ "type"],key))
{
- KiwiConfig[key] = val;
+ KiwiConfig[key] = val;
}
});
// "sources" are already there...
@@ -863,16 +887,6 @@
"contents" : `HBox (`HSpacing(1),
`VBox (
`VSpacing (0.2),
- /*
- `HBox (
- `HWeight (1, `HBox (
- boot_image_widget ()
-// `VBox (`Label (""), "configure_boot")
- )),
- `HWeight (1, `VBox (`Label (""), `Left ("compressed")))
- ),
- */
- `VSpacing (0.2),
`HBox (
`HWeight (1, "version"),
`HWeight (1, `HBox ("size", "sizeunit"))
@@ -882,7 +896,7 @@
`HWeight (1, `VBox (
`Left (`Label (_("Installed Software"))), "rt_sw", `Right ("configure_sw")
)),
- `HWeight (1, "ignore")
+ `HWeight (1, `VBox ("ignore", "delete_sw"))
),
`VSpacing (0.2)
), `HSpacing(1)),
@@ -891,7 +905,7 @@
"size", "sizeunit",
"sw_selection",
"rt_sw", "configure_sw",
- "ignore",
+ "ignore", "delete_sw"
],
],
"description" : $[
@@ -979,6 +993,73 @@
"validate_function" : CreateImage,
"no_help" : true,
],
+ // widgets for config.xml tab
+ /*
+ "isoboot" : $[
+ "widget" : `combobox,
+ "opt" : [ `hstretch, `notify ],
+ // combo box label
+ "label" : _("C&D Boot Image"),
+ // help text for "C&D Boot Image", %1/%2 is path (on extra line)
+ "help" : sformat (_("<p>Choose one <b>CD Boot Image</b> from the<br>
+<tt>%1/%2</tt><br>
+directory.</p>
+"),
+ Kiwi::kiwi_dir, boot_image_widget ()),
+ "items" : [],
+ "init" : InitBootCombo,
+ "store" : StoreBootCombo,
+ "handle" : HandleBootCombo,
+ ],
+ "xenboot" : $[
+ "widget" : `combobox,
+ "opt" : [ `hstretch, `notify ],
+ // combo box label
+ "label" : _("&Xen Boot Image"),
+ // help text for "XEN Boot Image"
+ "help" : sformat (_("<p>Choose one <b>Xen Boot Image</b> from the<br>
+<tt>%1/%2</tt><br>
+directory.</p>
+"),
+ Kiwi::kiwi_dir, boot_image_widget ()),
+ "items" : [],
+ "init" : InitBootCombo,
+ "store" : StoreBootCombo,
+ "handle" : HandleBootCombo,
+ ],
+ "usbboot" : $[
+ "widget" : `combobox,
+ "opt" : [ `hstretch, `notify ],
+ // combo box label
+ "label" : _("&USB Stick Boot Image"),
+ // help text for "XEN Boot Image"
+ "help" : sformat (_("<p>Choose one <b>USB stick Boot Image</b> from the<br>
+<tt>%1/%2</tt><br>
+directory.</p>
+"),
+ Kiwi::kiwi_dir, boot_image_widget ()),
+ "items" : [],
+ "init" : InitBootCombo,
+ "store" : StoreBootCombo,
+ "handle" : HandleBootCombo,
+ ],
+ "vmxboot" : $[
+ "widget" : `combobox,
+ "opt" : [ `hstretch, `notify ],
+ // combo box label
+ "label" : _("&Virtual Disk Boot Image"),
+ // help text for "XEN Boot Image"
+ "help" : sformat (_("<p>Choose one <b>Virtual Disk Boot Image</b> from the<br>
+<tt>%1/%2</tt><br>
+directory.</p>
+"),
+ Kiwi::kiwi_dir, boot_image_widget ()),
+ "items" : [],
+ "init" : InitBootCombo,
+ "store" : StoreBootCombo,
+ "handle" : HandleBootCombo,
+ ],
+ */
"configure_boot" : $[
"widget" : `push_button,
// pusbutton label
@@ -1033,6 +1114,16 @@
// help text for "&Ignored software"
"help" : _("<p>For <b>ignored software</b>, enter each entry (like 'smtp_daemon') on new line</p>"),
],
+ "delete_sw" : $[
+ "widget" : `multi_line_edit,
+ // label
+ "label" : _("Packages to &Delete"),
+ "init" : InitSWDelete,
+ "store" : StoreSWDelete,
+ "handle" : HandleSWDelete,
+ // help text for "&Ignored software"
+ "help" : _("<p>Each entry of <b>Packages to Delete</b> is one package name to be uninstalled from the target image.</p>"),
+ ],
"output_dir" : $[
"widget" : `textentry,
// textentry label
@@ -1297,77 +1388,88 @@
/**
* Main dialog for Kiwi image configuration
*/
- define symbol KiwiDialog () {
-
- InitImageConfiguration ();
+define symbol KiwiDialog () {
- map widget_descr = get_widget_description ();
- widget_descr["tab"] = CWMTab::CreateWidget($[
- "tab_order" : ["config.xml", "description", "users", "scripts", "directories"],
- "tabs" : tabs_descr (),
- "widget_descr" : widget_descr,
- "initial_tab" : "config.xml",
- ]);
- Wizard::SetContentsButtons("", `VBox (), "", Label::BackButton(), Label::NextButton());
+InitImageConfiguration ();
- term contents = `VBox (
- `Left (`Label (KiwiConfig["name"]:"")),
- "tab",
- `VSpacing (0.3),
- "global"
- );
+map widget_descr = get_widget_description ();
+widget_descr["tab"] = CWMTab::CreateWidget($[
+ "tab_order" : [
+ "config.xml", "description", "users", "scripts", "directories"
+ ],
+ "tabs" : tabs_descr (),
+ "widget_descr" : widget_descr,
+ "initial_tab" : "config.xml",
+]);
+Wizard::SetContentsButtons("", `VBox (), "", Label::BackButton(), Label::NextButton());
+term contents = `VBox (
+ `Left (`Label (KiwiConfig["name"]:"")),
+ "tab",
+ `VSpacing (0.3),
+ "global"
+);
- map caption = $[
- // dialog caption
- "iso" : _("Live CD Configuration"),
- // dialog caption
- "xen" : _("Xen Image Configuration"),
- // dialog caption
- "usb" : _("USB Stick Image Configuration"),
- // button label
- "vmx" : _("Virtual Disk Image"),
- ];
- map next_button = $[
- // button label
- "iso" : _("&Create ISO"),
- // button label
- "xen" : _("&Create Xen Image"),
- // button label
- "usb" : _("&Create USB Stick Image"),
- // button label
- "vmx" : _("&Create Virtual Disk Image"),
- ];
- symbol ret = CWM::ShowAndRun ($[
- "widget_names" : [ "global", "tab" ],
- "widget_descr" : widget_descr,
- "contents" : contents,
- "caption" : caption[kiwi_task]:"",
- "back_button" : Label::BackButton (),
+map caption = $[
+ // dialog caption
+ "iso" : _("Live CD Configuration"),
+ // dialog caption
+ "xen" : _("Xen Image Configuration"),
+ // dialog caption
+ "usb" : _("USB Stick Image Configuration"),
+ // button label
+ "vmx" : _("Virtual Disk Image"),
+];
+map next_button = $[
+ // button label
+ "iso" : _("&Create ISO"),
+ // button label
+ "xen" : _("&Create Xen Image"),
+ // button label
+ "usb" : _("&Create USB Stick Image"),
+ // button label
+ "vmx" : _("&Create Virtual Disk Image"),
+];
+symbol ret = CWM::ShowAndRun ($[
+ "widget_names" : [ "global", "tab" ],
+ "widget_descr" : widget_descr,
+ "contents" : contents,
+ // default dialog caption
+ "caption" : caption[kiwi_task]:_("Image Configuration"),
+ "back_button" : Label::BackButton (),
// "next_button" : next_button[kiwi_task]:Label::NextButton (),
- "next_button" : Label::FinishButton (),
- ]);
- y2milestone("Returning %1", ret);
- return ret;
- }
+ "next_button" : Label::FinishButton (),
+ "fallback_functions" : $[
+ `abort : ProductCreator::ReallyAbort
+ ],
+]);
+y2milestone("Returning %1", ret);
+return ret;
+}
/**
- * Prepare dialog: define kiwi data without cd-creator
+ * Prepare dialog: define kiwi data without product-creator
*/
define symbol PrepareDialog () {
+ kiwi_task = Kiwi::kiwi_task;
if (kiwi_task == "")
kiwi_task = "iso";
- map Config = KiwiConfig;
+ map Config = ProductCreator::Config;
string kiwi_configuration = Config["kiwi_configuration_" + kiwi_task]:"";
string name = Config["name"]:"";
string out_dir = Config["iso-directory"]:"";
- map repositories = $[];
- // originally enabled list of sources
- list<map> enabled_sources = [];
+ map repositories = Kiwi::current_repositories;
+ boolean new_configuration = (Config == $[]);
+ boolean append_name = false;
+
+ string help = (new_configuration ?
+ // help text for kiwi UI preparation
+ _("<p>Enter the name of your image configuration. Base new configuration on template from the list or on the directory with the existing configuration.</p>")
+ : "") +
// help text for kiwi UI preparation
- string help = _("<p>Enter the name of your image configuration or <b>Import</b> the directory with the existing one.</p>") +
+ (new_configuration ? sformat (_("<p>Place custom configuration templates under <tt>%1</tt> directory.</p>"), Kiwi::templates_dirs[0]:"") : "") +
// help text for kiwi UI preparation, cont.
_("<p>Choose the <b>Image Type</b> which should be created.</p>") +
@@ -1376,120 +1478,181 @@
_("<p>Select <b>Output Directory</b> for the created image.</p>") +
// help text for kiwi UI preparation, cont.
- _("<p>Modify the list of <b>Package Repositories</b> that will be used for creating the image. If the list is empty, current system repositories will be used.</p>") +
+ _("<p>Modify the list of <b>Package Repositories</b> that will be used for creating the image. Use <b>Add From System</b> to add one of current system repository.</p>") +
// help text for kiwi UI preparation, cont.
_("<p>Use <b>Next</b> to continue with the configuration.</p>");
- // on start, show the default YaST sources
- if (Config == $[])
+ list basic_type_items = [
+ // combo box item
+ `item (`id ("iso"), _("Live ISO Image"), kiwi_task == "iso"),
+ // combo box item
+ `item (`id ("xen"), _("Xen Image"), kiwi_task == "xen"),
+ // combo box item
+ `item (`id ("usb"), _("USB Stick Image"), kiwi_task == "usb"),
+ // combo box item
+ `item (`id ("vmx"), _("Virtual Disk Image"), kiwi_task == "vmx")
+ ];
+ map task2label = $[
+ // combo box item
+ "pxe" : _("Network Boot Image"),
+ // combo box item
+ "iso" : _("Live ISO Image"),
+ // combo box item
+ "xen" : _("Xen Image"),
+ // combo box item
+ "usb" : _("USB Stick Image"),
+ // combo box item
+ "vmx" : _("Virtual Disk Image")
+ ];
+
+ list type_items = basic_type_items;
+ list default_type_items = basic_type_items;
+
+ string supported_images = Kiwi::supported_boot_images;
+ if (supported_images != "" && supported_images != "template")
+ {
+ type_items = []; // will be read from template..., or:
+ foreach (string type, splitstring (supported_images,","),
+ {
+ if (haskey (task2label, type))
+ {
+ type_items = add (type_items,
+ `item (`id (type), task2label[type]:type));
+ }
+ });
+ default_type_items = type_items;
+ }
+ else if (supported_images == "template" && !new_configuration)
{
- Pkg::SourceRestore ();
- Pkg::SourceLoad();
- Config["sources"] = maplist (map source, Pkg::SourceEditGet (), {
- integer srcid = source["SrcId"]:-1;
- map data = Pkg::SourceGeneralData (srcid);
- string url = data["url"]:"";
- repositories[srcid] = url;
- return url;
+ list type_its = [];
+ //solve `back here (=no import)
+ foreach (string type, map data, Config["type"]:$[], {
+ type_its = add (type_its,
+ `item (`id (type), task2label[type]:type));
});
+ if (type_its != [])
+ type_items = type_its;
}
- else if (Config["sources"]:[] != [])
+ list present_types = maplist (
+ term it, (list<term>)type_items, ``(it[0,0]:""));
+ if (!contains (["iso", "xen", "usb", "vmx"], kiwi_task) &&
+ !contains (present_types, kiwi_task))
+ {
+ type_items = add (type_items,
+ `item (`id (kiwi_task), task2label[kiwi_task]:kiwi_task, true));
+ present_types = add (present_types, kiwi_task);
+ }
+
+ // on start, show the default YaST sources
+ if (Config["sources"]:[] != [] && repositories == $[])
{
- list sources = Config["sources"]:[];
- list<map> all_sources = Pkg::SourceEditGet();
- foreach (map source, all_sources, {
- integer srcid = source["SrcId"]:-1;
- map data = Pkg::SourceGeneralData (srcid);
- string url = data["url"]:"";
- string stripped = url;
- if (substring (url, 0, 6) == "dir://")
- stripped = substring (url, 6);
- if (contains(sources, url) || contains (sources, stripped))
- repositories[srcid] = url;
+ foreach (string src, Config["sources"]:[], {
+ repositories[src] = $[
+ "url" : src,
+ ];
});
}
+ list system_repo_items = maplist (string url, map repo,
+ Kiwi::initial_repositories, {
+ return `item (`id (url), url);
+ });
+ void update_repo_table () {
+ UI::ChangeWidget (`id (`repositories), `Items, maplist (
+ string url, map repo, repositories, ``(
+ `item (`id (url), url))
+ ));
+ UI::ChangeWidget (`id (`delete), `Enabled, size (repositories) > 0);
+ }
// read the new configuration and update UI accordingly
- void update_config (string dir) {
-
- // 1. delete previous sources (were in repositories list)
- foreach (map source, Pkg::SourceEditGet (), {
- integer srcid = source["SrcId"]:-1;
- if (haskey (repositories, srcid))
- Pkg::SourceDelete (srcid);
- });
+ // (no need to read config if it is provided as argument)
+ void update_config (string dir, map config) {
kiwi_configuration = dir;
- Config = eval (Kiwi::ReadConfigXML (kiwi_configuration));
- name = Config["name"]:"";
+ Config =
+ (config == $[] ? Kiwi::ReadConfigXML (kiwi_configuration) : config);
+ // busy popup
+ Popup::ShowFeedback (_("Importing repositories..."), _("Please wait..."));
+ repositories = Kiwi::ImportImageRepositories (Config, dir);
+ Popup::ClearFeedback ();
+ if (!new_configuration)
+ {
+ name = Config["name"]:"";
+ UI::ChangeWidget (`id (`config), `Value, name);
+ }
+ else
+ {
+ Config["version"] = "1.0.0";
+ }
if (Config["iso-directory"]:"" != "")
- UI::ChangeWidget (`id (`out_dir),`Value,Config["iso-directory"]:"");
- repositories = $[];
- foreach (map repo, (list<map>) Config["repository"]:[], {
- string source = repo["source",0,"path"]:"";
- if (source != "")
- {
- integer id = -1;
- string url = "";
- if (substring (source, 0, 1) == "/")
- url = "dir://";
- if (repo["type"]:"" == "rpm-dir")
- {
- id = Pkg::SourceCreateType (url + source, "", "Plaindir");
- }
- else
- id = Pkg::SourceCreate (url + source, "");
- if (id != -1)
- repositories[id] = url + source;
- }
- });
- UI::ChangeWidget (`id (`config), `Value, name);
- UI::ChangeWidget (`id (`repositories), `Items,
- maplist (integer id, string repo, repositories, ``(
- `item (`id (id), repo)))
- );
+ UI::ChangeWidget(`id(`out_dir), `Value, Config["iso-directory"]:"");
+ update_repo_table ();
+ list type_its = supported_images != "template" ? default_type_items: [];
+ boolean primary = false;
foreach (string type, map data, Config["type"]:$[], {
- kiwi_task = type;
+ if (!primary)
+ kiwi_task = type;
if (data["primary"]:"" == "true")
- break;
+ primary = true;
+ if ((supported_images == "" && !contains (present_types, type)) ||
+ supported_images == "template")
+ {
+ type_its = add (type_its,
+ `item (`id (type), task2label[type]:type));
+ present_types = union (present_types, [type]);
+ }
});
+ UI::ChangeWidget (`id (`type), `Items, type_its);
UI::ChangeWidget (`id (`type), `Value, kiwi_task);
}
- void update_repo_table () {
- UI::ChangeWidget (`id (`repositories), `Items, maplist (
- integer id, string repo, repositories, ``(`item (`id (id), repo))
- ));
- }
+ list template_items = maplist (string dir, map template, Kiwi::Templates, {
+ return `item (`id (dir), sformat (
+ // combo box item, %1 is name, %2 version
+ _("%1, version %2"), template["name"]:"", template["version"]:"")
+ );
+ });
term contents = `VBox (
- `HBox (
+ new_configuration ?
+ `VBox (
// text entry label
`TextEntry (`id (`config), _("&Kiwi configuration"), name),
- // push button label
- `VBox (`Label (""), `PushButton (`id (`import), _("&Import")))
- ),
- // frame label
- `Frame (_("Image Type"),
- `RadioButtonGroup (`id (`type), `HBox (`HSpacing (), `VBox (
- `VSpacing (0.2),
- `Left (`RadioButton (`id ("iso"), `opt (`notify),
- // radio button label
- _("&Live ISO Image"), kiwi_task == "iso")),
- `Left (`RadioButton (`id ("xen"), `opt (`notify),
- // radio button label
- _("&Xen Image"), kiwi_task == "xen")),
- `Left (`RadioButton (`id ("usb"), `opt (`notify),
- // radio button label
- _("&USB Stick Image"), kiwi_task == "usb")),
- // radio button label
- `Left (`RadioButton (`id ("vmx"), `opt (`notify),
- _("&Virtual Disk Image"), kiwi_task == "vmx")),
- `VSpacing (0.2)
- )))
- ),
+ `RadioButtonGroup (`id (`imp), `HBox (`HSpacing (), `VBox (
+ `VSpacing (0.2),
+ `Left (`RadioButton (`id ("rb_new"), `opt (`notify),
+ // radio button label
+ _("Create from beginning"), true)
+ ),
+ template_items == [] ? `VSpacing (0) :
+ `Left (`RadioButton (`id ("rb_template"), `opt (`notify),
+ // radio button label
+ _("Base on Template"))
+ ),
+ template_items == [] ? `VSpacing (0) :
+ `HBox (
+ `HSpacing (2.5),
+ `ComboBox (`id (`template), `opt (`notify, `hstretch), "",
+ template_items)
+ ),
+ `Left (`RadioButton (`id ("rb_dir"), `opt (`notify),
+ // radio button label
+ _("Base on Existing Configuration"))
+ ),
+ `HBox (
+ `HSpacing (2.5),
+ `Label (`id (`import_dir),`opt (`outputField,`hstretch),""),
+ // push button label
+ `PushButton (`id (`import), _("&Choose..."))
+ )
+ )))
+ ) :
+ `Left (`Label (`id (`config), name)),
+ // combo box label
+ `ComboBox (`id (`type), `opt (`notify, `hstretch), _("I&mage Type"),
+ type_items),
`HBox (
// text entry label
`TextEntry (`id (`out_dir), _("&Output directory"), out_dir),
@@ -1505,6 +1668,9 @@
),
`HBox (
`PushButton (`id (`add), Label::AddButton ()),
+ // menu butto label
+ `MenuButton (`id (`addsystem), _("A&dd From System"),
+ system_repo_items),
`PushButton (`id (`edit), Label::EditButton ()),
`PushButton (`id (`delete), Label::DeleteButton ()),
`HStretch ()
@@ -1513,24 +1679,53 @@
// dialog caption
Wizard::SetContentsButtons (_("Image preparation"), contents, help,
Label::BackButton(), Label::NextButton());
+ Wizard::RestoreBackButton();
+ Wizard::RestoreAbortButton();
- if (Config == $[] && kiwi_configuration != "")
+ if (new_configuration && kiwi_configuration != "")
{
- update_config (kiwi_configuration);
+ update_config (kiwi_configuration, $[]);
}
else
update_repo_table ();
- UI::SetFocus (`id (`config));
+ if (new_configuration)
+ {
+ UI::SetFocus (`id (`config));
+ if (template_items != [])
+ UI::ChangeWidget (`id (`template), `Enabled, false);
+ UI::ChangeWidget (`id (`import), `Enabled, false);
+ UI::ChangeWidget (`id (`config), `ValidChars, String::CAlnum () + "-_");
+ }
any ret = nil;
while (true)
{
ret = UI::UserInput();
if (ret == `abort || ret == `cancel || ret == `back)
{
- break;
+ if(ProductCreator::ReallyAbort()) break;
+ else continue;
+ }
+ else if (ret == "rb_dir")
+ {
+ if (template_items != [])
+ UI::ChangeWidget (`id (`template), `Enabled, false);
+ UI::ChangeWidget (`id (`import), `Enabled, true);
+ if (kiwi_configuration == "")
+ ret = `import;
}
- else if (ret == `import)
+ else if (ret == "rb_template")
+ {
+ UI::ChangeWidget (`id (`template), `Enabled, true);
+ UI::ChangeWidget (`id (`import), `Enabled, false);
+ ret = `template;
+ }
+ else if (ret == "rb_new")
+ {
+ UI::ChangeWidget (`id (`template), `Enabled, false);
+ UI::ChangeWidget (`id (`import), `Enabled, false);
+ }
+ if (ret == `import)
{
string dir = UI::AskForExistingDirectory (
kiwi_configuration== "" ? Kiwi::images_dir : kiwi_configuration,
@@ -1538,54 +1733,87 @@
_("Directory to Import"));
if (dir!= nil)
{
- update_config (dir);
+ UI::ChangeWidget (`id (`import_dir), `Value, dir);
+ update_config (dir, $[]);
}
}
+ else if (ret == `template)
+ {
+ string dir = (string) UI::QueryWidget (`id (`template), `Value);
+ update_config (dir, Kiwi::Templates[dir]:$[]);
+ }
+ else if (is (ret, string)) // system repository selected
+ {
+ map system_repo = Kiwi::initial_repositories[(string)ret]:$[];
+ if (!haskey (repositories, (string)ret))
+ repositories[(string)ret] = system_repo;
+
+ update_repo_table ();
+ }
else if (ret == `add)
{
Wizard::CreateDialog ();
- string url = "";
- if (SourceDialogs::TypeDialog () == `next &&
- SourceDialogs::EditDialog () == `next)
+ string url = "";
+ symbol type_ret = SourceDialogs::TypeDialog ();
+
+ if ((type_ret == `next || type_ret == `finish))
{
- url = SourceDialogs::GetURL ();
+ if (type_ret == `finish && SourceDialogs::GetURL () == "slp://")
+ {
+ string required_package = "yast2-slp";
+ boolean installed_before = PackageSystem::Installed (required_package);
+ if (! installed_before)
+ {
+ if (!PackageSystem::CheckAndInstallPackagesInteractive ([required_package]))
+ {
+ Report::Error (sformat (
+ // popup error message, %1 is the package name
+ _("Cannot search for SLP repositories
+without having %1 package installed"),
+ required_package
+ ));
+ y2warning ("Not searching for SLP repositories");
+ }
+ else
+ {
+ SCR::RegisterAgent(.slp, `ag_slp(`SlpAgent()));
+ }
+ }
+ string service = (string) WFM::call("select_slp_source");
+ if (service != nil)
+ url = service;
+ }
+ else
+ {
+ if (SourceDialogs::EditDialog () == `next)
+ url = SourceDialogs::GetURL ();
+ }
}
Wizard::CloseDialog ();
if (url != "")
{
- boolean present = false;
- foreach (integer id, string repo, repositories, {
- if (repo == url)
- present = true;
- });
- if (present) break;
+ if (haskey (repositories, url))
+ continue;
- integer id = -1;
map parsed = URL::Parse(url);
if (parsed["scheme"]:"" == "pkg")
{
parsed["scheme"] = "dir";
url = URL::Build (parsed);
- id = Pkg::SourceCreateType (url, "", "Plaindir");
- }
- else
- id = Pkg::SourceCreate (url, "");
-
- if (id != -1)
- {
- repositories[id] = url;
- update_repo_table ();
}
+ repositories[url] = $[
+ "url" : url,
+ "plaindir" : parsed["scheme"]:"" == "dir"
+ ];
+ update_repo_table ();
}
}
else if (ret == `edit)
{
- integer selected = (integer)
+ string url = (string)
UI::QueryWidget (`id (`repositories), `CurrentItem);
- map generalData = Pkg::SourceGeneralData (selected);
- string url = generalData["url"]:"";
- string url_selected = url;
- boolean plaindir = generalData["type"]:"YaST" == "Plaindir";
+ string selected_url = url;
+ boolean plaindir = repositories[url,"plaindir"]:false;
// change schema if the source type is plaindir
// to show the right popup dialog
if (plaindir)
@@ -1595,29 +1823,28 @@
url = URL::Build (parsed);
}
url = SourceDialogs::EditPopup (url);
- if (url == "" || url == nil || url == generalData["url"]:"")
+ if (url == "" || url == nil || url == selected_url)
continue;
// remove current url + add new one
- Pkg::SourceDelete (selected);
- repositories = remove (repositories, selected);
- integer id = -1;
+ repositories = remove (repositories, selected_url);
map parsed = URL::Parse(url);
if (parsed["scheme"]:"" == "pkg")
{
parsed["scheme"] = "dir";
url = URL::Build (parsed);
- id = Pkg::SourceCreateType (url, "", "Plaindir");
}
- else
- id = Pkg::SourceCreate (url, "");
- repositories[id] = url;
+ repositories[url] = $[
+ "url" : url,
+ "plaindir" : parsed["scheme"]:"" == "dir"
+ ];
update_repo_table ();
}
else if (ret == `delete)
{
- integer selected = (integer)
+ string selected = (string)
UI::QueryWidget (`id (`repositories), `CurrentItem);
- Pkg::SourceDelete (selected);
+ if (selected == nil)
+ continue;
repositories = remove (repositories, selected);
update_repo_table ();
}
@@ -1641,6 +1868,15 @@
UI::SetFocus (`id (`config));
continue;
}
+ if (new_configuration &&
+ FileUtils::Exists (Kiwi::images_dir + "/" + name))
+ {
+ // error popup
+ Popup::Error (sformat (_("Configuration with name \"%1\" already exists.
+Choose a different one."), name));
+ UI::SetFocus (`id (`config));
+ continue;
+ }
out_dir = (string) UI::QueryWidget (`id (`out_dir), `Value);
if (out_dir == "")
{
@@ -1649,6 +1885,14 @@
UI::SetFocus (`id (`out_dir));
continue;
}
+ if (repositories == $[])
+ {
+ // error popup
+ Popup::Error(_("Specify at least one package repository."));
+ UI::SetFocus (`id (`repositories));
+ continue;
+ }
+
kiwi_task = (string) UI::QueryWidget (`id (`type), `Value);
break;
}
@@ -1656,26 +1900,52 @@
string boot = Config["type",kiwi_task,"boot"]:"";
if (boot != "" && issubstring (boot, "/"))
{
- Config[kiwi_task + "boot"] = substring (boot, search (boot, "/") + 1);
+ string prefix = kiwi_task == "pxe" ? "net" : kiwi_task;
+ Config[prefix + "boot"] = substring (boot, search (boot, "/") + 1);
}
if (ret == `next)
{
- Config["name"] = name;
Config["kiwi_configuration_" + kiwi_task] = kiwi_configuration;
Config["_imported"] = true;
- Config["iso-directory"] = out_dir;
+ Config["iso-directory"] = out_dir +
+ (new_configuration ? "/" + name : "");
+ Config["name"] = name;
Config["sources"] = maplist (
- integer id, string repo, repositories, ``(repo));
+ string url, map repo, repositories, ``(url));
+ Config["new_configuration"] = new_configuration;
if (Config["sources"]:[] != [])
- ProductCreator::enable_sources = false;
- else
{
- // reenable original sources
- Pkg::SourceRestore ();
+ ProductCreator::enable_sources = false;
+ map current_sources = $[];
+ // delete current repos, that won't be used in config
+ foreach (map source, Pkg::SourceEditGet (), {
+ integer srcid = source["SrcId"]:-1;
+ map data = Pkg::SourceGeneralData (srcid);
+ string url = data["url"]:"";
+ current_sources[url] = srcid;
+ });
+ // initialize new repos now
+ foreach (string url, map repo, repositories, {
+ if (substring (url, 0, 1) == "/")
+ url = "dir://" + url;
+ if (haskey (current_sources, url))
+ {
+ current_sources = remove (current_sources, url);
+ return;
+ }
+ if (repo["plaindir"]:false)
+ Pkg::SourceCreateType (url, "", "Plaindir");
+ else
+ Pkg::SourceCreate (url, "");
+ });
+ foreach (string url, integer srcid, current_sources, {
+ Pkg::SourceDelete (srcid);
+ });
Pkg::SourceLoad();
}
ProductCreator::Config = Config;
- ProductCreator::kiwi_task = kiwi_task;
+ Kiwi::current_repositories = repositories;
+ Kiwi::kiwi_task = kiwi_task;
}
y2milestone("Returning %1", ret);
return (symbol) ret;
Modified: trunk/product-creator/src/wizards.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/wizards.ycp?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/src/wizards.ycp (original)
+++ trunk/product-creator/src/wizards.ycp Thu Oct 25 16:01:56 2007
@@ -11,9 +11,11 @@
textdomain "product-creator";
+import "Kiwi";
import "Wizard";
import "Popup";
import "Package";
+import "PackageCallbacksInit";
import "Sequencer";
include "product-creator/complex.ycp";
@@ -135,12 +137,26 @@
}
/**
+ * Initialize the list of current repositories (before any other handling):
+ * we need to know their id's so it is possible to delete them when new
+ * kiwi config is imported (and its repos should be added)
+ */
+symbol InitRepositories () {
+
+ Kiwi::initial_repositories = Kiwi::InitCurrentRepositories ();
+ Kiwi::Read ();
+ return `next;
+}
+
+/**
*/
define symbol KiwiSequence() ``{
map aliases = $[
"init_sources" : [ ``( InitSources () ), true ],
"kiwi" : ``( KiwiDialog () ),
"summary" : ``( CommitConfig() ),
+
+ // FIXME check if it was only kiwi config...
"write" : ``( WriteDialog() ),
];
@@ -148,6 +164,7 @@
"ws_start" : "init_sources",
"init_sources" : $[
`next : "kiwi",
+ `prepare : "prepare"
],
"kiwi": $[
`abort : `abort,
@@ -164,6 +181,40 @@
return Sequencer::Run( aliases, sequence );
}
+define symbol ImageCreatorSequence() {
+
+ map aliases = $[
+ "init_repositories" : [ ``( InitRepositories () ), true ],
+ "images_overview" : ``( ImagesOverviewDialog() ),
+ "kiwi_prepare" : ``( PrepareDialog() ),
+ "kiwi" : ``( KiwiDialog () ),
+ ];
+ map sequence = $[
+ "ws_start" : "init_repositories",
+ "init_repositories" : $[
+ `next : "images_overview"
+ ],
+ "images_overview" : $[
+ `abort : `abort,
+ `kiwi : "kiwi_prepare",
+ `next : `next,
+ ],
+ "kiwi_prepare" : $[
+ `abort : `abort,
+ `next : "kiwi"
+ ],
+ "kiwi": $[
+ `abort : `abort,
+ `next : "images_overview",
+ ],
+ ];
+
+ PackageCallbacksInit::InitPackageCallbacks();
+
+ symbol ret = Sequencer::Run(aliases, sequence);
+ return ret;
+}
+
/**
* Main workflow of the product-creator configuration
* @return sequence result
Modified: trunk/product-creator/yast2-product-creator.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/yast2-product-creator.spec.in?rev=41570&r1=41569&r2=41570&view=diff
==============================================================================
--- trunk/product-creator/yast2-product-creator.spec.in (original)
+++ trunk/product-creator/yast2-product-creator.spec.in Thu Oct 25 16:01:56 2007
@@ -2,6 +2,9 @@
@HEADER@
BuildRequires: perl-XML-Writer update-desktop-files yast2-devtools yast2-testsuite yast2-packager autoyast2-installation yast2-security
+
+PreReq: %fillup_prereq
+
Requires: yast2-packager autoyast2-installation yast2-security
# GPG.ycp and GPGWidgets.ycp
@@ -24,17 +27,20 @@
install -d $RPM_BUILD_ROOT/var/lib/YaST2/product-creator
@CLEAN@
+%post
+%{fillup_only -n product-creator}
%files
%defattr(-,root,root)
%dir @yncludedir@/product-creator
@yncludedir@/product-creator/*
@clientdir@/product-creator.ycp
+@clientdir@/image-creator.ycp
@clientdir@/kiwi.ycp
@moduledir@/*.ycp
@moduledir@/*.ybc
@desktopdir@/product-creator.desktop
-@desktopdir@/kiwi.desktop
+@desktopdir@/image-creator.desktop
@ybindir@/y2mkiso
%doc @docdir@
%dir @ydatadir@/product-creator
@@ -42,3 +48,4 @@
#%dir /etc/YaST2/product-creator
@scrconfdir@/*.scr
@agentdir@/ag_*
+/var/adm/fillup-templates/sysconfig.product-creator
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org