Created
March 17, 2016 05:42
-
-
Save rubenerd/928fbfc87d36ba829297 to your computer and use it in GitHub Desktop.
Recompress zip to tar.xz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
###### | |
## Recompresses ZIP files to tar.xz | |
## - Extracts to temp folder to prevent tarbombs | |
## - Recontainerises as tar | |
set -e | |
set -x | |
_source=`echo $1 | sed "s/\.zip\$//"`; | |
mkdir "$_source" | |
unzip -d "./$_source/" "$1" | |
tar -cvf "${_source}.tar" "./$_source/" | |
xz -9vv "${_source}.tar" | |
rm -rf "./$_source/" | |
rm -rf "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment