2023-03-14 20:45:33 +00:00
|
|
|
import java.util.concurrent.TimeUnit
|
|
|
|
plugins {
|
|
|
|
id "java"
|
2023-09-06 20:09:27 +00:00
|
|
|
id "com.netflix.nebula.ospackage" version "11.4.0"
|
2023-03-14 20:45:33 +00:00
|
|
|
}
|
2023-03-17 18:47:10 +00:00
|
|
|
// Get version from main project gradle
|
|
|
|
def packVersion = properties.get("packageVersion");
|
|
|
|
def jarVersion = properties.get("jarVersion");
|
2020-05-27 21:31:15 +00:00
|
|
|
|
2023-03-14 20:45:33 +00:00
|
|
|
java {
|
|
|
|
toolchain {
|
|
|
|
languageVersion = JavaLanguageVersion.of(17)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-27 21:31:15 +00:00
|
|
|
repositories {
|
2020-11-09 18:04:11 +00:00
|
|
|
mavenCentral()
|
2023-03-17 18:47:10 +00:00
|
|
|
flatDir { dirs "lib" }
|
2020-05-27 21:31:15 +00:00
|
|
|
}
|
|
|
|
|
2023-03-17 18:47:10 +00:00
|
|
|
dependencies {
|
2023-03-14 20:45:33 +00:00
|
|
|
implementation project(':HIRS_Utils')
|
|
|
|
implementation libs.jcommander
|
|
|
|
implementation libs.commons.io
|
2020-05-27 21:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ext.configDir = new File(projectDir, 'config')
|
|
|
|
|
|
|
|
jar {
|
2023-03-17 18:47:10 +00:00
|
|
|
// Keep jar clean:
|
|
|
|
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
2020-11-09 18:04:11 +00:00
|
|
|
manifest {
|
2023-03-14 20:45:33 +00:00
|
|
|
attributes(
|
|
|
|
"Main-Class": "hirs.tcg_eventlog.Main",
|
2023-03-17 18:47:10 +00:00
|
|
|
'Class-Path':configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
|
2023-03-14 20:45:33 +00:00
|
|
|
)
|
2023-03-17 18:47:10 +00:00
|
|
|
}
|
|
|
|
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
|
|
|
|
archiveVersion = jarVersion
|
2020-05-29 21:20:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Produce packages
|
|
|
|
ospackage {
|
2023-03-14 20:45:33 +00:00
|
|
|
packageName = 'tcg-eventlog-tool'
|
2020-11-09 18:04:11 +00:00
|
|
|
os = LINUX
|
2023-03-14 20:45:33 +00:00
|
|
|
arch = NOARCH
|
|
|
|
version = "$packVersion"
|
|
|
|
release = '1'
|
2020-05-29 21:20:06 +00:00
|
|
|
|
|
|
|
user 'root'
|
2020-11-09 18:04:11 +00:00
|
|
|
fileMode = 0755
|
2020-05-29 21:20:06 +00:00
|
|
|
|
2024-01-16 23:28:40 +00:00
|
|
|
into ('/opt/eltool/lib') {
|
2023-03-14 20:45:33 +00:00
|
|
|
from jar.outputs.files
|
2023-03-17 18:47:10 +00:00
|
|
|
from configurations.runtimeClasspath
|
2020-05-29 21:20:06 +00:00
|
|
|
}
|
2024-01-16 23:28:40 +00:00
|
|
|
into ('/opt/eltool/scripts') {
|
2023-03-14 20:45:33 +00:00
|
|
|
from ('scripts') {
|
2020-05-29 21:20:06 +00:00
|
|
|
exclude {
|
2023-03-14 20:45:33 +00:00
|
|
|
FileTreeElement details ->
|
|
|
|
details.file.name.endsWith('.bat')
|
2020-05-29 21:20:06 +00:00
|
|
|
}
|
2023-03-14 20:45:33 +00:00
|
|
|
}
|
2020-05-29 21:20:06 +00:00
|
|
|
}
|
2024-01-16 23:28:40 +00:00
|
|
|
into ('/opt/eltool/docs') {
|
2023-03-14 20:45:33 +00:00
|
|
|
from ('docs') {
|
|
|
|
exclude {
|
|
|
|
FileTreeElement details ->
|
|
|
|
details.file.name.endsWith('.odt')
|
|
|
|
}
|
2020-05-29 21:20:06 +00:00
|
|
|
}
|
2023-03-17 18:47:10 +00:00
|
|
|
from('./') {
|
|
|
|
include {
|
|
|
|
FileTreeElement details ->
|
|
|
|
details.file.name.endsWith('.md')
|
|
|
|
}
|
|
|
|
}
|
2020-11-09 18:04:11 +00:00
|
|
|
}
|
2023-03-14 20:45:33 +00:00
|
|
|
// Copy vendor-table into /tmp to avoid conflict with the ACA
|
2024-01-16 23:28:40 +00:00
|
|
|
into('/opt/eltool/default-properties') {
|
2020-11-09 18:04:11 +00:00
|
|
|
from ('../../HIRS_Utils/src/main/resources/vendor-table.json') {
|
2023-03-14 20:45:33 +00:00
|
|
|
fileMode 0664
|
|
|
|
addParentDirs = true
|
2020-11-09 18:04:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-14 20:45:33 +00:00
|
|
|
// place elt link in system path to enable command line access
|
2024-01-16 23:28:40 +00:00
|
|
|
link("/usr/local/bin/elt", "/opt/eltool/scripts/eventlog.sh", 0x755)
|
2023-03-17 18:47:10 +00:00
|
|
|
|
2024-01-16 23:28:40 +00:00
|
|
|
// Post Install
|
|
|
|
postInstall "echo ${jarVersion} > /opt/eltool/VERSION"
|
|
|
|
// Post Uninstall
|
|
|
|
postUninstall 'rm -rf /opt/eltool'
|
2021-11-09 13:32:04 +00:00
|
|
|
|
2020-11-09 18:04:11 +00:00
|
|
|
buildRpm {
|
2022-05-03 19:57:54 +00:00
|
|
|
arch = X86_64
|
2020-11-09 18:04:11 +00:00
|
|
|
}
|
|
|
|
buildDeb {
|
2022-05-03 19:57:54 +00:00
|
|
|
arch = X86_64
|
2020-05-29 21:20:06 +00:00
|
|
|
}
|
2021-08-02 14:08:33 +00:00
|
|
|
}
|