diff --git a/pom.xml b/pom.xml index 6599474f7..f42344fe2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ jdeb maven-plugin jdeb - 1.4 + 1.4.1 This library provides an Ant task and a Maven plugin to create Debian packages from Java builds in a truly cross platform manner. Build your Debian packages on any platform that has Java support. Windows, Linux, OS X - it doesn't @@ -187,7 +187,7 @@ ${project.build.directory}/it ${project.build.directory}/local-repo - src/it/settings.xml + clean package diff --git a/src/main/java/org/vafer/jdeb/ControlBuilder.java b/src/main/java/org/vafer/jdeb/ControlBuilder.java index 6e8d7a054..471357096 100644 --- a/src/main/java/org/vafer/jdeb/ControlBuilder.java +++ b/src/main/java/org/vafer/jdeb/ControlBuilder.java @@ -17,6 +17,7 @@ package org.vafer.jdeb; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -103,13 +104,19 @@ void buildControl(BinaryPackageControlFile packageControlFile, File[] controlFil if ("conffiles".equals(file.getName())) { foundConffiles = true; } - if (CONFIGURATION_FILENAMES.contains(file.getName()) || MAINTAINER_SCRIPTS.contains(file.getName())) { FilteredFile configurationFile = new FilteredFile(new FileInputStream(file), resolver); configurationFile.setOpenToken(openReplaceToken); configurationFile.setCloseToken(closeReplaceToken); addControlEntry(file.getName(), configurationFile.toString(), outputStream); + } else if (file.getName().endsWith(".bin")) { + InputStream in = new FileInputStream(file); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + Utils.copy(in, out); + in.close(); + out.close(); + addControlEntry(file.getName().substring(0, file.getName().length() - 4), out.toByteArray(), outputStream); } else if (!"control".equals(file.getName())) { // initialize the information stream to guess the type of the file InformationInputStream infoStream = new InformationInputStream(new FileInputStream(file)); @@ -209,23 +216,25 @@ public BinaryPackageControlFile createPackageControlFile(File file, BigInteger p private static void addControlEntry(final String pName, final String pContent, final TarArchiveOutputStream pOutput) throws IOException { - final byte[] data = pContent.getBytes("UTF-8"); + addControlEntry(pName, pContent.getBytes("UTF-8"), pOutput); + } + private static void addControlEntry(final String pName, final byte[] pData, final TarArchiveOutputStream pOutput) throws IOException { final TarArchiveEntry entry = new TarArchiveEntry("./" + pName, true); - entry.setSize(data.length); + entry.setSize(pData.length); entry.setNames("root", "root"); - + if (MAINTAINER_SCRIPTS.contains(pName)) { entry.setMode(PermMapper.toMode("755")); } else { entry.setMode(PermMapper.toMode("644")); } - + pOutput.putArchiveEntry(entry); - pOutput.write(data); + pOutput.write(pData); pOutput.closeArchiveEntry(); } - + /** * Tells if the specified directory is ignored by default (.svn, cvs, etc) *