I have some .tar.gz
-Archives and would like to only unpack the Tarball to create a sha256-checksum hash of the .tar
-File. (The reason for this is that the archive will be un- and repacked later on, as we are generating patch-files.)
Now this seems like an easy task but I'm stuck. There are either Gradle examples for:
- getting the unpacked
tarTree
(with a Gradle Copy-Task andtarTree(resources.gzip('model.tar.gz'))
(from documentation: working with files) - unzipping Files (with
zipTree
), which does not work with gzipped files
Both approaches do not work, since I need to create a checksum of the .tar
-File itself. Unfortunately I can't use commandLine
or gunzip
as the tasks should run on both Windows and Linux.
The only solution I can imagine of right now is unpacking the tar.gz
to a fileTree and repacking it to a tar-file, but I'm not even sure the checksum would be the same.
Is there really no way to do this directly?