mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-20 03:36:36 +00:00
added deb and rpm packaging for tcg_rim_tool [no ci]
This commit is contained in:
parent
258ce69a81
commit
8848642ec6
@ -3,8 +3,10 @@ plugins {
|
|||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
java {
|
||||||
options.release = 11
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(11)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -6,6 +6,11 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(11)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation libs.commons.lang
|
implementation libs.commons.lang
|
||||||
|
@ -5,8 +5,10 @@ plugins {
|
|||||||
|
|
||||||
ext.configDir = new File(projectDir, 'config')
|
ext.configDir = new File(projectDir, 'config')
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
java {
|
||||||
options.release = 11
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(11)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
32
build.gradle
32
build.gradle
@ -1,8 +1,11 @@
|
|||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
// Apply the application plugin to add support for building a CLI application in Java.
|
// Apply the application plugin to add support for building a CLI application in Java.
|
||||||
id 'application'
|
id 'application'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Global checkstyle file
|
// Global checkstyle file
|
||||||
ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml")
|
ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml")
|
||||||
|
|
||||||
@ -11,18 +14,23 @@ dependencies {
|
|||||||
// Use Maven Central for resolving dependencies.
|
// Use Maven Central for resolving dependencies.
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
// implementation project(':HIRS_Utils')
|
|
||||||
// implementation project(':HIRS_Structs')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('copyVersion') {
|
def projectVersion = rootProject.file('VERSION').text.trim()
|
||||||
doLast {
|
|
||||||
if (project.hasProperty('displayVersion')) {
|
|
||||||
String resourceDir="${buildDir}/resources/main"
|
|
||||||
println "setting app version file contents of: ${displayVersion} to ${resourceDir}"
|
|
||||||
new File(resourceDir, "VERSION").write("$displayVersion")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
version = file("$rootDir/VERSION").text.trim() + "-SNAPSHOT"
|
def buildTime = { ->
|
||||||
|
Date latestdate = new Date();
|
||||||
|
def time = latestdate.getTime();
|
||||||
|
long seconds = TimeUnit.MILLISECONDS.toSeconds(time);
|
||||||
|
return seconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
def gitHash = { ->
|
||||||
|
def gitProcess = 'git rev-parse --short HEAD'.execute();
|
||||||
|
gitProcess.waitFor();
|
||||||
|
def shortHash = gitProcess.text.trim();
|
||||||
|
def gitHash = shortHash.substring(0, shortHash.length() - 2);
|
||||||
|
return gitHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
project.ext["packageVersion"] = "${projectVersion}.${buildTime}.${gitHash}.el8"
|
||||||
|
@ -5,6 +5,8 @@ include ':TPM_Utils'
|
|||||||
include ':HIRS_AttestationCA'
|
include ':HIRS_AttestationCA'
|
||||||
include ':HIRS_AttestationCAPortal'
|
include ':HIRS_AttestationCAPortal'
|
||||||
include ':tools:tcg_eventlog_tool'
|
include ':tools:tcg_eventlog_tool'
|
||||||
|
include ':tools:tcg_rim_tool'
|
||||||
|
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
versionCatalogs {
|
versionCatalogs {
|
||||||
@ -38,6 +40,9 @@ dependencyResolutionManagement {
|
|||||||
library('jadira_usertype', 'org.jadira.usertype:usertype.core:6.0.1.GA')
|
library('jadira_usertype', 'org.jadira.usertype:usertype.core:6.0.1.GA')
|
||||||
library('javax_annotation', 'javax.annotation:javax.annotation-api:1.3')
|
library('javax_annotation', 'javax.annotation:javax.annotation-api:1.3')
|
||||||
library('javax_jaxb', 'javax.xml.bind:jaxb-api:2.3.0')
|
library('javax_jaxb', 'javax.xml.bind:jaxb-api:2.3.0')
|
||||||
|
library('javax_json', 'javax.json:javax.json-api:1.1.4')
|
||||||
|
library('glassfish_json', 'org.glassfish:javax.json:1.1.4')
|
||||||
|
library('glassfish_jaxb_runtime', 'org.glassfish.jaxb:jaxb-runtime:2.3.1')
|
||||||
library('javax_validation', 'javax.validation:validation-api:2.0.1.Final')
|
library('javax_validation', 'javax.validation:validation-api:2.0.1.Final')
|
||||||
library('jboss_logging', 'org.jboss.logging:jboss-logging:3.2.0.Final')
|
library('jboss_logging', 'org.jboss.logging:jboss-logging:3.2.0.Final')
|
||||||
library('jcommander', 'com.beust:jcommander:1.82')
|
library('jcommander', 'com.beust:jcommander:1.82')
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "java"
|
id "java"
|
||||||
id "nebula.ospackage" version "9.1.1"
|
id "nebula.ospackage" version "9.1.1"
|
||||||
}
|
}
|
||||||
version = '1.0'
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(11)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -30,12 +37,16 @@ jar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get version from main project gradle
|
||||||
|
def packVersion = properties.get("packageVersion");
|
||||||
|
//println "packageVersion is ${projVersion}"
|
||||||
|
|
||||||
// Produce packages
|
// Produce packages
|
||||||
ospackage {
|
ospackage {
|
||||||
packageName = 'tcg_eventlog_tool'
|
packageName = 'tcg_eventlog_tool'
|
||||||
os = LINUX
|
os = LINUX
|
||||||
arch = NOARCH
|
arch = NOARCH
|
||||||
version = '2.1.0'
|
version = "$packVersion"
|
||||||
release = '1'
|
release = '1'
|
||||||
|
|
||||||
into '/opt/hirs/eventlog'
|
into '/opt/hirs/eventlog'
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,6 +1,5 @@
|
|||||||
#Thu Sep 13 15:33:27 EDT 2018
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=gradle-4.5.1-all.zip
|
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
|
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
|
||||||
baseDir=${scriptDir%/*}
|
baseDir=${scriptDir%/*}
|
||||||
libDir=$baseDir"/lib/"
|
libDir=$baseDir"/lib/"
|
||||||
jar="tcg_eventlog_tool-1.0.jar";
|
jar="tcg_eventlog_tool.jar";
|
||||||
java -jar $libDir$jar "$@"
|
java -cp $libDir$jar:$libsDir* hirs.tcg_eventlog.Main "$@"
|
||||||
|
@ -1,28 +1,91 @@
|
|||||||
apply plugin: 'java'
|
plugins {
|
||||||
|
id "java"
|
||||||
|
id "nebula.ospackage" version "9.1.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(11)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'javax.json:javax.json-api:1.1.4', 'org.glassfish:javax.json:1.1.4', 'com.beust:jcommander:1.72', 'org.bouncycastle:bcmail-jdk15on:1.59'
|
implementation libs.bouncy.castle
|
||||||
testCompile 'org.testng:testng:6.8.8'
|
implementation libs.glassfish.json
|
||||||
|
implementation libs.glassfish.jaxb.runtime
|
||||||
|
implementation libs.jcommander
|
||||||
|
implementation libs.javax.json
|
||||||
|
implementation libs.javax.jaxb
|
||||||
|
implementation libs.javax.annotation
|
||||||
|
|
||||||
|
testImplementation libs.testng
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
// Keep jar clean:
|
||||||
attributes("Main-Class": "hirs.swid.Main",
|
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
|
||||||
"Class-Path": configurations.runtime.files.collect { "lib/$it.name" }.join(' ')
|
|
||||||
)
|
manifest {
|
||||||
}
|
attributes(
|
||||||
from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {}
|
'Main-Class': 'hirs.swid.Main',
|
||||||
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
|
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadArchives {
|
// Get version from main project gradle
|
||||||
repositories {
|
def packVersion = properties.get("packageVersion");
|
||||||
flatDir {
|
println "packageVersion is ${packVersion}"
|
||||||
dirs "${buildDir}"
|
|
||||||
}
|
ospackage {
|
||||||
}
|
packageName = 'tcg-rim-tool'
|
||||||
|
os = LINUX
|
||||||
|
arch = NOARCH
|
||||||
|
version = "$packVersion"
|
||||||
|
release = '1'
|
||||||
|
|
||||||
|
into '/opt/hirs/rimtool'
|
||||||
|
user 'root'
|
||||||
|
fileMode = 0755
|
||||||
|
|
||||||
|
from(jar.outputs.files) {
|
||||||
|
into 'lib'
|
||||||
|
}
|
||||||
|
|
||||||
|
from('libs') {
|
||||||
|
into 'lib'
|
||||||
|
}
|
||||||
|
|
||||||
|
from(configurations.runtimeClasspath) {
|
||||||
|
into 'lib'
|
||||||
|
}
|
||||||
|
|
||||||
|
from('scripts') {
|
||||||
|
exclude {
|
||||||
|
FileTreeElement details ->
|
||||||
|
details.file.name.endsWith('.bat')
|
||||||
|
}
|
||||||
|
into 'scripts'
|
||||||
|
}
|
||||||
|
|
||||||
|
from('data') {
|
||||||
|
exclude {
|
||||||
|
FileTreeElement details ->
|
||||||
|
details.file.name.endsWith('.md')
|
||||||
|
}
|
||||||
|
into './'
|
||||||
|
link("/usr/local/bin/rim", "/opt/hirs/rimtool/scripts/rimtool.sh", 0x755)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildRpm {
|
||||||
|
arch = I386
|
||||||
|
}
|
||||||
|
|
||||||
|
buildDeb {
|
||||||
|
arch = I386
|
||||||
}
|
}
|
||||||
|
BIN
tools/tcg_rim_tool/data/binary_bios_measurements
Normal file
BIN
tools/tcg_rim_tool/data/binary_bios_measurements
Normal file
Binary file not shown.
Binary file not shown.
BIN
tools/tcg_rim_tool/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
tools/tcg_rim_tool/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,6 +1,5 @@
|
|||||||
#Thu Sep 13 15:33:27 EDT 2018
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=gradle-4.5.1-all.zip
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
VERSION=2.1.0
|
|
||||||
GIT_HASH=`git rev-parse HEAD | head -c6`
|
|
||||||
GIT_COMMIT_UNIX_TIMESTAMP=`git show -s --format=%ct | xargs echo -n`
|
|
||||||
RELEASE="$((GIT_COMMIT_UNIX_TIMESTAMP)).$GIT_HASH"
|
|
||||||
name="tcg_rim_tool"
|
|
||||||
|
|
||||||
# Enter package directory
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
pushd $SCRIPT_DIR
|
|
||||||
|
|
||||||
tar -cf "$name-$VERSION.$RELEASE".tar build.gradle gradle* src/ docs/ rim_fields.json keystore.jks scripts/
|
|
||||||
gzip -f "$name-$VERSION.$RELEASE".tar
|
|
||||||
if [ -d rpmbuild ]; then
|
|
||||||
rm -rf rpmbuild
|
|
||||||
fi
|
|
||||||
mkdir -p rpmbuild/BUILD rpmbuild/BUILDROOT rpmbuild/SOURCES rpmbuild/RPMS rpmbuild/SPECS rpmbuild/SRPMS
|
|
||||||
rpmbuild -bb $name.spec --define "_sourcedir $PWD" --define "_topdir $PWD/rpmbuild" --define 'RELEASE '$RELEASE --define 'VERSION '$VERSION
|
|
||||||
|
|
||||||
popd
|
|
@ -3,6 +3,6 @@
|
|||||||
# Calls the the_tcg_rim_tool and passes in parameters
|
# Calls the the_tcg_rim_tool and passes in parameters
|
||||||
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
|
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
|
||||||
baseDir=${scriptDir%/*}
|
baseDir=${scriptDir%/*}
|
||||||
jar="tcg_rim_tool-2.1.0.jar";
|
jar="tcg_rim_tool.jar";
|
||||||
java -jar $baseDir/$jar "$@"
|
java -cp $baseDir/lib/$jar:$baseDir/lib/* hirs.swid.Main "$@"
|
||||||
|
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
Name: tcg_rim_tool
|
|
||||||
Version: %{?VERSION}
|
|
||||||
Release: %{?RELEASE}
|
|
||||||
Summary: A java command-line tool to create PC client root RIM
|
|
||||||
|
|
||||||
License: ASL 2.0
|
|
||||||
URL: https://github.com/nsacyber/HIRS
|
|
||||||
Source0: %{name}-%{version}.%{release}.tar.gz
|
|
||||||
|
|
||||||
BuildRequires: java-headless >= 1:1.8.0
|
|
||||||
|
|
||||||
%description
|
|
||||||
This tool will generate a base RIM file for PC clients in accordance with the schema located at http://standards.iso.org/iso/19770/-2/2015/schema.xsd. The generated RIM can either be empty if no arguments are given, or contain a payload if an input file is provided. The tool can also verify a given RIMfile against the schema. Use -h or --help to see a list of commands and uses.
|
|
||||||
|
|
||||||
%global __os_install_post %{nil}
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q -c -n %{name}
|
|
||||||
|
|
||||||
%pre
|
|
||||||
rm -f /opt/hirs/rimtool/%{name}*.jar
|
|
||||||
|
|
||||||
%build
|
|
||||||
./gradlew -Pversion=%{version} build
|
|
||||||
|
|
||||||
%install
|
|
||||||
mkdir -p %{buildroot}/opt/hirs/rimtool/ %{buildroot}/usr/local/bin
|
|
||||||
cp build/libs/%{name}-%{version}.jar %{buildroot}/opt/hirs/rimtool/
|
|
||||||
cp ./rim_fields.json %{buildroot}/opt/hirs/rimtool/
|
|
||||||
cp ./keystore.jks %{buildroot}/opt/hirs/rimtool/
|
|
||||||
cp -r ./scripts/ %{buildroot}/opt/hirs/rimtool/
|
|
||||||
ln -sf /opt/hirs/rimtool/scripts/rimtool.sh %{buildroot}/usr/local/bin/rim
|
|
||||||
|
|
||||||
%files
|
|
||||||
/opt/hirs/rimtool/%{name}-%{version}.jar
|
|
||||||
/opt/hirs/rimtool/rim_fields.json
|
|
||||||
/opt/hirs/rimtool/keystore.jks
|
|
||||||
/opt/hirs/rimtool/scripts
|
|
||||||
/usr/local/bin/rim
|
|
||||||
|
|
||||||
%attr(755, root, root) /opt/hirs/rimtool/scripts/rimtool.sh
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Tue Nov 10 2020 chubtub
|
|
||||||
- Second release
|
|
||||||
* Mon Jun 15 2020 chubtub
|
|
||||||
- First release
|
|
||||||
* Mon Jan 6 2020 chubtub
|
|
||||||
- First change
|
|
Loading…
Reference in New Issue
Block a user