Merge pull request #416 from nsacyber/support-file-revision

Vendor Table JSON refactor
This commit is contained in:
chubtub 2021-11-17 10:55:31 -05:00 committed by GitHub
commit 893c1db804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 4 deletions

View File

@ -260,7 +260,7 @@ fi
%attr(664, root, tomcat) /opt/hirs/default-properties/attestationca/banner.properties
%attr(664, root, tomcat) /opt/hirs/default-properties/attestationca/persistence.properties
%attr(664, root, tomcat) /opt/hirs/default-properties/component-class.json
%attr(664, root, tomcat) /opt/hirs/default-properties/attestationca/vendor-table.json
%attr(664, root, tomcat) /opt/hirs/default-properties/vendor-table.json
%attr(774, root, tomcat) /opt/hirs/scripts/common/aca
%attr(774, root, tomcat) /opt/hirs/scripts/aca
%attr(774, root, tomcat) /opt/hirs/extras/aca/tomcat-mysql-hirs.pp
@ -330,7 +330,7 @@ cp HIRS_Utils/src/main/resources/persistence.properties %{buildroot}/opt/hirs/de
cp HIRS_Utils/src/main/resources/logging.properties %{buildroot}/opt/hirs/default-properties/attestationca/
cp HIRS_Utils/src/main/resources/banner.properties %{buildroot}/opt/hirs/default-properties/attestationca/
cp HIRS_Utils/src/main/resources/component-class.json %{buildroot}/opt/hirs/default-properties/
cp HIRS_Utils/src/main/resources/vendor-table.json %{buildroot}/opt/hirs/default-properties/attestationca/
cp -n HIRS_Utils/src/main/resources/vendor-table.json %{buildroot}/opt/hirs/default-properties/
# install extras
mkdir -p %{buildroot}/opt/hirs/extras

View File

@ -31,7 +31,7 @@ In both cases the tcg_eventlog_tool-X.X.jar file should have been placed in the
Currenty only a install file for Linux RPM is supported.
To create an RPM on a linux device use the following command in the dame directory:
> ./gradlew builRPM
> ./gradlew buildRPM
# Installing
Currenty only a install package for Linux is supported.

View File

@ -108,7 +108,7 @@ ospackage {
link("/usr/local/bin/elt", "/opt/hirs/eventlog/scripts/eventlog.sh", 0x755)
}
into('/opt/hirs/default-properties/eventlogtool') {
into('/tmp/') {
fileMode 0664
from ('../../HIRS_Utils/src/main/resources/vendor-table.json') {
addParentDirs true
@ -116,6 +116,8 @@ ospackage {
}
}
postInstall file('scripts/vendor-table.sh')
buildRpm {
arch = I386
}

View File

@ -0,0 +1,22 @@
#!/bin/bash
HIRS_DIR="/opt/hirs/default-properties"
VENDOR_FILE="vendor-table.json"
# check that the directory exists
if [ ! -d "$HIRS_DIR" ]; then
mkdir -p $HIRS_DIR
fi
# in case there was a problem, still check and if all is well
# move the file with no-clobber
if [ -d "$HIRS_DIR" ]; then
# if the file doesn't exist
if [ ! -f "$HIRS_DIR/$VENDOR_FILE" ]; then
mv -n "/tmp/$VENDOR_FILE" $HIRS_DIR
chmod 0644 "$HIRS_DIR/$VENDOR_FILE"
else
# if it does, then just remove the tmp folder version
rm "/tmp/$VENDOR_FILE"
fi
fi