mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-20 03:36:36 +00:00
103 lines
2.7 KiB
Groovy
103 lines
2.7 KiB
Groovy
import java.util.concurrent.TimeUnit
|
|
|
|
plugins {
|
|
id "java"
|
|
id "nebula.ospackage" version "9.1.1"
|
|
}
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(11)
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':HIRS_Utils')
|
|
implementation libs.jcommander
|
|
implementation libs.commons.io
|
|
}
|
|
|
|
ext.configDir = new File(projectDir, 'config')
|
|
ext.checkstyleConfigDir = "$configDir/checkstyle"
|
|
ext.findbugsConfigDir = "$configDir/findbugs"
|
|
|
|
jar {
|
|
// Keep the jar clean:
|
|
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
|
|
manifest {
|
|
attributes(
|
|
'Main-Class': 'hirs.tcg_eventlog.Main',
|
|
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
|
|
)
|
|
}
|
|
}
|
|
|
|
// Get version from main project gradle
|
|
def packVersion = properties.get("packageVersion");
|
|
//println "packageVersion is ${projVersion}"
|
|
|
|
// Produce packages
|
|
ospackage {
|
|
packageName = 'tcg-eventlog-tool'
|
|
os = LINUX
|
|
arch = NOARCH
|
|
version = "$packVersion"
|
|
release = '1'
|
|
|
|
user 'root'
|
|
fileMode = 0755
|
|
|
|
into ('/opt/hirs/eventlog/lib') {
|
|
from jar.outputs.files
|
|
from 'lib'
|
|
from 'configurations.runtimeClasspath'
|
|
}
|
|
into ('/opt/hirs/eventlog/scripts') {
|
|
from ('scripts') {
|
|
exclude {
|
|
FileTreeElement details ->
|
|
details.file.name.endsWith('.bat')
|
|
}
|
|
}
|
|
}
|
|
into ('/opt/hirs/eventlog/docs') {
|
|
from ('docs') {
|
|
exclude {
|
|
FileTreeElement details ->
|
|
details.file.name.endsWith('.odt')
|
|
}
|
|
}
|
|
}
|
|
// Copy vendor-table into /tmp to avoid conflict with the ACA
|
|
into('/tmp/elt/default-properties') {
|
|
from ('../../HIRS_Utils/src/main/resources/vendor-table.json') {
|
|
fileMode 0664
|
|
addParentDirs = true
|
|
}
|
|
}
|
|
|
|
// place elt link in system path to enable command line access
|
|
link("/usr/local/bin/elt", "/opt/hirs/eventlog/scripts/eventlog.sh", 0x755)
|
|
|
|
// PostInstall
|
|
// Copy files from /opt/elt/default-properties/ to avoid conflicts with the ACA
|
|
postInstall "cp /tmp/elt/default-properties/vendor-table.json /opt/hirs/default-properties/."
|
|
postInstall "rm -rf /tmp/elt"
|
|
|
|
// Uninstall
|
|
// copy files to where package manager exspects them and remove project files
|
|
preUninstall "mkdir -p /tmp/elt/default-properties"
|
|
preUninstall "cp /opt/hirs/default-properties/vendor-table.json /tmp/elt/default-properties/."
|
|
postUninstall "rm -rf /tmp/elt"
|
|
buildRpm {
|
|
arch = X86_64
|
|
}
|
|
buildDeb {
|
|
arch = 'amd64'
|
|
}
|
|
}
|