Mailinglist Archive: yast-commit (1056 mails)

< Previous Next >
[yast-commit] r44517 - in /trunk/installation: package/yast2-installation.changes src/clients/inst_deploy_image.ycp src/clients/inst_prepare_image.ycp src/modules/ImageInstallation.ycp
  • From: jsrain@xxxxxxxxxxxxxxxx
  • Date: Fri, 15 Feb 2008 13:30:05 -0000
  • Message-id: <20080215133005.D3901148A88@xxxxxxxxxxxxxxxx>
Author: jsrain
Date: Fri Feb 15 14:30:04 2008
New Revision: 44517

URL: http://svn.opensuse.org/viewcvs/yast?rev=44517&view=rev
Log:
updated image-based installatoin not to use any hardcoded image names


Modified:
trunk/installation/package/yast2-installation.changes
trunk/installation/src/clients/inst_deploy_image.ycp
trunk/installation/src/clients/inst_prepare_image.ycp
trunk/installation/src/modules/ImageInstallation.ycp

Modified: trunk/installation/package/yast2-installation.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-installation.changes?rev=44517&r1=44516&r2=44517&view=diff
==============================================================================
--- trunk/installation/package/yast2-installation.changes (original)
+++ trunk/installation/package/yast2-installation.changes Fri Feb 15 14:30:04
2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Fri Feb 15 14:28:45 CET 2008 - jsrain@xxxxxxx
+
+- updated image-based installatoin not to use any hardcoded
+ image names
+
+-------------------------------------------------------------------
Thu Feb 14 11:20:04 CET 2008 - locilka@xxxxxxx

- Function FileSystemCopy from live-installer has been moved

Modified: trunk/installation/src/clients/inst_deploy_image.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_deploy_image.ycp?rev=44517&r1=44516&r2=44517&view=diff
==============================================================================
--- trunk/installation/src/clients/inst_deploy_image.ycp (original)
+++ trunk/installation/src/clients/inst_deploy_image.ycp Fri Feb 15 14:30:04
2008
@@ -8,8 +8,7 @@

y2milestone ("Deploying image");

-// TODO non-static list of images
-list<string> images = ["root", "zypp", "opt", "home"];
+list<string> images = ImageInstallation::ImageOrder ();

integer last_image = nil;

@@ -30,15 +29,37 @@
Progress::Step (image);
}

+if (! Installation::image_installation)
+ return `auto;
+
Wizard::SetContents (_("Deploying Installation Images"), `Empty (), "", false,
false);
Wizard::SetTitleIcon ("yast-inst-mode");

// TODO help
Progress::Simple (_("Deploying Installation Images"), _("Deploying
Installation Images"), size (images), "help");

-Pkg::TargetFinish ();
+// finish target if it was initialized
+if (! Installation::image_only)
+{
+// TODO save the status of all packages
+ Pkg::TargetFinish ();
+}
+
+/*
+// FIXME the images usually do not fit in RAMDISK
+// move download area to hard disk (for HTTP/FTP media)
+// TODO select according to partitioning
+string download_dir = "/img_tmp";
+download_dir = Installation::destdir + download_dir;
+SCR::Execute (.target.bash, sformat ("test -d %1 || mkdir -p %1",
download_dir));
+Pkg::SourceMoveDownloadArea (download_dir);
+// don't know why it didn't work :-(
+*/
+
ImageInstallation::DeployImages (images, Installation::destdir, SetProgress);

+//SCR::Execute (.target.bash, sformat ("rmdir %1", download_dir));
+
y2milestone ("Target image for package selector prepared");

return `next;

Modified: trunk/installation/src/clients/inst_prepare_image.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_prepare_image.ycp?rev=44517&r1=44516&r2=44517&view=diff
==============================================================================
--- trunk/installation/src/clients/inst_prepare_image.ycp (original)
+++ trunk/installation/src/clients/inst_prepare_image.ycp Fri Feb 15 14:30:04
2008
@@ -11,6 +11,7 @@
import "ImageInstallation";
import "GetInstArgs";
import "Wizard";
+import "Installation";

textdomain "installation";

@@ -23,23 +24,31 @@
Wizard::SetContents (_("Analyzing Installation Images"), `Empty (), "", false,
false);
Wizard::SetTitleIcon ("yast-inst-mode");

+// set repo to get images from
ImageInstallation::SetRepo (Packages::theSources[0]:0);
-// TODO: read the list of images from the media
-ImageInstallation::AddImage ("root", "base.tgz", "tar");
-ImageInstallation::AddImage ("home", "home.tgz", "tar");
-ImageInstallation::AddImage ("zypp", "zypp.tgz", "tar");
-ImageInstallation::AddImage ("opt", "opt.tgz", "tar");
-
-string sw_db_root = (string)SCR::Read (.target.tmpdir) + "/sw_db_root";
-ImageInstallation::DeployImageTemporarily ("zypp", sw_db_root);
-
-// TODO: redefine pkg callbacks for RPM database reading, which is the most
time-consuming part
-Pkg::TargetInitialize (sw_db_root);
-Pkg::TargetLoad ();

-ImageInstallation::CleanTemporaryImage ("zypp", sw_db_root);
+// list images for currently selected patterns
+// TODO: Pass selected pattern(s)
+ImageInstallation::FindImageSet ([]);
+
+// also set an RPM database
+if (! Installation::image_only)
+{
+ string sw_db_root = (string)SCR::Read (.target.tmpdir) + "/sw_db_root";
+ ImageInstallation::DeployImageTemporarily (ImageInstallation::SwMgmtImage
(), sw_db_root);
+
+ // TODO: redefine pkg callbacks for RPM database reading, which is the
most time-consuming part
+ Pkg::TargetInitialize (sw_db_root);
+ Pkg::TargetLoad ();

-y2milestone ("Target image for package selector prepared");
+ ImageInstallation::CleanTemporaryImage (ImageInstallation::SwMgmtImage (),
sw_db_root);
+
+ y2milestone ("Target image for package selector prepared");
+}
+else
+{
+ y2milestone ("Skipping preparing image for package selector");
+}

return `next;
}

Modified: trunk/installation/src/modules/ImageInstallation.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/modules/ImageInstallation.ycp?rev=44517&r1=44516&r2=44517&view=diff
==============================================================================
--- trunk/installation/src/modules/ImageInstallation.ycp (original)
+++ trunk/installation/src/modules/ImageInstallation.ycp Fri Feb 15 14:30:04
2008
@@ -16,7 +16,12 @@

module "ImageInstallation";

+import "Installation";
+import "XML";
import "Progress";
+import "Report";
+
+textdomain "installation";

/**
* Repository holding all images
@@ -29,6 +34,16 @@
map<string,map<string,any> > _images = $[];

/**
+ * Order of images
+ */
+list<string> _image_order = [];
+
+/**
+ * Image with software management metadata
+ */
+string _metadata_image = "";
+
+/**
* Template for the path for an image on the media
*/
string _image_path = "/images/%1";
@@ -46,6 +61,21 @@
_repo = repo;
}

+/**
+ * Name of image containing software management metadata (if exists)
+ * @return string image with sw mgmt metadata
+ */
+global string SwMgmtImage () {
+ return _metadata_image;
+}
+
+/**
+ * Order of images to be deployed
+ * @return a list of images definint the order
+ */
+global list<string> ImageOrder () {
+ return _image_order;
+}

/**
* Add information about new image
@@ -53,7 +83,7 @@
* @param file string the file name of the image
* @param type string the type of the image, one of "tar" and "fs"
*/
-global void AddImage (string id, string file, string type) {
+void AddImage (string id, string file, string type) {
_images[id] = $[
"file" : file,
"type" : type,
@@ -251,6 +281,67 @@
}

/**
+ * Find a set of images which suites selected patterns
+ * @param patterns a list of patterns which are selected
+ * @return boolean true on success or when media does not contain any images
+ */
+global boolean FindImageSet (list<string> patterns) {
+ // reset all data
+ _images = $[];
+ _image_order = [];
+ _metadata_image = "";
+
+ string filename = Pkg::SourceProvideOptionalFile (_repo, 1,
"/images/images.xml");
+ if (filename == nil)
+ {
+ Installation::image_installation = false;
+ Installation::image_only= false;
+ y2milestone ("Image list for installation not found");
+ return true;
+ }
+ map<string,any> image_descr = XML::XMLToYCPFile (filename);
+ if (image_descr == nil)
+ {
+ Installation::image_installation = false;
+ Installation::image_only= false;
+ Report::Error (_("Failed to read information about installation
images"));
+ return false;
+ }
+ list<map<string,any> > image_sets = image_descr["image_sets"]:[];
+ y2milestone ("Image set descriptions: %1", image_sets);
+ map<string,any> result = $[];
+ foreach (map<string,any> image, image_sets, {
+ string pattern = image["pattern"]:"";
+ if (pattern == "" && result == $[])
+ result = image;
+ else if (contains (patterns, pattern))
+ result = image;
+ });
+ if (result == $[])
+ {
+ Installation::image_installation = false;
+ Installation::image_only= false;
+ y2milestone ("No image for installation found");
+ return true;
+ }
+ Installation::image_installation = true;
+ if (haskey (result, "pkg_image"))
+ _metadata_image = result["pkg_image"]:"";
+ else
+ Installation::image_only= true;
+ foreach (map<string,string> img, result["images"]:[], {
+ _image_order = add (_image_order, img["name"]:"");
+ AddImage (img["name"]:"", img["file"]:"", img["type"]:"");
+ });
+ y2milestone ("Image-only installation: %1", Installation::image_only);
+ y2milestone ("Images: %1", _images);
+ y2milestone ("Image installation order: %1", _image_order);
+ if (! Installation::image_only)
+ y2milestone ("Image with software management metadata: %1",
_metadata_image);
+ return true;
+}
+
+/**
* Copy a subtree, limit to a single filesystem
* @param from string source directory
* @param to string target directory
@@ -337,4 +428,5 @@
return out["exit"]:-1 == 0;
}

-}
\ No newline at end of file
+
+}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages