Add git timestamp and hash to the rpm name. Also centralize version number to package.sh.

This commit is contained in:
chubtub 2022-02-08 17:31:22 -05:00
parent 65471c87f1
commit f8c593c4b7
3 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,4 @@
apply plugin: 'java'
version = '2.1.0'
repositories {
mavenCentral()

View File

@ -1,17 +1,20 @@
#!/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
name="tcg_rim_tool"
tar -cf $name.tar build.gradle gradle* src/ docs/ rim_fields.json keystore.jks scripts/
gzip -f $name.tar
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"
rpmbuild -bb $name.spec --define "_sourcedir $PWD" --define "_topdir $PWD/rpmbuild" --define 'RELEASE '$RELEASE --define 'VERSION '$VERSION
popd

View File

@ -1,11 +1,11 @@
Name: tcg_rim_tool
Version: 2.1.0
Release: 1%{?dist}
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}.tar.gz
Source0: %{name}-%{version}.%{release}.tar.gz
BuildRequires: java-headless >= 1:1.8.0
@ -19,7 +19,7 @@ This tool will generate a base RIM file for PC clients in accordance with the sc
rm -f /opt/hirs/rimtool/%{name}*.jar
%build
./gradlew build
./gradlew -Pversion=%{version} build
%install
mkdir -p %{buildroot}/opt/hirs/rimtool/ %{buildroot}/usr/local/bin