Skip to content

Commit 95a2895

Browse files
author
Jorrit Poelen
committed
add rpm support; inspired by bio-guoda/preston#332
1 parent 8fca9bc commit 95a2895

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

nomer/pom.xml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,79 @@
279279
</execution>
280280
</executions>
281281
</plugin>
282+
<plugin>
283+
<groupId>org.codehaus.mojo</groupId>
284+
<artifactId>rpm-maven-plugin</artifactId>
285+
<version>2.3.0</version>
286+
<executions>
287+
<execution>
288+
<phase>package</phase>
289+
<goals>
290+
<goal>rpm</goal>
291+
</goals>
292+
<configuration>
293+
<license>GPLv3</license>
294+
<distribution>Nomer</distribution>
295+
<group>Application/Collectors</group>
296+
<packager>Jorrit Poelen</packager>
297+
<prefix>/opt/${project.artifactId}</prefix>
298+
<copyTo>${project.build.directory}/${project.artifactId}-${project.version}.rpm</copyTo>
299+
<!--<changelogFile>changelog.md</changelogFile>-->
300+
<defineStatements>
301+
<defineStatement>_unpackaged_files_terminate_build 0</defineStatement>
302+
</defineStatements>
303+
<mappings>
304+
<mapping>
305+
<directory>/opt/${project.artifactId}/lib</directory>
306+
<directoryIncluded>true</directoryIncluded>
307+
<filemode>755</filemode>
308+
<username>root</username>
309+
<groupname>root</groupname>
310+
</mapping>
311+
<mapping>
312+
<directory>/opt/${project.artifactId}/lib</directory>
313+
<directoryIncluded>false</directoryIncluded>
314+
<filemode>644</filemode>
315+
<directoryIncluded>false</directoryIncluded>
316+
<username>root</username>
317+
<groupname>root</groupname>
318+
<dependency/>
319+
</mapping>
320+
<mapping>
321+
<directory>/opt/${project.artifactId}/lib</directory>
322+
<directoryIncluded>false</directoryIncluded>
323+
<filemode>644</filemode>
324+
<username>root</username>
325+
<groupname>root</groupname>
326+
<sources>
327+
<source>
328+
<location>target/${project.artifactId}-${project.version}.jar</location>
329+
</source>
330+
</sources>
331+
</mapping>
332+
<mapping>
333+
<directory>/usr/bin</directory>
334+
<directoryIncluded>false</directoryIncluded>
335+
<filemode>755</filemode>
336+
<username>root</username>
337+
<groupname>root</groupname>
338+
<sources>
339+
<source>
340+
<location>src/main/rpm/${project.artifactId}</location>
341+
</source>
342+
</sources>
343+
</mapping>
344+
</mappings>
345+
<preinstallScriptlet>
346+
<scriptFile>src/main/rpm/preinstall.sh</scriptFile>
347+
<fileEncoding>utf-8</fileEncoding>
348+
<filter>true</filter>
349+
</preinstallScriptlet>
350+
</configuration>
351+
</execution>
352+
</executions>
353+
</plugin>
354+
282355
</plugins>
283356
</build>
284357
</project>

nomer/src/main/rpm/nomer

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
#
3+
# Launches Nomer in JVM
4+
#
5+
6+
java -Xmx4G -XX:+UseG1GC -cp "/opt/nomer/lib/*" org.globalbioticinteractions.nomer.Nomer "$@"

nomer/src/main/rpm/preinstall.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -o errexit
3+
set -o nounset
4+
set -o pipefail
5+
6+
function verify_java_version_min {
7+
minimal_version=8
8+
current_version=$(java -version 2>&1 | tr "\n" " " | cut -d " " -f 3 | tr -d '"' | cut -d "." -f 1)
9+
if (( current_version < minimal_version ))
10+
then
11+
return 1;
12+
fi
13+
return 0
14+
}
15+
16+
# Verify the existence of java command, if not there verification should exit already
17+
type -P java &> /dev/null || { echo "java not found; please install java using [sudo dnf install java-21-openjdk.x86_64] (fedora) or similar."; exit 1; }
18+
19+
verify_java_version_min
20+
exit_code=$?
21+
22+
exit $exit_code

0 commit comments

Comments
 (0)