From 36dcbea8c99ab05d2aaa00a931561551a6f8f3fb Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Tue, 31 May 2016 23:45:47 +0200 Subject: add cern certs automatically --- packages/oraclejdk/oracle.gradle | 47 ++++++++++++++++++++++++++++-- packages/oraclejdk/oraclejdk7/build.gradle | 1 + 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/packages/oraclejdk/oracle.gradle b/packages/oraclejdk/oracle.gradle index 03977d7..d31a33d 100644 --- a/packages/oraclejdk/oracle.gradle +++ b/packages/oraclejdk/oracle.gradle @@ -11,12 +11,17 @@ buildscript { task download(type: org.xapek.yvesf.gradle.DownloadTask) {} task untar(type: Copy) { - into file("${buildDir}/unpacked/dist") + into file("${buildDir}/unpacked/dist/") eachFile { FileCopyDetails fcd -> fcd.path = fcd.path.substring(path.indexOf('/') + 1) } } -untar.dependsOn(download) +tasks.untar.dependsOn(download) +tasks.untar.doFirst { + if (file("${buildDir}/unpacked/dist/").exists()) { + file("${buildDir}/unpacked/dist/").deleteDir() + } +} ospackage { from untar.outputs.files @@ -26,4 +31,40 @@ project.afterEvaluate { untar.from tarTree(download.destFile) } -tasks.getByName('activator').dependsOn('untar') +tasks.activator.dependsOn('untar') + +task downloadCertGrid(type: org.xapek.yvesf.gradle.DownloadTask) { + source 'https://cafiles.cern.ch/cafiles/certificates/CERN%20Grid%20Certification%20Authority.crt' + sha256sum 'dce1eedad3edef466ecaeebfd711291e3b86f72ca8e6b0bba65162fd07a3e642' +} + +task downloadCertRoot2(type: org.xapek.yvesf.gradle.DownloadTask) { + source 'https://cafiles.cern.ch/cafiles/certificates/CERN%20Root%20Certification%20Authority%202.crt' + sha256sum '187f4f7b1315ebd2b72547c1accf2ec4077d51c14a0ce574904a9fdaea8a320c' +} + +void keytool(String alias, File cert) { + final bin = new File(project.buildDir, 'unpacked/dist/bin/keytool') + final keystore = new File(project.buildDir, 'unpacked/dist/jre/lib/security/cacerts') + project.exec { + it.executable(bin) + it.args( + '-noprompt', '-import', + '-trustcacerts', + '-alias', alias, + '-file', cert.absolutePath, + '-keystore', keystore.absolutePath, + '-storepass', 'changeit') + } +} + +final keytoolTask = tasks.create('keytool') { + inputs.file tasks.downloadCertGrid.outputs + inputs.file tasks.downloadCertRoot2.outputs +} +keytoolTask.dependsOn(tasks.untar, tasks.downloadCertGrid) +keytoolTask << { + keytool('cern_grid_ca', tasks.downloadCertGrid.destFile) + keytool('cern_root2_ca', tasks.downloadCertRoot2.destFile) +} +tasks.activator.dependsOn(keytoolTask) \ No newline at end of file diff --git a/packages/oraclejdk/oraclejdk7/build.gradle b/packages/oraclejdk/oraclejdk7/build.gradle index e47e237..0838dd6 100644 --- a/packages/oraclejdk/oraclejdk7/build.gradle +++ b/packages/oraclejdk/oraclejdk7/build.gradle @@ -8,6 +8,7 @@ download.sha256sum 'bad9a731639655118740bee119139c1ed019737ec802a630dd7ad7aab430 ospackage { into '/usr/lib/jvm/java-7-oraclejdk' } + activator.env['JAVA_HOME'] = '/usr/lib/jvm/java-7-oraclejdk' tasks.getByName('activator').doFirst { file("${buildDir}/unpacked/dist/bin").list().each { -- cgit v1.2.1