提交 9ec37cc0 编写于 作者: J Jesse Glick

Merge branch 'JENKINS-8957' of https://github.com/cowwoc/jenkins into cowwoc-JENKINS-8957

......@@ -224,16 +224,33 @@ public class JDKInstaller extends ToolInstaller {
*/
String logFile = jdkBundle+".install.log";
expectedLocation = expectedLocation.trim();
if (expectedLocation.endsWith("\\")) {
// Prevent a trailing slash from escaping quotes
expectedLocation = expectedLocation.substring(0, expectedLocation.length() - 1);
}
ArgumentListBuilder args = new ArgumentListBuilder();
args.add(jdkBundle);
assert (new File(expectedLocation).exists()) : expectedLocation
+ " must exist, otherwise /L will cause the installer to fail with error 1622";
if (isJava15() || isJava14()) {
args.add("/s","/v/qn REBOOT=ReallySuppress INSTALLDIR=\""+ expectedLocation +"\" /L \""+logFile+"\"");
// Installer uses InstallShield.
args.add("CMD.EXE", "/C");
// CMD.EXE /C must be followed by a single parameter (do not split it!)
args.add(jdkBundle + " /s /v\"/qn REBOOT=ReallySuppress INSTALLDIR=\\\""
+ expectedLocation + "\\\" /L \\\"" + expectedLocation
+ "\\jdk.exe.install.log\\\"\"");
} else {
// modern version supports arguments in more sane format.
args.add("/s","/v","/qn","/L","\""+logFile+"\"","REBOOT=ReallySuppress","INSTALLDIR=\""+ expectedLocation+"\"");
// Installed uses Windows Installer (MSI)
args.add(jdkBundle, "/s");
// Create a private JRE by omitting "PublicjreFeature"
// @see http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html#jdk-silent-installation
args.add("ADDLOCAL=\"ToolsFeature\"");
args.add("REBOOT=ReallySuppress", "INSTALLDIR=" + expectedLocation,
"/L \\\"" + expectedLocation + "\\jdk.exe.install.log\\\"");
}
// according to http://community.acresso.com/showthread.php?t=83301, \" is the trick to quote values with whitespaces.
// Oh Windows, oh windows, why do you have to be so difficult?
int r = launcher.launch().cmds(args).stdout(out)
.pwd(new FilePath(launcher.getChannel(), expectedLocation)).join();
if (r != 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册