Mailinglist Archive: yast-commit (864 mails)

< Previous Next >
[yast-commit] r41916 - in /trunk/product-creator: package/yast2-product-creator.changes src/ProductCreator.ycp
  • From: lslezak@xxxxxxxxxxxxxxxx
  • Date: Fri, 09 Nov 2007 11:27:01 -0000
  • Message-id: <20071109112701.6208E2984C@xxxxxxxxxxxxxxxx>
Author: lslezak
Date: Fri Nov 9 12:27:01 2007
New Revision: 41916

URL: http://svn.opensuse.org/viewcvs/yast?rev=41916&view=rev
Log:
- add GPG key to installation initrd on PPC architecture (#339449)

Modified:
trunk/product-creator/package/yast2-product-creator.changes
trunk/product-creator/src/ProductCreator.ycp

Modified: trunk/product-creator/package/yast2-product-creator.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/package/yast2-product-creator.changes?rev=41916&r1=41915&r2=41916&view=diff
==============================================================================
--- trunk/product-creator/package/yast2-product-creator.changes (original)
+++ trunk/product-creator/package/yast2-product-creator.changes Fri Nov 9
12:27:01 2007
@@ -6,6 +6,7 @@
compressed patter files, generate packages.DU only up to
the 3rd directory level (#335183)
- copy PPC boot files in /suseboot, /ppc and /PS3 (#335177)
+- add GPG key to installation initrd on PPC architecture (#339449)
- install required package createrepo (#331530), install additional
packages on PPC
- fixed ISO image creation on PPC when the path contained spaces

Modified: trunk/product-creator/src/ProductCreator.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/ProductCreator.ycp?rev=41916&r1=41915&r2=41916&view=diff
==============================================================================
--- trunk/product-creator/src/ProductCreator.ycp (original)
+++ trunk/product-creator/src/ProductCreator.ycp Fri Nov 9 12:27:01 2007
@@ -1790,6 +1790,37 @@
return ret;
}

+string DumpKernelFromObjectFile(string object)
+{
+ y2milestone("Extracting kernel from file %1", object);
+ string tmpdir = (string)SCR::Read(.target.tmpdir);
+ string target = tmpdir + "/tmp_kernel.gz";
+
+ string command = sformat("objcopy -O binary -j .kernel:vmlinux.strip '%1'
'%2'", String::Quote(object), String::Quote(target));
+ string ret = (Exec(command)) ? target : "";
+
+ y2milestone("Kernel extracted to %1", ret);
+
+ return ret;
+}
+
+string GunzipKernel(string kernel_gz)
+{
+ string command = sformat("gunzip -f %1", kernel_gz);
+ boolean success = Exec(command);
+ string ret = "";
+
+ // remove .gz suffix from the file name
+ if (success)
+ {
+ ret = regexpsub (kernel_gz, "^(.*)\\.gz$", "\\1");
+ }
+
+ y2milestone("Kernel unpacked to %1", ret);
+
+ return ret;
+}
+
global boolean InsertKeyToInitrds(string gpg_key, string base_dir)
{
// get initrd list
@@ -1805,12 +1836,54 @@
find_output = out["stdout"]:"";
}

+ map<string,string> inst_mapping = $[];
+
if (SCR::Read(.target.size, base_dir + "/suseboot") >= 0)
{
y2milestone("Searching for 'initrd*' in %1/suseboot...", base_dir);
command = sformat("cd '%1' && find suseboot -type f -name 'initrd*'",
String::Quote(base_dir));
out = (map)SCR::Execute(.target.bash_output, command);
find_output = find_output + out["stdout"]:"";
+
+ if (size(out["stdout"]:"") == 0)
+ {
+ y2milestone("initrd not found, searching for inst*");
+
+ command = sformat("cd '%1' && find suseboot -type f -name 'inst32';
find suseboot -type f -name 'inst64'", String::Quote(base_dir));
+ out = (map)SCR::Execute(.target.bash_output, command);
+
+ list<string> inst_files = splitstring(out["stdout"]:"", "\n");
+ // remove empty strings
+ inst_files = filter(string inst, inst_files, {return inst != "";});
+
+ if (size(inst_files) > 0)
+ {
+ y2milestone("Found inst* files: %1", inst_files);
+
+ integer index = 0;
+ // unpack the initrd from the inst* object
+ foreach(string inst, inst_files,
+ {
+ string tmp_initrd =
sformat("suseboot/.tmp_yast_initrd%1.gz", index);
+
+ command = sformat("cd '%1' && objcopy -O binary -j
.kernel:initrd '%2' '%3'", String::Quote(base_dir), String::Quote(inst),
tmp_initrd);
+
+ out = (map)SCR::Execute(.target.bash_output, command);
+
+ if (out["exit"]:-1 == 0)
+ {
+ y2milestone("Extracted %1 from %2", tmp_initrd,
inst);
+ find_output = find_output + tmp_initrd + "\n";
+
+ inst_mapping = add(inst_mapping, inst, tmp_initrd);
+ }
+
+ index = index + 1;
+ }
+ );
+
+ }
+ }
}

list<string> initrds = splitstring(find_output, "\n");
@@ -1833,6 +1906,50 @@
}
);

+ // put the initrd back to the inst file
+ foreach(string orig_inst, string tmp_initrd, inst_mapping,
+ {
+ y2milestone("%1 -> %2", tmp_initrd, orig_inst);
+
+ if (orig_inst == "suseboot/inst32" || orig_inst ==
"suseboot/inst64")
+ {
+ // extract kernel
+ string gzkernel = DumpKernelFromObjectFile(base_dir + "/" +
orig_inst);
+
+ if (gzkernel != "")
+ {
+ // unpack the kernel image - required by mkzimage
+ string kernel = GunzipKernel(gzkernel);
+ string tmp_dir = (string)SCR::Read( .target.tmpdir );
+
+ string initrd_copy = sformat("%1/tmp_initrd", tmp_dir);
+
+ // copy the initrd to a temp dir - mkzimage doesn't work
properly
+ // when there is a space in path
+ ret = ret && Exec(sformat("mv '%1/%2' '%3'",
String::Quote(base_dir), tmp_initrd, initrd_copy));
+
+ // create new inst file
+ // see mk_ppc_installation-images_bootbinaries.sh
(installation-images)
+ command = sformat("/bin/mkzimage --board chrp --vmlinux
'%1' --initrd '%2' --output '%3/new_inst' --tmp '%3'",
+ kernel, initrd_copy, tmp_dir);
+ ret = ret && Exec(command);
+
+ // remove the temporary files
+ command = sformat("rm -f '%1' '%2'", kernel, initrd_copy);
+ ret = ret && Exec(command);
+
+ // move the new file to the target directory
+ command = sformat("mv '%1/new_inst' '%2/%3'", tmp_dir,
String::Quote(base_dir), orig_inst);
+ ret = ret && Exec(command);
+ }
+ }
+ else
+ {
+ y2warning("Unsupported inst file: %1", orig_inst);
+ }
+ }
+ );
+
return ret;
}


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

< Previous Next >
This Thread
  • No further messages