diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-06-30 14:12:35 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-08-09 12:44:50 +0200 |
commit | d7b356f73b41640f5ee741f004c4fb41e0471d30 (patch) | |
tree | 06194c240798b1b342720b1bf406c346cac79f7c | |
parent | f97ee61255478e9ca683d1fb7c9fd777247293cb (diff) | |
download | nixpkgs-d7b356f73b41640f5ee741f004c4fb41e0471d30.tar nixpkgs-d7b356f73b41640f5ee741f004c4fb41e0471d30.tar.gz nixpkgs-d7b356f73b41640f5ee741f004c4fb41e0471d30.tar.bz2 nixpkgs-d7b356f73b41640f5ee741f004c4fb41e0471d30.tar.lz nixpkgs-d7b356f73b41640f5ee741f004c4fb41e0471d30.tar.xz nixpkgs-d7b356f73b41640f5ee741f004c4fb41e0471d30.tar.zst nixpkgs-d7b356f73b41640f5ee741f004c4fb41e0471d30.zip |
stdenv: Move unzip support to unzip's setup hook
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 11 | ||||
-rw-r--r-- | pkgs/tools/archivers/unzip/default.nix | 2 | ||||
-rw-r--r-- | pkgs/tools/archivers/unzip/setup-hook.sh | 5 |
3 files changed, 11 insertions, 7 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 9a756fd4723..e5fdbdf2d53 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -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 diff --git a/pkgs/tools/archivers/unzip/default.nix b/pkgs/tools/archivers/unzip/default.nix index 0f8ddb17059..7f2c81e2797 100644 --- a/pkgs/tools/archivers/unzip/default.nix +++ b/pkgs/tools/archivers/unzip/default.nix @@ -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"; diff --git a/pkgs/tools/archivers/unzip/setup-hook.sh b/pkgs/tools/archivers/unzip/setup-hook.sh new file mode 100644 index 00000000000..47894ded023 --- /dev/null +++ b/pkgs/tools/archivers/unzip/setup-hook.sh @@ -0,0 +1,5 @@ +addHook unpackCmd _tryUnzip +_tryUnzip() { + if ! [[ "foo.zip" =~ \.zip$ ]]; then return 1; fi + unzip -qq "$curSrc" +} |