mirror of https://github.com/acidanthera/audk.git
[Wizard- Far Install/Create]
Change Manifest file name to "FrameworkArchiveManifest.xml". Modify Md5 format in FrameworkArchiveMainfest.xml file. Add Md5 verification when install FAR. Fix the bug of Far installation can't work with Sun JDK 1.5.0_04 version. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1029 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
04566eff47
commit
9653129917
|
@ -226,6 +226,12 @@ public class Far {
|
||||||
byte[] totalBuffer = new byte[(int) tempFile.length()];
|
byte[] totalBuffer = new byte[(int) tempFile.length()];
|
||||||
FileInputStream fis = new FileInputStream(tempFile);
|
FileInputStream fis = new FileInputStream(tempFile);
|
||||||
fis.read(totalBuffer);
|
fis.read(totalBuffer);
|
||||||
|
//
|
||||||
|
// Check Md5
|
||||||
|
//
|
||||||
|
if (!ffItem.getMd5Value().equalsIgnoreCase(FarMd5.md5(totalBuffer))){
|
||||||
|
throw new Exception (ffItem.getRelativeFilename() + " Md5 is invaild!");
|
||||||
|
}
|
||||||
outputStream.write(totalBuffer);
|
outputStream.write(totalBuffer);
|
||||||
fis.close();
|
fis.close();
|
||||||
tempFile.delete();
|
tempFile.delete();
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class FarMd5 {
|
||||||
static public String md5(byte[] buffer) throws Exception {
|
static public String md5(byte[] buffer) throws Exception {
|
||||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
byte[] md5 = md.digest(buffer);
|
byte[] md5 = md.digest(buffer);
|
||||||
return new String(String.format("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", md5[0], md5[1], md5[2], md5[3], md5[4],
|
return new String(String.format("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", md5[0], md5[1], md5[2], md5[3], md5[4],
|
||||||
md5[5], md5[6], md5[7], md5[8], md5[9], md5[10], md5[11], md5[12], md5[13],
|
md5[5], md5[6], md5[7], md5[8], md5[9], md5[10], md5[11], md5[12], md5[13],
|
||||||
md5[14], md5[15]));
|
md5[14], md5[15]));
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class Mainfest implements ManifestInterface {
|
||||||
// /
|
// /
|
||||||
// / Mainfest file element name
|
// / Mainfest file element name
|
||||||
// /
|
// /
|
||||||
final static String mfFileName = "FarMainfest.MF";
|
final static String mfFileName = "FrameworkArhciveMainfest.xml";
|
||||||
|
|
||||||
//
|
//
|
||||||
// Header
|
// Header
|
||||||
|
@ -129,7 +129,7 @@ public class Mainfest implements ManifestInterface {
|
||||||
//
|
//
|
||||||
// Mainfest file
|
// Mainfest file
|
||||||
//
|
//
|
||||||
File mfFile = null;
|
public File mfFile = null;
|
||||||
|
|
||||||
public FarHeader getHeader() {
|
public FarHeader getHeader() {
|
||||||
return fhInfo;
|
return fhInfo;
|
||||||
|
@ -678,7 +678,7 @@ public class Mainfest implements ManifestInterface {
|
||||||
Source source = new DOMSource(this.mainfestDoc);
|
Source source = new DOMSource(this.mainfestDoc);
|
||||||
//
|
//
|
||||||
// Prepare the output file, get the Mainifest file name from <FarHeader>
|
// Prepare the output file, get the Mainifest file name from <FarHeader>
|
||||||
// /<FarName>.
|
// <FarName>.
|
||||||
//
|
//
|
||||||
this.mfFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar + mfFileName);
|
this.mfFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar + mfFileName);
|
||||||
//
|
//
|
||||||
|
@ -686,6 +686,10 @@ public class Mainfest implements ManifestInterface {
|
||||||
//
|
//
|
||||||
Result result = new StreamResult(this.mfFile);
|
Result result = new StreamResult(this.mfFile);
|
||||||
xformer.transform(source, result);
|
xformer.transform(source, result);
|
||||||
|
//
|
||||||
|
// Close result. Flush file by manual for Jdk1.5.0_04.
|
||||||
|
//
|
||||||
|
((StreamResult) result).getOutputStream().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pkgToFarPkgNode(Element parentNode, FarPackage pkgItem) {
|
public void pkgToFarPkgNode(Element parentNode, FarPackage pkgItem) {
|
||||||
|
|
Loading…
Reference in New Issue