forked from mirrors/nixpkgs
stdenv: Move unzip support to unzip's setup hook
This commit is contained in:
parent
f97ee61255
commit
d7b356f73b
|
@ -489,23 +489,20 @@ addHook unpackCmd _defaultUnpack
|
|||
_defaultUnpack() {
|
||||
if [ -d "$curSrc" ]; then
|
||||
|
||||
stripHash $curSrc
|
||||
cp -prd --no-preserve=timestamps $curSrc $strippedName
|
||||
stripHash "$curSrc"
|
||||
cp -prd --no-preserve=timestamps "$curSrc" $strippedName
|
||||
|
||||
else
|
||||
|
||||
case "$curSrc" in
|
||||
*.tar.xz | *.tar.lzma)
|
||||
# Don't rely on tar knowing about .xz.
|
||||
xz -d < $curSrc | tar xf -
|
||||
xz -d < "$curSrc" | tar xf -
|
||||
;;
|
||||
*.tar | *.tar.* | *.tgz | *.tbz2)
|
||||
# GNU tar can automatically select the decompression method
|
||||
# (info "(tar) gzip").
|
||||
tar xf $curSrc
|
||||
;;
|
||||
*.zip)
|
||||
unzip -qq $curSrc
|
||||
tar xf "$curSrc"
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
|
|
|
@ -31,6 +31,8 @@ stdenv.mkDerivation {
|
|||
|
||||
installFlags = "prefix=$(out)";
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
meta = {
|
||||
homepage = http://www.info-zip.org;
|
||||
description = "An extraction utility for archives compressed in .zip format";
|
||||
|
|
5
pkgs/tools/archivers/unzip/setup-hook.sh
Normal file
5
pkgs/tools/archivers/unzip/setup-hook.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
addHook unpackCmd _tryUnzip
|
||||
_tryUnzip() {
|
||||
if ! [[ "foo.zip" =~ \.zip$ ]]; then return 1; fi
|
||||
unzip -qq "$curSrc"
|
||||
}
|
Loading…
Reference in a new issue