summary refs log tree commit diff
path: root/pkgs/build-support/fetchzip
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2016-02-26 00:57:30 +0000
committerzimbatm <zimbatm@zimbatm.com>2016-02-26 00:57:30 +0000
commitd2f3e250cf86c0f91df73f29bf4404016ecc766c (patch)
tree99dbe8a0fdbffc53d7ac9a944a0b897d3d2f4064 /pkgs/build-support/fetchzip
parentb5407d402d3b1adf39ca5521cd5ca2a9c361d539 (diff)
parent91a2973dc3a33f76fa212be1258c00ea81c2d21e (diff)
downloadnixpkgs-d2f3e250cf86c0f91df73f29bf4404016ecc766c.tar
nixpkgs-d2f3e250cf86c0f91df73f29bf4404016ecc766c.tar.gz
nixpkgs-d2f3e250cf86c0f91df73f29bf4404016ecc766c.tar.bz2
nixpkgs-d2f3e250cf86c0f91df73f29bf4404016ecc766c.tar.lz
nixpkgs-d2f3e250cf86c0f91df73f29bf4404016ecc766c.tar.xz
nixpkgs-d2f3e250cf86c0f91df73f29bf4404016ecc766c.tar.zst
nixpkgs-d2f3e250cf86c0f91df73f29bf4404016ecc766c.zip
Merge pull request #8576 from obadz/nix-prefetch-zip
Add --ext option to nix-prefetch-zip
Diffstat (limited to 'pkgs/build-support/fetchzip')
-rwxr-xr-xpkgs/build-support/fetchzip/nix-prefetch-zip9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkgs/build-support/fetchzip/nix-prefetch-zip b/pkgs/build-support/fetchzip/nix-prefetch-zip
index ea55643668d..d9a5f51057f 100755
--- a/pkgs/build-support/fetchzip/nix-prefetch-zip
+++ b/pkgs/build-support/fetchzip/nix-prefetch-zip
@@ -6,6 +6,7 @@ usage(){
 Options:
       --url         url    The url of the archive to fetch.
       --name        name   The name to use for the store path (defaults to \`basename \$url\`).
+      --ext         ext    The file extension (.zip, .tar.gz, ...) to be REMOVED from name
       --hash        hash   The hash of unpacked archive.
       --hash-type   type   Use the specified cryptographic hash algorithm, which can be one of md5, sha1, and sha256.
       --leave-root         Keep the root directory of the archive.
@@ -16,6 +17,7 @@ Options:
 
 
 name=""
+ext=""
 argi=0
 argfun=""
 for arg; do
@@ -23,6 +25,7 @@ for arg; do
     case $arg in
       --url) argfun=set_url;;
       --name) argfun=set_name;;
+      --ext) argfun=set_ext;;
       --hash) argfun=set_expHash;;
       --hash-type) argfun=set_hashType;;
       --leave-root) leaveRoot=true;;
@@ -67,10 +70,12 @@ hashFormat="--base32"
 tmp=$(mktemp -d 2>/dev/null || mktemp -d -t "$$")
 trap "rm -rf '$tmp'" EXIT
 
-unpackDirTmp=$tmp/unpacked-tmp/$name
+dirname=$(basename -s "$ext" "$name")
+
+unpackDirTmp=$tmp/unpacked-tmp/$dirname
 mkdir -p $unpackDirTmp
 
-unpackDir=$tmp/unpacked/$name
+unpackDir=$tmp/unpacked/$dirname
 mkdir -p $unpackDir
 
 downloadedFile=$tmp/$(basename "$url")