binary control files#220
binary control files#220mlhartme wants to merge 1 commit intotcurdt:masterfrom mlhartme:binanry_control
Conversation
There was a problem hiding this comment.
Just to make the tests work in my environment. Quick hack for me, Do not merge this, sorry.
There was a problem hiding this comment.
But probably hard to implement. I think you detect variables withing string - and have to encode them for saving the resulting file.
Another approach would be a configurable method you call before closing the tar file. I'd add my binary file in this method. And make my method availabe to your Code by adding a dependency to the Plugin config in my pom.
|
Hey Michael, |
|
Yes, it want to ship a jar file that I can access from my maintainer script. The only way (I found ...) to do this is to append the jar file to the postrm script. You can see this in action here: https://github.com/mlhartme/stool/blob/master/setup/pom.xml |
There was a problem hiding this comment.
Frankly speaking I am not such a fan of adding some new rule about the file name. Maybe we should just make this work with https://github.com/mlhartme/jdeb/blob/binanry_control/src/main/java/org/vafer/jdeb/ControlBuilder.java#L120 instead.
There was a problem hiding this comment.
Agreed. I though about that too, but i didn't see a reliable way to detect binary files. In my case, the file is a shell script with a jar file appended.
There was a problem hiding this comment.
I guess the proper way to fix this is expanding https://github.com/tcurdt/jdeb/blob/master/src/main/java/org/vafer/jdeb/utils/InformationInputStream.java
Right now we are only checking for the BOM and the shebang. We could also also try to detect a binary there.
There was a problem hiding this comment.
How can you properly check for a binary there? Character codes >= 128?
And by the way: what about shell scripts with "here documents" http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04. Maybe they have a similar problem.
There was a problem hiding this comment.
If we don't use BOM and Shebang but plain heuristics we indeed run into those problems with "here documents", too.
I am wondering if we should take a step back here. Right now we have 2 types
- shell - where we apply variable expansion
- other - which we just copy without applying variable expansion
Introducing a 3rd type is a bit sneaky as we would want to have variable expansion on only the shell part of the combined file.
So question is whether there is another way to ship the jar but appending it to the shell script or having some kind of convention/marker that tells jdeb where to apply the variable expansion and what to copy as binary.
There was a problem hiding this comment.
I'm not aware of an alternative place for the jar: is has to be present when postrm is executed. And at this point dpkg has removed all other files of the package. Even e.g. prerm.
Is there a way to define a variables with my binary content?
There was a problem hiding this comment.
Not binary variables yet - but that's actually a very (!) interesting line of thinking to solve this.
I need to add binary control files to a package (actually a jar file, that I use in my maintainer scripts).
Can you please consider to merge something like this?
Best regards
Michael