sbt-pack
sbt-pack copied to clipboard
Implement custom posix permissions for pack and packArchive
Hello,
our current deployment policy dictates that:
- the application executable must be in the root of the archive rather than in the
/bin
directory - none of the unpacked files must be world readable at any time (so they need to be stored in the tarball as 0xx0)
- some of the unpacked files need custom permissions
It is not feasible to change these constraints in the short term.
As a general purpose solution, I would suggest to add some sort of mapping/callback to the create(.*)entry
methods so that a filter can be injected as a setting.
Something like this:
private def createTarEntry(file: File, fileName: String, binDir: File,
perms: (File) => Option[Int]) = {
val archiveEntry = new TarArchiveEntry(file, fileName)
perms(file) foreach { mode => archiveEntry.setMode(mode) }
archiveEntry
}
I have worked this around for the pack
task by scanning the target/pack
directory tree and changing the permissions on the file system. Unfortunately the packArchive
task ignores the filesystem settings.
At the moment I'm not able to fork/pull request.
Regards Nico
Scrap that. I did manage something that can be worked into a fix
https://github.com/xerial/sbt-pack/pull/90