Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

Arc unpack as a debian package

First, we need to define a few properties in the pom file

Pom file properties

Basically, these just allows us to use consistent names in the plugin configs that follow.

Then we come to the <build> section. The first thing to do, is to enable filtering on the resources. This is done such

The effect of this is that you can use ${}

and the like in the config files, and have this replaced during the build. 

Firstly, we want to ensure that the jar file is as executable as we can easily make it. To do this, we must make a manifest. This is done with the jar-plugin

In the manifest, I declare the main class, and the classpath. Notice that I declare the classpathPrefix to be the maven.deb.libfolder, in order for the system to be able to resolve the dependencies when installed as a debian package.

Okay, the jar file is now generated correctly. Lets start on generating the package. First, we need to use maven to get all the dependencies. This is done with the assembly plugin

This plugin uses the deb assembly. So, what will the deb.assembly do? Lets look at it. 

Basically, it puts all the jar dependencies of the project in one dir, ready for inclusion in the debian package. 

Time to make the first version of the deb. We need another plugin in the pom file to do that.

Note that it is important that this plugin is placed below the assembly plugin, as they both execute in the package phase, and jdeb depends on the debian assembly having been run.

So, what will this plugin do?

Well, it will make a debian package, with the filename ${}/${artifactId}${version}-java.deb.

The ever-important control file should be found in ${}/classes/debian/control/ More about that file later.

The lib folder ${maven.deb.libfolder} should contain the jars, from the debian-prepare assembly detailed above. Oh, and the project jar should also go there, as it was not included in the assembly.

So, now we just need to detail the control file, and we have the first barebone deb file. 

Make a file "control" in resources/debian/control, with this content


Now we should generate the deb, to check that what we have done so far works. Run mvn package.

Then we should check the deb. CD to the target directory, and use the lintian tool (lintian *.deb). Install it if you do not have it (sudo apt-get install lintian)

The tool should produce this error 

So we should include a copyright file. Make a file "copyright" with the following content in "resources/debian/copyright"

Now jdeb needs to be told to include this file. Add the following section to the plugin's list of datasets
mvn clean package to generate the package once more, and lintian it again. The error should now be

Okay, so we need to make a changelog file for debian. 

Here is some sample content for at changelog file, that we can use 

Put this content in "resources/debian/changelog/changelog

Regenerate the package and validate it once more. The error should now be

So, the changelog should be compressed. I have found that the antrun plugin seems to be the simplest way of doing this

So, after this change, the deb package should validate. But we have forgotten something. The most important thing, actually. The executable file.

Since this is a java program, we use a shell script to start the program. Create the file "resources/scripts/arc-unpack" with the following content

Remember, this file is in resources, so maven will replace the keys when compiling. Now, we need to tell jdeb to include this file. This is done by adding the following definition to the set of datasets
Regenerate and validate the deb file. You should now receive the following warning:
So, we need to add man pages to the project. 

Create the file "arc-unpack.8" in resources/man/man8, and give it this content:

sample stolen manpage

It is important that the file starts with ".TH arc-unpack 8" but the rest seems optional

Now we need to tell jdeb to include this file also. Add this section to the plugins list of datasets

Clean, regenerate and validate the package.

The error received now should be

So, we need to compress this file also. Change the antrun plugin to include the man folder also, like this.

The package should now be complete and validate. Lets try to install it.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.