Author: jsuchome Date: Mon Dec 17 13:21:12 2007 New Revision: 43128 URL: http://svn.opensuse.org/viewcvs/yast?rev=43128&view=rev Log: update to SP1 version Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/agents/cfg_product-creator.scr branches/SuSE-SLE-10-SP2-Branch/product-creator/src/SourceDialogsLite.ycp (with props) branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/config.sh (with props) branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/config.xml branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/boot (with props) branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/displaymanager branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/ifcfg-eth0 branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/routes branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/config.sh (with props) branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/config.xml branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/init.d/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/init.d/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/init.d/boot.xen (with props) branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/keyboard branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/network/ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/network/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/network/ifcfg-eth0 branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/sysconfig.product-creator branches/SuSE-SLE-10-SP2-Branch/product-creator/src/image-creator.desktop branches/SuSE-SLE-10-SP2-Branch/product-creator/src/image-creator.ycp (with props) branches/SuSE-SLE-10-SP2-Branch/product-creator/src/kiwi_dialogs.ycp (with props) Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/VERSION branches/SuSE-SLE-10-SP2-Branch/product-creator/agent-kiwi/ag_kiwi branches/SuSE-SLE-10-SP2-Branch/product-creator/agents/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/package/yast2-product-creator.changes branches/SuSE-SLE-10-SP2-Branch/product-creator/src/Kiwi.ycp branches/SuSE-SLE-10-SP2-Branch/product-creator/src/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/ProductCreator.ycp branches/SuSE-SLE-10-SP2-Branch/product-creator/src/commandline.ycp branches/SuSE-SLE-10-SP2-Branch/product-creator/src/complex.ycp branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/Makefile.am branches/SuSE-SLE-10-SP2-Branch/product-creator/src/dialogs.ycp branches/SuSE-SLE-10-SP2-Branch/product-creator/src/helps.ycp branches/SuSE-SLE-10-SP2-Branch/product-creator/src/product-creator.ycp branches/SuSE-SLE-10-SP2-Branch/product-creator/src/wizards.ycp branches/SuSE-SLE-10-SP2-Branch/product-creator/yast2-product-creator.spec.in Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/VERSION (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/VERSION Mon Dec 17 13:21:12 2007 @@ -1 +1 @@ -2.13.5 +2.13.25 Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/agent-kiwi/ag_kiwi URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/agent-kiwi/ag_kiwi (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/agent-kiwi/ag_kiwi Mon Dec 17 13:21:12 2007 @@ -29,15 +29,17 @@ my $optionsNodeList = $systemTree -> getElementsByTagName ("preferences"); my $usrdataNodeList = $systemTree -> getElementsByTagName ("users"); my $packageNodeList = $systemTree -> getElementsByTagName ("packages"); - my $imgnameNodeList = $systemTree -> getElementsByTagName ("image"); +# my $imgnameNodeList = $systemTree -> getElementsByTagName ("image"); my $key = "packages"; $retmap{$key} = {}; for (my $i=1;$i<= $packageNodeList->size();$i++) { my $node = $packageNodeList -> get_node($i); my $type = $node -> getAttribute ("type"); - y2milestone ("package list type: $type"); + y2debug ("package list type: $type"); $retmap{$key}{$type} = {}; + my $patterntype = $node -> getAttribute ("patternType"); + $retmap{$key}{$type}{"patternType"} = $patterntype if $patterntype; foreach my $tag ("package", "opensusePattern", "ignore") { my @sw_list = (); foreach my $element ($node -> getElementsByTagName ($tag)) { @@ -57,22 +59,20 @@ } } my $prefs = $optionsNodeList -> get_node(1); - foreach my $tag ("packagemanager", "version", "rpm-check-signatures", "rpm-force", - "size") { + foreach my $tag ("packagemanager", "version", "rpm-check-signatures", + "rpm-force", "size", "defaultdestination", "defaultroot", "locale") + { my $element = $prefs -> getElementsByTagName ($tag); - $retmap{$tag} = $element-> get_node(1)->textContent () if ($element); + $retmap{$tag} = $element->get_node(1)->textContent () if ($element); } # now get the 'type' attributes # example: <type primary="true" boot="isoboot/suse-10.3" flags="compressed">iso</type> # <type boot="vmxboot/suse-10.3" filesystem="ext3">vmx</type> my @ntag = $prefs -> getElementsByTagName ("type") -> get_nodelist(); foreach my $element (@ntag) { - my $primary = $element -> getAttribute ("primary"); - my $boot = $element -> getAttribute ("boot"); - my $flags = $element -> getAttribute ("flags"); my $type = $element -> textContent (); my %typemap = (); - foreach my $attr ("primary", "boot", "flags", "filesystem") { + foreach my $attr ("primary", "boot", "flags", "filesystem", "format") { my $val = $element -> getAttribute ($attr); $typemap{$attr} = $val if defined $val; } @@ -92,6 +92,19 @@ $retmap{$tag} = $element-> get_node(1)->textContent () if ($element); } + my $image = $systemTree -> getElementsByTagName ("image")->get_node (1); + my $image_name = $image -> getAttribute ("name"); + if ($image_name) { + $retmap{"name"} = $image_name; + y2milestone ("image name: $image_name"); + } + + my $scheme_ver = $image -> getAttribute ("schemeversion"); + $retmap{"schemeversion"} = $scheme_ver if $scheme_ver; + + my $inherit = $image -> getAttribute ("inherit"); + $retmap{"inherit"} = $inherit if $inherit; + $retmap{"users"} = {}; foreach my $usernode ($usrdataNodeList -> get_nodelist()) { my $group = $usernode -> getAttribute("group"); @@ -114,7 +127,7 @@ for (my $i=1;$i<= $driversNodeList->size();$i++) { my $node = $driversNodeList -> get_node($i); my $type = $node -> getAttribute ("type"); - y2milestone ("driver list type: $type"); + y2debug ("driver list type: $type"); $retmap{$key}{$type} = {}; foreach my $tag ("file") { my @list = (); @@ -128,26 +141,25 @@ } } $key = "repository"; - $retmap{$key} = {}; + my @repolist = (); for (my $i=1;$i<= $repositNodeList->size();$i++) { my $node = $repositNodeList -> get_node($i); - my $type = $node -> getAttribute ("type"); - y2milestone ("repo type: $type"); - my $status = $node -> getAttribute ("status"); - $retmap{$key}{$type} = {}; - $retmap{$key}{$type}{"status"} = $status if $status; - foreach my $tag ("source") { - # maybe it doesn't have sense to have list of sources in one repo... - my @list = (); - foreach my $element ($node -> getElementsByTagName ($tag)) { - my %item = (); - my $path = $element -> getAttribute ("path"); - $item{"path"} = $path if $path; - push @list, %item if %item; - } - $retmap{$key}{$type}{$tag} = @list if @list; + my %repo = (); + foreach my $tag ("type", "status") { + my $val = $node -> getAttribute ($tag); + $repo{$tag} = $val if $val; + } + my @list = (); # maybe list is not needed here... + foreach my $element ($node -> getElementsByTagName ("source")) { + my %item = (); + my $path = $element -> getAttribute ("path"); + $item{"path"} = $path if $path; + push @list, %item if %item; } + $repo{"source"} = @list if @list; + push @repolist, %repo if %repo; } + $retmap{$key} = @repolist if @repolist; ycp::Return (%retmap, 1); } elsif ($command eq "result") Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/agents/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/agents/Makefile.am (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/agents/Makefile.am Mon Dec 17 13:21:12 2007 @@ -4,6 +4,6 @@ agent_SCRIPTS = -scrconf_DATA = +scrconf_DATA = cfg_product-creator.scr EXTRA_DIST = $(agent_SCRIPTS) $(scrconf_DATA) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/agents/cfg_product-creator.scr URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/agents/cfg_product-creator.scr (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/agents/cfg_product-creator.scr Mon Dec 17 13:21:12 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: branches/SuSE-SLE-10-SP2-Branch/product-creator/package/yast2-product-creator.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/package/yast2-product-creator.changes (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/package/yast2-product-creator.changes Mon Dec 17 13:21:12 2007 @@ -1,4 +1,191 @@ ------------------------------------------------------------------- +Wed Dec 5 12:33:16 CET 2007 - jsuchome@suse.cz + +- fixed generating configuration path name (#346152) +- 2.13.25 + +------------------------------------------------------------------- +Fri Nov 16 12:59:17 CET 2007 - jsuchome@suse.cz + +- do not mention CD source in help texts (#341615) +- disable Delete button when there's nothing to delete (#341932) +- make the progress window smaller with small resolutions (#342046) +- do not automatically remove broken sources from the table (#341634) +- bigger timout before killing kiwi with SIGKILL (#341635) +- 2.13.24 + +------------------------------------------------------------------- +Mon Nov 12 12:30:16 CET 2007 - jsuchome@suse.cz + +- do not allow importing non-system configurations (#340495) +- 2.13.23 + +------------------------------------------------------------------- +Tue Nov 6 13:09:09 CET 2007 - jsuchome@suse.cz + +- remove unsupported source types also for product-creator-> kiwi + workflow (#339110) +- 2.13.22 + +------------------------------------------------------------------- +Mon Nov 5 21:56:21 CET 2007 - jsuchome@suse.cz + +- do not allow source types not supported by kiwi (#339110) +- 2.13.21 + +------------------------------------------------------------------- +Fri Nov 2 11:02:42 CET 2007 - jsuchome@suse.cz + +- correctly escape strings which should be written to config.xml + (seen in #338090) +- 2.13.20 + +------------------------------------------------------------------- +Thu Nov 1 10:57:39 CET 2007 - jsuchome@suse.cz + +- save all types from the template to target config.xml +- show correct list of repositories when going back (#337862) +- fixed checking if repository has 'plaindir' format (#338115) +- show which repositories YaST failed to add (#337618) +- added support for "format" and "locale" tags in config.xml +- added support for OEM image type +- 2.13.19 + +------------------------------------------------------------------- +Fri Oct 26 10:25:49 CEST 2007 - jsuchome@suse.cz + +- fix the sequence for going to kiwi image from main summary +- do not read the template name when going from main summary +- 2.13.18 + +------------------------------------------------------------------- +Thu Oct 25 14:05:48 CEST 2007 - jsuchome@suse.cz + +- allow more characters in the image name +- 2.13.17 + +------------------------------------------------------------------- +Tue Oct 16 23:37:05 CEST 2007 - jsuchome@suse.cz + +- 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) +- 2.13.16 + +------------------------------------------------------------------- +Mon Oct 15 16:41:48 CEST 2007 - jsuchome@suse.cz + +- update defaultroot only for new configurations (#327057) +- check for absolute paths in boot image entry +- index repositories by url, not by order +- 2.13.15 + +------------------------------------------------------------------- +Mon Oct 15 13:27:11 CEST 2007 - jsuchome@suse.cz + +- fix initializing when going Back (#332581) +- 2.13.14 + +------------------------------------------------------------------- +Fri Oct 12 11:15:01 CEST 2007 - jsuchome@suse.cz + +- 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) +- 2.13.13 + +------------------------------------------------------------------- +Tue Oct 2 11:49:14 CEST 2007 - jsuchome@suse.cz + +- 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) +- 2.13.12 + +------------------------------------------------------------------- +Mon Oct 1 14:43:47 CEST 2007 - jsuchome@suse.cz + +- do not close module after kiwi failure (#327593) +- check stderr and stdout after kiwi finish/failure (#327610) +- do not allow configuration without name (#328003) +- destination directory specified in sysconfig file (#327055) +- support for kiwi images templates (F302371) +- support project control for images (F302370) +- use zypper instead of smart +- write schemeversion to config.xml +- directories with templates are specified in + /etc/sysconfig/product-creator +- enable modifications of configurations without creating images +- do not import already imported and modified configuration +- enable support for unlisted boot images (e.g. netboot) +- show the maximum available space +- use lazy initialization of installation sources +- tell zypper to ignore zypp lock (#310581) +- remove 'prepare' directory before calling kiwi (#325664) +- use defaultroot value from config.xml for 'prepare' directory (F302371) + +------------------------------------------------------------------- +Mon Sep 17 15:27:43 CEST 2007 - jsuchome@suse.cz + +- support installation sources of s390x (#301362) + +------------------------------------------------------------------- +Tue Aug 28 10:58:22 CEST 2007 - jsuchome@suse.cz + +- include the package from "post-packages" section of autoyast + profile (#291776) +- 2.13.11 + +------------------------------------------------------------------- +Fri Aug 24 14:57:50 CEST 2007 - jsuchome@suse.cz + +- do not require packages with image descriptions, include required + files (originally created by ms@suse.de for kiwi-desc-buildservice + and kiwi-desc-livesystem) as templates (#289552) +- show kiwi error output in separate window +- mark plaindir installation types as rpm-dir in config.xml +- 2.13.10 + +------------------------------------------------------------------- +Fri Aug 10 14:48:44 CEST 2007 - jsuchome@suse.cz + +- CLI option for gpg passphrase (daniel.rahn and lslezak, #287477) +- 2.13.9 + +------------------------------------------------------------------- +Wed Aug 8 15:19:45 CEST 2007 - jsuchome@suse.cz + +- yet another fix for "Back" button behavior (#289524) +- enable editing of isolinux.cfg in case of autoYaST usage (#287443) +- kiwi config: fixed path to directory with XEN template +- 2.13.8 + +------------------------------------------------------------------- +Wed Jul 25 09:41:05 CEST 2007 - lslezak@suse.cz + +- fixed "Back" button behavior in the Isolinux configuration + dialog (#289524) + +------------------------------------------------------------------- +Mon Jun 18 11:17:42 CEST 2007 - jsuchome@suse.cz + +- changed "Create ISO image" button label, added missing help text + (#284276) +- 2.13.7 + +------------------------------------------------------------------- +Wed Jun 13 14:44:47 CEST 2007 - jsuchome@suse.cz + +- merged texts from proofreading +- fixed the help text for signing (#283235) +- 2.13.6 + +------------------------------------------------------------------- Tue Jun 5 15:35:29 CEST 2007 - jsuchome@suse.cz - kiwi UI: create output directly in output directory to prevent Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/Kiwi.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/Kiwi.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/Kiwi.ycp Mon Dec 17 13:21:12 2007 @@ -21,15 +21,49 @@ import "Report"; import "Security"; import "String"; + import "URL"; string encryption_method = nil; + + // temporary directory, where kiwi is working global string tmp_dir = ""; - global string images_dir = "/usr/share/kiwi/image"; + // 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 = "zypper"; + + list<map> all_sources = []; + + // repositories used for current configuration + global map <string,map> current_repositories = $[]; + + // initial system repositories + global map <string,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<string,map> Templates = $[]; + + // repository schemes unsupported by kiwi + // (= not to be offered as new sources, to be deleted + // from current system sources) + global list<string> unsupported_schemes = [ "iso", "cd", "dvd", "nfs", "smb" ]; + /** * crypt given user password with current encryption algorithm */ @@ -57,31 +91,130 @@ if (substring (source, 0, 6) == "dir://") return substring (source, 6); - //FIXME plaindir -> rpm-dir return source; } /** + * generate the 'repository' tag + */ + 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); + + foreach (map sourcemap, all_sources, { + integer srcid = sourcemap["SrcId"]:-1; + map data = Pkg::SourceGeneralData (srcid); + string url = data["url"]:""; + if (url == source || url == source_path) + { + if (data["type"]:"" == "Plaindir") + type = "rpm-dir"; + if (data["type"]:"" == "YUM") + type = "rpm-md"; + } + }); + ret = $[ + "__key" : "repository", + "type" : type, + "__children": [ + $[ + "__key" : "source", + "path" : source_path + ] + ] + ]; + return ret; + } + + /** * generate the name of directory with kiwi configuration */ string get_config_dir (string name, string task) { - return "/kw" + task + "-YaST-" + deletechars (name, " \t"); + return deletechars (name, " \t"); } + /** - * generate the value for image type + * generate the values for image type */ - map get_type_value (map config, string task) { + list<map> get_type_values (map config, string task) { + string boot_image = sformat ("%1boot/%2", task, config[task + "boot"]:"suse-10.2"); + list<map> retlist = maplist ( + string type, map typemap, (map<string,map>)config["type"]:$[], { + + if (typemap["boot"]:"" != "") + boot_image = typemap["boot"]:""; + + map ret = $[ + "__key" : "type", + "__value" : type, + "boot" : boot_image, + ]; + if (type != "iso") + ret["filesystem"] = typemap["filesystem"]:"ext3"; + if (typemap["flags"]:"" != "") + ret["flags"] = typemap["flags"]:""; + if (typemap["format"]:"" != "") + ret["format"] = typemap["format"]:""; + if (type == task) + ret["primary"] = "true"; + return ret; + }); + if (retlist == []) + { + map ret = $[ + "__key" : "type", + "__value" : task, + "boot" : boot_image, + "primary" : "true" + ]; + if (task != "iso") + ret["filesystem"] = "ext3"; + retlist = [ ret ]; + } + return retlist; + } + + /** + * generate the list of packages/patterns for image + */ + map get_image_packages (map config, list packages, list patterns,list ignored) + { map ret = $[ - "__key" : "type", - "__value" : task, - "primary" : "true", - "boot" : sformat ("%1boot/%2", task, config[task + "boot"]:"suse-10.2"), -//FIXME (KiwiConfig["compressed"]:false ? ",compressed" : ""), + "__key" : "packages", + "type" : "image", + "__children": union (union (packages, patterns), ignored) ]; - if (task != "iso") - ret["filesystem"] = "ext3"; + if (config["image_patternType"]:"" != "") + ret["patternType"] = config["image_patternType"]:""; return ret; } @@ -120,9 +253,10 @@ children = children + "\n" + Map2XML (chmap, level + 1); }); else if (subkey == "__value") - value = sformat ("%1", val); + value = String::EscapeTags (sformat ("%1", val)); else if (is (val, string)) - ret = sformat ("%1 %2="%3"", ret, subkey, val); + ret = sformat ("%1 %2="%3"", + ret, subkey, String::EscapeTags (tostring (val))); }); if (non_unique_key[key]:false) return sformat ("%1/>", ret); @@ -148,41 +282,80 @@ return ret; map config = (map) SCR::Read (.kiwi, base_path + "/config.xml"); + if (config == nil) + return ret; map<string,map> packages = config["packages"]:$[]; // rest parts of "packages" are saved in product-creator map - ret["ignore"] = maplist (map p, (list<map>)packages["image","ignore"]:[], ``(p["name"]:"")); + ret["ignore"] = maplist (map p, + (list<map>)packages["image","ignore"]:[], ``(p["name"]:"")); // value of "arch" is currently ignored... foreach (string section, [ "boot", "xen" ], { - ret[section + "_packages"] = - maplist (map p, (list<map>)packages[section, "package"]:[], ``(p["name"]:"")); - ret[section + "_patterns"] = - maplist (map p, (list<map>)packages[section, "opensusePattern"]:[], ``(p["name"]:"")); - ret[section + "_ignore"] = - maplist (map p, (list<map>)packages[section, "ignore"]:[], ``(p["name"]:"")); - }); + ret[section + "_packages"] = maplist (map p, + (list<map>)packages[section, "package"]:[], ``(p["name"]:"")); + ret[section + "_patterns"] = maplist (map p, + (list<map>)packages[section,"opensusePattern"]:[],``(p["name"]:"")); + ret[section + "_ignore"] = maplist (map p, + (list<map>)packages[section, "ignore"]:[], ``(p["name"]:"")); + }); + // list of packages and patterns is needed for import, not for new image + ret["addons"] = maplist (map p, + (list<map>)packages["image","opensusePattern"]:[], ``(p["name"]:"")); + 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"]:"" != "") ret["xen_disk"] = packages["xen","disk"]:""; if (packages["xen","memory"]:"" != "") ret["xen_memory"] = tointeger (packages["xen","memory"]:"512"); -// FIXME read list of packages and patterns???? -> only for non-default! - foreach (string key, [ "author", "contact", "specification", "packagemanager", "version", - "rpm-check-signatures", "rpm-force", "sizeunit", "type" ], { + foreach (string key, [ "author", "contact", "image_type", "specification", + "packagemanager", "version", "rpm-check-signatures", "rpm-force", + "sizeunit", "type", "name", "repository", "defaultdestination", + "schemeversion", "defaultroot", "inherit", "locale"], + { if (config[key]:nil != nil) ret[key] = config[key]:nil; }); if (haskey (config, "size")) ret["size"] = tointeger (config["size"]:"2700"); - + if (haskey (config, "defaultdestination")) + ret["iso-directory"] = config["defaultdestination"]:""; + foreach (string user, map usermap, (map<string,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 + ]; + }); return ret; } /** * 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 = []; @@ -248,32 +421,16 @@ ]); }); - list write_list = [ $[ - "__key" : "image", - "name" : KiwiConfig["name"]:"", - "__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), $[ "__key" : "version", "__value" : KiwiConfig["version"]:"1", @@ -285,8 +442,7 @@ ], $[ "__key" : "packagemanager", -// "__value" : "zypper", FIXME still not working for SLES10SP1... - "__value" : "smart", + "__value" : KiwiConfig["packagemanager"]:default_packagemanager ], $[ "__key" : "rpm-check-signatures", @@ -296,10 +452,60 @@ "__key" : "rpm-force", "__value" : KiwiConfig["rpm-force"]:"True", ], + $[ + "__key" : "defaultdestination", + "__value" : KiwiConfig["iso-directory"]:"", + ], + ], + ]; + foreach (map typemap, get_type_values (KiwiConfig, task), { + preferences["__children"] = prepend (preferences["__children"]:[], + typemap); + }); + if (KiwiConfig["defaultroot"]:"" != "") + { + preferences["__children"] = add (preferences["__children"]:[], $[ + "__key" : "defaultroot", + "__value" : KiwiConfig["defaultroot"]:"", + ]); + } + if (KiwiConfig["locale"]:"" != "") + { + preferences["__children"] = add (preferences["__children"]:[], $[ + "__key" : "locale", + "__value" : KiwiConfig["locale"]:"", + ]); + } + + + 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"]:[], $[ @@ -317,34 +523,20 @@ ]); } write_list[0,"__children"] = union (write_list[0,"__children"]:[], - maplist (string source, (list<string>) KiwiConfig["sources"]:[], { - return $[ - "__key" : "repository", - "type" : "yast2", //FIXME rpm-dir? - "__children": [ - $[ - "__key" : "source", - "path" : adapt_source_path (source), - ] - ] - ]; - }) + maplist (string source, (list<string>) KiwiConfig["sources"]:[], + ``(get_source_value (source, KiwiConfig)) + ) ); write_list[0,"__children"] = union (write_list[0,"__children"]:[], [ - $[ - "__key" : "packages", - "type" : "image", -// "patternType" : "onlyRequired". // FIXME what does this mean? -// "patternType" : "plusRecommended", - "__children": union (union (packages_list, patterns_list), ignored_list) - ], + get_image_packages ( + KiwiConfig, packages_list, patterns_list, ignored_list), $[ "__key" : "packages", "type" : "boot", "__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", @@ -356,13 +548,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)) { @@ -382,6 +583,10 @@ SCR::Execute (.target.bash, "chmod +x " + config_dir + "/" + file); } }); + foreach (string file, KiwiConfig["import_files"]:[], { + y2milestone ("copying %1 to %2", file,config_dir); + SCR::Execute (.target.bash, sformat ("cp -ar %1 %2/", file,config_dir)); + }); return true; } @@ -396,35 +601,59 @@ return false; } - /* rather do not remove, filesystem can be mounted - 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)); } - */ - - string cmd = sformat ("kiwi --root %1/myphysical --prepare %2 --logfile terminal", tmp_dir, config_dir); - - y2milestone ("calling '%1'", cmd); - - SCR::Execute (.background.run_output_err, cmd); + integer height = 8; + map display_info = UI::GetDisplayInfo (); + // reduce the height with small resolutions (#342046) + if (display_info["TextMode"]:false || display_info["Height"]:0 < 600) + height = 6; // construct the dialog UI::OpenDialog(`opt(`decorated), `HBox(`HSpacing(1.5), - `VSpacing(25), `VBox( `HSpacing(85), - `VSpacing(0.5), - // label - `ReplacePoint (`id (`rpl), `Left (`Label(_("Preparing physical extend...")))), - `VSpacing(0.5), - `LogView (`id (`log), "", 8, 0), - `VSpacing(0.5), - `ReplacePoint (`id (`rp), `PushButton (`id(`cancel),`opt(`key_F9), Label::CancelButton ())), - `VSpacing(0.5)), - `HSpacing(1.5) + `VWeight (2, `VBox ( + `VSpacing(0.5), + // label + `ReplacePoint (`id (`rpl), `Left (`Label(_("Preparing for Image Creation")))), + `VSpacing(0.5), + `LogView (`id (`log), "", height, 0) + )), + `VWeight (1, `VBox ( + `VSpacing(0.5), + `LogView (`id (`errlog), "", height / 2, 0), + `VSpacing(0.5), + `ReplacePoint (`id (`rp), `PushButton (`id(`cancel),`opt(`key_F9), Label::CancelButton ())), + `VSpacing(0.5) + )) + ), `HSpacing(1.5) )); + 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"); + }); + + list<string> err = (list<string>) SCR::Read(.background.newerr); + foreach (string line, err, { + line = String::Replace (line, "\r", "\n"); + UI::ChangeWidget (`id(`errlog), `LastLine, line + "\n"); + }); + } + + string cmd = sformat ("ZYPP_READONLY_HACK=1 kiwi --root %1 --prepare %2 --logfile terminal", chroot_dir, config_dir); + + y2milestone ("calling '%1'", cmd); + + SCR::Execute (.background.run_output_err, cmd); + symbol ret = nil; boolean creating = false; do @@ -433,23 +662,18 @@ if ((boolean) SCR::Read(.background.output_open) && (integer) SCR::Read(.background.newlines)>0) { - // 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"); - }); - - list script_err = (list) SCR::Read(.background.newerr); + update_output (); } else if (!(boolean)SCR::Read(.background.isrunning)) { + update_output (); + integer status = (integer) SCR::Read (.background.status); if (status != 0) { UI::ReplaceWidget (`id (`rp), `HBox ( // label (command result) - `Label (`opt (`boldFont), _("KIWI failed.")), + `Label (`opt (`boldFont), _("Image creation failed.")), `PushButton (`id(`close), Label::CloseButton ()) )); ret = (symbol) UI::UserInput (); @@ -462,11 +686,10 @@ // 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...")))); + UI::ReplaceWidget (`id (`rpl), `Left (`Label (_("Creating Image")))); SCR::Execute (.background.run_output_err, cmd); ret = nil; continue; @@ -475,7 +698,7 @@ { UI::ReplaceWidget (`id (`rp), `HBox ( // label (command result) - `Label (`opt (`boldFont), _("KIWI succeeded.")), + `Label (`opt (`boldFont), _("Image creation succeeded.")), `PushButton (`id(`ok), Label::OKButton ()) )); ret = (symbol) UI::UserInput (); @@ -484,12 +707,27 @@ } if (ret == `cancel) { - SCR::Execute(.background.kill); + integer pid = (integer)SCR::Read (.background.pid); + if (pid != -1) + { + // first, send a sigterm + SCR::Execute (.target.bash, sformat ("kill %1", pid)); + // busy popup message + Popup::ShowFeedback (_("Closing kiwi..."), + // busy popup message + _("This will take a while...")); + sleep (5000); + if ((boolean)SCR::Read(.background.isrunning)) + // .background.kill sends a sigkill after another second + SCR::Execute(.background.kill); + Popup::ClearFeedback (); + } } sleep (100); } while (ret == nil); - SCR::Execute(.background.kill); + if ((boolean)SCR::Read(.background.isrunning)) + SCR::Execute(.background.kill); UI::CloseDialog (); return ret == `ok; } @@ -497,11 +735,124 @@ /** * 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 <string,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 <string,map> InitCurrentRepositories () { + + Pkg::SourceRestore (); + foreach (map source, Pkg::SourceEditGet (), { + integer srcid = source["SrcId"]:-1; + map data = Pkg::SourceGeneralData (srcid); + string url = data["url"]:""; + map parsed = URL::Parse(url); + if (! contains (unsupported_schemes, parsed["scheme"]:"")) + { + 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 (config["image_type"]:"" != "system") + y2warning ("%1 not a 'system' image type, skipping", name); + else 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: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/Makefile.am (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/Makefile.am Mon Dec 17 13:21:12 2007 @@ -8,7 +8,8 @@ YCPCFLAGS = -I ./include client_DATA = \ - product-creator.ycp + product-creator.ycp \ + image-creator.ycp ynclude_DATA = \ helps.ycp \ @@ -17,15 +18,16 @@ complex.ycp \ routines.ycp \ commandline.ycp \ - kiwi.ycp - + kiwi_dialogs.ycp desktop_DATA = \ - product-creator.desktop + product-creator.desktop \ + image-creator.desktop module_DATA = \ ProductCreator.ycp \ - Kiwi.ycp + Kiwi.ycp \ + SourceDialogsLite.ycp EXTRA_DIST = $(client_DATA) $(ynclude_DATA) $(module_DATA) $(desktop_DATA) Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/ProductCreator.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/ProductCreator.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/ProductCreator.ycp Mon Dec 17 13:21:12 2007 @@ -62,6 +62,7 @@ global boolean profile_parsed = false; +global integer max_size_mb = 999 * 1024; /* Configuration Map */ global map<string, any> Config = $[]; @@ -90,8 +91,8 @@ 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; // original source configuration, needed to reset the package manager list<map<string,any> > original_config = nil; @@ -125,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); @@ -141,7 +144,7 @@ { list<string> items = splitstring(dir_listing, "\n"); - code10 = code10 || contains(items, Arch::architecture() + "/"); + code10 = code10 || contains(items, arch + "/"); } } }); @@ -558,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()]; @@ -1041,6 +1046,7 @@ integer sles_src = 0; string descr_dir = ""; string arch = Arch::architecture(); + if (arch == "s390_64") arch = "s390x"; y2milestone("Config: %1", Config); @@ -1655,7 +1661,9 @@ if (!inserted) { - Report::Error(sformat(_("Could not add GPG key %1 to initrd\n%2"), gpg_key, initrd)); + Report::Error(sformat(_("Could not add GPG key %1 to initrd +%2. +"), gpg_key, initrd)); ret = false; } } @@ -1734,7 +1742,9 @@ // yes/no popup: error message if (!signed) { - if (Popup::YesNo(_("Error: Could not digitally sign the source.\nTry it again?"))) + if (Popup::YesNo(_("Error: Could not digitally sign the source. +Try again? +"))) { passphrase = (Mode::commandline()) ? gpg_passphrase : GPGWidgets::AskPassphrasePopup(gpg_key); } @@ -1772,6 +1782,7 @@ string cpCmd = ""; string arch = Arch::architecture(); + if (arch == "s390_64") arch = "s390x"; y2debug("isolinux.cfg: %1", Config["bootconfig"]:"" ); if (Config["bootconfig"]:"" != "") { @@ -1885,6 +1896,10 @@ global define void enableSources()``{ + // used by standalone kiwi UI, which does onw sources handling... + if (!enable_sources) + return; + // TODO FIXME: use better way to reset the source config in the package manager if (original_config != nil) { @@ -2183,7 +2198,9 @@ if (l_packge == nil || l_packge == "") { - Report::Error(sformat(_("Cannot download package %1\n from source %2"), package["path"]:"", source)); + Report::Error(sformat(_("Cannot download package %1 + from source %2. +"), package["path"]:"", source)); ret = false; break; } @@ -2276,6 +2293,18 @@ PackageAI::toinstall = software["packages"]:[]; Config["packages"] = AutoinstSoftware::autoinstPackages(); + + // add "post-packages" + list post_packages = software["post-packages"]:[]; + if (size(post_packages) > 0) + { + y2milestone("Adding "post-packages": %1", post_packages); + Config["packages"] = union(Config["packages"]:[], post_packages); + } + + // TODO: remove also "remove-packages" from the list? + // Is it safe to remove them due to possible dependencies?? + y2milestone("Config: %1", Config ); profile_parsed = true; return true; Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/SourceDialogsLite.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/SourceDialogsLite.ycp (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/SourceDialogsLite.ycp Mon Dec 17 13:21:12 2007 @@ -0,0 +1,1031 @@ +/** + * File: SourceDialogsLite.ycp + * + * Authors: Jiri Srain <jsrain@suse.cz> + * Klaus Kaempf <kkaempf@suse.de> + * Gabriele Strattner <gs@suse.de> + * Stefan Schubert <schubi@suse.de> + * Cornelius Schumacher <cschum@suse.de> + * + * Purpose: + * Reduced version of SourceDialogs.ycp: removed the support for + * source types unsupported by kiwi (#339110) + * + * $Id$ + */ + +{ +textdomain "packager"; + +module "SourceDialogsLite"; + +import "Label"; +import "URL"; +import "Popup"; +import "CWM"; +import "SourceManager"; + +// common functions / data + +/** + * URL to work with + */ +string _url = ""; + +/** + * Allow HTTPS for next source dialog? + */ +boolean _allow_https = true; + +/** + * Help text suffix for some types of the medias + */ +string multi_cd_help = _("<p>If the catalog is on multiple medias, +set the location of the first media of the set.</p>"); + +/** + * Set the URL to work with + * @param url string URL to run the dialogs with + */ +global void SetURL (string url) { + _url = url; +} + +/** + * Return URL after the run of the dialog + * @return string the URL + */ +global string GetURL () { + return _url; +} + +/** + * Postprocess URL of an ISO image + * @param url string URL in the original form + * @return string postprocessed URL + */ +string PosprocessISOURL (string url) { + y2milestone ("Updating ISO URL %1", url); + integer last = findlastof (url, "/") + 1; + string onlydir = substring (url, 0, last); + url = "iso:/?iso=" + substring (url, last) + "&url=" + onlydir; + y2milestone ("Updated URL: %1", url); + return url; +} + +/** + * Check if URL is an ISO URL + * @param url string URL to check + * @return boolean true if URL is an ISO URL, false otherwise + */ +boolean IsISOURL (string url) { + boolean ret = substring (url, 0, 5) == "iso:/" && + issubstring (url, "&url="); + y2milestone ("URL %1 is ISO: %2", url, ret); + return ret; +} + +/** + * Preprocess the ISO URL to be used in the dialogs + * @param url string URL to preprocess + * @return string preprocessed URL + */ +string PreprocessISOURL (string url) { + y2milestone ("Preprocessing ISO URL %1", url); + integer url_pt = search (url, "&url="); + string serverpart = substring (url, url_pt + 5); + string isopart = substring (url, 0, url_pt); + url = serverpart + substring (isopart, search (isopart, "iso=") + 4); + y2milestone ("Updated URL: %1", url); + return url; +} + +/** + * check if given path points to ISO file + * @param url string URL to check + * @return boolean true if URL is ISO image + */ +boolean PathIsISO (string url) { + if (size (url) < 4) return false; + return substring (url, size (url) - 4, 4) == ".iso"; +} + +/** + * Add a slash to the part of url, if it is not already present + * @param urlpart string a part of the URL + * @return string urlpart with leading slash + */ +string Slashed (string urlpart) { + if ( substring( urlpart, 0, 1 ) == "/" ) + return urlpart; + return "/" + urlpart; +} + +/** + * Remove leading and trailing (and inner) spaces from the host name + * @param host string original host name + * @return string host without leading and trailing spaces + */ +string NormalizeHost (string host) { + host = deletechars (host, " \t"); + return host; +} + +/** + * Return an HBox with ok and cancel buttons for use by other dialogs. + * @return An HBox term for use in a CreateDialog call. + */ +term PopupButtons() { + return `HBox( + `PushButton( `id( `ok ), `opt( `default ), Label::OKButton() ), + `HStretch(), + `PushButton( `id( `cancel ), Label::CancelButton() ) + ); +} + +/** + * Get scheme of a URL, also for ISO URL get scheme of the access protocol + * @param url string URL to get scheme for + * @return string URL scheme + */ +string URLScheme (string url) { + string scheme = ""; + if (IsISOURL (url)) + { + string tmp_url = PreprocessISOURL (url); + map parsed = URL::Parse (tmp_url); + scheme = parsed["scheme"]:""; + } + else + { + map parsed = URL::Parse (url); + scheme = parsed["scheme"]:""; + } + + if (scheme == "" || scheme == nil) + scheme = "url"; + y2milestone ("URL scheme for URL %1: %2", url, scheme); + return scheme; +} + +// raw URL editation widget + +/** + * Init function of a widget + * @param key string widget key + */ +void PlainURLInit (string key) { + UI::ChangeWidget (`id (`url), `Value, _url); + UI::SetFocus (`url); +} + +/** + * Store function of a widget + * @param key string widget key + * @param event map which caused settings being stored + */ +void PlainURLStore (string key, map event) { + _url = (string)UI::QueryWidget (`id (`url), `Value); +} + +boolean PlainURLValidate (string key, map event) { + string url = (string)UI::QueryWidget (`id (`url), `Value); + if (url == "") + { + UI::SetFocus (`id (`url)); + // popup message + Popup::Message (_("URL cannot be empty.")); + return false; + } + return true; +} + +/** + * Get widget description map + * @return widget description map + */ +map<string,any> PlainURLWidget () { + return $[ + "widget" : `custom, + "custom_widget" : `VBox ( + // text entry + `TextEntry( `id( `url ), _("&URL") ) + ), + "init" : PlainURLInit, + "store" : PlainURLStore, + "validate_type" : `function, + "validate_function" : PlainURLValidate, + // help text + "help" : _("<p><big><b>Catalog URL</b></big><br> +Use <b>URL</b> to specify the URL of the catalog.<p>") + multi_cd_help, + ]; +} + +// NFS editation widget + +/** + * Init function of a widget + * @param key string widget key + */ +void NFSInit (string key) { + boolean iso = IsISOURL (_url); + if (iso) + _url = PreprocessISOURL (_url); + map parsed = URL::Parse (_url); + UI::ChangeWidget (`id (`server), `Value, parsed["host"]:""); + UI::ChangeWidget (`id (`dir), `Value, parsed["path"]:""); + UI::SetFocus (`server); +} + +/** + * Store function of a widget + * @param key string widget key + * @param event map which caused settings being stored + */ +void NFSStore (string key, map event) { + map parsed = $[ + "scheme" : "nfs", + "host" : NormalizeHost ( + (string)UI::QueryWidget (`id (`server), `Value)), + "path" : (string)UI::QueryWidget (`id (`dir), `Value), + ]; + _url = URL::Build (parsed); +} + +/** + * Get widget description map + * @return widget description map + */ +map<string,any> NFSWidget () { + return $[ + "widget" : `custom, + "custom_widget" : `VBox ( + // text entry + `TextEntry (`id (`server), _("&Server Name")), + // text entry + `TextEntry (`id (`dir), _("&Path to Directory")) + ), + "init" : NFSInit, + "store" : NFSStore, + // help text + "help" : _("<p><big><b>NFS Server</b></big><br> +Use <b>Server Name</b> and <b>Path to Directory</b> +to specify the NFS server host name and path on the server.<p>") ++ multi_cd_help, + ]; +} + +// CD/DVD source widget + +/** + * Init function of a widget + * @param key string widget key + */ +void CDInit (string key) { + map parsed = URL::Parse (_url); + string scheme = parsed["scheme"]:""; + if (scheme == "dvd") + UI::ChangeWidget (`id (`cd), `Value, true); + else + UI::ChangeWidget (`id (`dvd), `Value, true); + UI::SetFocus (`cd); +} + +/** + * Store function of a widget + * @param key string widget key + * @param event map which caused settings being stored + */ +void CDStore (string key, map event) { + symbol device = (symbol)UI::QueryWidget (`id (`device), `CurrentButton); + if (device == `cd) + _url = "cd:///"; + else + _url = "dvd:///"; +} + +/** + * Get widget description map + * @return widget description map + */ +map<string,any> CDWidget () { + return $[ + "widget" : `custom, + "custom_widget" : `RadioButtonGroup (`id (`device), `VBox ( + // radio button + `Left (`RadioButton (`id (`cd), _("&CD-ROM"))), + // radio button + `Left (`RadioButton (`id (`dvd ), _("&DVD-ROM"))) + )), + "init" : CDInit, + "store" : CDStore, + "help" : _("<p><big><b>CD or DVD Media</b></big><br> +Set <b>CD-ROM</b> or <b>DVD-ROM</b> to specify the type of media.</p>"), + ]; +} + +// File / Directory source widget + +/** + * Init function of a widget + * @param key string widget key + */ +void DirInit (string key) { + boolean iso = IsISOURL (_url); + if (iso) + _url = PreprocessISOURL (_url); + map parsed = URL::Parse (_url); + UI::ChangeWidget (`id (`dir), `Value, parsed["path"]:""); + UI::SetFocus (`dir); + +} + +/** + * Store function of a widget + * @param key string widget key + * @param event map which caused settings being stored + */ +void DirStore (string key, map event) { + map parsed = $[ + "scheme" : "dir", + "path" : (string)UI::QueryWidget (`id (`dir), `Value), + ]; + _url = URL::Build (parsed); + + if (UI::WidgetExists(`id(`ch_iso))) + { + boolean iso = (boolean)UI::QueryWidget (`id (`ch_iso), `Value); + if (iso) + _url = PosprocessISOURL (_url); + } +} + +/** + * Handle function of a widget + * @param key string widget key + * @param event map which caused settings being stored + * @return always nil + */ +symbol DirHandle (string key, map event) { + + string dir = (string)UI::QueryWidget (`id (`dir), `Value); + string result = + // dialog caption + UI::AskForExistingDirectory (dir, _("Local Directory")); + if ( result != nil ) + UI::ChangeWidget (`id (`dir), `Value, result); + return nil; +} + +/** + * Get widget description map + * @return widget description map + */ +map<string,any> DirWidget () { + return $[ + "widget" : `custom, + "custom_widget" : `VBox( + `HBox( + // text entry + `TextEntry (`id (`dir), _("&Path to Directory")), + `VBox ( + `Label (""), + // push button + `PushButton (`id (`browse), _("&Browse...")) + ) + ) + ), + "init" : DirInit, + "store" : DirStore, + "handle" : DirHandle, + "handle_events" : [ `browse ], + "help" : _("<p><big><b>Local Directory</b></big><br> +Ise <b>Path to Directory</b> to specify the path to the +directory of the installation media.</p>") ++ multi_cd_help, + ]; + +} + +/** + * Store function of a widget + * @param key string widget key + * @param event map which caused settings being stored + */ +void PlainDirStore (string key, map event) { + map parsed = $[ + "scheme" : "pkg", + "path" : (string)UI::QueryWidget (`id (`dir), `Value), + ]; + _url = URL::Build (parsed); +} +/** + * Get widget description map + * @return widget description map + */ +map<string,any> PlainDirWidget () { + return $[ + "widget" : `custom, + "custom_widget" : `VBox( + `HBox( + // text entry + `TextEntry (`id (`dir), _("&Path to Directory")), + `VBox ( + `Label (""), + // push button + `PushButton (`id (`browse), _("&Browse...")) + ) + ) + ), + "init" : DirInit, + "store" : PlainDirStore, + "handle" : DirHandle, + "handle_events" : [ `browse ], + "help" : _("<p><big><b>Local Directory</b></big><br> +Use <b>Path to Directory</b> to specify the path to the +directory holding RPM packages.</p>") + ]; + +} + +// HTTP(s)/FTP/SMB/CIFS source widget + +/** + * Handle function of a widget + * @param key string widget key + * @param event map which caused settings being stored + * @return always nil + */ +symbol ServerHandle (string key, map event) { + y2debug("ServerHandle: %1, %2", key, event); + any id = event["ID"]:nil; + if (is (id, symbol) + && contains ([`http, `https, `ftp, `samba, `rb_type], (symbol)id)) + { + symbol type = (symbol)UI::QueryWidget (`id (`rb_type), `CurrentButton); + string server = UI::WidgetExists (`id (`server)) + ? (string)UI::QueryWidget (`id (`server), `Value) + : ""; + string dir = UI::WidgetExists (`id (`dir)) + ? (string)UI::QueryWidget (`id (`dir), `Value) + : ""; + boolean anonymous = UI::WidgetExists (`id (`anonymous)) + ? (boolean)UI::QueryWidget (`id (`anonymous), `Value) + : false; + string username = UI::WidgetExists (`id (`username)) + ? (string)UI::QueryWidget (`id (`username), `Value) + : ""; + string password = UI::WidgetExists (`id (`password)) + ? (string)UI::QueryWidget (`id (`password), `Value) + : ""; + term widget = `VBox ( + // text entry + `TextEntry (`id (`server), _("Server &Name"), server), + type == `samba + // text entry + ? `TextEntry (`id (`share), _("&Share")) + : `Empty (), + type == `samba + ? `VBox ( + `TextEntry (`id (`dir), + // text entry + _("&Path to Directory"), dir) + ) + // text entry + : `TextEntry( `id( `dir ), _("&Directory on Server"), dir), + `HBox ( + `HSpacing (0.5), + // frame + `Frame (_("Au&thentication"), `VBox ( + `Left (`CheckBox (`id (`anonymous), `opt (`notify), + // check box + _("&Anonymous"), anonymous)), + // text entry + `TextEntry (`id (`username), _("&User Name"), username), + // password entry + `Password (`id (`password), _("&Password"), password) + )), + `HSpacing (0.5) + ) + ); + UI::ReplaceWidget (`id (`server_rp), widget); + + // update widget status + UI::ChangeWidget (`id (`username), `Enabled, !anonymous); + UI::ChangeWidget (`id (`password), `Enabled, !anonymous); + return nil; + } + if (event["ID"]:nil == `anonymous) + { + boolean anonymous = (boolean)UI::QueryWidget (`id (`anonymous), + `Value); + UI::ChangeWidget (`id (`username), `Enabled, !anonymous); + UI::ChangeWidget (`id (`password), `Enabled, !anonymous); + return nil; + } +} + +/** + * Init function of a widget + * @param key string widget key + */ +void ServerInit (string key) { + term protocol_box = `HBox ( + `HStretch (), + // radio button + `RadioButton (`id (`ftp),`opt (`notify), _("&FTP")), + `HStretch(), + // radio button + `RadioButton (`id (`http),`opt (`notify), _("H&TTP")), + `HStretch() + ); + if (_allow_https) + { + protocol_box = add (protocol_box, + // radio button + `RadioButton (`id (`https), `opt (`notify), _("HTT&PS")) + ); + protocol_box = add (protocol_box, `HStretch ()); + } + protocol_box = add (protocol_box, `HStretch ()); + protocol_box = `RadioButtonGroup (`id (`rb_type), `opt (`notify), + protocol_box); + UI::ReplaceWidget (`id (`rb_type_rp), protocol_box); + + boolean iso = IsISOURL (_url); + if (iso) + _url = PreprocessISOURL (_url); + map parsed = URL::Parse (_url); + symbol type = `ftp; + if ( parsed["scheme"]:"" == "http" ) + type = `http; + else if ( parsed["scheme"]:"" == "https" ) + type = `https; + UI::ChangeWidget (`id (`rb_type), `CurrentButton, type); + ServerHandle (key, $[ "ID" : `rb_type ]); + + UI::ChangeWidget (`id (`server), `Value, parsed["host"]:""); + string dir = parsed["path"]:""; + UI::ChangeWidget (`id (`dir), `Value, dir); + UI::ChangeWidget (`id (`username), `Value, parsed["user"]:""); + UI::ChangeWidget (`id (`password), `Value, parsed["pass"]:""); + boolean anonymous = ! (parsed["user"]:"" != "" || parsed["pass"]:"" != ""); + y2milestone ("Anonymous: %1", anonymous); + UI::ChangeWidget (`id (`anonymous), `Value, anonymous); + if (anonymous) + { + UI::ChangeWidget (`id (`username), `Enabled, false); + UI::ChangeWidget (`id (`password), `Enabled, false); + } +} + +/** + * Store function of a widget + * @param key string widget key + * @param event map which caused settings being stored + */ +void ServerStore (string key, map event) { + y2debug("Server store: %1, %2", key, event); + + symbol type = (symbol) UI::QueryWidget( `id( `rb_type), `CurrentButton ); + map parsed = $[]; + if ( type == `ftp ) + parsed["scheme"] = "ftp"; + else if ( type == `http ) + parsed["scheme"] = "http"; + else if ( type == `https ) + parsed["scheme"] = "https"; + + boolean anonymous = (boolean)UI::QueryWidget (`id (`anonymous), `Value); + if ( !anonymous ) { + string user = (string)UI::QueryWidget (`id (`username), `Value); + string pass = (string)UI::QueryWidget (`id (`password ), `Value); + if (size (user) != 0) + parsed["user"] = user; + if (size (pass) != 0) + parsed["pass"] = pass; + } + + string host = NormalizeHost((string)UI::QueryWidget (`id (`server), `Value)); + string directory = (string)UI::QueryWidget (`id (`dir), `Value); + + // is / in the host name? + integer pos = findfirstof(host, "/"); + if (pos != nil) + { + // update the hostname and the directory, + // URL::Build return empty URL when the hostname is not valid + y2milestone("The hostname contains a path: %1", host); + string dir = substring(host, pos); + + if (substring(dir, size(dir) - 1, 1) != "/" && substring(directory, 0, 1) != "/") + { + dir = dir + "/"; + } + + directory = dir + directory; + host = substring(host, 0, pos); + + y2milestone("Updated hostname: %1, directory: %2", host, directory); + } + + parsed["host"] = host; + + if (type != `ftp) + // FTP needs to distinguish absolute and relative path + { + directory = Slashed (directory); + } + parsed["path"] = directory; + y2milestone("Entered URL: %1", parsed); + _url = URL::Build (parsed); + y2milestone("URL::Build: %1", _url); + if (UI::WidgetExists (`id (`ch_iso))) + { + boolean iso = (boolean)UI::QueryWidget (`id (`ch_iso), `Value); + if (iso) + _url = PosprocessISOURL (_url); + } +} + + +/** + * Get widget description map + * @return widget description map + */ +map<string,any> ServerWidget () { + return $[ + "widget" : `custom, + "custom_widget" : `VBox ( + `HBox ( + `HSpacing (0.5), + // frame + `Frame (_("P&rotocol"), `ReplacePoint (`id (`rb_type_rp), + `Empty ()) + ), + `HSpacing( 0.5 ) + ), + `ReplacePoint (`id (`server_rp), `Empty ()) + ), + "init" : ServerInit, + "store" : ServerStore, + "handle" : ServerHandle, + "help" : _("<p><big><b>Server and Directory</b></big><br> +Use <b>Server Name</b> and <b>Path to Directory</b> +to specify the server host name and path on the server. +To enable authentication, uncheck <b>Anonymous</b> and specify the +<b>User Name</b> and the <b>Password</b>. +</p>") ++ multi_cd_help, + ]; +} + +/** + * Checks whether some network is available in the current moment, + * see the bug #170147 for more information. + */ +boolean IsAnyNetworkAvailable () { + boolean ret = false; + + string command = "TERM=dumb /sbin/ip -o address show | grep inet | grep -v scope.host"; + y2milestone("Running %1", command); + map cmd_run = (map) SCR::Execute(.target.bash_output, command); + y2milestone("Command returned: %1", cmd_run); + + // command failed + if (cmd_run["exit"]:-1 != 0) { + // some errors were there, we don't know the status, rather return that it's available + // `grep` also returns non zero exit code when there is nothing to do... + if (cmd_run["stdout"]:"" != "") { + y2error("Checking the network failed"); + ret = true; + } + // some devices are listed + } else if (cmd_run["stdout"]:"" != nil && cmd_run["stdout"]:"" != "") { + ret = true; + } + + return ret; +} + + +term SelectRadioWidget () { + term contents = `HBox (`HStretch (), `VBox ( + `RadioButtonGroup (`id (`type), `VBox ( + `VStretch (), + // radio button + `Left (`RadioButton(`id(`slp), _("&Scan Using SLP..."))), + // radio button + `Left (`RadioButton(`id(`ftp), _("&FTP..."))), + // radio button + `Left (`RadioButton(`id(`http), _("&HTTP..."))), + // radio button + `Left (`RadioButton(`id(`https), _("HTT&PS..."))), + // radio button + /* + `Left (`RadioButton(`id(`samba), _("&SMB/CIFS"))), + // radio button + `Left (`RadioButton(`id(`nfs), _("&NFS..."))), + // radio button + `Left (`RadioButton(`id(`cd), _("&CD..."))), + // radio button + `Left (`RadioButton(`id(`dvd), _("&DVD..."))), + */ + // radio button + `Left (`RadioButton(`id(`local_dir), _("&Local Directory..."))), + // radio button + `Left (`RadioButton(`id(`pkg), _("&Package Directory..."))), + // radio button +// `Left (`RadioButton (`id (`specify_url),_("Specify &URL..."))), + `VStretch () + ))), `HStretch () + ); + if (! IsAnyNetworkAvailable()) { + y2milestone ("Network is not available, skipping all Network-related options..."); + + contents = `HBox (`HStretch (), `VBox ( + `RadioButtonGroup (`id (`type), `VBox ( + `VStretch (), + /* + // radio button + `Left (`RadioButton(`id(`cd), _("&CD..."))), + // radio button + `Left (`RadioButton(`id(`dvd), _("&DVD..."))), + */ + // radio button + `Left (`RadioButton(`id(`local_dir), _("&Local Directory..."))), + // radio button + `Left (`RadioButton(`id(`pkg), _("&Package Directory..."))), + // radio button +// `Left (`RadioButton (`id (`specify_url),_("Specify &URL..."))), + `VStretch () + ))), `HStretch () + ); + } else { + y2milestone("Network is available, allowing Network-related options..."); + } + return contents; +} + +string SelectWidgetHelp () { + // help text + string help_text = _("<p><big><b>Catalog Media</b></big><br> +The software catalog can be located on a network server, +or on the hard disk.</p>"); + + // help, continued + help_text = help_text + _("<p> +The product CDs can be copied to the hard disk. +Insert the path where the first +CD is located, for example, /data1/<b>CD1</b>. +Only the base path is required if all CDs are copied +into one directory.</p> +"); + + // help, continued + help_text = help_text + _("<p> +Network installation requires a working network connection. +Specify the directory where the packages from +the first CD are located, such as /data1/CD1.</p> +"); + return help_text; +} + +boolean SelectValidate (string key, map event) { + symbol selected = (symbol)UI::QueryWidget (`id (`type), `CurrentButton); + if (selected == nil) + { + // error popup + Popup::Message (_("Select the media type.")); + return false; + } + if (selected == `cd || selected == `dvd) + { + Pkg::SourceReleaseAll(); + string msg = selected == `cd + ? _("Insert the add-on product CD") + : _("Insert the add-on product DVD"); + if (! SourceManager::AskForCD (msg)) + return false; + } + return true; +} + +symbol SelectHandle (string key, map event) { + if (! (event["ID"]:nil == `next || event["ID"]:nil == `ok)) + return nil; + symbol selected = (symbol)UI::QueryWidget (`id (`type), `CurrentButton); + if (selected == nil) + return nil; + if (selected == `slp || selected == `cd || selected == `dvd) + return `finish; +} + +void SelectStore (string key, map event) { + _url = ""; + symbol selected = (symbol)UI::QueryWidget (`id (`type), `CurrentButton); + if (contains ([`ftp, `http, `https, `samba, `nfs, `cd, `dvd, + `local_dir, `specify__url, `slp, `pkg], selected)) + { + if ( selected == `ftp ) _url = "ftp://"; + else if ( selected == `http ) _url = "http://"; + else if ( selected == `https ) _url = "https://"; + else if ( selected == `samba ) _url = "smb://"; + else if ( selected == `nfs ) _url = "nfs://"; + else if ( selected == `cd ) _url = "cd:///"; + else if ( selected == `dvd ) _url = "dvd:///"; + else if ( selected == `local_dir ) _url = "dir://"; + else if ( selected == `pkg ) _url = "pkg://"; // hack for local PlainDir source + else if ( selected == `slp ) _url = "slp://"; + } +} + +map<string,any> SelectWidget () { + return $[ + "widget" : `func, + "widget_func" : SelectRadioWidget, + "help" : SelectWidgetHelp (), + "validate_type" : `function, + "validate_function" : SelectValidate, + "store" : SelectStore, + "handle" : SelectHandle, + ]; +} + +// general data + +/** + * Individual widgets + */ +map<string,map<string,any> > _widgets = $[]; + +/** + * Get individual widgets + * @return individual widgets + */ +map<string,map<string,any> > Widgets () { + if (size (_widgets) == 0) + _widgets = $[ + "url" : PlainURLWidget (), + "nfs" : NFSWidget (), + "cd" : CDWidget (), + "dvd" : CDWidget (), + "dir" : DirWidget (), + "file" : DirWidget (), + "pkg" : PlainDirWidget(), + "http" : ServerWidget (), + "https" : ServerWidget (), + "ftp" : ServerWidget (), + "smb" : ServerWidget (), + "cifs" : ServerWidget (), + "select" : SelectWidget (), + ]; + return _widgets; +} + +/** + * Captions for individual protocols + */ +map<string,string> _caption = $[ + // label / dialog caption + "url" : _("Catalog URL"), + // label / dialog caption + "nfs" : _("NFS Server"), + // label / dialog caption + "cd" : _("CD or DVD Media"), + // label / dialog caption + "dvd" : _("CD or DVD Media"), + // label / dialog caption + "dir" : _("Local Directory"), + // label / dialog caption + "file" : _("Local Directory"), + // label / dialog caption + "pkg" : _("Package Directory"), + // label / dialog caption + "http" : _("Server and Directory"), + // label / dialog caption + "https" : _("Server and Directory"), + // label / dialog caption + "ftp" : _("Server and Directory"), + // label / dialog caption + "smb" : _("Server and Directory"), + // label / dialog caption + "cifs" : _("Server and Directory"), +]; + +// general functions + +/** + * Get contents of a popup for specified protocol + * @param proto string protocol to display popup for + * @return term popup contents + */ +term PopupContents (string proto) { + return `VBox ( + `HSpacing (50), + // label + `Label (_caption[proto]:""), + proto, + PopupButtons () + ); +}; + +/** + * URL editation popup with the HTTPS option + * @param url string url URL to edit + * @return string modified URL or empty string if canceled + */ +global string EditPopup (string url) { + SetURL (url); + string proto = URLScheme (url); + y2milestone ("Displaying popup for protocol %1", proto); + + list<map<string,any> > w = CWM::CreateWidgets ([proto], Widgets ()); + term contents = PopupContents (proto); + contents = CWM::PrepareDialog (contents, w); + UI::OpenDialog (contents); + symbol ret = CWM::Run (w, $[]); + y2milestone ("Ret: %1", ret); + UI::CloseDialog (); + if (ret == `ok) + return GetURL (); + else + return ""; +} + +/** + * URL editation popup without the HTTPS option + * @param url string url URL to edit + * @return string modified URL or empty string if canceled + */ +global string EditPopupNoHTTPS (string url) { + _allow_https = false; + string ret = EditPopup (url); + _allow_https = true; + return ret; +} + +/** + * Sample implementation of URL selection dialog + * @return symbol for wizard sequencer + */ +global symbol EditDialog () { + string proto = URLScheme (_url); + y2milestone ("Displaying dialog for protocol %1", proto); + string caption = _caption[proto]:""; + + return CWM::ShowAndRun ($[ + "widget_names" : [proto], + "widget_descr" : Widgets (), + "contents" : `HVCenter(`MinWidth( 65, proto ) ), + "caption" : caption, + "back_button" : Label::BackButton (), + "next_button" : Label::NextButton (), + "fallback_functions" : $[] + ]); +} + +/** + * URL editation popup with the HTTPS option + * @return string modified URL or empty string if canceled + */ +global string TypePopup () { + list<map<string,any> > w = CWM::CreateWidgets (["select"], Widgets ()); + term contents = PopupContents ("select"); + contents = CWM::PrepareDialog (contents, w); + UI::OpenDialog (contents); + symbol ret = CWM::Run (w, $[]); + y2milestone ("Ret: %1", ret); + UI::CloseDialog (); + return ""; +/* + if (ret == `ok) + return GetURL (); + else + return ""; +*/ +} + +/** + * Sample implementation of URL type selection dialog + * @return symbol for wizard sequencer + */ +global symbol TypeDialog () { + y2milestone ("Running source type dialog"); + // dialog caption + string caption = _("Media Type"); + symbol ret = CWM::ShowAndRun ($[ + "widget_names" : ["select"], + "widget_descr" : Widgets (), + "contents" : `VBox ( "select" ), + "caption" : caption, + "back_button" : Label::BackButton (), + "next_button" : Label::NextButton (), + "fallback_functions" : $[] + ]); + y2milestone ("Type dialog returned %1", ret); + return ret; +} + +} // EOF + Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/commandline.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/commandline.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/commandline.ycp Mon Dec 17 13:21:12 2007 @@ -10,11 +10,32 @@ { import "CommandLine"; import "Progress"; - + import "ProductCreator"; textdomain "product-creator"; + + void ProcessConfigFileOption(map params) + { + if (haskey(params, "configfile")) + { + string new_config = params["configfile"]:""; + + if (new_config != nil && new_config != "") + { + y2milestone("Using config file: %1", new_config); + + // TODO FIXME: set the config file path in "initialize" handler, + // don't read the default config file if the "configfile" option is used + ProductCreator::ConfigFile = new_config; + ProductCreator::Read(); + } + } + } + boolean ListHandler(map params) { + ProcessConfigFileOption(params); + foreach(string name, map<string, any> conf, ProductCreator::Configs, { CommandLine::Print(name); @@ -28,26 +49,31 @@ { y2milestone("CreateIsoHandler parameters: %1", params); + ProcessConfigFileOption(params); + string name = params["name"]:""; if (name != "") { - CommandLine::PrintVerbose(sformat(_("Loading Configuration '%1'..."), name)); + CommandLine::PrintVerbose(sformat(_("Loading configuration %1..."), name)); // load the requested configuration if (!ProductCreator::LoadConfig(name)) { - CommandLine::Print(sformat(_("Cannot load configuration '%1'"), name)); + CommandLine::Print(sformat(_("Cannot load configuration %1."), name)); return false; } - string file = params["passphrase"]:""; + string file = params["passphrase_file"]:""; if (file != nil && file != "") { y2milestone("Reading passphrase from file %1...", file); ProductCreator::gpg_passphrase = (string)SCR::Read(.target.string, file); } + if (haskey (params, "passphrase")) + ProductCreator::gpg_passphrase = params["passphrase"]:""; + // disable the progress boolean progress = Progress::set(false); @@ -68,7 +94,7 @@ integer image_size = (integer)SCR::Read(.target.size, iso_name); if (SCR::Read(.target.size, iso_name) < 0) { - CommandLine::Print(sformat(_("Cannot create ISO image %1"), iso_name)); + CommandLine::Print(sformat(_("Cannot create ISO image %1."), iso_name)); return false; } else Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/complex.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/complex.ycp Mon Dec 17 13:21:12 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"; @@ -90,17 +91,17 @@ contents, `HBox ( // push button label - `PushButton(`id(`create_button), _("&Create ISO Image")), + `PushButton(`id(`create_button), _("&Create Image")), // menu button label - `MenuButton (`id (`kiwi), _("Cre&ate Image with Kiwi..."), [ + `MenuButton (`id (`kiwi), _("Cre&ate Image with KIWI..."), [ // push button label `item(`id(`iso_button), _("Live ISO Image")), // push button label - `item(`id(`xen_button), _("XEN Image")), + `item(`id(`xen_button), _("Xen Image")), // push button label - `item(`id(`usb_button), _("USB stick Image")), + `item(`id(`usb_button), _("USB Stick Image")), // push button label - `item(`id(`vmx_button), _("Virtual disk Image")), + `item(`id(`vmx_button), _("Virtual Disk Image")), ]) ) ); @@ -136,7 +137,7 @@ break; } /* edit */ - else if(ret == `edit_button) { + else if(ret == `edit_button || ret == `table) { ProductCreator::LoadConfig(current); ret = `edit; break; @@ -169,34 +170,34 @@ break; } else if(ret == `iso_button && - Package::InstallAll (["kiwi", "kiwi-desc-isoboot", "kiwi-desc-livesystem"])) { + 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; } else if (ret == `xen_button && - Package::InstallAll (["kiwi", "kiwi-desc-xenboot", "kiwi-desc-buildservice"])) { + 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; } else if (ret == `usb_button && - Package::InstallAll (["kiwi", "kiwi-desc-usbboot", "kiwi-desc-livesystem"])) { + 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; } else if (ret == `vmx_button && - Package::InstallAll (["kiwi", "kiwi-desc-vmxboot", "kiwi-desc-livesystem"])) { + 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; } @@ -252,9 +253,9 @@ if (gpg_key != "") { // label - progress_stages = add(progress_stages, _("Sign the Source With a GPG Key")); + progress_stages = add(progress_stages, _("Sign the source with a GPG key")); // progressbar label - progress_descriptions = add(progress_descriptions, _("Signing the Source With a GPG Key...")); + progress_descriptions = add(progress_descriptions, _("Signing the source with a GPG key...")); } Progress::New( @@ -524,14 +525,187 @@ return `skip_isolinux; } - if (ProductCreator::Config["profile"]:""!="") - { - return `autoyast; - } - 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); + if (config["image_type"]:"" != "system") + { + y2warning ("%1 not a 'system' image type, skipping", d); + return; + } + 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 (`edit), `opt (`key_F4), Label::EditButton ()), + `PushButton (`id (`delete), `opt (`key_F5), Label::DeleteButton ()), + `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); + UI::ChangeWidget (`id (`delete), `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); + UI::ChangeWidget (`id (`edit), `Enabled, size (overview) > 0); + UI::ChangeWidget (`id (`delete), `Enabled, size (overview) > 0); + } + } + 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: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/Makefile.am (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/Makefile.am Mon Dec 17 13:21:12 2007 @@ -1,6 +1,7 @@ # # Makefile.am for devtools/devtools/skeletons/config/agents # +SUBDIRS = kiwi_templates ydatadir = @ydatadir@/product-creator @@ -10,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: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,6 @@ +# +# Makefile.am for product-creator/kiwi_templates +# + +SUBDIRS = xen iso + Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,14 @@ +# +# Makefile.am for product-creator/kiwi_templates/iso +# +SUBDIRS= root + +ydatadir = @ydatadir@/product-creator/kiwi_templates/iso + +ydata_DATA = \ + config.xml + +ydata_SCRIPTS = \ + config.sh + +EXTRA_DIST = $(ydata_DATA) $(ydata_SCRIPTS) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/config.sh URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/config.sh (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/config.sh Mon Dec 17 13:21:12 2007 @@ -0,0 +1,48 @@ +#!/bin/bash +#================ +# FILE : config.sh +#---------------- +# PROJECT : OpenSuSE KIWI Image System +# COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH. All rights reserved +# : +# AUTHOR : Marcus Schaefer <ms@suse.de> +# : +# BELONGS TO : Operating System images +# : +# DESCRIPTION : configuration script for SUSE based +# : operating systems +# : +# : +# STATUS : BETA +#---------------- +#====================================== +# Functions... +#-------------------------------------- +test -f /.kconfig && . /.kconfig +test -f /.profile && . /.profile + +#====================================== +# Greeting... +#-------------------------------------- +echo "Configure image: [$name]..." + +#====================================== +# Activate services +#-------------------------------------- +suseActivateServices +suseRemoveService boot.multipath +suseRemoveService boot.device-mapper +suseRemoveService mdadmd +suseRemoveService multipathd + +#====================================== +# SuSEconfig +#-------------------------------------- +suseConfig + +#====================================== +# Umount kernel filesystems +#-------------------------------------- +baseCleanMount + +exit 0 Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/config.xml URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/config.xml (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/config.xml Mon Dec 17 13:21:12 2007 @@ -0,0 +1,35 @@ +<image name="kiwi-image-template"> + <description type="system"> + <author></author> + <contact></contact> + <specification>Template for system image configuration</specification> + </description> + <preferences> + <version>1</version> + <size unit="M">2700</size> + <rpm-check-signatures>False</rpm-check-signatures> + <rpm-force>True</rpm-force> + </preferences> + <users group="users"> + <user home="/home/linux" name="linux"/> + <user home="/root" name="root"/> + </users> + <packages type="image" patternType="plusRecommended"> + <package name="xkeyboard-config"/> + <package name="sax2"/> + <opensusePattern name="default"/> + <opensusePattern name="base"/> + <opensusePattern name="x11"/> + <opensusePattern name="kde"/> + </packages> + <packages type="xen" memory="512" disk="/dev/sda"> + <package name="kernel-xen"/> + <package name="xen"/> + </packages> + <packages type="boot"> + <package name="filesystem"/> + <package name="glibc-locale"/> + <package name="kernel-default"/> + <package name="devs"/> + </packages> +</image> Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,4 @@ +# +# Makefile.am for product-creator/kiwi_templates/iso/root +# +SUBDIRS= etc Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,8 @@ +# +# Makefile.am for product-creator/kiwi_templates/iso/root/etc +# +SUBDIRS= init.d sysconfig + +ydatadir = @ydatadir@/product-creator/kiwi_templates/iso/root/etc + +EXTRA_DIST = $(ydata_DATA) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,9 @@ +# +# Makefile.am for product-creator/kiwi_templates/iso/root/etc/init.d +# +ydatadir = @ydatadir@/product-creator/kiwi_templates/iso/root/etc/init.d + +ydata_SCRIPTS = \ + boot + +EXTRA_DIST = $(ydata_SCRIPTS) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/boot URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/boot (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/init.d/boot Mon Dec 17 13:21:12 2007 @@ -0,0 +1,323 @@ +#! /bin/bash +# +# Copyright (c) 1996-2004 SuSE Linux AG, Nuernberg, Germany. +# All rights reserved. +# +# Author: Ruediger Oertel <ro@suse.de>, 1996-2002 +# Werner Fink <werner@suse.de>, 1996-2004 +# Burchard Steinbild, 1996-2000 +# Florian La Roche, 1996 +# +# Please send feedback to http://www.suse.de/feedback +# +# /etc/init.d/boot +# +# first script to be executed from init on system startup +# + +# +# Avoid be interrupted by child or keyboard +# +trap "echo" SIGINT SIGSEGV SIGQUIT +set +e + +# +# Get terminal size of standard input of the system console +# +test -z "$CONSOLE" && CONSOLE=/dev/console +set -- $(stty size < $CONSOLE) + LINES=$1 +COLUMNS=$2 +export LINES COLUMNS CONSOLE + +# +# Set I/O of this script and its childs to console +# +exec 0<> $CONSOLE 1>&0 2>&0 + +# +# Export the real device in variable REDIRECT. +# +REDIRECT="`showconsole 2>/dev/null`" +export REDIRECT +if test $COLUMNS -eq 0 ; then + # Serial: columns and lines are not defined + LINES=24 + COLUMNS=80 + test "$TERM" = "linux" -o -z "$TERM" && TERM=vt102 +fi + +# +# Configuration and coloring of the boot messages +# + +. /etc/rc.status +. /etc/sysconfig/boot + +echo -n "System Boot Control: " +echo "Running $0" + +# +# Start of e.g. blogd, requires /proc and /dev/pts. +# +rc_reset +echo -n "Mounting procfs at /proc" +mount -n -t proc proc /proc +rc_status -v -r + +echo -n "Mounting sysfs at /sys" +mount -n -t sysfs sysfs /sys +rc_status -v -r + +if test -d /sys/kernel/debug ; then + while read dev type ; do + if test "$type" = "debugfs" ; then + echo -n "Mounting debugfs at /sys/kernel/debug" + mount -n -t debugfs debugfs /sys/kernel/debug + rc_status -v -r + fi + done < /proc/filesystems +fi +# +# mount tmpfs on /dev if not already done by initramfs +# +while read dev dir type options; do + if test "$dir" = "/dev" -a "$type" = "tmpfs"; then + DEV_MOUNTED=1; + break; + fi +done < /proc/mounts +if test -z "$DEV_MOUNTED"; then + echo -n "Mounting tmpfs at /dev" + mount -n -t tmpfs -o mode=0755 udev /dev + rc_status -v -r +fi + +# +# populate /dev with initial content +# +echo -n "Initializing /dev" +cp --preserve=all --recursive --remove-destination /lib/udev/devices/* /dev +chmod 1777 /dev/shm +rc_status -v -r + +echo -n "Mounting devpts at /dev/pts" +mount -n -t devpts -o mode=0620,gid=5 devpts /dev/pts +rc_status -v -r + +# +# Save old terminal settings and set -nl to avoid staircase +# effect, do not lock scrolling, and avoid break characters. +# +otty=$(stty -g) +if test "$FLOW_CONTROL" = "yes" ; then + stty -nl ixon ignbrk -brkint +else + stty -nl -ixon ignbrk -brkint +fi + +# +# Should we ask for interactive boot mode +# +DO_CONFIRM="" +read -t 2 check < /proc/cmdline 2> /dev/null +case "$check" in + *confirm*) DO_CONFIRM=yes ;; +esac +test -z "$CONFIRM_PROMPT_TIMEOUT" && CONFIRM_PROMPT_TIMEOUT=5 +if test "$PROMPT_FOR_CONFIRM" = "yes" -a "$DO_CONFIRM" != "yes" ; then + echo -en "${extd}Enter Interactive startup mode?${norm}" + rc_timer_on "$CONFIRM_PROMPT_TIMEOUT" 37 + read -t "$CONFIRM_PROMPT_TIMEOUT" -n 1 \ + -p " ${extd}y${norm}/[${extd}n${norm}]("${CONFIRM_PROMPT_TIMEOUT}s") " answer + rc_timer_off + case "$answer" in + [yYiI]) DO_CONFIRM=yes ;; + *) DO_CONFIRM= ;; + esac + unset answer + echo +fi +export DO_CONFIRM + +# +# Start blogd, requires /proc and /dev/pts. +# Export the real device in variable REDIRECT. +# +test -x /sbin/blogd -a -n "$REDIRECT" && /sbin/blogd $REDIRECT +if test -z "$REDIRECT" ; then + if (echo -n > /dev/tty) 2>/dev/null ; then + REDIRECT=/dev/tty + else + REDIRECT=/dev/console + fi +fi + +# +# Common used variables +# +bootrc=/etc/init.d/boot.d +rex="[0-9][0-9]" +failed="" +skipped="" +callord="" + +# +# Initialize boosplash progressbar variables +# +. /etc/rc.splash B +splashtrigger "rlchange B" + +# +# Check if we are able to use make for booting +# +test -s /etc/init.d/.depend.boot || RUN_PARALLEL="no" +test -s /etc/init.d/Makefile || RUN_PARALLEL="no" +test "$DO_CONFIRM" = "yes" && RUN_PARALLEL="no" +type -p startpar &> /dev/null || RUN_PARALLEL="no" +startpar -v &> /dev/null || RUN_PARALLEL="no" + +# +# Start bootup client scripts. +# +if test "$RUN_PARALLEL" = "yes" ; then + + # + # Start scripts in parallel with make behaviour of startpar + # + + startopt="-p4 -t 30 -T 3 $(splashmake)" + eval $(startpar $startopt -M boot) + failed="${failed:+$failed }$failed_service" + skipped="${skipped:+$skipped }$skipped_service" + + unset failed_service skipped_service startopt + +elif test -d ${bootrc}/ ; then + + # + # Start scripts in given link order + # + for i in ${bootrc}/S${rex}*; do + + test -f $i || continue + + B=${i##*/} + script=${B#*S$rex} + B=${B%$script} + + if test "$DO_CONFIRM" = "yes" ; then + rc_confirm -t $CONFIRM_PROMPT_TIMEOUT "Start bootup script ${script}" < $REDIRECT > $REDIRECT 2>&1 + case "$?" in + 0) true ;; + 1) continue ;; + 2) DO_CONFIRM="" + esac + fi + + blogger "$script start" + + if test -x "$i" ; then + $i start + else + echo Running $i + /bin/sh $i b + rc_status -v1 -r + fi + status=$? + echo -en "$rc_reset" + splashprogress "$script start" + + case $status in + [1-47]) failed="${failed:+$failed }$script" ;; + [56]) skipped="${skipped:+$skipped }$script" ;; + 0|*) ;; + esac + + blogger "'$script start' exits with status $status" + done +fi + +splashtrigger "rlreached B" + +# +# Be verbose and print stats +# +echo -n "System Boot Control: " +echo -e "The system has been ${stat}${extd}set up${norm}" +if test -n "$failed" ; then + n=$((${#failed} + 7)) + echo -n "Failed features: " + test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" + echo -e "${warn}${failed}${norm}" +fi +if test -n "$skipped" ; then + n=$((${#skipped} + 7)) + echo -n "Skipped features: " + test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" + echo -e "${attn}${skipped}${norm}" +fi + +# +# Start user defined bootup script. +# +if test -f /etc/init.d/boot.local ; then + echo -n "System Boot Control: " + echo "Running /etc/init.d/boot.local" + /bin/sh /etc/init.d/boot.local + rc_status -v1 -r + splashtrigger "boot.local" +fi + +# +# Stop blogd +# +test -x /sbin/blogd && killproc -QUIT /sbin/blogd + +# +# Check for boot cycle detection +# +test -s /lib/bootcycle/stats && . /lib/bootcycle/stats + +# +# Remember for master resource script +# +if test "$DO_CONFIRM" = "yes" ; then + touch /var/run/do_confirm +fi + +# +# Restore old terminal settings +# +stty $otty + +# create config file if not yet done +if [ ! -f /etc/X11/xorg.conf ];then + /usr/sbin/sax2 -c 0 -a -i &>/dev/null +fi + +# +# Let YaST2 finish its installation, if you installed with YaST2 +# +if test -f /var/lib/YaST2/runme_at_boot ; then + HOSTTYPE=$(uname -m) + splashtrigger "YaST" + exec 0<> $REDIRECT 1>&0 2>&0 + # if yast2 failed, this ensures proper system setup + #ulimit -c unlimited + touch /var/lib/YaST2/run_suseconfig + if test -x /usr/lib/YaST2/startup/YaST2.Second-Stage; then + /usr/lib/YaST2/startup/YaST2.Second-Stage + else + # oops, yast2 not installed + rm -f /var/lib/YaST2/runme_at_boot + fi +fi +# run SuSEconfig (with args) if needed +if test -f /var/lib/YaST2/run_suseconfig ; then + /sbin/SuSEconfig `cat /var/lib/YaST2/run_suseconfig` + rm -f /var/lib/YaST2/run_suseconfig +fi + +rc_reset +exit 0 Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,11 @@ +# +# Makefile.am for product-creator/kiwi_templates/iso/root/etc/sysconfig +# +SUBDIRS= network + +ydatadir = @ydatadir@/product-creator/kiwi_templates/iso/root/etc/sysconfig + +ydata_DATA = \ + displaymanager + +EXTRA_DIST = $(ydata_DATA) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/displaymanager URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/displaymanager (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/displaymanager Mon Dec 17 13:21:12 2007 @@ -0,0 +1,102 @@ +## Path: Desktop/Display manager +## Description: settings to generate a proper displaymanager config +## Type: string(kdm,xdm,gdm,wdm,console) +## Default: "" +## Config: xdm,kdm,gdm +# +# Here you can set the default Display manager (kdm/xdm/gdm/wdm/console). +# all changes in this file require a restart of the displaymanager +# +DISPLAYMANAGER="kdm" + +## Type: yesno +## Default: no +# +# Allow remote access to your display manager (kdm only for now) +# +DISPLAYMANAGER_REMOTE_ACCESS="no" + +## Type: yesno +## Default: no +# +# Allow remote access of the user root to your display manager +# +DISPLAYMANAGER_ROOT_LOGIN_REMOTE="no" + +## Type: yesno +## Default: yes +# +# let the displaymanager start a local Xserver +# set to "no" for remote-access only +# set to "no" on architectures without any Xserver (e.g. s390/s390x) +# +DISPLAYMANAGER_STARTS_XSERVER="yes" +## Path: Desktop/Display manager +## Description: settings to generate a proper displaymanager config +## Type: string +## Default: +## Config: kdm3 +# +# space separated list of users for which icons should be shown in KDM +# if empty, then take system defaults +# +KDM_USERS="" + +## Type: string +## Default: +# +# Special greeting words in kdm +# +KDM_GREETSTRING="" + +## Type: string +## Default: +# +# define the user whom should get logged in without request +# +DISPLAYMANAGER_AUTOLOGIN="" + +## Type: yesno +## Default: no +# +# Allow all users to login without password, but ask for the user +# +DISPLAYMANAGER_PASSWORD_LESS_LOGIN="no" + +## Type: yesno +## Default: no +## Config: xdm +# +# Tcp port 6000 of Xserver. When set to "no" (default) Xserver is +# started with "-nolisten tcp". Only set this to "yes" if you really +# need to. Use ssh X11 port forwarding whenever possible. +# +DISPLAYMANAGER_XSERVER_TCP_PORT_6000_OPEN="no" + +## Type: string +## Default: SUSE +# +# Define the theme to be used by kdm. If empty, the traditional login +# window is used (which lacks some features) +# +DISPLAYMANAGER_KDM_THEME="SUSE" + +## Type: yesno +## Default: no +# +# Display a combobox for Active Directory domains. +# +DISPLAYMANAGER_AD_INTEGRATION="no" + +## Type: list(root,all,none,auto) +## Default: auto +# +# Determine who will be able to shutdown or reboot the system in kdm +# and gdm. Valid values are: "root" (only root can shutdown), "all" +# (everybody can shutdown), "none" (nobody can shutdown from +# displaymanager), "auto" (follow +# System/Security/Permissions/PERMISSION_SECURITY to decide: "easy +# local" is equal to "all", everything else is equal to "root"). Note +# that remote user can never shutdown in GDM. +# +DISPLAYMANAGER_SHUTDOWN="auto" Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,10 @@ +# +# Makefile.am for product-creator/kiwi_templates/iso/root/etc/sysconfig/network +# + +ydatadir = @ydatadir@/product-creator/kiwi_templates/iso/root/etc/sysconfig/network + +ydata_DATA = \ + ifcfg-eth0 + +EXTRA_DIST = $(ydata_DATA) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/ifcfg-eth0 URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/ifcfg-eth0 (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/ifcfg-eth0 Mon Dec 17 13:21:12 2007 @@ -0,0 +1,4 @@ +BOOTPROTO='dhcp' +MTU='' +REMOTE_IPADDR='' +STARTMODE='onboot' Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/iso/root/etc/sysconfig/network/routes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== (empty) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,14 @@ +# +# Makefile.am for product-creator/kiwi_templates/xen +# +SUBDIRS= root + +ydatadir = @ydatadir@/product-creator/kiwi_templates/xen + +ydata_DATA = \ + config.xml + +ydata_SCRIPTS = \ + config.sh + +EXTRA_DIST = $(ydata_DATA) $(ydata_SCRIPTS) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/config.sh URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/config.sh (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/config.sh Mon Dec 17 13:21:12 2007 @@ -0,0 +1,53 @@ +#!/bin/bash +#================ +# FILE : config.sh +#---------------- +# PROJECT : OpenSuSE KIWI Image System +# COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH. All rights reserved +# : +# AUTHOR : Marcus Schaefer <ms@suse.de> +# : +# BELONGS TO : Operating System images +# : +# DESCRIPTION : configuration script for SUSE based +# : operating systems +# : +# : +# STATUS : BETA +#---------------- +#====================================== +# Functions... +#-------------------------------------- +test -f /.kconfig && . /.kconfig +test -f /.profile && . /.profile + +#====================================== +# Greeting... +#-------------------------------------- +echo "Configure image: [$name]..." + +#====================================== +# Activate services +#-------------------------------------- +suseActivateServices +suseRemoveService boot.multipath +suseRemoveService boot.device-mapper +suseRemoveService mdadmd +suseRemoveService multipathd + +#====================================== +# SuSEconfig +#-------------------------------------- +suseConfig + +#====================================== +# Setup ssh permissions +#-------------------------------------- +cd /etc/ssh && chmod og-r *_key + +#====================================== +# Umount kernel filesystems +#-------------------------------------- +baseCleanMount + +exit 0 Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/config.xml URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/config.xml (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/config.xml Mon Dec 17 13:21:12 2007 @@ -0,0 +1,177 @@ +<image name="kiwi-xen-image-template"> + <description type="system"> + <author></author> + <contact></contact> + <specification>Template for system image configuration</specification> + </description> + <preferences> + <version>1</version> + <size unit="M">2700</size> + <rpm-check-signatures>False</rpm-check-signatures> + <rpm-force>True</rpm-force> + </preferences> + <users group="users"> + <user home="/home/linux" name="linux"/> + <user home="/root" name="root"/> + </users> + <packages type="image"> + <package name="OpenIPMI"/> + <package name="lvm2"/> + <package name="aaa_base"/> + <package name="aaa_skel"/> + <package name="acl"/> + <package name="acpid"/> + <package name="attr"/> + <!-- for x86_64 only --> + <package name="linux32" arch="x86_64"/> + <package name="bash"/> + <package name="bc"/> + <package name="bind-libs"/> + <package name="binutils"/> + <package name="bootcycle"/> + <package name="screen"/> + <package name="bridge-utils"/> + <package name="mdadm"/> + <package name="bzip2"/> + <package name="coreutils"/> + <package name="cpio"/> + <package name="cpufrequtils"/> + <package name="cracklib"/> + <package name="db"/> + <package name="device-mapper"/> + <package name="dhcpcd"/> + <package name="diffutils"/> + <package name="e2fsprogs"/> + <package name="file"/> + <package name="filesystem"/> + <package name="fillup"/> + <package name="findutils"/> + <package name="gawk"/> + <package name="gpg"/> + <package name="grep"/> + <package name="grub"/> + <package name="gzip"/> + <package name="hwinfo"/> + <package name="ifplugd"/> + <package name="initviocons"/> + <package name="insserv"/> + <package name="iproute2"/> + <package name="iptables"/> + <package name="iputils"/> + <package name="kbd"/> + <package name="kernel-xen"/> + <package name="kernel-smp"/> + <package name="klogd"/> + <package name="ksymoops"/> + <package name="less"/> + <package name="libacl"/> + <package name="libaio"/> + <package name="libattr"/> + <package name="libcap"/> + <package name="libcom_err"/> + <package name="libevent"/> + <package name="libgcc"/> + <package name="libgssapi"/> + <package name="libicu"/> + <package name="libnscd"/> + <package name="libpcap"/> + <package name="libpng"/> + <package name="libreiserfs"/> + <package name="librpcsecgss"/> + <package name="libstdc++"/> + <package name="libtool"/> + <package name="libusb"/> + <package name="libxcrypt"/> + <package name="libxml2"/> + <package name="libxml2-python"/> + <package name="libzio"/> + <package name="logrotate"/> + <package name="mingetty"/> + <package name="mkinitrd"/> + <package name="mktemp"/> + <package name="module-init-tools"/> + <package name="ncurses"/> + <package name="net-tools"/> + <package name="netcfg"/> + <package name="nscd"/> + <package name="openslp"/> + <package name="openssh"/> + <package name="openssl"/> + <package name="pam"/> + <package name="pam-modules"/> + <package name="pax"/> + <package name="pciutils"/> + <package name="perl"/> + <package name="perl-TimeDate"/> + <package name="perl-Bit-Vector"/> + <package name="perl-Bootloader"/> + <package name="perl-Carp-Clan"/> + <package name="perl-Compress-Zlib"/> + <package name="perl-Config-Crontab"/> + <package name="perl-Config-IniFiles"/> + <package name="perl-Crypt-SmbHash"/> + <package name="perl-Date-Calc"/> + <package name="perl-Digest-MD4"/> + <package name="perl-Digest-SHA1"/> + <package name="perl-Parse-RecDescent"/> + <package name="perl-URI"/> + <package name="perl-X500-DN"/> + <package name="perl-XML-Parser"/> + <package name="perl-XML-Writer"/> + <package name="perl-gettext"/> + <package name="permissions"/> + <package name="pmtools"/> + <package name="popt"/> + <package name="prctl"/> + <package name="procinfo"/> + <package name="procmail"/> + <package name="procps"/> + <package name="psmisc"/> + <package name="pwdutils"/> + <package name="python"/> + <package name="python-xml"/> + <package name="readline"/> + <package name="recode"/> + <package name="reiserfs"/> + <package name="rpm"/> + <package name="rsync"/> + <package name="sed"/> + <package name="sharutils"/> + <package name="strace"/> + <package name="suse-build-key"/> + <package name="suspend"/> + <package name="sysconfig"/> + <package name="sysfsutils"/> + <package name="syslinux"/> + <package name="syslog-ng"/> + <package name="sysvinit"/> + <package name="tar"/> + <package name="tcpd"/> + <package name="terminfo"/> + <package name="timezone"/> + <package name="udev"/> + <package name="utempter"/> + <package name="util-linux"/> + <package name="vim"/> + <package name="wol"/> + <package name="xen"/> + <package name="xen-libs"/> + <package name="xen-tools"/> + <package name="xntp"/> + <package name="zlib"/> + <package name="resmgr"/> + <package name="irqbalance"/> + <package name="portmap"/> + <package name="cron"/> + </packages> + <packages type="xen" memory="512" disk="/dev/sda"> + <package name="kernel-xen"/> + <package name="xen"/> + </packages> + <packages type="boot"> + <package name="filesystem"/> + <package name="glibc-locale"/> + <package name="devs"/> + <package name="procps"/> + </packages> +</image> Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,4 @@ +# +# Makefile.am for product-creator/kiwi_templates/xen/root +# +SUBDIRS= etc Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,8 @@ +# +# Makefile.am for product-creator/kiwi_templates/xen/root/etc +# +SUBDIRS= init.d sysconfig + +ydatadir = @ydatadir@/product-creator/kiwi_templates/xen/root/etc + +EXTRA_DIST = $(ydata_DATA) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/init.d/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/init.d/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/init.d/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,10 @@ +# +# Makefile.am for product-creator/kiwi_templates/xen/root/etc/init.d +# + +ydatadir = @ydatadir@/product-creator/kiwi_templates/xen/root/etc/init.d + +ydata_SCRIPTS = \ + boot.xen + +EXTRA_DIST = $(ydata_SCRIPTS) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/init.d/boot.xen URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/init.d/boot.xen (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/init.d/boot.xen Mon Dec 17 13:21:12 2007 @@ -0,0 +1,80 @@ +#! /bin/sh +# +# Copyright (c) 2001-2002 SuSE Linux AG, Nuernberg, Germany. +# All rights reserved. +# +# /etc/init.d/boot.xen +# +### BEGIN INIT INFO +# Provides: boot.xen +# Required-Start: boot.localfs +# Required-Stop: +# Default-Start: B S +# Default-Stop: +# Description: Check and Prepare xen environment +### END INIT INFO + +. /etc/rc.status +rc_reset + +kernel=`uname -r | grep -qi "-xen" && echo xen || echo none` +if [ ! -e /proc/xen/capabilities ]; then + domain=native +elif ! grep control_d /proc/xen/capabilities >/dev/null 2>&1; then + domain=domU +else + domain=dom0 +fi + +case "$1" in + start|restart) + # + # Check and Prepare xen environment + # + echo -n "Setting up xen environment" + if test ! "$kernel" = "xen";then + rc_status -s + rc_failed 6 + else + if test "$domain" = "dom0";then + rc_status -s + rc_failed 6 + else + insserv -r /etc/init.d/kbd + insserv -r /etc/init.d/acpid + sed -ie "s/^[2-6]:/#\0/" /etc/inittab + init q + rc_status + rc_status -v -r + fi + fi + ;; + stop) + echo -n "Restoring default environment" + if test ! "$kernel" = "xen";then + rc_status -s + rc_failed 6 + else + if test "$domain" = "dom0";then + rc_status -s + rc_failed 6 + else + insserv /etc/init.d/acpid + insserv /etc/init.d/kbd + sed -ie "s/^#([2-6]:)/\1/" /etc/inittab + init q + rc_status -v -r + fi + fi + ;; + status) + rc_failed 4 + rc_status -v + ;; + *) + echo "Usage: $0 {start|stop|status|restart}" + exit 1 + ;; +esac + +rc_exit Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,11 @@ +# +# Makefile.am for product-creator/kiwi_templates/xen/root/etc/sysconfig +# +SUBDIRS= network + +ydatadir = @ydatadir@/product-creator/kiwi_templates/xen/root/etc/sysconfig + +ydata_DATA = \ + keyboard + +EXTRA_DIST = $(ydata_DATA) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/keyboard URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/keyboard (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/keyboard Mon Dec 17 13:21:12 2007 @@ -0,0 +1,97 @@ +## Path: Hardware/Keyboard +## Description: Keyboard settings +## Type: string +## Default: "" +## ServiceRestart: kbd +# +# Keyboard settings for the text console +# +# Keyboard mapping +# (/usr/share/kbd/keymaps/) +# e.g. KEYTABLE="de-latin1-nodeadkeys", "us" or empty for US settings +# +KEYTABLE="us.map.gz" + +## Type: integer +## Default: +# +# Keyboard delay time in ms (250, 500, 750, 1000) +KBD_DELAY="" + +## Type: string(2.0,2.1,2.3,2.5,2.7,3.0,3.3,3.7,4.0,4.3,4.6,5.0,5.5,6.0,6.7,7.5,8.0,8.6,9.2,10.0,10.9,12.0,13.3,15.0,16.0,17.1,18.5,20.0,21.8,24.0,26.7,30.0) +## Default: +# +# Keyboard repeat rate (2.0 - 30.0) +KBD_RATE="" + +## Type: list(bios,yes,no) +## Default: bios +# +# NumLock on? ("yes" or "no" or empty or "bios" for BIOS setting) +KBD_NUMLOCK="bios" + +## Type: yesno +## Default: no +# +# ScrollLock on? ("yes" or "no") +KBD_SCRLOCK="no" + +## Type: yesno +## Default: no +# +# CapsLock on? ("yes" or "no") +KBD_CAPSLOCK="no" + +## Type: yesno +## Default: no +# +# Disable CAPS LOCK and make it a normal Shift key? +# (Ctrl Caps Lock will still toggle Caps Lock functionality) +# Note that you need to tweak the xkb maps or use xmodmap +# if you want to do the same under X-Windows. In ~/.Xmodmap: +# keycode 0x42 = Shift_L Shift_L +# +KBD_DISABLE_CAPS_LOCK="no" + +## Type: string +## Default: "tty1 tty2 tty3 tty4 tty5 tty6" +# +# ttys for the above settings +# Example: "tty1 tty2" +# "" for all tty's +# +KBD_TTY="tty1 tty2 tty3 tty4 tty5 tty6" + +# +# Compose tables to be loaded. +# Compose tables are good for producing characters, which can not +# be directly input from your keyboard, such as characters with +# accents, currency signs, ... +# Please read /usr/share/doc/packages/kbd/README.SuSE for an +# explanation. +# You may leave this variable empty (default compose table from kernel +# or KEYTABLE will be used then -- most keyboard maps don't have a +# compose table, though) +# More than one compose table can be given. For a selection of possible +# tables see /usr/share/kbd/keymaps/include/compose.* +# You can give more than one compose table, but only the last one will +# determine the compose combinations. +# The word "clear" has a special meaning: +# Your compose table will be cleared, before more compose symbols are +# added. +# The files compose.winkeys and shiftctrl may be used to map the +# <compose> key to the W*n menu key and Shift-Ctrl, respectively, +# on a PC keyboard. +# A typical setting for Latin1 users (with a PC keyboard) may be +# COMPOSETABLE="clear winkeys shiftctrl latin1.add" +# For latin2, this would be +# COMPOSETABLE="clear winkeys shiftctrl latin2" +# A typical setting for sb. with a character set, where a matching +# compose table is missing (but with a PC keyboard), would be +# COMPOSETABLE="winkeys shiftctrl" +# +COMPOSETABLE="clear winkeys shiftctrl latin1.add" + +# The YaST-internal identifier of the attached keyboard. +# +YAST_KEYBOARD="us,pc104" Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/network/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/network/Makefile.am (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/network/Makefile.am Mon Dec 17 13:21:12 2007 @@ -0,0 +1,10 @@ +# +# Makefile.am for product-creator/kiwi_templates/xen/root/etc/sysconfig/network +# + +ydatadir = @ydatadir@/product-creator/kiwi_templates/xen/root/etc/sysconfig/network + +ydata_DATA = \ + ifcfg-eth0 + +EXTRA_DIST = $(ydata_DATA) Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/network/ifcfg-eth0 URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/network/ifcfg-eth0 (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/kiwi_templates/xen/root/etc/sysconfig/network/ifcfg-eth0 Mon Dec 17 13:21:12 2007 @@ -0,0 +1,4 @@ +BOOTPROTO='dhcp' +MTU='' +REMOTE_IPADDR='' +STARTMODE='onboot' Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/sysconfig.product-creator URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/sysconfig.product-creator (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/data/sysconfig.product-creator Mon Dec 17 13:21:12 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: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/dialogs.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/dialogs.ycp Mon Dec 17 13:21:12 2007 @@ -25,6 +25,7 @@ import "GPGWidgets"; import "CWM"; import "String"; + import "Package"; include "product-creator/helps.ycp"; @@ -503,6 +504,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") { @@ -512,7 +516,7 @@ foreach(string key, string value, read_content, { - if (key == "ARCH." + Arch::architecture()) + if (key == "ARCH." + arch) { found_architecture = true; break; @@ -526,7 +530,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) { @@ -539,7 +543,9 @@ } else { - Report::Error(sformat(_("The source does not support architecture of this machine (%1).\nSelect another source."), Arch::architecture())); + Report::Error(sformat(_("The source does not support the architecture of this machine (%1). +Select another source. +"), arch)); } } else if (ret == `remove) @@ -868,7 +874,10 @@ any ret = nil; // set a mount point - there is no use to display DU of the current system - Pkg::TargetInitDU([ $[ "name" : "/", "free" : 999*1024*1024 /* 999GB */, "used" : 0, "readonly" : false ] ]); + Pkg::TargetInitDU([ $[ "name" : "/", + "free" : ProductCreator::max_size_mb * 1024, + "used" : 0, "readonly" : false ] + ]); /* dialog caption */ string caption = _("Software Selection"); @@ -1102,7 +1111,10 @@ { string details = (string)SCR::Read(.target.string, "/var/log/YaST2/badlist"); // error message, %1 = details - Report::LongError(sformat(_("The dependecies cannot be resolved.\n\n%1"), details)); + Report::LongError(sformat(_("The dependencies cannot be resolved. + +%1 +"), details)); return $["ui" : `failed]; } @@ -1253,7 +1265,8 @@ // TODO: validate the dialog (is a key selected if the checkbox is selected? // "validate_help" : _("Select a gpg key in the table. Create...") "help" : _("<p><big><b>Sign</b></big><br> -adsfsdfsddsfsdfdsf</p>") +To make it possible for users to verify your product, sign it with a GPG key. +This key is checked when the product is added as an installation source.</p>") ] ]; } @@ -1310,21 +1323,25 @@ ProductCreator::CommitConfig(); - // caption string summary = ""; + // summary caption summary = Summary::AddHeader(summary, _("Package Source") ); summary = Summary::OpenList(summary); foreach(string s, ProductCreator::Config["sources"]:[], ``{ summary = Summary::AddListItem(summary, s); }); summary = Summary::CloseList(summary); + // summary caption summary = Summary::AddHeader(summary, _("Packages") ); + // summary line summary = Summary::AddLine(summary, sformat(_("Selected %1 packages"), size(Pkg::GetPackages(`selected, true)))); + // summary caption summary = Summary::AddHeader(summary,_("Output Directory")); + // summary line summary = Summary::AddLine(summary,sformat(_("Creating directory tree in <b> %1/%2 </b>"), ProductCreator::Config["iso-directory"]:"", ProductCreator::Config["name"]:"") ); Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/helps.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/helps.ycp Mon Dec 17 13:21:12 2007 @@ -62,7 +62,15 @@ _("<p><b><big>Editing or Deleting:</big></b><br> Choose a configuration to change or remove. Then press <b>Edit</b> or <b>Delete</b> as desired.</p> -"), +") + + + // overview dialog help part 4 +_("<p>Use <b>Create Image</b> to create the ISO image or directory with your +configured product.</p>") + + + // overview dialog help part 5 +_("<p>Press <b>Create Image with KIWI</b> for additional configuration of various +types of images, such as Live media or Xen images, with the KIWI image system.</p>"), /* Configure1 dialog help 1/4 */ "initial" : _("<p><b><big>Configuration Name and Packages</big></b><br> Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/image-creator.desktop URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/image-creator.desktop (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/image-creator.desktop Mon Dec 17 13:21:12 2007 @@ -0,0 +1,23 @@ +[Desktop Entry] +Type=Application +Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Misc; + +X-KDE-ModuleType=Library +X-KDE-RootOnly=true +X-KDE-HasReadOnlyMode=true +X-KDE-Library=yast2 +X-SuSE-YaST-Call=image-creator + +X-SuSE-YaST-Group=Misc +X-SuSE-YaST-Argument= +X-SuSE-YaST-RootOnly=true +X-SuSE-YaST-AutoInst= +X-SuSE-YaST-Geometry= +X-SuSE-YaST-SortKey= + +Icon=yast-cd-creator +Exec=/sbin/yast2 image-creator + +Name=Image Creator +GenericName=Create the Live CD, USB or XEN image +X-KDE-SubstituteUID=true Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/image-creator.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/image-creator.ycp (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/image-creator.ycp Mon Dec 17 13:21:12 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 */ +} Added: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/kiwi_dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/kiwi_dialogs.ycp (added) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/kiwi_dialogs.ycp Mon Dec 17 13:21:12 2007 @@ -0,0 +1,1985 @@ +/** + * File: include/product-creator/kiwi.ycp + * Package: Configuration of product-creator + * Summary: Dialogs for kiwi configuration + * Authors: Jiri Suchomel <jsuchome@suse.cz> + * + * $Id$ + */ +{ + textdomain "product-creator"; + + import "CWM"; + import "CWMTab"; + import "Directory"; + import "ProductCreator"; + import "FileUtils"; + import "Label"; + import "Kiwi"; + import "Popup"; + import "SourceDialogsLite"; + import "SourceManager"; + import "Summary"; + import "URL"; + import "Wizard"; + + include "product-creator/dialogs.ycp"; + + // map of current image configuration + map<string,any> KiwiConfig = $[]; + + // what are we configuring now ("iso"/"xen"/...) + string kiwi_task = ""; + + // return the id of actual widget for boot image + string boot_image_widget () { + return kiwi_task + "boot"; + } + + // read available the images under /usr/share/kiwi/image/ directory + list<term> GetAvailableImages (string subdir) { + + list<term> ret = []; + 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) + return ret; + foreach (string file, splitstring (out["stdout"]:"", "\n"), { + if (file != "" && FileUtils::IsDirectory (sformat ("%1/%2/%3", dir, subdir, file))) + { + ret = add (ret, `item (`id(file), file, file == KiwiConfig[subdir]:"")); + } + }); + return ret; + } + + /******************************************************************************************** + * widget handlers + *******************************************************************************************/ + + /** + * Initialize the widget with ignored packages + */ + define void InitSWIgnore (string id) { + string sw_selection = KiwiConfig["sw_selection"]:"image"; + string ignore_key = sw_selection == "image" ? "ignore" : (sw_selection + "_ignore"); + UI::ChangeWidget (`id (id), `Value, mergestring (KiwiConfig[ignore_key]:[], "\n")); + } + + define void StoreSWIgnore (string key, map event) { + string sw_selection = KiwiConfig["sw_selection"]:"image"; + string ignore_key = sw_selection == "image" ? "ignore" : (sw_selection + "_ignore"); + KiwiConfig[ignore_key] = filter (string p, + splitstring ((string) UI::QueryWidget(`id(key), `Value), "\n"), ``(p != "")); + } + + define symbol HandleSWIgnore (string key, map event) { + if (event["ID"]:nil == `next) StoreSWIgnore (key, event); + 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 + */ + define void InitSWRichText (string id) { + + string sw_selection = KiwiConfig["sw_selection"]:"image"; + string pattern_key = sw_selection == "image" ? "addons" : (sw_selection + "_patterns"); + string rt = ""; + if (KiwiConfig[pattern_key]:[] != []) + { + // richtext header + rt = Summary::AddHeader ("", _("Patterns")); + foreach (string pattern, (list<string>) KiwiConfig[pattern_key]:[], { + rt = Summary::AddListItem (rt, pattern); + }); + } + string package_key = sw_selection == "image" ? "packages" : (sw_selection + "_packages"); + if (KiwiConfig[package_key]:[] != []) + { + // richtext header + rt = Summary::AddHeader (rt, _("Packages")); + foreach (string package, (list<string>) KiwiConfig[package_key]:[], { + rt = Summary::AddListItem (rt, package); + }); + } + UI::ChangeWidget (`id (id), `Value, rt); + } + + /** + * Handler for software selection + */ + define symbol HandleSWSelection (string key, map event) { + if (event["ID"]:nil == key) + { + 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; + if (sw_selection == "image" && packageSelector () != `cancel) + { + KiwiConfig["addons"] = ProductCreator::Config["addons"]:[]; + KiwiConfig["packages"] = ProductCreator::Config["packages"]:[]; + InitSWRichText ("rt_sw"); + if (ProductCreator::Config["taboo"]:[] != nil) + { + //FIXME do not replace current 'ignored' tags... + KiwiConfig["ignore"] = union (KiwiConfig["ignore"]:[], + ProductCreator::Config["taboo"]:[]); + InitSWIgnore ("ignore"); + } + } + else if (sw_selection != "image") + { + map<string,any> selected = runPackageSelector ("", + KiwiConfig[sw_selection + "_patterns"]:[], + KiwiConfig[sw_selection + "_packages"]:[], + KiwiConfig[sw_selection + "_ignore"]:[], + `packages + ); + KiwiConfig[sw_selection + "_patterns"] = selected["addons"]:[]; + KiwiConfig[sw_selection + "_packages"] = selected["packages"]:[]; + InitSWRichText ("rt_sw"); + if (ProductCreator::Config["taboo"]:[] != nil) + { + KiwiConfig["ignore"] = ProductCreator::Config["taboo"]:[]; + InitSWIgnore ("ignore"); + } + } + } + return nil; + } + + /** + * initialize the combo box with package selection groups + */ + define void InitSWSelectionCombo (string id) { + string sw_selection = KiwiConfig["sw_selection"]:"image"; + list items = [ + `item (`id ("image"), _("Image"), sw_selection == "image"), + ]; + if (kiwi_task == "xen") + items = add (items, `item (`id ("xen"), _("Xen Specific"), sw_selection == "xen")); + UI::ChangeWidget (`id (id), `Items, items); + } + + define void StoreSWSelectionCombo (string key, map event) { + KiwiConfig[key] = (string) UI::QueryWidget(`id(key), `Value); + } + + /** + * handler for combo box with isoboot items + */ + define symbol HandleSWSelectionCombo (string key, map event) { + any id = event["ID"]:nil; + // store the value on exiting + if (id == `next) StoreSWSelectionCombo (key, event); + else if (event["ID"]:nil == key) + { + string selected = (string) UI::QueryWidget(`id(key), `Value); + if (selected != KiwiConfig["sw_selection"]:"image") + { + StoreSWIgnore ("ignore", event); + StoreSWSelectionCombo (key, event); + InitSWRichText ("rt_sw"); + InitSWIgnore ("ignore"); + } + } + return nil; + } + + + /** + * initialize the value of combo box with isoboot items + */ + define void InitBootCombo (string id) { + UI::ChangeWidget (`id (id), `Items, GetAvailableImages (id)); + } + + /** + * store the value of current isoboot image + */ + define void StoreBootCombo (string key, map event) { + KiwiConfig[key] = (string) UI::QueryWidget(`id(key), `Value); + } + /** + * handler for combo box with isoboot items + */ + define symbol HandleBootCombo (string key, map event) { + // store the value on exiting + if (event["ID"]:nil == `next) StoreBootCombo (key, event); + return nil; + } + + /** + * initialize the value of compress checkbox + */ + define void InitCompressCheckBox (string id) { + UI::ChangeWidget (`id (id), `Enabled, false); + UI::ChangeWidget (`id (id), `Value, KiwiConfig["compressed"]:false); + } + + /** + * store the value of compress checkbox + */ + define void StoreCompressCheckBox (string key, map event) { + KiwiConfig["compressed"] = (boolean) UI::QueryWidget(`id(key), `Value); + } + /** + * handler for compress checkbox + */ + define symbol HandleCompressCheckBox (string key, map event) { + // store the value on exiting + if (event["ID"]:nil == `next) StoreCompressCheckBox (key, event); + return nil; + } + + /** + * initialize the value of version + */ + define void InitVersion (string id) { + UI::ChangeWidget (`id (id), `Value, sformat ("%1", KiwiConfig[id]:"1")); + } + + /** + * store the value of current version + */ + define void StoreVersion (string key, map event) { + KiwiConfig[key] = sformat ("%1", UI::QueryWidget(`id(key), `Value)); + } + + /** + * handler for version + */ + define symbol HandleVersion (string key, map event) { + // store the value on exiting + if (event["ID"]:nil == `next) StoreVersion (key, event); + return nil; + } + + /** + * initialize the value of combo box with isoboot items + */ + define void InitSizeUnitCombo (string id) { + UI::ChangeWidget (`id (id), `Items, maplist (string u, [ "M", "G" ], ``( + `item (`id (u), u + "B", KiwiConfig[id]:"M" == u)) + )); + } + + /** + * initialize the value of version + */ + define void InitSize (string id) { + UI::ChangeWidget (`id (id), `Value, KiwiConfig[id]:2700); + } + + /** + * initialize the product label + */ + define void InitLabel (string id) { + UI::ChangeWidget (`id ("name"), `Value, KiwiConfig["name"]:""); + } + + + /** + * universal widget: initialize the string value of widget @param + */ + define void InitDescription (string id) { + UI::ChangeWidget (`id (id), `Value, KiwiConfig[id]:""); + } + + /** + * store the string value of given widget + */ + define void StoreDescription (string key, map event) { + KiwiConfig[key] = UI::QueryWidget (`id(key), `Value); + } + + /** + * handler for general string-value widgets: store their value on exit/save + */ + define symbol HandleDescription (string key, map event) { + // store the value on exiting + if (event["ID"]:nil == `next) StoreDescription (key, event); + return nil; + } + + define void InitOutputDir (string id) { + UI::ChangeWidget (`id (id), `Value, KiwiConfig["iso-directory"]:""); + } + + /** + * initialize the table with users + */ + define void InitUsersTable (string id) { + + list items = maplist (string user, map usermap, (map<string,map>) KiwiConfig["users"]:$[], + ``(`item (`id (user), user, usermap["home"]:""))); + UI::ChangeWidget (`id ("table"), `Items, items); + UI::ChangeWidget (`id ("edituser"), `Enabled, size (items) > 0); + UI::ChangeWidget (`id ("deleteuser"), `Enabled, size (items) > 0); + } + + /** + * Handle changes in users table + */ + define symbol HandleAddEditUser (string key, map event) { + if (event["ID"]:nil != key && (key != "userstable" || event["ID"]:nil != "table")) return nil; + + if (key == "userstable") key = "edituser"; + string current_user = (string) UI::QueryWidget (`id ("table"), `CurrentItem); + + UI::OpenDialog (`opt(`decorated), `HBox (`HSpacing (0.5), `VBox ( + `VSpacing (0.5), + // popup label + `Label (`id (`label), _("Add new user")), + // text entry label + `TextEntry (`id (`username), _("&Name")), + `Password (`id (`pw1), Label::Password(), ""), + `Password (`id(`pw2), Label::ConfirmPassword(), ""), + `TextEntry (`id (`home), _("&Home Directory")), + `HBox ( + `PushButton (`id(`ok),`opt(`key_F10), Label::OKButton()), + `PushButton (`id(`cancel),`opt(`key_F9), Label::CancelButton()) + ), + `VSpacing (0.5)), `HSpacing (0.5)) + ); + if (key == "edituser") + { + UI::ChangeWidget (`id (`username), `Value, current_user); + UI::ChangeWidget (`id (`home), `Value, KiwiConfig["users", current_user, "home"]:""); + UI::ChangeWidget (`id (`pw1), `Value, "*****"); + UI::ChangeWidget (`id (`pw2), `Value, "*****"); + // popup label + UI::ChangeWidget (`id (`label), `Value, _("Edit User")); + } + any ret = nil; + repeat + { + ret = UI::UserInput (); + if (ret == `ok) + { + string username = (string) UI::QueryWidget (`id(`username), `Value); + string pwd = (string) UI::QueryWidget (`id(`pw1), `Value); + if (username == "") + { + // popup message + Report::Error (_("Enter the user name.")); + ret = `notnext; + continue; + } + if (pwd != UI::QueryWidget (`id(`pw2), `Value)) + { + // popup message + Report::Error (_("The passwords do not match. +Try again.")); + ret = `notnext; + continue; + } + if (pwd == "") + { + // popup message + Report::Error (_("Enter the user password.")); + ret = `notnext; + continue; + } + if (! haskey (KiwiConfig, "users")) + KiwiConfig["users"] = $[]; + else if (key == "edituser" && username != current_user) + KiwiConfig["users"] = remove (KiwiConfig["users"]:$[], current_user); + KiwiConfig["users", username] = $[ + "pwd" : pwd, + "home" : UI::QueryWidget (`id(`home), `Value) + ]; + } + } until (ret == `ok || ret == `cancel); + + UI::CloseDialog (); + if (ret == `ok) InitUsersTable ("table"); + return nil; + } + + /** + * handle delete user button + */ + define symbol HandleDeleteUser (string key, map event) { + if (event["ID"]:nil != key) return nil; + + string current_user = (string) UI::QueryWidget (`id ("table"), `CurrentItem); + KiwiConfig["users"] = remove (KiwiConfig["users"]:$[], current_user); + InitUsersTable ("table"); + return nil; + } + + /** + * initialize the table with root dir contents + */ + define void InitRootDirTable (string id) { + + list items = maplist (string file, (list<string>) KiwiConfig["root_dir"]:[], { +// return `item (`id (file), substring (file, findlastof (file, "/") + 1)); + return `item (`id (file), file); + }); + UI::ChangeWidget (`id ("roottable"), `Items, items); + UI::ChangeWidget (`id ("root_dir_delete"), `Enabled, size (items) > 0); + } + + // add new subdir to the 'root' directory + define symbol HandleAddToRootDir (string key, map event) { + + if (event["ID"]:nil != key) return nil; + // popup for file selection dialog + string dir = UI::AskForExistingDirectory ("", _("Directory to Import")); + if (dir!= nil) + { + KiwiConfig["root_dir"] = union (KiwiConfig["root_dir"]:[], [dir]); + InitRootDirTable ("roottable"); + } + return nil; + } + + // delete subdir from the 'root' directory + define symbol HandleDeleteFromRootDir (string key, map event) { + if (event["ID"]:nil != key) return nil; + string current = (string) UI::QueryWidget (`id ("roottable"), `Value); + KiwiConfig["root_dir"] = filter (string f, KiwiConfig["root_dir"]:[], ``(f != current)); + InitRootDirTable ("roottable"); + return nil; + } + + /** + * initialize the table with config dir contents + */ + define void InitConfigDirTable (string id) { + + list items = maplist (string file, (list<string>) KiwiConfig["config_dir"]:[], { +// return `item (`id (file), substring (file, findlastof (file, "/") + 1)); + return `item (`id (file), file); + }); + UI::ChangeWidget (`id ("configtable"), `Items, items); + UI::ChangeWidget (`id ("config_dir_delete"), `Enabled, size (items) > 0); + } + + // add new subdir to the 'config' directory + define symbol HandleAddToConfigDir (string key, map event) { + + if (event["ID"]:nil != key) return nil; + // popup for file selection dialog + string dir = UI::AskForExistingFile ("", "", _("Script to Import")); + if (dir!= nil) + { + KiwiConfig["config_dir"] = union (KiwiConfig["config_dir"]:[], [dir]); + InitConfigDirTable ("configtable"); + } + return nil; + } + + // delete subdir from the 'config' directory + define symbol HandleDeleteFromConfigDir (string key, map event) { + if (event["ID"]:nil != key) return nil; + string current = (string) UI::QueryWidget (`id ("configtable"), `Value); + KiwiConfig["config_dir"] = filter (string f, KiwiConfig["config_dir"]:[], ``(f != current)); + InitConfigDirTable ("configtable"); + return nil; + } + + /** + * universal handler for directory browsing + */ + string BrowseDirectoryHandler (string key, string label) { + + string current = (string) UI::QueryWidget (`id (key), `Value); + if (current == nil) current = ""; + string dir = UI::AskForExistingDirectory (current, label); + if (dir!= nil) + { + UI::ChangeWidget (`id (key), `Value, dir); + StoreDescription (key, $[]); + } + return dir; + } + + /** + * handler for 'root' directory browse + */ + symbol HandleBrowseRootDirectory (string key, map event) { + if (event["ID"]:nil != key) return nil; + // popup for file selection dialog ('root' is a name, do not translate) + BrowseDirectoryHandler ("root_dir", _("Path to root Directory")); + return nil; + } + + /** + * handler for 'config' directory browse + */ + symbol HandleBrowseConfigDirectory (string key, map event) { + if (event["ID"]:nil != key) return nil; + // popup for file selection dialog ('config' is a name, do not translate) + BrowseDirectoryHandler ("config_dir", _("Path to config Directory")); + return nil; + } + + /** + * handler for output directory browse + */ + symbol HandleBrowseOutputDirectory (string key, map event) { + if (event["ID"]:nil != key) return nil; + // popup for file selection dialog + BrowseDirectoryHandler ("output_dir", _("Path to the Output Directory")); + return nil; + } + + /** + * universal handler for file browsing + */ + string BrowseFileHandler (string key, string label) { + + string current = (string) UI::QueryWidget (`id (key), `Value); + if (current == nil) current = ""; + string file = UI::AskForExistingFile (current, "", label); + if (file != nil && key != "config.sh") + { + UI::ChangeWidget (`id (key), `Value, file); + StoreDescription (key, $[]); + } + return file; + } + + /** + * Handler for browsing for images.sh file + */ + symbol HandleBrowseImagesFile (string key, map event) { + if (event["ID"]:nil != key) return nil; + // popup for file selection dialog + BrowseFileHandler ("images_path", _("Path to images.sh File")); + return nil; + } + + /** + * Handler for browsing for autoyast profile + */ + symbol HandleBrowseAutoYaSTFile (string key, map event) { + if (event["ID"]:nil != key) return nil; + // popup for file selection dialog + BrowseFileHandler ("autoyast_path", _("Path to AutoYaST Profile")); + return nil; + } + + /** + * Handler for importing config.sh file + */ + symbol HandleImportConfigFile (string key, map event) { + if (event["ID"]:nil != key) return nil; + // popup for file selection dialog + string file = BrowseFileHandler ("config.sh", _("Path to config.sh File")); + if (file != nil) + { + if (FileUtils::Exists (file)) + { + string configsh = (string) SCR::Read (.target.string, file); + if (configsh != nil) + { + UI::ChangeWidget (`id ("config.sh"), `Value, configsh); + StoreDescription ("config.sh", event); + } + } + } + return nil; + } + + /** + * Handler for importing images.sh file + * TODO same function as HandleImportConfigFile + */ + symbol HandleImportImagesFile (string key, map event) { + if (event["ID"]:nil != key) return nil; + // popup for file selection dialog + string file = BrowseFileHandler ("images.sh", _("Path to images.sh File")); + if (file != nil) + { + if (FileUtils::Exists (file)) + { + string imagessh = (string) SCR::Read (.target.string, file); + if (imagessh != nil) + { + UI::ChangeWidget (`id ("images.sh"), `Value, imagessh); + StoreDescription ("images.sh", event); + } + } + } + return nil; + } + + // generic popup + define symbol NotImplementedHandler (string key, map event) { + if (event["ID"]:nil == key) + { + Popup::Message (_("Feature not implemented yet.")); + } + return nil; + } + + /** + * handler for main action: create the iso image with kiwi + */ + define boolean CreateImage (string key, map event) { + if (event["ID"]:nil != `next) + return true; + boolean ret = true; + map question = $[ + // popup question + "iso" : _("Create ISO image now?"), + // popup question + "xen" : _("Create Xen image now?"), + // popup question + "usb" : _("Create USB stick image now?"), + // popup question + "vmx" : _("Create virtual disk image now?"), + ]; + + map success = $[ + // popup message, %1 is a dir + "iso" : _("ISO image successfully created in +%1 +directory."), + // popup message, %1 is a dir + "xen" : _("Xen image files successfully created in +%1 +directory. +"), + // popup message, %1 is a dir + "usb" : _("USB stick image successfully created in +%1 +directory."), + // popup message, %1 is a dir + "vmx" : _("Virtual disk image successfully created in +%1 +directory."), + ]; + + Kiwi::WriteConfigXML (KiwiConfig, kiwi_task); + // default question + if (Popup::YesNo (question[kiwi_task]:_("Create image now?"))) + { + if (true) + { + string out_dir = KiwiConfig["iso-directory"]:""; + if (FileUtils::CheckAndCreatePath (out_dir) && Kiwi::PrepareAndCreate (out_dir)) + { + if (kiwi_task == "usb" && false) + { + // additional question (yes/no) + if (Popup::YesNo (sformat (success[kiwi_task]:"", out_dir) + _(" +Save the image to the stick now?"))) + { + NotImplementedHandler ("", $[ "ID" : ""]); + } + } + else + { + // default popup message, %1 is a dir + Popup::Message (sformat (success[kiwi_task]:_("Image successfully created in +%1 +directory."), out_dir)); + } + } + else + { + ret = false; + } + } + } + string dir = Kiwi::SaveConfiguration (KiwiConfig, kiwi_task); + if (dir != nil && dir != "") + { + ProductCreator::Config["kiwi_configuration_" + kiwi_task] = dir; + } + return ret; + } + + /** + * Global init function for Kiwi image dialog + * - read saved settings and fill in defaults + */ + define void InitImageConfiguration () { + + kiwi_task = Kiwi::kiwi_task; + string kiwi_dir = "/usr/share/kiwi/image/"; + + // read the information from the base product + integer src_id = ProductCreator::checkProductDependency (); + map<string,string> content = ProductCreator::ReadContentFile(src_id); + + KiwiConfig = ProductCreator::Config; + // busy popup + Popup::ShowFeedback (_("Reading current image configuration..."), _("Please wait...")); + + map default_dirmap = $[ + "iso" : sformat ("%1/kwliveDVD-suse-10.3", kiwi_dir), + "xen" : sformat ("%1/buildhost-suse-SLES10", kiwi_dir), + "usb" : sformat ("%1/kwliveDVD-suse-10.3", kiwi_dir), + "vmx" : sformat ("%1/kwliveDVD-suse-10.3", kiwi_dir), + ]; + + // 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) + if (!FileUtils::Exists (default_dir)) + { + default_dir = Directory::datadir+"/product-creator/kiwi_templates/"; + default_dir = default_dir + (kiwi_task == "xen" ? "xen" : "iso"); + } + y2warning ("directory %1 is not available, using %2", kiwi_configuration, default_dir); + kiwi_configuration = default_dir; + } + + if (FileUtils::Exists (kiwi_configuration + "/root")) + { + // read all entries from root_dir and save to list + map out = (map) SCR::Execute (.target.bash_output, + sformat ("ls -A1 -d %1/root/* 2>/dev/null", kiwi_configuration)); + KiwiConfig["root_dir"] = filter (string f, splitstring(out["stdout"]:"", "\n"), ``(f!="")); + } + if (FileUtils::Exists (kiwi_configuration + "/config")) + { + map out = (map) SCR::Execute (.target.bash_output, + sformat ("ls -A1 -d %1/config/* 2>/dev/null", kiwi_configuration)); + KiwiConfig["config_dir"] = filter (string f, splitstring(out["stdout"]:"", "\n"),``(f!="")); + } + + foreach (string file, [ "images.sh", "config.sh" ], { + string file_path = kiwi_configuration + "/" + file; + if (FileUtils::Exists (file_path)) + { + string contents = (string) SCR::Read (.target.string, file_path); + if (contents != nil) + KiwiConfig[file] = contents; + } + }); + // take care of the rest in the input directory (#330052) + 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); + if (contains (["images.sh", "config.sh", "config.xml", "root","config"], + last)) + return; + import_files = add (import_files, line); + }); + KiwiConfig["import_files"] = import_files; + + + map<string,any> read_config = Kiwi::ReadConfigXML (kiwi_configuration); + if (!KiwiConfig["_imported"]:false) + { + // "type" had different meaning in ProductCreator::Config... + if (haskey (KiwiConfig, "type")) + KiwiConfig = remove (KiwiConfig, "type"); + KiwiConfig = (map<string,any>) union (KiwiConfig, read_config); + // for new configuration, do not read all from the template + y2milestone ("product-creator based configuration..."); + foreach (string key, ["addons", "packages", "sources"], { + KiwiConfig[key] = ProductCreator::Config[key]:[]; + }); + KiwiConfig["name"] = ProductCreator::Config["name"]:""; + } + else + { + y2milestone ("imported configuration..."); + // ignore options already set earlier... + foreach (string key, any val, read_config, { + if (!contains (["name", "iso-directory", "sources", "version", + "type"],key)) + { + KiwiConfig[key] = val; + } + }); + // "sources" are already there... + foreach (string key, ["addons", "packages"], { + ProductCreator::Config[key] = KiwiConfig[key]:[]; + }); + } + + map label2boot = $[ + "openSUSE 10.2" : "suse-10.2", + "openSUSE 10.3" : "suse-10.3", + "SUSE Linux 10.1" : "suse-10.1", + "SUSE Linux Enterprise Server 10" : "suse-SLES10", + "SUSE Linux Enterprise Desktop 10" : "suse-SLED10" + ]; + map distproduct2boot = $[ + "openSUSE-10.2-CD-download" : "suse-10.2", + "openSUSE-10.2-dvd5-download" : "suse-10.2", + "openSUSE-10.3-dvd5-download" : "suse-10.3", + "openSUSE-10.3-CD-download" : "suse-10.3", + "SUSE-Linux-10.1-CD-download-x86" : "suse-10.1", + "SUSE-Linux-Enterprise-Server-i386" : "suse-SLES10", + "SUSE-Linux-Enterprise-Desktop-i386" : "suse-SLED10", + "SUSE-Linux-Enterprise-Server-SP1" : "suse-SLES10-SP1", + "SUSE-Linux-Enterprise-Desktop-SP1" : "suse-SLED10-SP1" + ]; + string boot_image = label2boot[content["LABEL"]:""]:""; + if (boot_image == "") + boot_image = distproduct2boot[content["DISTPRODUCT"]:""]:""; + + // guess some default boot image value + if (kiwi_task == "iso" && !haskey (KiwiConfig, "isoboot") && boot_image != "") + { + KiwiConfig["isoboot"] = boot_image; + } + else if (kiwi_task == "usb") + { + if (!haskey (KiwiConfig, "usbboot") && boot_image != "") + KiwiConfig["usbboot"] = boot_image; + } + else if (kiwi_task == "vmx") + { + if (!haskey (KiwiConfig, "vmxboot") && boot_image != "") + KiwiConfig["vmxboot"] = boot_image; + } + else if (kiwi_task == "xen") + { + if (!haskey (KiwiConfig, "xenboot")) + KiwiConfig["xenboot"] = boot_image; + } + string name = KiwiConfig["name"]:""; + if (!haskey (KiwiConfig, "specification")) + KiwiConfig["specification"] = KiwiConfig["name"]:""; + Popup::ClearFeedback (); + } + + + /******************************************************************************************** + * widget descriptions + *******************************************************************************************/ + + // return map with description of tabs + // it is a function, to be able to adapt to actual state (e.g. boot_image_widget ()) + map tabs_descr () { + + return $[ + "config.xml" : $[ + // tab header + "header" : _("Image Configuration"), + "contents" : `HBox (`HSpacing(1), + `VBox ( + `VSpacing (0.2), + `HBox ( + `HWeight (1, "version"), + `HWeight (1, `HBox ("size", "sizeunit")) + ), + "sw_selection", + `HBox ( + `HWeight (1, `VBox ( + `Left (`Label (_("Installed Software"))), "rt_sw", `Right ("configure_sw") + )), + `HWeight (1, `VBox ("ignore", "delete_sw")) + ), + `VSpacing (0.2) + ), `HSpacing(1)), + "widget_names" : [ + "version", + "size", "sizeunit", + "sw_selection", + "rt_sw", "configure_sw", + "ignore", "delete_sw" + ], + ], + "description" : $[ + // tab header + "header" : _("Description"), + "contents" : `HBox (`HSpacing(1), + `VBox ( + `VSpacing (0.2), + "author", + `VSpacing (0.2), + "contact", + `VSpacing (0.2), + "specification", + `VStretch () + ), `HSpacing (1)), + "widget_names" : [ "author", "contact", "specification" ], + ], + "users" : $[ + // tab header + "header" : _("Users"), + "contents" : `HBox (`HSpacing(1), + `VBox ( + "general_users", + `VSpacing (0.2), + "group", + `VSpacing (0.2), + "userstable", + `VSpacing (0.2), + `HBox ("adduser", "edituser", "deleteuser", `HStretch ()), + `VSpacing (0.2) + ), `HSpacing (1)), + "widget_names" : [ + "general_users", "group", "userstable", "adduser", "edituser", "deleteuser" + ] + ], + "scripts" : $[ + // tab header + "header" : _("Scripts"), + "contents" : `HBox (`HSpacing(1), + `VBox ( + "general_scripts", + `VSpacing (0.2), + `HBox ("config.sh", `Bottom ("import_config.sh")), + `HBox ("images.sh", `Bottom ("import_images.sh")), + `VSpacing (0.2) + ), `HSpacing (1)), + "widget_names" : [ + "general_scripts", + "config.sh", "import_config.sh", + "images.sh", "import_images.sh", + ], + ], + "directories" : $[ + // tab header + "header" : _("Directories"), + "contents" : `HBox (`HSpacing(1), + `VBox ( + "general_directories", + `VSpacing (0.2), + "root_dir_table", + `VSpacing (0.2), + `HBox ("root_dir_add", `Left ("root_dir_delete")), + `VSpacing (0.2), + "config_dir_table", + `VSpacing (0.2), + `HBox ("config_dir_add", `Left ("config_dir_delete")), + `VSpacing (0.2), + `VSpacing (0.2) + ), `HSpacing (1)), + "widget_names" : [ + "general_directories", + "root_dir_table", "root_dir_add", "root_dir_delete", + "config_dir_table", "config_dir_add", "config_dir_delete", + ], + ], + ]; + } + + map<string, map> get_widget_description () { + return $[ + // global widgets + "global" :$[ + "widget" : `empty, + "validate_type" : `function, + "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 + "label" : _("C&onfigure..."), + "help" : _("<p>Create a new boot image with <b>Configure</b>.</p>"), + "handle" : NotImplementedHandler + ], + "compressed" : $[ + "widget" : `checkbox, + // textentry label + "label" : _("Co&mpress"), + "help" : _("<p>Check <b>Compress</b> if the final image should be based \non the squashfs compressed file system."), + "init" : InitCompressCheckBox, + "store" : StoreCompressCheckBox, + "handle" : HandleCompressCheckBox, + ], + "sw_selection" : kiwi_task == "xen" ? $[ + "widget" : `combobox, + "opt" : [ `hstretch, `notify ], + // combo box label + "label" : _("So&ftware Selection"), + // help text for "So&ftware selection" + "help" : "", + "items" : [], + "init" : InitSWSelectionCombo, + "store" : StoreSWSelectionCombo, + "handle" : HandleSWSelectionCombo, + ] : $[ + "widget" : `empty, + "no_help" : true, + ], + "rt_sw" : $[ + "widget" : `richtext, + "init" : InitSWRichText, + "help" : "", + "label" : "&L", + ], + "configure_sw" : $[ + "widget" : `push_button, + // pusbutton label + "label" : _("Ch&ange..."), + "help" : _("<p>Adapt the software selection with <b>Change</b>.</p>"), + "handle" : HandleSWSelection + ], + "ignore" : $[ + "widget" : `multi_line_edit, + // label + "label" : _("&Ignored Software"), + "init" : InitSWIgnore, + "store" : StoreSWIgnore, + "handle" : HandleSWIgnore, + // 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 + "label" : _("O&utput Directory"), + "help" : _("help for output dir"), + "init" : InitOutputDir, + ], + "browse_output_dir" : $[ + "widget" : `push_button, + "label" : Label::BrowseButton (), + "help" : "", + "handle" : HandleBrowseOutputDirectory + ], + "version" : $[ + "widget" : `textentry, + // textentry label + "label" : _("&Version"), + "help" : _("<p>Enter the <b>Version</b> of your image configuration.</p>"), + "valid_chars" : String::CDigit () + ".", + "init" : InitVersion, + "store" : StoreVersion, + "handle" : HandleVersion, + ], + "size" : $[ + "widget" : `intfield, + "opt" : [ `hstretch ], + // textentry label + "label" : _("&Size"), + "help" : _("<p>Set the image <b>Size</b> in the specified <b>Unit</b>.</p>"), + "init" : InitSize, + "store" : StoreDescription, + "handle" : HandleDescription, + ], + "sizeunit" : $[ + "widget" : `combobox, + // textentry label + "label" : _("&Unit"), + "no_help" : true, + "items" : [], + "init" : InitSizeUnitCombo, + "store" : StoreDescription, + "handle" : HandleDescription, + ], + // ---------------- widgtes for directory structure + "general_scripts" : $[ + "widget" : `empty, + // general help for directory structure tab + "help" : _("<p>Here, edit the configuration scripts used to build your image.</p>"), + ], + "general_directories" : $[ + "widget" : `empty, + // general help for directory structure tab + "help" : _("<p>Here, point to the configuration directories that should help to build your image.</p>"), + ], + "root_dir" : $[ + "widget" : `textentry, + // textentry label + "label" : _("Directory with System Configur&ation"), + // help text + "help" : _("<p>Define the path to the <b>Directory with System Configuration</b> (the <tt>root</tt> directory). The entire directory is copied into the root of the image tree using <tt>cp -a</tt>.</p>"), + "init" : InitDescription, + "store" : StoreDescription, + "handle" : HandleDescription, + ], + "browse_root_dir" : $[ + "widget" : `push_button, + "label" : Label::BrowseButton (), + "help" : "", + "handle" : HandleBrowseRootDirectory + ], + "root_dir_table" : $[ + "widget" : `custom, + "custom_widget" : `VBox ( + // label (above table) + `Left (`Label (_("Directory with System Configuration"))), + `Table (`id("roottable"), `header ( + // table header + _("Path to Directory")) + ) + ), + // help for table with users + "help" : _("<p>Configure the <b>Directory with System Configuration</b> (the <tt>root</tt> directory). The entire directory is copied into the root of the image tree using <tt>cp -a</tt>.</p>"), + "init" : InitRootDirTable, + ], + "root_dir_add" : $[ + "widget" : `push_button, + "label" : Label::AddButton (), + "no_help" : true, + "handle" : HandleAddToRootDir, + ], + "root_dir_delete" : $[ + "widget" : `push_button, + "label" : Label::DeleteButton (), + "no_help" : true, + "handle" : HandleDeleteFromRootDir, + ], + "config_dir_table" : $[ + "widget" : `custom, + "custom_widget" : `VBox ( + // label (above table) + `Left (`Label (_("Directory with Scripts"))), + `Table (`id("configtable"), `header ( + // table header + _("Path to File")) + ) + ), + // help for table with users + "help" : _("<p>Configure the <b>Directory with Scripts</b> (the <tt>config</tt> directory). It contains scripts that are run after the installation of all the image packages.</p>"), + "init" : InitConfigDirTable, + ], + "config_dir_add" : $[ + "widget" : `push_button, + "label" : Label::AddButton (), + "no_help" : true, + "handle" : HandleAddToConfigDir, + ], + "config_dir_delete" : $[ + "widget" : `push_button, + "label" : Label::DeleteButton (), + "no_help" : true, + "handle" : HandleDeleteFromConfigDir, + ], + "config.sh" : $[ + "widget" : `multi_line_edit, + // textentry label + "label" : _("I&mage Configuration Script"), + "help" : _("<p>Edit your <b>Image Configuration Script</b>, called <tt>config.sh</tt>. This script is run at the end of the installation but before the package scripts have run.</p>"), + "init" : InitDescription, + "store" : StoreDescription, + "handle" : HandleDescription, + ], + "import_config.sh" : $[ + "widget" : `push_button, + // textentry label + "label" : _("&Import..."), + "help" : "", + "handle" : HandleImportConfigFile + ], + "config_dir" : $[ + "widget" : `textentry, + // textentry label + "label" : _("Pa&th to Directory with Scripts"), + "help" : _("<p>The optional <b>Directory with Scripts</b> (<tt>config</tt> directory) contains scripts that are run after the installation of all the image packages.</p>"), + "init" : InitDescription, + "store" : StoreDescription, + "handle" : HandleDescription, + ], + "browse_config_dir" : $[ + "widget" : `push_button, + // push button label + "label" : _("Br&owse..."), + "help" : "", + "handle" : HandleBrowseConfigDirectory + ], + "autoyast_path" : $[ + "widget" : `textentry, + // textentry label + "label" : _("Path to Auto&YaST Profile"), + "help" : _("Choose the path to the AutoYaST profile (config.xml)."), + ], + "browse_autoyast" : $[ + "widget" : `push_button, + // push button label + "label" : _("Brow&se..."), + "help" : "", + "handle" : HandleBrowseAutoYaSTFile + ], + "images.sh" : $[ + "widget" : `multi_line_edit, + // textentry label + "label" : _("C&leanup Script"), + "help" : _("<p>Edit your <b>Cleanup Script</b> (<tt>images.sh</tt>). This script is run at the beginning of the image creation process.</p>"), + "init" : InitDescription, + "store" : StoreDescription, + "handle" : HandleDescription, + ], + "import_images.sh" : $[ + "widget" : `push_button, + // textentry label + "label" : _("Im&port..."), + "help" : "", + "handle" : HandleImportImagesFile + ], + // ---------------- widgtes for description tab + "author" : $[ + "widget" : `textentry, + // textentry label + "label" : _("&Author"), + // help text for Author, Contact and Specification widgets + "help" : _("<p>Set the values for <b>Author</b> of the image, <b>Contact Information</b>, and the image <b>Specification</b>.</p>"), + "init" : InitDescription, + "store" : StoreDescription, + "handle" : HandleDescription, + ], + "contact" : $[ + "widget" : `textentry, + // textentry label + "label" : _("C&ontact"), + "init" : InitDescription, + "store" : StoreDescription, + "handle" : HandleDescription, + "no_help" : true, + ], + "specification" : $[ + "widget" : `multi_line_edit, + // textentry label + "label" : _("&Specification"), + "init" : InitDescription, + "store" : StoreDescription, + "handle" : HandleDescription, + "no_help" : true, + ], + // ---------------- widgtes for users tab + "general_users" : $[ + "widget" : `empty, + // general help for users tab + "help" : _("<p>Here, create users that should be available in the target system.</p>"), + ], + "group" : $[ + "widget" : `textentry, + // textentry label + "label" : _("&Group name"), + "help" : _("<p>Select the <b>Group Name</b> to which the users belong.</p>"), + "init" : InitDescription, + "store" : StoreDescription, + "handle" : HandleDescription, + ], + "userstable" : $[ + "widget" : `custom, + "custom_widget" : `Table (`id("table"), `opt (`notify), `header( + // table header + _("Name"), + // table header + _("Home Directory"))), + // help for table with users + "help" : _("<p>For each user, specify <b>Name</b>, <b>Password</b>, and <b>Home Directory</b>.</p>"), + "init" : InitUsersTable, + "handle" : HandleAddEditUser, + ], + "adduser" : $[ + "widget" : `push_button, + "label" : Label::AddButton (), + "no_help" : true, + "handle" : HandleAddEditUser, + ], + "edituser" : $[ + "widget" : `push_button, + "label" : Label::EditButton (), + "no_help" : true, + "handle" : HandleAddEditUser, + ], + "deleteuser" : $[ + "widget" : `push_button, + "label" : Label::DeleteButton (), + "no_help" : true, + "handle" : HandleDeleteUser, + ], + // ------------------ + ]; + } + + /** + * Main dialog for Kiwi image configuration + */ +define symbol KiwiDialog () { + +InitImageConfiguration (); + +map<string, 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, + // 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 (), + "fallback_functions" : $[ + `abort : ProductCreator::ReallyAbort + ], +]); +y2milestone("Returning %1", ret); +return ret; +} + + /** + * Prepare dialog: define kiwi data without product-creator + */ + define symbol PrepareDialog () { + + kiwi_task = Kiwi::kiwi_task; + if (kiwi_task == "") + kiwi_task = "iso"; + + map<string,any> Config = ProductCreator::Config; + string kiwi_configuration = Config["kiwi_configuration_" + kiwi_task]:""; + string name = Config["name"]:""; + string out_dir = Config["iso-directory"]:""; + map <string,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 + (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>") + + + // help text for kiwi UI preparation, cont. + _("<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. 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>"); + + 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"), + // combo box item + "oem" : _("OEM 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,type == kiwi_task)); + } + }); + default_type_items = type_items; + } + else if (supported_images == "template" && !new_configuration) + { + 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, type == kiwi_task)); + }); + if (type_its != []) + type_items = type_its; + } + 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 == $[]) + { + 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 + // (no need to read config if it is provided as argument) + boolean update_config (string dir, map config) { + + kiwi_configuration = dir; + Config = + (config == $[] ? Kiwi::ReadConfigXML (kiwi_configuration) : config); + + if (Config["image_type"]:"" != "system") + { + y2warning ("%1 does not have 'system' image type, skipping", dir); + // error popup + Popup::Error (_("Selected directory does not contain valid description of system configuration")); + return false; + } + + // 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"]:""); + update_repo_table (); + list type_its = supported_images != "template" ? default_type_items: []; + boolean primary = false; + foreach (string type, map data, Config["type"]:$[], { + if (!primary) + kiwi_task = type; + if (data["primary"]:"" == "true") + 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); + return true; + } + + 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 ( + new_configuration ? + `VBox ( + // text entry label + `TextEntry (`id (`config), _("&Kiwi configuration"), name), + `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), + `VBox ( + `Label (""), + `PushButton (`id (`browse), Label::BrowseButton ()) + ) + ), + `VSpacing (0.2), + `Table (`id(`repositories), `header ( + // table header + _("Package Repository")) + ), + `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 () + ) + ); + // dialog caption + Wizard::SetContentsButtons (_("Image preparation"), contents, help, + Label::BackButton(), Label::NextButton()); + Wizard::RestoreBackButton(); + Wizard::RestoreAbortButton(); + + if (new_configuration && kiwi_configuration != "") + { + update_config (kiwi_configuration, $[]); + } + else + update_repo_table (); + + 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) + { + 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 == "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, + // popup for file selection dialog + _("Directory to Import")); + if (dir!= nil && update_config (dir, $[])) + { + UI::ChangeWidget (`id (`import_dir), `Value, 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 + ret != "rb_dir" && ret != "rb_new") + { + 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 = ""; + symbol type_ret = SourceDialogsLite::TypeDialog (); + + if ((type_ret == `next || type_ret == `finish)) + { + // FIXME SLP code for SLE10SP1 only, adapt for 10.3... + if (type_ret == `finish && SourceDialogsLite::GetURL () == "slp://") + { + string service = SourceManager::AddSourceTypeSLP (); + if (service != nil) + { + url = service; + } + } + else + { + if (SourceDialogsLite::EditDialog () == `next) + url = SourceDialogsLite::GetURL (); + } + } + Wizard::CloseDialog (); + if (url != "") + { + if (haskey (repositories, url)) + continue; + + map parsed = URL::Parse(url); + boolean plaindir = false; + if (parsed["scheme"]:"" == "pkg") + { + parsed["scheme"] = "dir"; + plaindir = true; + url = URL::Build (parsed); + } + repositories[url] = $[ + "url" : url, + "plaindir" : plaindir + ]; + update_repo_table (); + } + } + else if (ret == `edit) + { + string url = (string) + UI::QueryWidget (`id (`repositories), `CurrentItem); + 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) + { + map parsed = URL::Parse(url); + parsed["scheme"] = "pkg"; + url = URL::Build (parsed); + } + url = SourceDialogsLite::EditPopup (url); + if (url == "" || url == nil || url == selected_url) + continue; + // remove current url + add new one + repositories = remove (repositories, selected_url); + map parsed = URL::Parse(url); + plaindir = false; + if (parsed["scheme"]:"" == "pkg") + { + parsed["scheme"] = "dir"; + plaindir = true; + url = URL::Build (parsed); + } + repositories[url] = $[ + "url" : url, + "plaindir" : plaindir + ]; + update_repo_table (); + } + else if (ret == `delete) + { + string selected = (string) + UI::QueryWidget (`id (`repositories), `CurrentItem); + if (selected == nil) + continue; + repositories = remove (repositories, selected); + update_repo_table (); + } + else if (ret == `browse) + { + string dir = UI::AskForExistingDirectory ("", + // popup for file selection dialog + _("Path to the Output Directory")); + if (dir!= nil) + { + UI::ChangeWidget (`id (`out_dir), `Value, dir); + } + } + else if (ret == `next) + { + name = (string) UI::QueryWidget (`id (`config), `Value); + if (name == "") + { + // error popup + Report::Error(_("Enter the name of the configuration.")); + 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 == "") + { + // error popup + Popup::Error (_("Enter the path to the output directory.")); + 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); + + list<string> failed_repositories = []; + map<string,map> new_repositories = $[]; + if (size (repositories) > 0) + { + map<string,integer> 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 + new_repositories = filter (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 true; + } + integer source_ret = -1; + if (repo["plaindir"]:false) + source_ret = Pkg::SourceCreateType (url, "", "Plaindir"); + else + source_ret = Pkg::SourceCreate (url, ""); + if (source_ret == -1) + { + failed_repositories = add (failed_repositories, url); + return false; + } + else return true; + }); + foreach (string url, integer srcid, current_sources, { + Pkg::SourceDelete (srcid); + }); + } + if (failed_repositories != []) + { + // continue/cancel popup %1 is a \n separated list + if (!Popup::ContinueCancel (sformat (_("Failed to add these installation sources: + +%1. + +Continue anyway?"), mergestring (failed_repositories, "\n")))) + { + continue; + } + else + { + repositories = new_repositories; + } + } + break; + } + } + string boot = Config["type",kiwi_task,"boot"]:""; + if (boot != "" && issubstring (boot, "/")) + { + string prefix = kiwi_task == "pxe" ? "net" : kiwi_task; + Config[prefix + "boot"] = substring (boot, search (boot, "/") + 1); + } + if (ret == `next) + { + if (size (repositories) > 0) + { + ProductCreator::enable_sources = false; + Pkg::SourceLoad(); + } + Config["kiwi_configuration_" + kiwi_task] = kiwi_configuration; + Config["_imported"] = true; + Config["iso-directory"] = out_dir + + (new_configuration ? "/" + name : ""); + Config["name"] = name; + Config["new_configuration"] = new_configuration; + Config["sources"] = maplist ( + string url, map repo, repositories, ``(url)); + ProductCreator::Config = Config; + Kiwi::current_repositories = repositories; + Kiwi::kiwi_task = kiwi_task; + } + y2milestone("Returning %1", ret); + return (symbol) ret; + } +} Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/product-creator.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/product-creator.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/product-creator.ycp Mon Dec 17 13:21:12 2007 @@ -53,13 +53,24 @@ ], "passphrase" : $[ // translators: command line help text for the 'passhrase' option - "help" : _("File with GPG passhrase required for signing the source."), + "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"), + "type" : "string" + ], + "configfile" : $[ + // cmd line help text for the 'configfile' option, %1 is a file name + "help" : sformat(_("Path to the configuration file (default is %1"), + ProductCreator::ConfigFile), "type" : "string" ] ], "mappings" : $[ - "list" : [], - "create-iso" : ["name", "passphrase"], + "list" : ["configfile"], + "create-iso" : ["name", "passphrase", "passphrase_file", "configfile"], ] ]; Modified: branches/SuSE-SLE-10-SP2-Branch/product-creator/src/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/src/wizards.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/src/wizards.ycp Mon Dec 17 13:21:12 2007 @@ -11,14 +11,17 @@ textdomain "product-creator"; +import "Kiwi"; import "Wizard"; import "Popup"; import "Package"; +import "PackageCallbacksInit"; import "Sequencer"; +import "URL"; include "product-creator/complex.ycp"; include "product-creator/dialogs.ycp"; -include "product-creator/kiwi.ycp"; +include "product-creator/kiwi_dialogs.ycp"; /** @@ -32,7 +35,7 @@ "source" : ``( sourceDialog() ), "config1" : ``( Configure1Dialog() ), "config2" : ``( Configure2Dialog() ), - "isolinuxcheck" : ``( CheckBootableSrc() ), + "isolinuxcheck" : [ ``( CheckBootableSrc() ), true], "isolinux" : ``( isolinuxDialog() ), "packagemanager": ``( packageSelector() ), "gpgkey" : ``( gpgKeyDialog() ), @@ -58,7 +61,6 @@ "isolinuxcheck" : $[ `next : "isolinux", `skip_isolinux : "packagemanager", - `autoyast : "gpgkey" ], "isolinux": $[ `abort : `abort, @@ -69,7 +71,8 @@ `abort : `abort, `next : "gpgkey", `accept : "gpgkey", - `failed : "summary" + `failed : "summary", + `cancel : "isolinuxcheck", ], "gpgkey" : $[ `abort : `abort, @@ -131,6 +134,39 @@ symbol InitSources () { ProductCreator::EnableSource(); + + // remove the source types unsupported by kiwi (#339110) + list<string> sources = []; + list<string> removed = []; + foreach (string url, ProductCreator::Config["sources"]:[], { + map parsed = URL::Parse(url); + if (contains (Kiwi::unsupported_schemes, parsed["scheme"]:"")) + removed = add (removed, url); + else + sources = add (sources, url); + }); + ProductCreator::Config["sources"] = sources; + if (removed != []) + { + // message popup, %1 is a \n separated list + Popup::Message (sformat (_("These installation sources are not supported by kiwi: + +%1. + +They were removed from current configuration."), mergestring (removed, "\n"))); + } + return `next; +} + +/** + * 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; } @@ -141,6 +177,8 @@ "init_sources" : [ ``( InitSources () ), true ], "kiwi" : ``( KiwiDialog () ), "summary" : ``( CommitConfig() ), + + // FIXME check if it was only kiwi config... "write" : ``( WriteDialog() ), ]; @@ -164,6 +202,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: branches/SuSE-SLE-10-SP2-Branch/product-creator/yast2-product-creator.spec.in URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/product... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/product-creator/yast2-product-creator.spec.in (original) +++ branches/SuSE-SLE-10-SP2-Branch/product-creator/yast2-product-creator.spec.in Mon Dec 17 13:21:12 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 @@ -25,14 +28,19 @@ @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 @moduledir@/*.ycp @moduledir@/*.ybc @desktopdir@/product-creator.desktop +@desktopdir@/image-creator.desktop @ybindir@/y2mkiso %doc @docdir@ %dir @ydatadir@/product-creator @@ -40,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