Implement debian package build

This commit is contained in:
RatzzFatzz
2025-02-05 15:49:46 +01:00
parent d98c4cd49e
commit 553c672e4d
6 changed files with 148 additions and 69 deletions

164
pom.xml
View File

@@ -11,6 +11,11 @@
<properties> <properties>
<mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass> <mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass>
<project.maintainer>RatzzFatzz</project.maintainer>
<project.maintainer.mail>github.contact@ratzloeffel.de</project.maintainer.mail>
<project.description>Command-line utility for batch-managing default audio and subtitle tracks in MKV files.</project.description>
<java-version>21</java-version>
<lombok-version>1.18.36</lombok-version> <lombok-version>1.18.36</lombok-version>
</properties> </properties>
@@ -66,24 +71,54 @@
<plugin> <plugin>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version> <version>3.3.1</version>
<executions>
<execution>
<id>copy-jpackage-input</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/jpackage-input</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<includes>
<include>${project.artifactId}-${project.version}.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.panteleyev</groupId> <groupId>org.panteleyev</groupId>
<artifactId>jpackage-maven-plugin</artifactId> <artifactId>jpackage-maven-plugin</artifactId>
<version>1.6.5</version> <version>1.6.5</version>
<executions>
<execution>
<id>windows</id>
<configuration> <configuration>
<resourceDir>${project.basedir}/src/main/resources/</resourceDir> <name>${project.artifactId}</name>
<vendor>RatzzFatzz</vendor>
<appVersion>${project.version}</appVersion>
<destination>target/installer</destination>
<input>target/jpackage-input</input>
<mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass>
<mainJar>${project.artifactId}-${project.version}.jar</mainJar>
<resourceDir>${project.basedir}/src/wix/resources/</resourceDir>
<type>EXE</type> <type>EXE</type>
<winConsole>true</winConsole> <winConsole>true</winConsole>
<winShortcut>false</winShortcut> <winShortcut>false</winShortcut>
<winMenu>false</winMenu> <winMenu>false</winMenu>
<javaOptions> <javaOptions>
<javaOption>-Dlog4j.configurationFile=log4j2-installed.yaml</javaOption> <javaOption>-Dlog4j.configurationFile=log4j2-windows.yaml</javaOption>
</javaOptions> </javaOptions>
</configuration> </configuration>
<executions>
<execution>
<id>windows</id>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>jpackage</goal> <goal>jpackage</goal>
@@ -97,25 +132,71 @@
<profile> <profile>
<id>linux</id> <id>linux</id>
<build> <build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>log4j2-debian.yaml</include>
</includes>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.panteleyev</groupId> <artifactId>maven-resources-plugin</artifactId>
<artifactId>jpackage-maven-plugin</artifactId> <version>3.3.1</version>
<version>1.4.0</version>
<executions> <executions>
<execution> <execution>
<id>linux-deb</id> <id>filter-linux-package-info</id>
<configuration>
<type>DEB</type>
<installDir>/usr/local/bin</installDir>
<linuxShortcut>false</linuxShortcut>
<linuxPackageName>mkvasc</linuxPackageName>
<linuxDebMaintainer>your@email.com</linuxDebMaintainer>
</configuration>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>jpackage</goal> <goal>copy-resources</goal>
</goals> </goals>
<configuration>
<outputDirectory>${project.build.directory}/debian-package-info</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/deb</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>jdeb</artifactId>
<groupId>org.vafer</groupId>
<version>1.13</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jdeb</goal>
</goals>
<configuration>
<dataSet>
<!-- JAR file -->
<data>
<src>${project.build.directory}/${project.build.finalName}.jar</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/usr/lib/${project.artifactId}</prefix>
</mapper>
</data>
<!-- Launcher script -->
<data>
<src>${project.build.directory}/debian-package-info/bin/mkvaudiosubtitlechanger</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/usr/bin</prefix>
<filemode>755</filemode>
</mapper>
</data>
</dataSet>
<controlDir>${project.build.directory}/debian-package-info/control</controlDir>
</configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
@@ -197,8 +278,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version> <version>3.13.0</version>
<configuration> <configuration>
<source>21</source> <source>${java-version}</source>
<target>21</target> <target>${java-version}</target>
<compilerArgs> <compilerArgs>
<arg>-Aproject=${project.groupId}/${project.artifactId}</arg> <arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
</compilerArgs> </compilerArgs>
@@ -218,51 +299,6 @@
</plugin> </plugin>
</plugins> </plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-jpackage-input</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/jpackage-input</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<includes>
<include>${project.artifactId}-${project.version}.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.panteleyev</groupId>
<artifactId>jpackage-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<name>${project.artifactId}</name>
<vendor>RatzzFatzz</vendor>
<appVersion>${project.version}</appVersion>
<destination>target/installer</destination>
<input>target/jpackage-input</input>
<mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass>
<mainJar>${project.artifactId}-${project.version}.jar</mainJar>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build> </build>
<repositories> <repositories>

View File

@@ -0,0 +1 @@
java -Dlog4j.configurationFile=log4j2-debian.yaml -jar /usr/lib/${project.artifactId}/${project.artifactId}-${project.version}.jar "$@"

8
src/deb/control/control Normal file
View File

@@ -0,0 +1,8 @@
Package: ${project.artifactId}
Version: ${project.version}
Section: misc
Priority: optional
Architecture: all
Depends: java-runtime (>=21), mkvtoolnix
Maintainer: ${project.maintainer} <${project.maintainer.mail}>
Description: ${project.description}

View File

@@ -0,0 +1,34 @@
Configuration:
name: DefaultLogger
Appenders:
RollingFile:
name: FileAppender
fileName: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/application.log
filePattern: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
PatternLayout:
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
ThresholdFilter:
level: info
Policies:
OnStartupTriggeringPolicy:
minSize: 0
DefaultRolloverStrategy:
max: 30
Delete:
basePath: logs/archive
maxDepth: 1
IfLastModified:
age: 30d
IfAccumulatedFileSize:
exceeds: 1GB
Loggers:
Root:
level: info
AppenderRef:
- ref: FileAppender
Logger:
name: "com.zaxxer.hikari.HikariConfig"
level: info
AppenderRef:
- ref: FileAppender