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() {
|
_defaultUnpack() {
|
||||||
if [ -d "$curSrc" ]; then
|
if [ -d "$curSrc" ]; then
|
||||||
|
|
||||||
stripHash $curSrc
|
stripHash "$curSrc"
|
||||||
cp -prd --no-preserve=timestamps $curSrc $strippedName
|
cp -prd --no-preserve=timestamps "$curSrc" $strippedName
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
case "$curSrc" in
|
case "$curSrc" in
|
||||||
*.tar.xz | *.tar.lzma)
|
*.tar.xz | *.tar.lzma)
|
||||||
# Don't rely on tar knowing about .xz.
|
# Don't rely on tar knowing about .xz.
|
||||||
xz -d < $curSrc | tar xf -
|
xz -d < "$curSrc" | tar xf -
|
||||||
;;
|
;;
|
||||||
*.tar | *.tar.* | *.tgz | *.tbz2)
|
*.tar | *.tar.* | *.tgz | *.tbz2)
|
||||||
# GNU tar can automatically select the decompression method
|
# GNU tar can automatically select the decompression method
|
||||||
# (info "(tar) gzip").
|
# (info "(tar) gzip").
|
||||||
tar xf $curSrc
|
tar xf "$curSrc"
|
||||||
;;
|
|
||||||
*.zip)
|
|
||||||
unzip -qq $curSrc
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 1
|
return 1
|
||||||
|
@ -31,6 +31,8 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
installFlags = "prefix=$(out)";
|
installFlags = "prefix=$(out)";
|
||||||
|
|
||||||
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://www.info-zip.org;
|
homepage = http://www.info-zip.org;
|
||||||
description = "An extraction utility for archives compressed in .zip format";
|
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…
x
Reference in New Issue
Block a user