Skip to content

Commit

Permalink
add debian package config
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorrit Poelen committed Aug 4, 2023
1 parent 78a8a71 commit c644023
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 19 deletions.
184 changes: 166 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
<picocli.version>4.6.3</picocli.version>
<asciidoctor-maven-plugin.version>2.2.2</asciidoctor-maven-plugin.version>
<asciidoctorj.version>2.5.3</asciidoctorj.version>
<generated.docs.dir>${project.build.outputDirectory}/org/globalbioticinteractions/elton/docs</generated.docs.dir>
<generated.docs.dir>${project.build.outputDirectory}/org/globalbioticinteractions/elton/docs
</generated.docs.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
<project.build.testResourceEncoding>UTF-8</project.build.testResourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<exec-maven-plugin.version>3.1.0</exec-maven-plugin.version>
<cmd.class>org.globalbioticinteractions.elton.Elton</cmd.class>
</properties>

<dependencies>
Expand Down Expand Up @@ -164,17 +167,21 @@
<finalName>elton-app</finalName>
<shadedArtifactAttached>false</shadedArtifactAttached>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.globalbioticinteractions.elton.Elton</mainClass>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${cmd.class}</mainClass>
<manifestEntries>
<Implementation-Version>${project.version}</Implementation-Version>
<Project-Version>${project.version}</Project-Version>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
<addHeader>false</addHeader>
</transformer>
</transformers>
Expand Down Expand Up @@ -205,27 +212,49 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<id>generate-manpages</id>
<phase>process-classes</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>${cmd.class}</argument>
<argument>gen-manpage</argument>
<argument>--outdir</argument>
<argument>${generated.docs.dir}/adoc</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>generate-completion</id>
<phase>process-classes</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-Dpicocli.autocomplete.systemExitOnError</argument>
<argument>-cp</argument>
<classpath/>
<argument>picocli.AutoComplete</argument>
<argument>--force</argument><!-- overwrite if exists -->
<argument>--completionScript</argument>
<argument>${project.build.directory}/${project.artifactId}_completion</argument>
<argument>${cmd.class}</argument>
</arguments>
</configuration>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>org.globalbioticinteractions.elton.Elton</argument>
<argument>gen-manpage</argument>
<argument>--outdir</argument>
<argument>${generated.docs.dir}/adoc</argument>
</arguments>
</configuration>
</plugin>

<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
Expand All @@ -251,6 +280,125 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<includeScope>compile</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>jdeb</artifactId>
<groupId>org.vafer</groupId>
<version>1.10</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jdeb</goal>
</goals>
<configuration>
<verbose>true</verbose>
<controlDir>${basedir}/src/main/deb/control</controlDir>
<dataSet>

<data>
<src>${project.build.directory}/${project.build.finalName}.jar</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/usr/share/${project.artifactId}/lib</prefix>
<filemode>644</filemode>
<user>${project.artifactId}</user>
<group>${project.artifactId}</group>
</mapper>
</data>

<data>
<src>${project.basedir}/src/main/deb/bin/${project.artifactId}</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/usr/share/${project.artifactId}/bin</prefix>
<filemode>755</filemode>
<user>${project.artifactId}</user>
<group>${project.artifactId}</group>
</mapper>
</data>

<data>
<src>${project.build.directory}/${project.artifactId}_completion</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/etc/bash_completion.d/</prefix>
<filemode>755</filemode>
<user>${project.artifactId}</user>
<group>${project.artifactId}</group>
</mapper>
</data>

<data>
<src>${project.build.directory}/lib</src>
<type>directory</type>
<mapper>
<type>perm</type>
<prefix>/usr/share/${project.artifactId}/lib</prefix>
<filemode>644</filemode>
<user>${project.artifactId}</user>
<group>${project.artifactId}</group>
</mapper>
</data>

<data>
<src>${generated.docs.dir}/manpage</src>
<type>directory</type>
<mapper>
<type>perm</type>
<prefix>/usr/local/share/man/man1/</prefix>
<filemode>644</filemode>
<user>${project.artifactId}</user>
<group>${project.artifactId}</group>
</mapper>
</data>

<data>
<type>template</type>
<paths>
<path>etc/${project.artifactId}</path>
<path>var/lib/${project.artifactId}</path>
<path>var/log/${project.artifactId}</path>
<path>var/run/${project.artifactId}</path>
</paths>
<mapper>
<type>perm</type>
<filemode>750</filemode>
<user>${project.artifactId}</user>
<group>${project.artifactId}</group>
</mapper>
</data>
<data>
<type>link</type>
<symlink>true</symlink>
<linkName>/usr/local/bin/${project.artifactId}</linkName>
<linkTarget>/usr/share/${project.artifactId}/bin/${project.artifactId}</linkTarget>
</data>
</dataSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
6 changes: 6 additions & 0 deletions src/main/deb/bin/elton
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
#
# Launches Elton in JVM
#

java -Xmx4G -XX:+UseG1GC -cp "/usr/share/elton/lib/*" org.globalbioticinteractions.elton.Elton $@
9 changes: 9 additions & 0 deletions src/main/deb/control/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Package: [[name]]
Version: [[version]]
Section: misc
Priority: low
Architecture: all
Description: [[description]]
Maintainer: [email protected]
Website: https://github.com/globalbioticinteractions/elton
Depends: openjdk-8-jdk-headless | openjdk-11-jdk-headless
1 change: 1 addition & 0 deletions src/main/deb/control/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/bin/sh
1 change: 1 addition & 0 deletions src/main/deb/control/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/bin/sh
1 change: 1 addition & 0 deletions src/main/deb/control/preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/bin/sh
1 change: 1 addition & 0 deletions src/main/deb/control/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/bin/sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@CommandLine.Command(
name = "config-man",
aliases = {"config-manpage", "install-manpage"},
description = "Installs/configures Elton man page, so you can type [man preston] on unix-like system to learn more about Preston. "
description = "Installs/configures Elton man page, so you can type [man elton] on unix-like system to learn more about Preston. "
)
public class CmdInstallManual implements Runnable {

Expand Down

0 comments on commit c644023

Please sign in to comment.