mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-21 05:53:27 +00:00
169 lines
5.2 KiB
Groovy
169 lines
5.2 KiB
Groovy
plugins {
|
|
id 'application'
|
|
id 'java'
|
|
id 'war'
|
|
id "nebula.ospackage" version "9.1.1"
|
|
id 'org.springframework.boot' version '3.0.6'
|
|
id 'io.spring.dependency-management' version '1.1.0'
|
|
}
|
|
|
|
// Get version from main project gradle
|
|
def packVersion = properties.get("packageVersion");
|
|
def jarVersion = properties.get("jarVersion");
|
|
//println "packageVersion is ${projVersion}"
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(17)
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
compileOnly {
|
|
extendsFrom annotationProcessor
|
|
}
|
|
all*.exclude module: 'spring-boot-starter-logging'
|
|
}
|
|
|
|
repositories {
|
|
flatDir { dirs "lib" }
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':HIRS_Utils')
|
|
implementation project(':HIRS_AttestationCA')
|
|
|
|
implementation libs.pci
|
|
implementation libs.gson
|
|
implementation libs.bouncycastle
|
|
implementation libs.guava
|
|
implementation libs.jakarta.servlet
|
|
|
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
|
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
|
|
implementation 'org.apache.logging.log4j:log4j-spring-boot'
|
|
implementation 'org.projectlombok:lombok'
|
|
implementation 'commons-fileupload:commons-fileupload:1.5'
|
|
implementation 'org.junit.jupiter:junit-jupiter:5.4.2'
|
|
implementation 'org.junit.jupiter:junit-jupiter:5.4.2'
|
|
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper:10.1.5'
|
|
|
|
compileOnly 'org.projectlombok:lombok'
|
|
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
|
|
annotationProcessor 'org.projectlombok:lombok'
|
|
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
|
|
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
testImplementation libs.testng
|
|
}
|
|
|
|
war {
|
|
from(buildDir) {
|
|
include 'VERSION'
|
|
into 'WEB-INF/classes'
|
|
}
|
|
archiveFileName = 'HIRS_AttestationCAPortal.war'
|
|
}
|
|
|
|
ospackage {
|
|
packageName = 'HIRS_AttestationCA'
|
|
os = LINUX
|
|
arch = NOARCH
|
|
version = "$packVersion"
|
|
release = '1'
|
|
|
|
user 'root'
|
|
fileMode = 0755
|
|
|
|
def tpath="/opt"
|
|
|
|
addParentDirs = true
|
|
createDirectoryEntry true
|
|
|
|
preInstall "rm -rf /opt/hirs/default-properties"
|
|
preInstall "mkdir -p /opt/hirs/default-properties/"
|
|
preInstall "mkdir -p /tmp/hirs/default-properties/"
|
|
|
|
// Setup /etc/hirs
|
|
into ('/etc/hirs/aca/') {
|
|
from '../HIRS_AttestationCA/src/main/resources/defaults.properties'
|
|
rename {'aca.properties'}
|
|
}
|
|
into ('/etc/hirs/') {
|
|
from '../HIRS_Utils/src/main/resources/banner.properties'
|
|
from '../HIRS_Utils/src/main/resources/persistence.properties'
|
|
from '../HIRS_Utils/src/main/resources/logging.properties'
|
|
}
|
|
// Setup tomcat files
|
|
// Create and package HIRS_AttestationCA:war
|
|
into ("${tpath}/tomcat/webapps") {
|
|
from war.outputs.files
|
|
from '../HIRS_AttestationCA/build/libs/HIRS_AttestationCA.war'
|
|
user 'root'
|
|
fileMode = 0755
|
|
}
|
|
into ("${tpath}/tomcat/lib") {
|
|
from 'libs'
|
|
from configurations.runtimeClasspath
|
|
}
|
|
into ("/opt/hirs/scripts/aca/") {
|
|
from '../package/conf/tomcat.service'
|
|
from '../package/scripts/install_tomcat.sh'
|
|
from '../package/scripts/aca/aca_property_setup.sh'
|
|
from '../package/scripts/aca/aca_setup.sh'
|
|
}
|
|
into ("/opt/hirs/scripts/pki/") {
|
|
from '../package/scripts/pki/ca.conf'
|
|
from '../package/scripts/pki/pki_setup.sh'
|
|
from '../package/scripts/pki/pki_chain_gen.sh'
|
|
}
|
|
into ("/opt/hirs/scripts/db/") {
|
|
from '../package/scripts/db/db_create.sh'
|
|
from '../package/scripts/db/db_create.sql'
|
|
from '../package/scripts/db/db_drop.sh'
|
|
from '../package/scripts/db/db_drop.sql'
|
|
from '../package/scripts/db/secure_mysql.sql'
|
|
}
|
|
into ("/opt/hirs/scripts/common") {
|
|
from '../package/scripts/common/'
|
|
}
|
|
into ('/opt/hirs/extras/aca/') {
|
|
from '../package/extras/aca/'
|
|
}
|
|
|
|
// Copy json files to /tmp and move into /opt/hirs in postInstall section
|
|
// Allows HIRS tools to be installed using the same files
|
|
into ('/tmp/aca/default-properties/') {
|
|
from '../HIRS_AttestationCA/src/main/resources/vendor-table.json'
|
|
from '../HIRS_AttestationCA/src/main/resources/component-class.json'
|
|
}
|
|
// Post Install
|
|
|
|
postInstall file('../package/scripts/db/db_create.sh')
|
|
postInstall file('../package/scripts/pki/pki_setup.sh')
|
|
|
|
postInstall 'mkdir -p /etc/hirs/aca/certificates'
|
|
postInstall 'cp /tmp/aca/default-properties/* /opt/hirs/default-properties/.'
|
|
postInstall 'rm -rf /tmp/aca/'
|
|
// postInstall file('../package/scripts/install_tomcat.sh')
|
|
|
|
postInstall 'sh /opt/tomcat/bin/catalina.sh start'
|
|
|
|
// Post Uninstall
|
|
// Copy files to /tmp that package manager will be expecting them there
|
|
preUninstall 'mkdir -p /tmp/aca/default-properties/'
|
|
preUninstall 'cp -f /opt/hirs/default-properties/* /tmp/aca/default-properties/.'
|
|
preUninstall file('../package/scripts/db/db_drop.sh')
|
|
|
|
buildRpm {
|
|
arch = X86_64
|
|
}
|
|
|
|
buildDeb {
|
|
arch = 'amd64'
|
|
}
|
|
}
|